cancel
Showing results for 
Search instead for 
Did you mean: 

Can't override a '__weak' function

diverger
Senior

Hi,

I write my own 'void HAL_SPI_TxRxCpltCallback(SPI_HandleTypeDef *hspi)', intend to override the default weak one. But when debug, my version is never called, it always steps into the 'weak' one. I'm new to CubeIDE, the version is 1.16.0, any suggestions?

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions

Using .cpp ?

Double check spelling/capitalization

Perhaps use objdump to inspect generated object from your source file.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

4 REPLIES 4

Using .cpp ?

Double check spelling/capitalization

Perhaps use objdump to inspect generated object from your source file.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Hi,

My project is created as C++ project indeed. But my 'strong' version is defined in a ".c" file. Even I convert the project to 'C' project, my strong version won't be called. And I'm sure they have same signatures.

BTW: does CubeIDE support 'objdump'? I'm on Windows system, not Linux.

I'm running GNU/GCC on Windows and have objdump and objcopy, and on Keil I have fromelf

Y:\STM32\GNU>objdump Usage: objdump <option(s)> <file(s)> Display information from object <file(s)>. At least one of the following switches must be given: -a, --archive-headers Display archive header information -f, --file-headers Display the contents of the overall file header -p, --private-headers Display object format specific file header contents -P, --private=OPT,OPT... Display object format specific contents -h, --[section-]headers Display the contents of the section headers -x, --all-headers Display the contents of all headers -d, --disassemble Display assembler contents of executable sections -D, --disassemble-all Display assembler contents of all sections -S, --source Intermix source code with disassembly -s, --full-contents Display the full contents of all sections requested -g, --debugging Display debug information in object file -e, --debugging-tags Display debug information using ctags style -G, --stabs Display (in raw form) any STABS info in the file -W[lLiaprmfFsoRt] or --dwarf[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames, =frames-interp,=str,=loc,=Ranges,=pubtypes, =gdb_index,=trace_info,=trace_abbrev,=trace_aranges, =addr,=cu_index] Display DWARF info in the file -t, --syms Display the contents of the symbol table(s) -T, --dynamic-syms Display the contents of the dynamic symbol table -r, --reloc Display the relocation entries in the file -R, --dynamic-reloc Display the dynamic relocation entries in the file @<file> Read options from <file> -v, --version Display this program's version number -i, --info List object formats and architectures supported -H, --help Display this information Y:\STM32\GNU>objdump -v GNU objdump (GNU Tools for ARM Embedded Processors) 2.24.0.20141128 Copyright 2013 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License version 3 or (at your option) any later version. This program has absolutely no warranty.
View more

Not sure what CubeIDE brings in, but I'm not limited by that

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
TDK
Super User

Temporarily rename the weak one to something else, see if it compiles and links. Could be a misspelling in your strong version, or the string version isn't being compiled.

If you feel a post has answered your question, please click "Accept as Solution".