Tuesday, April 12, 2022

[SOLVED] Overriding weak C function alias with ASM function

Issue

I am developing on an ARM Cortex M3.

My IDE generates a C source file which includes an ISR vector table written in C as a struct of function pointers for ISR. By default they all have a weak alias which is the default hander.

I want to override the weak alias with an ASM function. Can I do this? I don't want to mess with the premade table, I just want to provide an ASM function to fill the name instead of using a C function, so load the ASM functions address of a given name.


Solution

Sure, just write the functions in assembly using the same symbol as the desired ISR. When a global symbol with the same name as a weak symbol exists, it replaces the weak symbol.



Answered By - fuz
Answer Checked By - Marie Seifert (WPSolving Admin)