How do I use a custom linker file with the STM32 Support Package?

16 次查看(过去 30 天)
Is there a way to specify a custom linker file for the "Embedded Coder® Support Package for STMicroelectronics® STM32 Processors"?

采纳的回答

MathWorks Support Team
MathWorks Support Team 2024-9-11,0:00
The STM32 support package currently does not offer a built-in way to specify a custom linker file. This is because we use the linker file generated by the STM32CubeMX tool.
As a workaround, you can overwrite the generated linker file with the desired custom linker file using the "Post Code Generation Command" after the code generation has occurred but before the build process starts.
More information on customizing the build process using the Post Code Generation Command can be found here: https://www.mathworks.com/help/rtw/ug/customizing-post-code-generation-build-processing.html
Assuming your custom linker file is located at <sourceLDFile>, and the automatically generated linker file from CubeMX is in <destinationLDFile>. The generated linker file should be inside a folder named "STM32CubeIDE" at the same level as the IOC project file.
In the parameters of the Simulink model, append the following string under:
Hardware > Hardware settings > Code Generation > Advanced Parameters > Post Code Generation Command
;copyfile('<sourceLDFile>', '<destinationLDFile>','f');
where <sourceLDFile> and <destinationLDFile> are the absolute paths to the custom linker file and the generated linker file, respectively.
See the following screenshot for reference:

更多回答(0 个)

标签

尚未输入任何标签。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by