I was reading the STM32F407 startup file in Keil software to gather some information. I faced this problem: What is the [WEAK] symbol used for?

A part of the code that this symbol has been used in is:

Reset_Handler    PROC
                 EXPORT  Reset_Handler             [WEAK]
        IMPORT  SystemInit
        IMPORT  __main

                 LDR     R0, =SystemInit
                 BLX     R0
                 LDR     R0, =__main
                 BX      R0
  • \$\begingroup\$ Are IMPORT SystemInit and IMPORT __main really indented as shown here? \$\endgroup\$ Oct 27, 2018 at 9:56

1 Answer 1


It says the implementation of the function should be weakly linked (as opposed to strongly linked, which is the usual).

This allows providing a "fallback" implementation of a function, in case no other (strongly linked) is found.

This is often used for default interrupt handlers in bare-metal MCU frameworks. This way, when you implement an interrupt, you just have to write your function, without having to remove the default one from the sources, and the linker does the job.

See https://en.wikipedia.org/wiki/Weak_symbol


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.