Problems encountered in transplanting ucosii B OSStartHang

Publisher:快乐奇迹Latest update time:2015-09-21 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
ucosii can run normally on STM32rbt6. For work needs, I ported ucosii to STM32F103C8T6 and changed the startup code. As a result, the program died when it started scheduling.

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

Reference address:Problems encountered in transplanting ucosii B OSStartHang

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

Morse Microelectronics receives $140 million in Series B funding to accelerate IoT connectivity and transform the future of digital technology
Morse Microelectronics receives $140 million in Series B funding to accelerate IoT connectivity and transform the future of digital technology Strategic partnership with Megachips accompanying investment will usher in a new era of Wi-Fi HaLow technology September 7, 2022 - Sydney, Australia - Morse Microelectronic
[Internet of Things]
BMW B48 headlight dimmer switch link principle design circuit
Other people buy cars to drive, but we buy cars to dismantle. Recently, we learned some methods to dismantle the headlight assembly of a car, so we also took out the BMW 5 Series B48 of our colleague to study it. After research by engineers from Su Rui De, on the latest BMW B48, LIN is installed in the vehicle with
[Embedded]
BMW B48 headlight dimmer switch link principle design circuit
DS18B20 temperature measurement alarm system controlled by 51 single chip microcomputer
Required functions and effects The measurement range of the single-chip DS18B20 temperature measurement system is 0-99.9 degrees Celsius. The upper limit alarm temperature and the lower limit alarm temperature can be set (that is, the buzzer alarms when it is higher than the upper limit value or lower than the lower l
[Microcontroller]
DS18B20 temperature measurement alarm system controlled by 51 single chip microcomputer
Design of high-speed data acquisition system for B-mode ultrasonic radio frequency signals
Preface Medical ultrasound imaging uses the difference in acoustic characteristics reflected by ultrasound waves passing through various tissues of the human body to distinguish different tissues, and displays the interface of organs and the fine structure inside tissues in the form of images. This examinatio
[Test Measurement]
Design of high-speed data acquisition system for B-mode ultrasonic radio frequency signals
UC3842B electric vehicle charger circuit diagram
UC3842B electric vehicle charger circuit diagram
[Power Management]
UC3842B electric vehicle charger circuit diagram
Blue Bridge Cup STC15 MCU Review——DS18B20
Preface Temperature detection is also a common test point in the Blue Bridge Cup. Sometimes it is necessary to display one or two decimal places, and sometimes only the integer place is needed (usually there are too many things to display and the decimal place cannot be placed). Since the official directly shows the u
[Microcontroller]
Blue Bridge Cup STC15 MCU Review——DS18B20
Combination of A2B and C2B technologies with smart cars
The development of smart cars is in full swing. On the one hand, car manufacturers are adding advanced, feature-rich driving and infotainment experiences to cars. At the same time, in order to meet environmental, safety and cost challenges, car manufacturers have to actively do "subtraction" - reduce car weight, compl
[Automotive Electronics]
Combination of A2B and C2B technologies with smart cars
Design of LCD controller built into S3C44B0X microprocessor
introduction The S3C44B0X microprocessor is a cost-effective and high-performance microcontroller solution provided by Samsung for handheld devices and general applications. It uses the ARM7TDMI core, operates at 66MHz, and integrates peripheral devices such as LCD controllers. Its LCD controller is v
[Microcontroller]
Design of LCD controller built into S3C44B0X microprocessor
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号