arm-elf-gcc 4.3.2 missing _from_arm functions

Hi, I am using arm-elf-gcc 4.3.2 and binutils 2.19.51 to compile application running on AT91SAM7X256. Most of my program runs in Thumb mode, but some of its parts (interrupt entries, exceptions entries and first part of boot procedure) runs in ARM mode. To achieve that C files running in Thumb mode are compiled with -mthumb. During linking linker analyzes jumps and if there is mode change during jump, it adds _from_arm or _from_thumb wrappers changing processor mode before actual jump. Unfortunatelly sometimes one or couple of these wrappers are missing. I mean they have got their symbol name defined correctly, they occupy correct amount of code space, but in these places are filled with zeros instead of wrapper code. I haven’t found any reason why it is happening and also I see no pattern. Can you tell me if you seen similar arm-elf-gcc and arm-elf-ld behaviour in your project? Whan can couse such behaviour? Thanks, Adam

arm-elf-gcc 4.3.2 missing _from_arm functions

This is a GCC bug.  Are you using GCC V4.4.0?  Can you tell me which distribution you are using? I know that CodeSourcery have fixed this bug in their version, but I’m not sure if the fix has made it into a release build yet. Regards.

arm-elf-gcc 4.3.2 missing _from_arm functions

Sorry, just noticed you say its V4.3.2 in the subject. The recommended way of writing interrupts that use the FreeRTOS API is to create a wrapper function that saves and restores the context, and calls the real handler.  The wrapper function is commonly in a naked C function.  I think if you move the wrapper into a genuine asm function (so the asm source file saves the context, calls the C handler, then restores the context) you should be ok. Regards.

arm-elf-gcc 4.3.2 missing _from_arm functions

Hi Richard, All my interrupts follow the scheme you have described. The wrapper function is compiled in ARM mode, because I am using AT91SAM7X256 AIC vectoring, which jumps directly to wrapper. The wrapper saves the context and jumps to ISR which is compiled in Thumb mode. Normally linker should add processor mode changing code to Thumb, but sometimes it is missing. The example code you can find in https://freeecu.svn.sourceforge.net/svnroot/freeecu/trunk/meas_t/source in file meas_t_arm_only.c Regarding your previous question I am using GCC 4.3.2 toolchain, which I’ve compiled myself following instructions found in http://www.openhardware.net/Embedded_ARM/Toolchain/  I’ve also tried with GNUARM 4.3.2 and still the issue is present. You have said that this issue has been fixed in GCC 4.4.0. Can you point me to link describing this bug etc. please ? Best regards, Adam

arm-elf-gcc 4.3.2 missing _from_arm functions

> All my interrupts follow the scheme you have described. The > wrapper function > is compiled in ARM mode, because I am using AT91SAM7X256 AIC > vectoring, which > jumps directly to wrapper. The wrapper saves the context and > jumps to ISR which > is compiled in Thumb mode. Normally linker should add > processor mode changing > code to Thumb, but sometimes it is missing. > The example code you can find in > https://freeecu.svn.sourceforge.net/svnroot/freeecu/trunk/meas > _t/source > in file meas_t_arm_only.c Did you try my suggestion of replacing the naked wrapper with a proper assembly function? <snip> > You have said that this issue has been fixed in GCC 4.4.0. Don’t think I said that.  V4.4.0 was the first version that I became aware of the issue, so 4.4.0 (official source distribution) definitely has the issue.  It was CodeSourcery that said they had fixed it, but were not sure if the fix was in their latest release or not. Regards.

arm-elf-gcc 4.3.2 missing _from_arm functions

Sorry for the slightly off topic question. I’m currently using 4.1.1 downloaded from www.amontec.com/sdk4arm.shtml. This package is over 2 years old so I’m wondering if I should upgrade but is there any compelling reason to do so? It’s worked fine so far but I am interested in significant bug fixes, features and especially optimizations.

arm-elf-gcc 4.3.2 missing _from_arm functions

Honestly I would wait with upgrading until 4.4 will stabilize. Currently it contains a lot of annoying bugs, which affect stability of applications. And stability is in my personal opinion is much more important than new optimization features etc.

arm-elf-gcc 4.3.2 missing _from_arm functions

> Did you try my suggestion of replacing the naked wrapper with a proper assembly function? Yes, I’ve tried this. Unfortunately it doesn’t work :-( Especially when optimization -O2 is enabled, the amount of missing stubs is almost 80%. For now I plan to stick to ARM only code until there will be new version of gcc with this bug fixed available. Did anybody know when this bug is planned to be fixed? Or maybe it is fixed already? Regards, Adam

arm-elf-gcc 4.3.2 missing _from_arm functions

I’m told by the good folks at Rowley that if you use the __attribute__((noline)) attribute on the C function that the wrapper calls then everything should be ok. Regards.

arm-elf-gcc 4.3.2 missing _from_arm functions

Did you mean __attribute__((__noinline__)) ? So the code should look like the example below? void vIsrFunctionCompiledInArmMode(void) { portSAVE_CONTEXT();                    /* Increment the tick count – this may wake a task. */         vTaskIncrementTick();         /* Find the highest priority task that is ready to run. */         vTaskSwitchContext();                 /* End the interrupt in the AIC. */         AT91C_BASE_AIC->AIC_EOICR = AT91C_BASE_PITC->PITC_PIVR;;                 portRESTORE_CONTEXT(); }

arm-elf-gcc 4.3.2 missing _from_arm functions

Did you mean __attribute__((__noinline__))? So the code should look like the the example below? Does this work for all gcc C compilers, or only for Rowley? File compiled with -mthumb option: void  vIsrFunctionInThumbMode(void) __attribute__((__noinline__)); void  vIsrFunctionInThumbMode(void) {   /* ISR body compiled as Thumb code */ } File compiled without -mthumb option: void vIsrFunctionCompiledInArmMode(void) {   portSAVE_CONTEXT();              vIsrFunctionInThumbMode();   portRESTORE_CONTEXT(); } Best regards, Adam

arm-elf-gcc 4.3.2 missing _from_arm functions

No – I think its meant to be more like this: http://pastebin.com/m7a5cffa3 regards.

arm-elf-gcc 4.3.2 missing _from_arm functions

Sorry – try this one: http://pastebin.com/m60c5715d the first was incorrect. Regards.