Using Keil's own RTL under STM32

Publisher:Amy啊111111Latest update time:2015-11-16 Source: eefocusKeywords:STM32  Wedge  RTL Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
This is my first time using RTL and I don't really understand it. This is copied from another forum and I think it's good and can provide some ideas for beginners.

Keil ARTX (Advanced Real-Time eXecutive) is a small real-time operating system provided by Keil for the ARM series, integrated into its UV3 development environment. After downloading and installing the RealView MDK personal learning version, ARTX is also installed in the C:KeilARMRLRTX directory. There are STM32 example programs in the C:KeilARMBoardsKeilMCBSTM32STLIB_RTX_Blinky directory. After simple modification, it runs on the Wanli development board.
#include
#include
OS_TID t_phaseA; //Assign task ID number
OS_TID t_phaseB;
OS_TID t_phaseC;
OS_TID t_phaseD;

#define LED_A GPIO_Pin_4
#define LED_B GPIO_Pin_5
#define LED_C GPIO_Pin_6
#define LED_D GPIO_Pin_7
#define LED_On(led) GPIO_SetBits(GPIOC , led)
#define LED_Off(led) GPIO_ResetBits(GPIOC, led)

extern void SetupClock (void);
extern void SetupLED (void);


void phaseA (void) __task {
for (;;) {
LED_On (LED_A);
os_dly_wait (100);
LED_Off(LED_A);
os_dly_wait (100);
}
}

void phaseB (vo id) __task {
for (;;) {
LED_On (LED_B);
os_dly_wait (100);
LED_Off(LED_B);
os_dly_wait (100);
}
}

void phaseC (void) __task {
for (;;) {
LED_On (LED_C);
os_dly_wait (100);
LED_Off(LED_C);
os_dly_wait (1 00);
}
} void

phaseD (void) __task {
for (;;) {
LED_On (LED_D);
os_dly_wait (100);
LED_Off(LED_D);
os_dly_wait (100);
}
}

void init (void) __task {
t_phaseA = os_tsk_create (phaseA, 0);
os_dly_wait (50);
t_phaseB = os_tsk_create (phaseB, 0);
os_dly_wait (50);
t_phaseC = os_tsk_create (phaseC, 0);
os_dly_wait (50);
t_phaseD = os_tsk_create (phaseD, 0);
os_tsk_delete_self ();
}

int main (void) {
SetupClock();
SetupLED ();
os_sys_init (init);
}
After the initialization, os_sys_init (init) starts the initialization task. In the initialization task, 4 tasks are started one after another. After starting,

Delete the initialization task. These four tasks each control the switch of an LED.

============================================

Personal understanding:

 

int main(void)

{

         os_sys_init_user( TaskMain,               

                            50,

                            TaskSysInitStack,

                            SysInitTaskStakSize );

 

         while(1); 

}

Question 1: Why don't we call the os_sys_init_user() API after creating many small tasks in TaskMain? The reason is that after initializing TaskMain, it does not return, so it cannot execute the while statement below  .

Q2: TaskMain creates small tasks, and each small task has a while(1) infinite loop, which is the concept of multithreading. Except for while(1), all other functions are executed only once, including the variables in the main function and small tasks. Only while(1) runs with time slices and priorities, realizing multithreaded execution.

Keywords:STM32  Wedge  RTL Reference address:Using Keil's own RTL under STM32

Previous article:Understanding the tasks of RTL creation
Next article:STM32 SYSTICK

Recommended ReadingLatest update time:2024-11-16 21:27

Keil5.24 creates uCOSIII project to implement stm32 real-time operating system (environment configuration)
Since ARM Keil was upgraded to Keil5 series, Keil tools have greatly simplified the porting of operating systems and various library files. You can complete the transplantation work by just moving your fingers and checking some library files. 1: Assume that you have installed Keil 5.24 (earlier versions support fewer
[Microcontroller]
Keil5.24 creates uCOSIII project to implement stm32 real-time operating system (environment configuration)
STM32 study notes USART
USART Functional Overview The interface is connected to other devices via three pins (see Figure 248). Any USART bidirectional communication requires at least two pins: receive data input (RX) and transmit data output (TX). RX: Receive data serial input. Use oversampling technology to distinguish data from noise and
[Microcontroller]
How to convert the STM32 F101 series program to STM F103 and a compilation error occurs!
The following is the solution (experimental environment KEIL5 version number: 5.25) first step:  Take F103C8T6 small capacity as an example (MD represents medium capacity 64K or 128K), HD represents (large capacity 256K or 512K)   After the changes are made, compile it! If there are still many errors in the co
[Microcontroller]
How to convert the STM32 F101 series program to STM F103 and a compilation error occurs!
STM32 - Power consumption cannot be reduced after entering STOP mode
background: Recently, after debugging the board into STOP mode, I found that the current was at the mA level and the power consumption could not be reduced. Finally, I found that after the ADC was turned on, I forgot to turn it off, resulting in a current consumption of 1.45mA. content: After using the HAL_PWR_Enter
[Microcontroller]
STM32 - Power consumption cannot be reduced after entering STOP mode
stm32 learning five
Key input learning (key_polling): Objective: Through the input of the key, the LED light can be reversed.    To read the key input, it is necessary to write a key.c and key.h file. Here, the library function writing principle (imitating the library function writing method) is used to obtain the key action.  First,
[Microcontroller]
ST to showcase three products that enhance the human experience at MWC Shanghai 2024
MWC Shanghai 2024 is an unforgettable technology feast. This year, ST exhibited more than 30 innovative products, covering application solutions in 9 fields, and more than 50 industry experts were present to provide in-depth answers and exchanges for visitors . We will not only showcase the latest achievemen
[Embedded]
8 configurations of STM32 IO port (GPIO)
1    /` The STM32 input and output pins have the following 8 possible configurations: (4 inputs + 2 outputs + 2 multiplexed outputs) ① Floating input_IN_FLOATING ② With pull-up input_IPU    ③ With pull-down input_IPD                      ④ Analog input_AIN ⑤ Open drain output_OUT_OD          ⑥ Push
[Microcontroller]
Design and Implementation of 16-bit Microcontroller
With the development of information technology, the popularization of network communication, information security and information home appliances, embedded MCU is an indispensable component in all these information products. At present, some domestic scientific research institutions and semiconductor companies are c
[Embedded]
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号