This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: mis-handling of arm semihosting in libgloss/arm/crt0.S


> Anyway, you are correct, the wrong software interrupt instruction is being
> used when crt0.S is built for ARMv[67]-M architectures. ?Please could you
> try out the attached patch which I think should fix things, and let me know
> how you get on ?
>
Thanks for your help.
As for the question we are talking about, I think it's more complicated.
Since we have macros in swi.h like

#define AngelSWI_ARM 			0x123456
#ifdef __thumb__
#define AngelSWI 			0xAB
#else
#define AngelSWI 			AngelSWI_ARM
#endif

So, your patch
-#if defined(__thumb2__)
-	bkpt	AngelSWI
-#else
-	/*  We are always in ARM mode for startup */
-	AngelSWIAsm	AngelSWI_ARM
-#endif
+	AngelSWIAsm	AngelSWI
 	ldr	r0, .LC0	/*  point at values read */

will use 0xAB for all thumb state, which is only correct for thumb2
and armv6-m here. Considering thumb state on architecture pre armv6,
as the comment, we are always in ARM mode for startup for these
architectures, and should use 0x123456 for these archs here.

actually found this problem during my work on supporting
armv7-m/armv6-m in libgloss/arm and have already worked out a patch.
Hoping I could pass internal review and send it to newlib list ASAP.
Please help me review it then. :(

Thanks
-- 
Regards.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]