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

ASM strong function gets replaced by weak function

I have a project where I need to define strong function in ASM. If I do so it gets ignored and default weak function is used instead. If I define strong function in C it works fine, that is strong one will be called.

If I add the following code to C, then strong ASM function will be called.

extern void SVC_Handler(void);
void(*SVC_Handler_fp)(void) = &SVC_Handler;

I tried changing linking order but it doesn't help. Any way to fix this without using global memory?

this is a linker command line

c:\SysGCC\arm-eabi\bin\arm-eabi-g++.exe -o ../../../VisualGDB/Release/det-os-example-stm32l496ze -Wl,-gc-sections -TC:/Users/USAGu/AppData/Local/VisualGDB/EmbeddedBSPs/arm-eabi/com.sysprogs.arm.stm32/STM32L4xxxx/LinkerScripts/STM32L496ZG_flash.lds --specs=nano.specs --specs=nosys.specs  -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mcpu=cortex-m4  -Wl,--start-group VisualGDB/Release/main.o ../../../VisualGDB/Release/lib-det-os-stm32l496ze.a ../../../VisualGDB/Release/lib-stm32l496ze.a -Wl,--end-group:

lib-det-os-stm32l496ze.a has a strong ASM function.

https://github.com/robot-corral/mazebot/blob/master/software/common/lib-det-os/src-asm/svc_handler.S

lib-stm32l496ze.a has a weak ASM function.

https://github.com/robot-corral/mazebot/blob/master/software/common/lib-stm32l4/src/startup_stm32l496xx.s

Function name is SVC_Handler

GCC v7.2

LD 2.29