当前位置:网站首页>Simulink automatically generates STM32 code details
Simulink automatically generates STM32 code details
2022-07-28 04:57:00 【chaikeya】
1、 Development software
STM32-MAT/TARGET_V5.6.0
STM32CubeMX_V5.6.0
JAVA 64_bit
MATLAB_2018b
MDK-ARM_V5
The picture below is STM32-MAT/TARGET_V5.6.0 Version requirements in the official manual .

Why use so much software :
- STM32CubeMX Software is based on JAVA The environment is running .
- STM32-MAT/TARGET stay simulink Is equivalent to the peripheral driver library of generated code .
- Take advantage of the official simulink Development library for development work , First call STM32CubeMX Software generated configuration file .


Baidu network disk software resource sharing : link :https://pan.baidu.com/s/1anbU-S9qEtSVDEMIc18yMA Extraction code :9tzi
2、 Software download and installation
2.1 STM32-MAT/TARGET Official website Download address :
https://www.st.com/en/development-tools/stm32-mat-target.html?s_searchtype=partnumber

STM32-MAT/TARGET install :
The process is brief , After installation, open the folder as shown in the figure :

1. Run as administrator startup.bat
open MATLAB Running environment .
2. You need to add a path when opening for the first time , Enter >>pathtool, And put STM32-MAT/TARGET Add the installation path of .
3. open simulink There will be one more module library STM32 A list of , Pictured

2.2 JAVA Official website :
https://www.java.com/zh_CN/download/ie_manual.jsp
JAVA install :
Run as administrator jre-8u112-windows-x64.exe, Install in the default folder .
2.3 STM32CubeMX Official website Download address :
https://www.st.com/zh/development-tools/stm32cubemx.html

download STM32CubeMX library :
The new version can be installed directly , When creating a project, you can directly download libraries of different models .


STM32CubeMX yes ST Official development support is fast MDK-ARM Software for generating engineering documents , You can directly compile it and download it to the target development board , It saves the work of manually configuring the underlying code , Use the visual graphics window for efficient configuration .
example 1: use STM32CubeMX Generate STM32 Code
1、 choice MCU



2、 Set up IO Mouth properties


3、 Set downloader and clock source

4、 Set project name 、 Save path and IDE Tools :



5、 The generated code 、 Open the code generation folder , Or open the project directly :


example 2: use simulink Generate STM32 Code
The version used here :
STM32CubeMX-5.3.0
Download address :https://www.stmcu.org.cn/document/detail/index/id-214984
STM32_MAT_TARGET_V4.4.2
Download address :https://www.stmcu.org.cn/document/detail/index/id-216053
1、 stay STM32CubeMX-5.3.0 Configure specific ARM chip STM32F103RCTx, And save it as an engineering file myTest3.ioc;( Reference example 1)
2、simulink System settings ( Refer to the first blog )



3、 stay SIMULINK I'll build a new one MODEL file untitled, take MCU CONFIG and GPIO _Write These two modules are from the toolkit (Target Support Package-STM32Adapter) Middle drag untitled file , And in STM32_Config Specify... In the module myTest1.ioc File path ,OK Then the module is automatically renamed “STM32F103RCTx”. explain MCU Configuration has been successful .

4、 double-click GPIO write modular , Select pin IO.

5、 Perfect model , Pictured

6、Ctrl+B The generated code
if .ioc The project file is generated before the file , Open it by yourself .
if .ioc The project file was not generated before the file , It will turn on automatically STM32CubeMX-5.3.0 Click on generate code that will do .




7、 In addition, we need to pay attention to .ioc Document and .slx The files should be in the same folder

Refer to Blogger :
https://blog.csdn.net/ybhuangfugui/article/details/52225736#commentBox
turn :
1、STM32CubeMX There will be the following prompt when opening :
To be installed 64bit Java Otherwise, it will lead to STM32CubeMX Some functions cannot be used .
2、STM32CubeMX The generated project file cannot be used keil open , The tips are as follows
Keil Version problem , Another... Is installed MDK-ARM_V5 Software can .
The software and version of the generated project can be found in STM32CubeMX Set .

3、code replacement library Choose none![]()


4、 add to GPIO Module prompt
Error evaluating 'MaskDialog' callback of GPIO_Write(mask) No function or variable defined 'Pin_idx' And simulink The model cannot generate code
Software version :MATLAB2018_b、STM32-MAT/TARGET_5.6.0、STM32CubeMX_5.6.0

https://www.ilovematlab.cn/thread-485075-1-1.html
By chaikeya 2020/4/30
边栏推荐
- Euler road / Euler circuit
- Observable time series data downsampling practice in Prometheus
- FreeRTOS startup process, coding style and debugging method
- FreeRTOS learning (I)
- 提升学生群体中的STEAM教育核心素养
- What SaaS architecture design do you need to know?
- Redis配置文件详解/参数详解及淘汰策略
- FPGA: use PWM wave to control LED brightness
- 猿辅导技术进化论:助力教与学 构想未来学校
- 吉利AI面试题【杭州多测师】【杭州多测师_王sir】
猜你喜欢

100 lectures on Excel practical application cases (XI) - tips for inserting pictures in Excel

Transformer -- Analysis and application of attention model
![[high CPU consumption] software_ reporter_ tool.exe](/img/3f/2c1ecff0a81ead0448e1215567ede7.png)
[high CPU consumption] software_ reporter_ tool.exe

Array or object, date operation

How to quickly locate bugs? How to write test cases?

Odoo action analysis (action.client, action.act_window, action.server)

(克隆虚拟机步骤)

机器人教育在STEM课程中的设计研究

Rendering process, how the code becomes a page (2)

The first artificial intelligence security competition starts. Three competition questions are waiting for you to fight
随机推荐
Summary and review of puppeter
Flink mind map
Machine learning and deep learning -- normalization processing
Installing MySQL under Linux
(克隆虚拟机步骤)
Research on the design of robot education in stem course
Odoo action analysis (action.client, action.act_window, action.server)
(3.1) [Trojan horse synthesis technology]
CPU and memory usage are too high. How to modify RTSP round robin detection parameters to reduce server consumption?
System clock failure of database fault tolerance
Have you learned the common SQL interview questions on the short video platform?
Geely AI interview question [Hangzhou multi tester] [Hangzhou multi tester _ Wang Sir]
Transformer -- Analysis and application of attention model
Can plastics comply with gb/t 2408 - Determination of flammability
数据库故障容错之系统时钟故障
[Sylar] framework -chapter20- daemon module
Redis配置文件详解/参数详解及淘汰策略
[Sylar] framework -chapter24- support business modularization
Gerrit operation - rollback a patch_ set
HDU 3585 maximum shortest distance