Can anyone comment on the prologue and epilogue of following code, particularly the content of r7 when the routine returns?
{
0: b480 push {r7}
2: af00 add r7, sp, #0
if ((ANADIG_MISC->MISC_DIFPROG & ANADIG_MISC_MISC_DIFPROG_CHIPID(0x10U)) != 0U)
4: 4b0b ldr r3, [pc, #44] @ (34 <RamBased_ROM_API_Init+0x34>)
6: f8d3 3800 ldr.w r3, [r3, #2048] @ 0x800
a: f003 0310 and.w r3, r3, #16
e: 2b00 cmp r3, #0
10: d005 beq.n 1e <RamBased_ROM_API_Init+0x1e>
{
g_bootloaderTree = ((bootloader_api_entry_t *)*(uint32_t *)0x0021001cU);
12: 4b09 ldr r3, [pc, #36] @ (38 <RamBased_ROM_API_Init+0x38>)
14: 681b ldr r3, [r3, #0]
16: 461a mov r2, r3
18: 4b08 ldr r3, [pc, #32] @ (3c <RamBased_ROM_API_Init+0x3c>)
1a: 601a str r2, [r3, #0]
}
else
{
g_bootloaderTree = ((bootloader_api_entry_t *)*(uint32_t *)0x0020001cU);
}
}
1c: e004 b.n 28 <RamBased_ROM_API_Init+0x28>
g_bootloaderTree = ((bootloader_api_entry_t *)*(uint32_t *)0x0020001cU);
1e: 4b08 ldr r3, [pc, #32] @ (40 <RamBased_ROM_API_Init+0x40>)
20: 681b ldr r3, [r3, #0]
22: 461a mov r2, r3
24: 4b05 ldr r3, [pc, #20] @ (3c <RamBased_ROM_API_Init+0x3c>)
26: 601a str r2, [r3, #0]
}
28: bf00 nop
2a: 46bd mov sp, r7
2c: f85d 7b04 ldr.w r7, [sp], #4
30: 4770 bx lr
32: bf00 nop
34: 40c84000 .word 0x40c84000
38: 0021001c .word 0x0021001c
3c: 80981070 .word 0x80981070
40: 0020001c .word 0x0020001c
Thanks very much!
So you guys are completely stumped by a tiny bit of assembly?
Hi @Littell,
Could you help me with the following information?
Which MCU are you using?
Could you explain what is the expected behavior of the application?
It's an RT1176 (CM7) and the expected behavior isn't relevant - I'm asking for an analysis of the assembly code, in particular the contents of r7 when the function returns.
My apologies for the late reply.
I understand may not be able to share more information about the application, however, custom code and assembly code is out of the scope of support through this channel.
If you need help with any ARM related instructions in particular, I would recommend contacting ARM support. For NXP products related questions you may also contact your NXP Distributor for help.
Please let me know if there’s anything else that I can do for you.
Regards,