I want to use IAP functions to program a sector of flash, but my program is running in the flash. So I'm using __swi to execute the function as a software interrupt so it will turn off interrupts during the flash erase/write. I also want to run out of RAM so it's not executing in the flash. Can I use __swi and __ram together? The compiler gets syntax errors if I use both. Is there a way to do this?
The error actually occurs due to the function prototypes in a header file: void func (void) __swi(8) __ram; will give a syntax error at the ;
"The error actually occurs due to the function prototypes in a header file" Is it meaningful to have Interrupt Service functions prototyped in a header file for the ARM? It certainly isn't for the 8051!
Is it meaningful to have Interrupt Service functions prototyped in a header file for the ARM? It certainly isn't for the 8051! Yes it is. In the ARM compiler, you can specify a function with the __swi extension. The compiler automatically adds the function to the software interrupt vector list. Any function that calls the swi function will generate code to do a software interrupt instead of calling the function directly.
"Is it meaningful to have Interrupt Service functions prototyped in a header file for the ARM? It certainly isn't for the 8051! Yes it is. In the ARM compiler, you can specify a function with the __swi extension. The compiler automatically adds the function to the software interrupt vector list. Any function that calls the swi function will generate code to do a software interrupt instead of calling the function directly." I think Andy's point is that the prototype may not permit the additional qualifiers. For instance: void Timer(void) interrupt 1; void Timer(void) interrupt 1 { //Code } does not compile, whereas: void Timer(void); void Timer(void) interrupt 1 { //Code } does.