Hello,
i would like to have a debug build with frame pointers on an ARM Cortex-M4
MCU.
These are the options passed to GCC 9.1.0:
-fno-omit-frame-pointer
-mthumb
-march=armv7e-m
-mtune=cortex-m4
-mcpu=cortex-m4
-mfloat-abi=hard
-ffreestanding
-std=c11
I also tested several combinations of the following options:
-mabi=aapcs
-mabi=atpcs
-mapcs-frame
-mtpcs-frame
-mtpcs-leaf-frame
-mno-sched-prolog
-O1
-O0
But never got the fp register (r11) set up.
This is one sample function from objdump (fp appears nowhere):
80005c0: b5b0 push {r4, r5, r7, lr}
80005c2: af00 add r7, sp, #0
80005c4: 4605 mov r5, r0
80005c6: 2030 movs r0, #48
80005c8: f7ff ffa6 bl 8000518
80005cc: 2078 movs r0, #120
80005ce: f7ff ffa3 bl 8000518
80005d2: 241c movs r4, #28
80005d4: fa25 f304 lsr.w r3, r5, r4
80005d8: f003 030f and.w r3, r3, #15
80005dc: 2b09 cmp r3, #9
80005de: bfcc ite gt
80005e0: 2037 movgt r0, #55
80005e2: 2030 movle r0, #48
80005e4: 4418 add r0, r3
80005e6: f7ff ff97 bl 8000518
80005ea: 3c04 subs r4, #4
80005ec: f114 0f04 cmn.w r4, #4
80005f0: d1f0 bne.n 80005d4
80005f2: bdb0 pop {r4, r5, r7, pc}
So, all in all, how can it be done?
Regards,
Vicenç.