What does [WEAK] mean in STM32 startup assembly code?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
5
down vote

favorite












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
ENDP


There are other places in the code that this symbol has been used in. I just bring a part as an instance.










share|improve this question























  • Are IMPORT SystemInit and IMPORT __main really indented as shown here?
    – Peter Mortensen
    7 hours ago














up vote
5
down vote

favorite












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
ENDP


There are other places in the code that this symbol has been used in. I just bring a part as an instance.










share|improve this question























  • Are IMPORT SystemInit and IMPORT __main really indented as shown here?
    – Peter Mortensen
    7 hours ago












up vote
5
down vote

favorite









up vote
5
down vote

favorite











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
ENDP


There are other places in the code that this symbol has been used in. I just bring a part as an instance.










share|improve this question















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
ENDP


There are other places in the code that this symbol has been used in. I just bring a part as an instance.







stm32 assembly keil






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 14 mins ago









Ben Voigt

1,64611326




1,64611326










asked 11 hours ago









Amin

875




875











  • Are IMPORT SystemInit and IMPORT __main really indented as shown here?
    – Peter Mortensen
    7 hours ago
















  • Are IMPORT SystemInit and IMPORT __main really indented as shown here?
    – Peter Mortensen
    7 hours ago















Are IMPORT SystemInit and IMPORT __main really indented as shown here?
– Peter Mortensen
7 hours ago




Are IMPORT SystemInit and IMPORT __main really indented as shown here?
– Peter Mortensen
7 hours ago










1 Answer
1






active

oldest

votes

















up vote
11
down vote



accepted










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






share|improve this answer






















  • (Perhaps link to the non-mobile version instead, en.wikipedia.org/wiki/Weak_symbol)
    – Peter Mortensen
    7 hours ago






  • 1




    I was on my mobile, I didn't even notice the links were different. Well, I won't be able to fix that soon, so feel free to make an edit if you can. Thanks anyway.
    – dim
    6 hours ago










Your Answer




StackExchange.ifUsing("editor", function ()
return StackExchange.using("mathjaxEditing", function ()
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
);
);
, "mathjax-editing");

StackExchange.ifUsing("editor", function ()
return StackExchange.using("schematics", function ()
StackExchange.schematics.init();
);
, "cicuitlab");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "135"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2felectronics.stackexchange.com%2fquestions%2f403511%2fwhat-does-weak-mean-in-stm32-startup-assembly-code%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
11
down vote



accepted










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






share|improve this answer






















  • (Perhaps link to the non-mobile version instead, en.wikipedia.org/wiki/Weak_symbol)
    – Peter Mortensen
    7 hours ago






  • 1




    I was on my mobile, I didn't even notice the links were different. Well, I won't be able to fix that soon, so feel free to make an edit if you can. Thanks anyway.
    – dim
    6 hours ago














up vote
11
down vote



accepted










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






share|improve this answer






















  • (Perhaps link to the non-mobile version instead, en.wikipedia.org/wiki/Weak_symbol)
    – Peter Mortensen
    7 hours ago






  • 1




    I was on my mobile, I didn't even notice the links were different. Well, I won't be able to fix that soon, so feel free to make an edit if you can. Thanks anyway.
    – dim
    6 hours ago












up vote
11
down vote



accepted







up vote
11
down vote



accepted






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






share|improve this answer














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







share|improve this answer














share|improve this answer



share|improve this answer








edited 5 hours ago









Felthry

2,821826




2,821826










answered 10 hours ago









dim

12.7k22364




12.7k22364











  • (Perhaps link to the non-mobile version instead, en.wikipedia.org/wiki/Weak_symbol)
    – Peter Mortensen
    7 hours ago






  • 1




    I was on my mobile, I didn't even notice the links were different. Well, I won't be able to fix that soon, so feel free to make an edit if you can. Thanks anyway.
    – dim
    6 hours ago
















  • (Perhaps link to the non-mobile version instead, en.wikipedia.org/wiki/Weak_symbol)
    – Peter Mortensen
    7 hours ago






  • 1




    I was on my mobile, I didn't even notice the links were different. Well, I won't be able to fix that soon, so feel free to make an edit if you can. Thanks anyway.
    – dim
    6 hours ago















(Perhaps link to the non-mobile version instead, en.wikipedia.org/wiki/Weak_symbol)
– Peter Mortensen
7 hours ago




(Perhaps link to the non-mobile version instead, en.wikipedia.org/wiki/Weak_symbol)
– Peter Mortensen
7 hours ago




1




1




I was on my mobile, I didn't even notice the links were different. Well, I won't be able to fix that soon, so feel free to make an edit if you can. Thanks anyway.
– dim
6 hours ago




I was on my mobile, I didn't even notice the links were different. Well, I won't be able to fix that soon, so feel free to make an edit if you can. Thanks anyway.
– dim
6 hours ago

















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2felectronics.stackexchange.com%2fquestions%2f403511%2fwhat-does-weak-mean-in-stm32-startup-assembly-code%23new-answer', 'question_page');

);

Post as a guest













































































Comments

Popular posts from this blog

What does second last employer means? [closed]

Installing NextGIS Connect into QGIS 3?

One-line joke