This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Caller Function Did Not Keep R3

Hi,

I have a "test_fun1()" function call to a inline ASM "test_fun2()". I found that the caller, "test_fun1()" did not keep the R3 before jump to "test_fun2()", which cause the result of the  "test_fun1()" is not correct (inline ASM "test_fun2()" use R3).

The same code works fine with Keil MDK-ARM. It also works when I change the Core from M3 to M0. 

Does the "test_fun2()" have any problem/violation?

I will be appreciated if anyone can give some suggestions. Thanks.

Following are some information and the code (It has some differences from the original application code, I create a simple ASM version to reproduces the issue). 

GNU Arm Version: 9 2020-q2-update (gcc-arm-none-eabi-9-2020-q2-update-win32.exe)

ARM_CORE = cortex-m3
ARCH_OPTION = -mcpu=$(ARM_CORE) -mthumb -mthumb-interwork
C_OPTION = -gdwarf-2 -MD -Wall -Os -mapcs-frame -ffunction-sections -fdata-sections
L_OPTION = -Wl,-Map=$(TARGET_NAME).map -Wl,--gc-sections --specs=nano.specs

Caller_R3_source_code.zip

main.c

test.c

disasm.txt

0