I'm trying to access an assembler method from C code. It looks like it ought to work but when I try to execute a line of asm code it jumps to Dummy_Handler, almost seems like a pointer problem. But it compiles OK and the map and lss files look OK, so not sure what's happening? Any help would be appreciated. count value is passed in R0 extern void delay(int); /** * \brief Application entry point. * * \return Unused (ANSI-C compatibility). */ int main(void) { /* Initialize the SAM system */ SystemInit(); //Disable WDT WDT->WDT_MR = WDT_MR_WDDIS; while (1) { delay(5); } }
/* * utils.s * * Created: Mon 10 6 2014 6:14:19 PM * Author: Mike */ .section .text.utils .global delay delay: mov R1, #0x0021 loop: sub R1, R1, #1 cbz R1, iloop b loop iloop: sub R0, R0, #1 cbnz R0, ret b delay ret: bx lr .end