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

[WEAK] Attribute

I'm building a project for the STM32F476. The default interrupt handlers are defined in the file "startup_stm32f746xx.s" and they're declared with the weak attribute, like this:

                EXPORT  RTC_Alarm_IRQHandler              [WEAK] 

I have my own interrupt handler for the RTC alarm interrupt, declared in a file named rtc.c using the same name as above. Looking at the map file after building my project, it seems like the linker is removing my alarm interrupt handler function:

Removing rtc.o(.text.RTC_ALARM_IRQHandler), (48 bytes).
Removing rtc.o(.ARM.exidx.text.RTC_ALARM_IRQHandler), (8 bytes).

Why is the linker removing my RTC alarm handler function? I thought the purpose of the [WEAK] attribute was to define a default instance of a function that could be overridden by another instance of the function. Even the help file seems to imply this:

        Use the [WEAK] attribute to inform the linker that a different instance of symbol takes precedence over this one, if a different one is available from another source.

How do I prevent the linker from removing my implementation of the RTC_Alarm_IRQHandler function?

Parents Reply Children
No data