I am just now learning Assembly calls with c. I am trying to change my code, so the assembly code never exits and continues to blink the LED, but I cannot figure out how to do it. I have tried changing the C file to just have the myled=!myled, but that doesnt work.
Change the delay_asm code turn on and off the LED and never exit the delay_asm.s subroutine.
here is the C file and Assembly.
#include "mbed.h"
DigitalOut myled(LED1);
extern "C" void delay_asm(void);
int main() {
while(1) {
delay_asm();
myled = !myled; // invert LED state
}
}
Assembly file:
AREA |.text|, CODE, READONLY
delay_asm PROC
EXPORT delay_asm
MOV R0, #0x01900000
MOV R1, #1
LOOP SUBS R0, R1
BNE LOOP
BX LR
ENDP
ALIGN
END