Issue using stm32L4 with matlab 2025a

14 views (last 30 days)
Ankit
Ankit on 20 Aug 2025
Edited: Shivam on 7 Oct 2025 at 6:33
### Invoking Target Language Compiler on stm32L4_blink.rtw
### Using System Target File: C:\Program Files\MATLAB\R2025a\rtw\c\ert\ert.tlc
### Loading TLC function libraries
........
### Initial pass through model to cache user defined code
### Caching model source code
..............................
### Writing header file stm32L4_blink_types.h
.
### Writing header file stm32L4_blink.h
### Writing header file rtwtypes.h
### Writing source file stm32L4_blink.c
### Writing header file stm32L4_blink_private.h
### Writing header file rtmodel.h
.
### Writing source file ert_main.c
### TLC code generation complete (took 1.272s).
### Saving binary information cache.
### Generating code from STM32CubeMX project: E:\matlabexample\stm32l7\stm32l4blinkled.ioc
### Build procedure for stm32L4_blink aborted due to an error.
Top model targets:
Model Build Reason Status Build Duration
=========================================================================================================================================
stm32L4_blink Information cache folder or artifacts were missing. Failed to build. For more information, see build log. 0d
0 of 1 models built (0 models already up to date)
Build duration: 0h 0m 41.734s
Error:E:\matlabexample\stm32l7\.mxproject\.mxproject file does not exist at .ioc project path E:\matlabexample\stm32l7\.mxproject. Ensure code is generated from STM32CubeMX project.
Also In Matlab2025a Toolchain changed to ARMClANG. ANY Changes required in CubeMX Related to this?

Accepted Answer

Shivam
Shivam on 9 Sep 2025
Edited: Shivam on 7 Oct 2025 at 6:33
Hello Ankit,
The below given steps might be helpful in debuging the errors:
  • In your case, the default toolchain considered is Armclang. This mainly happends when you install Armclang during the installation of "Embedded Coder Support Package for STMicroelectronics STM32 Processors". If you skip the corresponding step, the default toolchain choosen will be "GNU tools for ARM Embedded Processors". You can change the toolchain from the "Code Generation" tab appearing under "hardware settings" as shown below:
Try to change the toolchain to "GNU tools for ARM Embedded Processors" and again build the model.
  • If error is still not resolved, it may be possible due to incorrect configuration of peripherals in IOC file. In this case, try to directly generatre the code from the STM32CUBEMX application by pressing "Generate code" button appearing on the top right corner of the window. The code should be generated without any errors. If there is an error, try to address it by making suitable changes in the peripheral configurations.
If the issue is not resolved, kindly contact the Technical Support for further assistance:
Please make sure to attach the relevant files pertaining to the project like simplified/reduced Simulink model and the IOC file. It will be helpful in reproducing the issue faced by you.
Regards,
Shivam Gothi

More Answers (1)

Anmol
Anmol on 3 Sep 2025
Hi Ankit,
I understand that you are generating code for a Simulink/Embedded Coder for an STM32 project working with MATLAB 2025a and facing the mentioned error:
Error:E:\matlabexample\stm32l7\.mxproject\.mxproject file does not exist at .ioc project path E:\matlabexample\stm32l7\.mxproject. Ensure code is generated from STM32CubeMX project.
This error is occurring because of the missing .mxproject file at the .ioc project path.
The primary purpose of the .mxproject file is to tell the STM32CubeIDE build system how to compile and link your code correctly. It stores the metadata that is generated when you configure your project in STM32CubeMX .This file is specific to the IDE and holds information that the compiler and linker need to do their job.
You can refer to this example to better understand the workflow of working with CubeMX project and MATLAB. This might help you identify any issues in configuring the model.
Hope, this helps.

Products


Release

R2025a

Community Treasure Hunt

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

Start Hunting!