Hello,
I am using uVision 5.15 processor is emf32g222f128. my code(part of bootloader based on silicon lab supplied code) is:
oid BOOT_jump(uint32_t sp, uint32_t pc) { /* Set new MSP, PSP based on SP (r0)*/ __asm("msr msp, r0"); __asm("msr psp, r0"); //goto *Default_PC; /* Jump to PC (r1)*/ __asm("mov pc, r1"); }
causes compiler errors:
compiling Bootloader.c... Bootloader.c(153): warning: #1267-D: Implicit physical register R0 should be defined as a variable __asm("msr msp, r0"); Bootloader.c(153): error: #549: variable "R0" is used before its value is set __asm("msr msp, r0"); Bootloader.c(157): warning: #1267-D: Implicit physical register R1 should be defined as a variable __asm("mov pc, r1"); Bootloader.c(157): error: #549: variable "R1" is used before its value is set __asm("mov pc, r1"); Bootloader.c: 2 warnings, 2 errors
I have tried several variations. msr msp r0 works fine but not the "mov pc, r1" Any ideas?
Thanks
Yash
msr msp r0 works fine but not the "mov pc, r1"
Interesting you should say that, given that the assembler rejected both with the same warning and error message.
The warning is quite clear. I suggest you look at the documentation for how this is supposed to be done. Or you could switch from inline assembly to an actual assembly source file.