SAM7 interrupts

I am working with FreeRTOS on the At91sam7x-ek development board.  I am trying to write some serial code to poll an external device, and I am trying to use the PDC to buffer the values before having a thread running in FreeRTOS copy over the buffer, then reset the PDC.  However, the PDC buffer isn’t getting all of the characters when it is attached to the external device (works fine in hyper terminal though…).  So, I decided to write an interrupt to just print out all of the received characters over a TCP connection.  I write a simple little interrupt that will just echo the character back over the serial port for starters, and then compiled it all using the arm-gcc.  I also ended up putting the interrupt function in a separate file so that I could compile it in ARM mode, rather than THUMB mode. However, when I run the program on the uC, whenever the interrupt is generated, the entire kernel locks up.  My best guess is that when it is not returning to "Thumb" mode after the conclusion of the interrupt, but I’m not completely sure.  However, I was looking at some of the FreeRTOS code, parcitularly the EMAC interrupt, and it is able to use interrupts without much trouble, however, on the comments for the prototypes they all have something about an asm wrapper.  I don’t know if that is talking about the __attribute__ or if that means that somewhere in some assembler file, i need to write some code that tells the uC to switch back to "thumb" mode.  I was hoping that since you (or someone in your group) was the one who wrote the EMAC interrupt, that you might know how to fix this problem.  Any help would be greatly appreciated, or even a point in the right direction. Thanks :)

SAM7 interrupts

> I am working with FreeRTOS on the At91sam7x-ek development board.  I am trying > to write some serial code to poll an external device, and I am trying to use > the PDC to buffer the values before having a thread running in FreeRTOS copy > over the buffer, then reset the PDC.  However, the PDC buffer isn’t getting > all of the characters when it is attached to the external device (works fine > in hyper terminal though…).  Have you tried writing a very simply program that just does nothing else but receive the data?  Without any other functionality, FreeRTOS related or otherwise?  Once you have this running you can start to add in other things to see where it starts to go wrong. >So, I decided to write an interrupt to just print > out all of the received characters over a TCP connection.  I write a simple > little interrupt that will just echo the character back over the serial port > for starters, and then compiled it all using the arm-gcc.  I also ended up putting > the interrupt function in a separate file so that I could compile it in ARM > mode, rather than THUMB mode. However, when I run the program on the uC, whenever > the interrupt is generated, the entire kernel locks up.  Which version of GCC are you using?  There we a bug reported recently that can be fixed using a particular command line option.  See this thread: http://sourceforge.net/forum/forum.php?thread_id=1597532&forum_id=382005 >My best guess is that > when it is not returning to "Thumb" mode after the conclusion of the interrupt, > but I’m not completely sure.  >However, I was looking at some of the FreeRTOS > code, parcitularly the EMAC interrupt, and it is able to use interrupts without > much trouble, however, on the comments for the prototypes they all have something > about an asm wrapper.  I don’t know if that is talking about the __attribute__ > or if that means that somewhere in some assembler file, i need to write some > code that tells the uC to switch back to "thumb" mode.   Any help would be greatly appreciated, > or even a point in the right direction. Thanks :) If your interrupt does not cause a context switch then it can be written as a normal interrupt without having to worry about anything.  If you are wanting to cause a context switch in the interrupt then make sure you copy the examples given for the GCC compiler – not the IAR compiler.  The GCC compiler does not need the asm wrappers.