There are already many documents explaining how to migrate and set up projects. Here we will only explain the files that need to be modified and the reasons for the modifications.
3: os_cup_a.asm
Keywords:STM32
Reference address:STM32 learning record 13 ucosII transplantation
1: os_cpu.h
We need to modify this file:
1) void OS_CPU_PendSVHandler(void) needs to be replaced with void PendSV_Handler(void) Generally, when we develop software based on stm32 chips, we will use the startup files provided in the standard peripheral library CMSIS, such as startup_stm32f10x_hd.s. However, Micrium does not use ST's standard startup files, but writes them separately into two .s files, namely init.s and vectors.s
(Micrium\Software\EvalBoards\ST\STM3210B-EVAL\RVMDK) init.s is responsible for entering main(), and vectors.s sets the interrupt vector. Since the interrupt vector OS_CPU_PendSVHandler is set in vectors.s, and we use startup_stm32f10x_hd.s as the startup file, and in the startup_stm32f10x_hd.s file, the interrupt vector of PendSV is named PendSV_Handler, so just replace the OS_CPU_PendSVHandler of the corresponding file with PendSV_Handler, where the function declaration is in OS_CPU_C.h and the specific interrupt service function prototype is in OS_CPU_A.ASM, which will be modified later. In this way, the replaced PendSV_Handler function is declared in OS_CPU_C.h, and there is a specific interrupt service function code in OS_CPU_A.ASM, which corresponds to the vector address in startup_stm32f10x_hd.s.
2) Comment out the last three SysTick service functions
void OS_CPU_SysTickHandler(void);
void OS_CPU_SysTickInit(void);
INT32U OS_CPU_SysTickClkFreq(void);
Among them, the OS_CPU_SysTickHandler function has been defined in the ST standard library stm32f10x_it.c and is not needed here;
Among them, OS_CPU_SysTickInit is defined in os_cpu_c.c, depends on OS_CPU_SysTickClkFreq, is used to initialize the SysTick timer, and needs to be commented out; Among them, OS_CPU_SysTickClkFreq is defined in the BSP.c of the official EvalBoards, and the dependency needs to be removed. If necessary, we can implement it in bsp.c.
2: stm32f10x_it.c
Due to 1.2, it needs to be modified
SysTick is the "heartbeat" of the OS, which can be called a tick clock. It is essentially a timer, just like the PendSV interrupt. In startup_stm32f10x_hd.s, the interrupt vector of SysTick is named SysTick_Handler. Since the ST standard library already has related library functions, we only need to make the following changes:
Open the os_cpu_c.c file and find the content code of void OS_CPU_SysTickHandler(void)
OS_CPU_SR cpu_sr;
OS_ENTER_CRITICAL();
OSIntNesting++;
OS_EXIT_CRITICAL();
OSTimeTick();
OSIntExit();
Copy it to the SysTick_Handler (void) function in the stm32f10x_it.c file;
void SysTick_Handler(void)
{
OS_CPU_SR cpu_sr;
OS_ENTER_CRITICAL();
OSIntNesting++;
OS_EXIT_CRITICAL();
OSTimeTick();
OSIntExit();
}
And add in the file header: #include
Due to 1.1, the prototype of the OS_CPU_PendSVHandler interrupt service function is in this file. We need to replace it with PendSV_Handler to match the interrupt vector in startup_stm32f10x_hd.s.
1) Comment out EXPORT OS_CPU_PendSVHandler and change it to EXPORT PendSV_Handler,
2) Find the OS_CPU_PendSVHandler program prototype and rename it to PendSV_Handler
In this way, the PendSV_Handler interrupt service function is successfully established. At the same time, we need to comment out the relevant PendSV_Handler declarations and definitions in stm32f10x_it.h and stm32f10x_it.c to prevent conflicts.
4: os_cpu_c.c
Since 1.2, make the following changes:
1) Comment out the contents of the last two functions OS_CPU_SysTickHandler() and OS_CPU_SysTickInit();
2) Disable the following macro definitions because they involve the Systick service function commented in the previous step
#define OS_CPU_CM3_NVIC_ST_CTRL (*((volatile INT32U *)0xE000E010))
#define OS_CPU_CM3_NVIC_ST_RELOAD (*((volatile INT32U *)0xE000E014))
#define OS_CPU_CM3_NVIC_ST_CURRENT (*((volatile INT32U *)0xE000E018))
#define OS_CPU_CM3_NVIC_ST_CAL (*((volatile INT32U *)0xE000E01C))
#define OS_CPU_CM3_NVIC_ST_CTRL_COUNT 0x00010000
#define OS_CPU_CM3_NVIC_ST_CTRL_CLK_SRC 0x00000004
#define OS_CPU_CM3_NVIC_ST_CTRL_INTEN 0x00000002
#define OS_CPU_CM3_NVIC_ST_CTRL_ENABLE 0x00000001
5: os_cfg.h
This file is the header file for configuring the kernel. In this file, we can disable semaphores, mutexes, mailboxes, queues, semaphore sets, timers, memory management, and debug mode:
#define OS_FLAG_EN 0 //Disable semaphore set
#define OS_MBOX_EN 0 //Disable mailbox
#define OS_MEM_EN 0 //Disable memory management
#define OS_MUTEX_EN 0 //Disable mutex semaphore
#define OS_Q_EN 0 //Disable queue
#define OS_SEM_EN 0 //Disable semaphore
#define OS_TMR_EN 0 //Disable timer
#define OS_DEBUG_EN 0 //Disable debugging
You can also disable the application's hook functions and multiple event controls
#define OS_APP_HOOKS_EN 0
#define OS_EVENT_MULTI_EN 0
The modifications are mainly to remove some functions, reduce the kernel size, and facilitate compilation and debugging. When needed, the corresponding functions will be enabled.
Previous article:STM32 learning record 14 serial port interrupt in ucosii
Next article:STM32 learning record 12 interrupt vector table
- Popular Resources
- Popular amplifiers
Recommended Content
Latest Microcontroller Articles
- Naxin Micro and Xinxian jointly launched the NS800RT series of real-time control MCUs
- How to learn embedded systems based on ARM platform
- Summary of jffs2_scan_eraseblock issues
- Application of SPCOMM Control in Serial Communication of Delphi7.0
- Using TComm component to realize serial communication in Delphi environment
- Bar chart code for embedded development practices
- Embedded Development Learning (10)
- Embedded Development Learning (8)
- Embedded Development Learning (6)
He Limin Column
Microcontroller and Embedded Systems Bible
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
MoreSelected Circuit Diagrams
MorePopular Articles
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
MoreDaily News
- STMicroelectronics discloses its 2027-2028 financial model and path to achieve its 2030 goals
- 2024 China Automotive Charging and Battery Swapping Ecosystem Conference held in Taiyuan
- State-owned enterprises team up to invest in solid-state battery giant
- The evolution of electronic and electrical architecture is accelerating
- The first! National Automotive Chip Quality Inspection Center established
- BYD releases self-developed automotive chip using 4nm process, with a running score of up to 1.15 million
- GEODNET launches GEO-PULSE, a car GPS navigation device
- Should Chinese car companies develop their own high-computing chips?
- Infineon and Siemens combine embedded automotive software platform with microcontrollers to provide the necessary functions for next-generation SDVs
- Continental launches invisible biometric sensor display to monitor passengers' vital signs
Guess you like
- [Live broadcast tomorrow at 2:00 pm] Introduction to Intel FPGA programmable acceleration platform. If you are afraid of forgetting to watch, please join the WeChat group and wait.
- How to control a four-phase stepper motor with pwm?
- TMS320C6000 Basic Learning (2) - Architecture
- Correspondence between TL5728-IDK-A3 board and network port
- 【GD32E503 Review】Part 7: What is screen tearing? Let’s take a look!
- 【ESP32-Korvo Review】 04 Development Environment Construction
- 【10/30@Shanghai- System Integrator Meeting, Sign Up Now! 】IoT Strategic Cooperation Summit Forum-Building...
- How to remove the AD official logo from the PCB template
- PCB wiring question
- Requirements for using IAR ETM Trace debugging features