I want to override the default exception handler. I see it's a weak symbol so all it should take is to create a function with the same name and signature, right? So I created a file called handlers.c with the following content:
Thanks @Giovanni. I checked the map file, and my symbol appears under "Discarded Input Sections". I guess the linker dumps it before it has a chance to override the weak version. But I was unable to keep it in even by marking it with [font=Courier New]__attribute__((used))[/font].
There are two more references to this symbol, one under "Cross Reference Table" that only tells that it's defined in my source file, and under "Linker script and memory map" on the top of all exception vectors from vectors.o, so it's the weak version.
Actually I have a main.cpp. I tried putting it there making sure it has C-style linkage, but that didn't help, either.
Do you think it has something to do with messing around with the vector table? I partitioned my flash, the first 128kB is for the bootloader, the main app starts after that. So for the main app I moved my vectors 128kB into the flash by defining CORTEX_VTOR_INIT to 0x00020000U in my chconf.h. I also recompiled and flashed my bootloader with the overridden handler, but no luck.