Problem generating code for stm32 and cubemx 'EXTRA_SOU​RCE_RELATI​VE_PATH' unrecognized

23 ビュー (過去 30 日間)
Lorenzo
Lorenzo 2022 年 11 月 8 日
回答済み: Sivapriya Srinivasan 2023 年 5 月 26 日
Dear all,
I am trying to generate code for an stm32f4xx custom board using matlab 2022b, the two support packages (cortex-M and stm32 processors) using the cubemx approach (I have a custom board with stm32f407vg and do not want to use the discovery board support) and the keil compiler.
I configured the board in IOC file and set MDK-ARM as toolchain.
If I try to generate code directly from cubemx it works: it generates a set of directories, source files and the .uvprojx keil project. I can load it into keil uvision and build it successfully. Actually linking fails since there is no main function, that is supposed to be "provided by matlab", but at this stage matlab files ahve not been generated already.
When I try to generate the code from simulink it stops with this error:
"Unrecognized method, property, or field 'EXTRA_SOURCE_RELATIVE_PATH' for class 'stm32cube.mdkarm'."
and have no clue where to look into.
I must add that I can succesfully compile my simulink scheme if I select GNU as toolchain (but unfortunately cannot use keil uvision at that point), thus the scheme, at the moment a simple oscillator with a couple of led flashing - derived from stm32_gettingstarted should be fine.
Can someone give a hint on where to look into the code generation process ?
Thank'you,
Lorenzo

回答 (1 件)

Sivapriya Srinivasan
Sivapriya Srinivasan 2023 年 5 月 26 日
Hey Lorenzo,
  • The error "Unrecognized method, property, or field 'EXTRA_SOURCE_RELATIVE_PATH' for class 'stm32cube.mdkarm'" usually occurs because there is a mismatch between the versions of the STM32 Support Package and the Keil MDK-ARM toolchain. Since you are using MATLAB 2022b and have configured the board in the IOC file, it is important to ensure that you are using the latest version of the STM32 Support Package that is compatible with MATLAB 2022b.
If the version of the STM32 Support Package installed in MATLAB is not the latest version, update it to the lates version using the Support Package Installer.
Check the compatibility between the STM32 Support Package and Keil MDK-ARM: Make sure the version of the Keil MDK-ARM toolchain you are using is compatible with the version of the STM32 Support Package installed in MATLAB. You can check the compatibility between the two on the MathWorks website.
  • Based on the error message you provided, it seems that there is an issue with the configuration of the MDK-ARM toolchain settings in your model.
Make sure that the MDK-ARM toolchain is properly configured in your model. Check that the compiler, linker and assembler paths are correctly set in the “Configuration Parameters” dialog, under “Code Generation -> Interface”.
Check that the MDK-ARM toolchain settings are not conflicting with the STM32 support package settings. In the same “Configuration Parameters” dialog, ensure that the “General -> Target hardware resources -> Board or device” option matches the STM32F4xx MCU used in your custom board. Also, ensure that the “Toolchain -> Advanced settings -> Use some library functions as assembler code” option is unchecked.
  • If the above steps do not resolve the issue, try reconfiguring the board in the IOC file and generating code again.
You can also try generating the code directly from the STM32 CubeMX and then importing it into MATLAB and configuring it for use with Simulink.
Hope this helps!
You can refer to MathWorks Documentation for further assistance!

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by