Then OSStart(); After entering
void OSStart (void)
{
if (OSRunning == OS_FALSE) {
OS_SchedNew();
OSPrioCur = OSPrioHighRdy;
OSTCBHighRdy = OSTCBPrioTbl[OSPrioHighRdy];
OSTCBCur = OSTCBHighRdy;
OSStartHighRdy();
} } Stop at the black bold, and find the position of
OSStartHang
B OSStartHang
in the assembly code .asm through debugging .
After searching online, some netizens provided answers
about the solution of STM32F107VC _OSStartHang
Problem: After transplanting UCOS-II, the program is always at
B OSStartHang, //According to the prompt, it should never reach this step.
In fact, it is very simple, because the abnormal interrupt PendSV_Handler of STM32 itself replaces the abnormal interrupt OSPendSV of UCOS, making it unable to execute normally. So we need to change
PendSV_Handler is changed to OSPendSV to make the interrupt work properly.
The first type
Change startup_stm32f10x_cl.s (V3.5. version)
1. DCD PendSV_Handler; PendSV Handler
is changed to:
DCD OSPendSV; OSPendSV interrupt
2. PendSV_Handler PROC
EXPORT PendSV_Handler [WEAK]
B.
ENDP
is changed to:
OSPendSV PROC
EXPORT OSPendSV [WEAK]
B.
ENDP
The second type: —The interrupt vector table (entry address of the interrupt function) is defined in startup_stm32f10x_cl.s
—C language code of the interrupt service function in stm32f10x_it.c.
There are two sections of code in startup_stm32f10x_cl.s as follows:
DCD PendSV_Handler
DCD SysTick_Handler
The service functions in stm32f10x_it.c are as follows
void PendSV_Handler(void)
void SysTick_Handler(void)
1: The ucos system interrupt function is renamed PendSV_Handler, and the void PendSV_Handler(void) function in the stm32f10x_it.c file is commented out.
2: Add the following code to the void SysTick_Handler(void) function:
void SysTick_Handler(void)
{
OS_CPU_SR cpu_sr;
OS_ENTER_CRITICAL(); // Tell uC/OS-II that we are starting an ISR
OSIntNesting++;
OS_EXIT_CRITICAL();
OSTimeTick(); // Call uC/OS-II's OSTimeTick()
OSIntExit(); // Tell uC/OS-II that we are leaving the ISR
}
===
...
The one IAR5.4.
Refer to the above operation, it is already working, there are some differences. Use the startup_stm32f10x_cl.s V3.1.2 version.
DCD OSPendSV ; PendSV Handler
PUBWEAK OSPendSV
SECTION .text:CODE:REORDER(1)
OSPendSV
B OSPendSV
Previous article:About the problem of No Cortex-M Device found when using jlink to download the program
Next article:UCOSII enters OS_TaskIdle during runtime
Recommended ReadingLatest update time:2024-11-16 21:35
- Popular Resources
- Popular amplifiers
- Microgrid Stability Analysis and Control Microgrid Modeling Stability Analysis and Control to Improve Power Distribution and Power Flow Control (
- Signal and System Experiment Tutorial (Edited by Jin Bo)
- Effective Unit Testing (Lasse Koskela)
- Intelligent computing systems (Chen Yunji, Li Ling, Li Wei, Guo Qi, Du Zidong)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Award-winning live broadcast: In-depth analysis of TI's latest C2000 real-time controller to solve the pain points of multi-MCU real-time power supply projects
- Use of 2.4G wireless communication module NRF24L01 on Cortex M
- Last day! Answer the questions and you will have a chance to win a 50-yuan Jingdong card! A powerful tool to simplify complex sensor systems
- How to select low-power MCU
- MSP430F5529 clock multiplier setting is effective
- Musk asked engineers to write the code silently: tear it up after review and recreate it on the computer
- DIY an eco-bottle
- How many layers does TCP/IP have? What is the function of each layer?
- MSP430 Flash information area
- 【Silicon Labs Development Kit Review 04】_Simplicity Studio v5 printf redirection