Noted potetntial issue with ARM7 port

em1ssnuke wrote on Wednesday, November 05, 2008:

On switching back and forth between Thumb mode and ARM mode there is a potential stack issue.  I’m attempting to narrow it down further but have a question of the FreeRTOS port for the ARM7.  Can FreeRTOS port run purely in ARM mode for the AT91SAM7xxxx cores?  This would help the debug effort such that i can rule out the ARM to Thumb back to ARM switching (if it is in fact not the issue).

I am using the ARM7_AT91SAM7X256_Eclipse FreeRTOS demo as my base.  And using the Yagarto tool chain as the compiler/linker etc.

The driver i’m debugging is using the SSC port on the AT91SAM7SE256 (similar to the AT91SAM7 in the port).  It is DMA’ing a set piece of data over and over and approximately after 2000 transmissions is when the data becomes corrupted (looking both on an oscope and the data copied into the buffer prior to transmission via DMA.  I can tell it’s the ~2000th piece of data due to count value i have in the data being transmitted.

If i get the system to build purely in ARM mode i would rerun these tests to see if it something related with the SSC and DMA.  So just to reiterate the question, can FreeRTOS port run purely in ARM mode for the AT91SAM7xxxx cores?


rtel wrote on Wednesday, November 05, 2008:

I have co-incidentally written an application that uses THUMB mode and the SSC port with DMA (along with numerous other peripherals with DMA) on a SAM7, if there were issues I’m sure the customer would have let me know by now :o)

Take a look at the batch files in the FreeRTOS/Demo/ARM7_LPC2106_GCC directory, these together with the makefile show you how two switch between ARM only and ARM/THUMB interworked builds albeit for an LPC2000.  I’m not sure however if I have ever run the SAM7 purely in ARM mode as the device is optimised for THUMB operation.

From memory - remove the -DTHUMB_INTERWORK compile time option, and probably a couple of more GCC specifics like -mthumb-interwork and -mthumb flags.


em1ssnuke wrote on Wednesday, November 05, 2008:

Ok, have it compiled for ARM mode and the issues is still present.  I’m sure it’s something with the my SSC driver.

em1ssnuke wrote on Friday, November 07, 2008:

Forgot __attribute__ ((naked)); on my ISR Wrapper … :confused: