当前位置:网站首页>Create RT thread software simulation project and write RT thread kernel
Create RT thread software simulation project and write RT thread kernel
2022-06-10 07:02:00 【1ShyJn25】
newly build RT-Thread engineering —— Software emulation
At the beginning of writing RT-Thread Before the kernel , So let's just create a new one RT-Thread engineering ,Device choice Cortex-M3(Cortex-M4 or Cortex-M7) The processor of the kernel , Select software simulation for debugging mode , Finally, put RT-Thread Migration to STM32 Development board . The final migration is very simple , Just change the startup file and add bsp Just drive .
New local project folder
Before starting the new project , Let's create a new folder in the local computer to store the project . You can name the folder “ newly build RT-Thread engineering —— Software emulation ”( The name can be set at will ), Then create new folders and files under this folder , The inclusion relations and functions of these folders are shown in the table 1 Shown .
surface 1 Folders under the root directory of project folders and their functions 


Use KEIL New project 
New Project
Start by opening KEIL5 Software , Build a new project , The project files are placed in the newly created directory Project below , Name it RT-Thread-ra, among ra Is custom , It should be noted that it must be in English , Not in Chinese .
Select Device for Target
Set the project name , After confirmation, the corresponding... Will pop up Select Device for Target Dialog box , Select processor , Choose here ARMCM4, Can also be based on Device Model selection ARMCM3 or ARMCM7, Choose according to your own development board 
Manage Run-Time Environment
After selecting the processor , single click OK The button will pop up Manage Run-Time Environment Dialog box . Here it is CMSIS Column CORE, stay Device Column Startup File can 
single click OK Button , close Manage Run-Time Environment After the dialog , Just selected CORE and Startup These two files will be added to the project group 
These two files were initially stored in KEIL Installation directory , When configuring Manage Run-Time Environment After the dialog , The software will transfer the selected file from KEIL Copy the installation directory of to our project directory Project\RTE\Device\(ARMCM3ARMCM4 or ARMCM7) below . among startup_ARMCM4.s Is a startup file written in assembly language ,system_ARMCM4.c Yes, it is C Language and clock related files . Want to know more specific content , You can read the source code of these two files directly . As long as it is (Cortex-M3、Cortex-M4 or Cortex-M7) The single chip microcomputer of the kernel , Both documents apply .
stay KEIL Create a new file group in the project 


Create an empty main.c
Set up software emulation 
No development board can use this software to simulate
Modify clock size
In the clock related file system_ARMCM4.c The beginning of , There is a code that defines the frequency of the system clock as 25MHz. In software simulation , Make sure the time is accurate , The system clock in the code must be consistent with the clock in the software simulation , therefore Options for Target In the dialog box Target The clock frequency in the tab should be set by default 12 Change to 25.
Clock related macro definitions
#define __HSI ( 8000000UL)
#define __XTAL ( 5000000UL)
#define __SYSTEM_CLOCK (5*__XTAL) /* 5*5000000=25M*/
Add the header file path

Reference resources 《RT-Thread Kernel Implementation and application development practice guide -STM32》
边栏推荐
- mongo,mongodb优化思路
- 【动态规划】博弈论:取石子游戏合集
- Multiple solutions to one problem × 5 (array + circular linked list)
- What should I do if I fail to withdraw cash from online gambling?
- 2022-06-09:每个会议给定开始和结束时间, 后面的会议如果跟前面的会议有任何冲突,完全取消冲突的、之前的会议,安排当前的。 给定一个会议数组,返回安排的会议列表。 来自通维数码。
- R 17 date format exercise
- Embedded development | common operations of EEPROM driver code
- Around ifelse and business logic
- 电脑新加内存条后 游戏崩溃 浏览器卡死 电脑蓝屏
- 30. localstorage and sessionstorage are unknown
猜你喜欢

npm怎么安装与使用

2022-06-09:每个会议给定开始和结束时间, 后面的会议如果跟前面的会议有任何冲突,完全取消冲突的、之前的会议,安排当前的。 给定一个会议数组,返回安排的会议列表。 来自通维数码。

leetcode. 38 --- appearance series

TeleyeControlor V8.16发布 完成注册表功能

Beyond compare

TeleyeControlor V8.47版本发布 更改Socket框架

The game crashed after the computer added a new memory module, and the browser blocked the blue screen of the computer
![findfont: Font family [‘msyh‘] not found. Falling back to DejaVu Sans.](/img/f2/6086b3b4a931fffee0bdd15a2b2c00.jpg)
findfont: Font family [‘msyh‘] not found. Falling back to DejaVu Sans.

Multiple solutions to one problem × 5 (array + circular linked list)

The title of my composition is - "my district head father"
随机推荐
Arduino configuring esp32 development environment
ROS2+Gazebo11+Car+OpenCV巡线识别和速度转向控制学习
Around ifelse and business logic
SM2 state secret encryption and signing operation tool
Read in one second: the practical operation of increasing capital and shares of enterprises!
Beyond compare
What's new in openlayers 6.13
【动态规划】LeetCode1092. 最短公共超序列
一本通1281.最长上升子序列 题解 动态规划
The game crashed after the computer added a new memory module, and the browser blocked the blue screen of the computer
LabVIEW控制Arduino实现红外测距(进阶篇—6)
Local storage of JS data interaction
npm怎么安装与使用
Rk3399 default browser and Chinese language
Jumping game II
19 r judgment control function exercise
I/o basic knowledge sorting
How to modify photos of downloaded word resume templates
YoseZang 原创 特征码定位器 SignatureTest V6.36 Rls 发布
Where will the alarm messages go? Fly in the flying book