Here's the context for my question:
- I use a ARM7 architecture (ARM720T TDMI...)
- Compile using GCC of codesourcedy (arm-none-eabi ver 4.5.2)
- I'm a newbie with gcc and ARM architecture but have worked in embeded for 5 years ;-)
In my project, a C function is called from an assembly file before the stack is initialized. Because the stack is not initialized, the function must not use the stack.
Is it possible with some "pragma like" command to force gcc to not use the stack with that particular function?
Additional information : The goal of my work is to convert a project previously compiled with ARMASM to gcc. So in ARMASM, calling this C function before the stack initialization was working. Maybe that the definitive answer will be that it is not possible to do this in gcc...
Below there is an extract of the ELF listing for the C function called in the assembly code (as you can see I tried a always_inline, but when called from assembly this doesn't seem to be enough):
000049d0 <CInit_Init>:
__attribute__((always_inline)) extern void CInit_Init(void) {
49d0: e52db004 push {fp} ; (str fp, [sp, #-4]!)
49d4: e28db000 add fp, sp, #0
__attribute__((always_inline)) void COM1_Init(void);
__attribute__((always_inline)) extern inline void COM1_Init_I(void) {
// Skip if already enabled
if (TEST_BIT_CLR(HwrSysControl1, HwSysControl1UartEnable)) {
49d8: e59f3038 ldr r3, [pc, #56] ; 4a18 <CInit_Init+0x48>
49dc: e5933000 ldr r3, [r3]
49e0: e2033c01 and r3, r3, #256 ; 0x100
49e4: e3530000 cmp r3, #0
49e8: 1a000007 bne 4a0c <CInit_Init+0x3c>
HwrUart1Control = (
49ec: e59f3028 ldr r3, [pc, #40] ; 4a1c <CInit_Init+0x4c>
49f0: e59f2028 ldr r2, [pc, #40] ; 4a20 <CInit_Init+0x50>
49f4: e5832000 str r2, [r3]
HwUartControlDataLength8|
HwUartControlFifoEnable|
HwUartControlRate115200);
BIT_SET(HwrSysControl1, HwSysControl1UartEnable);
49f8: e59f3018 ldr r3, [pc, #24] ; 4a18 <CInit_Init+0x48>
49fc: e59f2014 ldr r2, [pc, #20] ; 4a18 <CInit_Init+0x48>
4a00: e5922000 ldr r2, [r2]
4a04: e3822c01 orr r2, r2, #256 ; 0x100
4a08: e5832000 str r2, [r3]
COM1_Init_I();
}
4a0c: e28bd000 add sp, fp, #0
4a10: e49db004 pop {fp} ; (ldr fp, [sp], #4)
4a14: e12fff1e bx lr
4a18: 80000100 .word 0x80000100
4a1c: 800004c0 .word 0x800004c0
4a20: 00070001 .word 0x00070001