Hi Mirko,
The errors you're encountering during the compilation phase in Simulink when trying to integrate external C libraries for STM32 microcontrollers suggest that there's a mismatch between the assembly code generated and what the assembler expects. This could be due to various reasons, including incorrect compiler settings, incompatible assembly syntax, or issues with the C code being compiled.
Here are some steps you can take to troubleshoot and resolve the issue:
- Check Compiler Compatibility: Ensure that you're using a compiler that is compatible with the STM32 microcontroller and that it understands the assembly instructions being used. The STM32 typically uses ARM Cortex processors.
- Review Custom Code Settings: In Simulink, make sure that the custom code settings, such as include paths, source files, and defines, are correctly specified. Also, ensure that the settings are compatible with the compiler you're using.
- Inline Assembly Syntax: If the C code contains inline assembly, ensure that the syntax is correct for the compiler you're using. Different compilers may have different syntax requirements for inline assembly.
- Assembly File Generation: The errors seem to be coming from an assembly file (*.s). Check whether the assembly file is generated by the compiler or provided as part of the library. If it's generated by the compiler, there might be an issue with the compiler's configuration or the C code itself.
- Simulink Model Configuration: Verify the Simulink model configuration parameters, specifically the hardware implementation settings. Make sure that you have selected the correct target hardware and that the toolchain settings align with your compiler.
- Update Libraries and Toolchain: Ensure that all libraries and the toolchain are up to date. Sometimes, compatibility issues can be resolved by updating to the latest versions.
By following these steps, you should be able to identify the source of the compilation errors.
Please refer to the below MathWorks documentation of working with STM32 controllers - https://www.mathworks.com/help/ecoder/stmicroelectronicsstm32f4discovery/ug/Getting-started-stm32cubemx.html
Hope this helps.