Tool/software:
Hello,
I hope the title matches the problem well.
So our situation is that we use the mcu-plus-sdk and we want to overwrite some functions, while this works well for most of the drivers, overwriting some dpl-functions doesn't work as assumed. I had some guidance by George for the understanding of how the linker-works: MCU-PLUS-SDK-AM243X: "not stripping symbol X because it is named in a relocation" - Arm-based microcontrollers forum - Arm-based microcontrollers - TI E2E support forums
And we also fixed a problem with linking with sections when redefining your own implementations in your library but you mention both libraries - the one which contains the functions to be overriden, as well as your own, by explicitly mentioning the library which contains the sections which overwrite functions of the sdk: MCU-PLUS-SDK-AM243X: overwriting sdk-functions with own implementation not working correctly - Arm-based microcontrollers forum - Arm-based microcontrollers - TI E2E support forums
While in the above-case we did overwrite the abort-handlers, now we want to overwrite some of the debug-functionality.
So far I managed that the linke does not complain about redefined smybols, so this seems to work. This is the folder-structure of the example:
The .c-files are copied from the sdk and contain modified content, but still define all the functions that will be overwritten to be contained in one compilation unit.
The modification also affects the sections, since we will place some of those functions in a special .text.debug-section like this (the header activates this part, just VSCode does not show it correctly):
Note that in the sdk, those functions are not placed in a section like this!
And now the important part happens which is a bit special in the linker-script.
We are placing the freertos library, which contains the symbols to be overriden, in a section:
the .text.debug-section is also placed:
If I now compile without further modifications, our .text.debug-section does not contain those symbols. in contrary, the map-file shows that the ones of the freertos-library are included:
Our library is linked in the link-command before the freertos-library. extract from the link-command:
As soon as I remove the freertos-library from the linker-script, it works and uses our copy of the file from our library:
but as soon as I add the freertos-lib again and try to add it like with the other solution:
I get this error when linking:
linker_r5f_mcu1_0_freertos_debug.cmd", line 63: error #10068-D: no matching section
This doesn't make sense to me, since this section is obviously inside this library.
It gets even more confusing, since, when I now remove the freertos-library again, it builds again as well and places our section in there with the addition of the explicit placement of the libti_hw_support-mcu1_0.a!
Why does the linksr say there is no matching section, when there even is one and it uses it? Could it be the message is just an indicator for another issue?
My guess is, since there is no .text.debug-section-attribute for the functions in the sdk, they differ in their input section to our definitions, and thus the linker would handle them differently?
What am I doing wrong here?
Edit: I tested it by removing our section-attributes and then it works with including both libraries in the linker-script. so putting those functions into a separate section, other than in the sdk, seems to be the problem.
Unfortunately we had a reason why this was needed, but it's some time ago and I will find out.
Is there a possibility to achieve the replacing of the sdk-library functions while at the same time, placing them in a different section than the one in the sdk?
Best regards,
Felix