CDC demo for IAR?

nobody wrote on Thursday, September 01, 2005:

Thanks very much for releasing the new version.  I see the new USB CDC files.

Do you have them integrated into the AT91sam7S65 IAR environment?

My first attempts to compile them get tangled up with portENTER_SWITCHING_ISR() not being defined for IAR.  Also the AT91F_AIC_ConfigureIt() arguments in USB-CDC.c don’t compile when dropped into the IAR demo.

rtel wrote on Thursday, September 01, 2005:

Interrupt service routines require different syntax between GCC and IAR.

GCC has a very powerful inline assembler, meaning the entire ISR can be written in C by simply calling the save and restore context macros.

IAR on the other hand does not have the same inline assembler capabilities, and therefore requires an ASM wrapper for the ISRs.

Also the macro used to cause a context switch at the end of the ISR is different.

See the Interrupt service routines section of the page for an explanation of the required GCC syntax, and the Interrupt service routines section of for an explanation of the required IAR syntax.  It is a small task to convert the provided GCC function to the IAR syntax.  You can also copy the syntax from the existing USB hid demo in the files FreeRTOS/Demo/ARM7_AT91SAM7S64_IAR/USB/USBSample.c and FreeRTOS/Demo/ARM7_AT91SAM7S64_IAR/USB/USB_ISR.s79. 

Basically in IAR you want to use:

__arm void vUSB_ISR( void )
// Paste the code from the GCC CDC file here, all the
// code between but not including the ENTER and EXIT
// switching ISR macros.

/* We may want to switch to the USB task, if this message has made
it the highest priority task that is ready to execute. */
portEND_SWITCHING_ISR( xTaskWokenByPost );

/* Clear the AIC ready for the next interrupt. */