当前位置:网站首页>FreeRTOS startup - based on stm32
FreeRTOS startup - based on stm32
2022-06-11 04:08:00 【z_ Curtain】
FreeRTOS Startup process
1、Reset_Handler
The first assembly function executed after the system is powered on , The system initializes through this function
1 Reset_Handler PROC
2 EXPORT Reset_Handler [WEAK]
3 IMPORT __main
4 IMPORT SystemInit
5 LDR R0, =SystemInit
6 BLX R0
7 LDR R0, =__main
8 BX R0
9 ENDP
2、__main
C Library function , This function will be called after system initialization , To carry out C Code
3、main()
main The function is C Language code is the first function to execute , Generally, the creation and startup of the operating system are in main Call in function .
int main(void)
{
BaseType_t xReturn = pdPASS;/* Define a return value for creation information , The default is pdPASS */
/* Hardware initialization of development board */
BSP_Init();
taskENTER_CRITICAL(); // Enter the critical area
/* establish AppTaskCreate Mission */
xReturn = xTaskCreate((TaskFunction_t )AppTaskCreate,/* Task entry function */
(const char* )"AppTaskCreate",/* Task name */
(uint16_t )512, /* Task stack size */
(void* )NULL,/* Task entry function parameters */
(UBaseType_t )1, /* Task priority */
(TaskHandle_t*)&AppTaskCreate_Handle);/* Task control block pointer */
taskEXIT_CRITICAL(); // Exit critical region
/* Start task scheduling */
if (pdPASS == xReturn)
vTaskStartScheduler(); /* Start the task , Turn on scheduling */ (3)
else
return -1;
while (1); /* Normal will not be implemented here */
}
4、 Create tasks
By calling FreeRTOS The task creation function of creates a task , In task creation ,FreeRTOS It will automatically perform a series of operating system initialization , Such as initializing memory .
// Create task function prototype
BaseType_t xTaskCreate( TaskFunction_t pxTaskCode,
const char * const pcName,
const uint16_t usStackDepth,
void * const pvParameters,
UBaseType_t uxPriority,
TaskHandle_t * const pxCreatedTask )
5、 Start the task
When the task is created , We need to turn on the scheduler , Because creating is just adding tasks to the system , Not really scheduled yet , And idle tasks are not realized , The timer task has not been realized , All of these are starting the scheduling function vTaskStartScheduler() Implemented in .
Why idle tasks ? because FreeRTOS Once started , It is necessary to ensure that a task in the system is running at all times (Runing), And idle tasks cannot be suspended or deleted , Idle tasks have the lowest priority , So that other tasks in the system can preempt idle tasks at any time CPU Right to use .
These are all necessary things for the system , There is no need for users to implement ,FreeRTOS It's all done for us . After handling these necessary things , The system really starts up .
Reference resources
Wildfire FreeRTOS Actual combat of Kernel Implementation and application development
边栏推荐
- Market prospect analysis and Research Report of programmable digital temperature regulator in 2022
- A Security Analysis Of Browser Extensions
- Unity prefab scene 冲突合并工具 UnityYAMLMerge
- 关于重复发包的防护与绕过
- Source insight 4.0 setting shortcut keys for comments and uncomments
- Vulkan-官方示例解读-RayTracing
- Possible problems with password retrieval function (supplementary)
- Evil CSRF
- [dataset] | UAV Perspective
- Chinese classics for children
猜你喜欢

Large factory outsourcing or self research company? How to choose a job for a tester?

Build local source 2.0 for Galaxy Kirin server version

Kirin V10 installation of tongweb7.0

开源项目 英雄联盟 之WPF

Sslstrip Ultimate - location hijacking

写给通信年轻人的27个忠告

店铺门面转让出租小程序开发制作功能介绍

雷达辐射源调制信号仿真

Interface performance optimization ideas

如何提高回归测试效率
随机推荐
App live broadcast source code, platform login page and password modification page
Eth Of Erc20 And Erc721
7. list label
PHP正则用例
ESP8266_ RTOS modifies IP address and hostname in AP mode
Writing shell scripts using vscode
After the installation of Damon database is completed, query whether it is case sensitive
【CNN】|How much position information do convolutional neural networks encode?
Record a VMware problem
VNC remote configuration of Galaxy Kirin server system
A.前缀极差(C语言)
Market prospect analysis and Research Report of pipe and hose press fitting tools in 2022
域名解析耗时是什么?域名解析耗时影响因素有哪些?
Embedded basic interface-i2c
店铺门面转让出租小程序开发制作功能介绍
Market prospect analysis and Research Report of single photon counting detector in 2022
AI助力,释放法务势能!iTerms合同智审系统重磅发布
【CustomView】Glide+BitmapTransformation 图片上下边框波浪处理(WaveTransformation)
检测php网站是否已经被攻破的方法
Docker swarm installing MySQL Cluster