1821 views|5 replies

1w

Posts

16

Resources
The OP
 

[Shanghai Hangxin ACM32F070 development board review] 6. Transplant the RTX operating system [Copy link]

 This post was last edited by ddllxxrr on 2022-11-3 12:58

Recently, a high-level company held a lecture on the UCOS operating system. I was furious when I heard it, because the porting of UCOS is too troublesome. I have said it before, do you dare to use it in your product after porting it? ? ?

I was reminded of KEIL’s RTX operating system, which does not require any porting, just a check mark.

This time I will move it to the Shanghai Hangxin ACM32F070 development board. Why not take a shortcut? Besides, RTX also has a file system and a GUI.

The first step is to check the box: find the green diamond in the MDK menu

Step 2: Write your own program

1. Use the last watchdog program to delete the dog first, and include the header file at the beginning of the MAIN function: #include "cmsis_os.h"

After including the header file, the definition is as follows:

void led_Thread1 (void const *argument);

osThreadDef(led_Thread1, osPriorityNormal, 1, 0);

osThreadId T_led_ID1;

And write the led_Thread1 function:


void led_Thread1 (void const *argument)
{
	while(1)
	{
	printfS("HELLO EEWORLD !!!"); 
	osDelay(500);
	}
}

Step 3:

Then compile, and it will prompt that the SYSTICK program definition is repeated.

Disable the SYSTICK function in System_ACM32F0x0.c and compile it again.

Operation results:

Full Program:

*
  ******************************************************************************
  * @File     main.c
  * @brief    main source File.
  ******************************************************************************
*/
#include "APP.h"
#include "cmsis_os.h"
#define UART_BAUD_RATE  115200

UART_HandleTypeDef UART2_Handle;
void led_Thread1 (void const *argument);

osThreadDef(led_Thread1, osPriorityNormal, 1, 0);

osThreadId T_led_ID1;
/************************************************************************
 * function   : Uart_Init
 * Description: Uart Initiation. 
 ************************************************************************/ 
void Uart_Init(void) 
{
    UART2_Handle.Instance        = UART2;    
    UART2_Handle.Init.BaudRate   = UART_BAUD_RATE; 
    UART2_Handle.Init.WordLength = UART_WORDLENGTH_8B;
    UART2_Handle.Init.StopBits   = UART_STOPBITS_1;
    UART2_Handle.Init.Parity     = UART_PARITY_NONE;
    UART2_Handle.Init.Mode       = UART_MODE_TX_RX_DEBUG;
    UART2_Handle.Init.HwFlowCtl  = UART_HWCONTROL_NONE;
    
    HAL_UART_Init(&UART2_Handle);  
    
    /* UART_DEBUG_ENABLE control printfS */     
    printfS("MCU is running, HCLK=%dHz, PCLK=%dHz\n", System_Get_SystemClock(), System_Get_APBClock());       
}
/*********************************************************************************
* Function    : main
* Description : 
* Input       : 
* Outpu       : 
* Author      : CWT                         Data : 2020年
**********************************************************************************/
int main(void)
{
	  osKernelInitialize ();                    // initialize CMSIS-RTOS
    System_Init();
    Uart_Init(); 
    
    //WDT_Reset_Test(); 
	
	  T_led_ID1 = osThreadCreate(osThread(led_Thread1), NULL);
	
	  osKernelStart ();                         // start thread execution 

}


void led_Thread1 (void const *argument)
{
	while(1)
	{
	printfS("HELLO EEWORLD !!!"); 
	osDelay(500);
	}
}

This post is from Domestic Chip Exchange

Latest reply

nmg
I don't quite understand. I remember that for Linux and other transplants, you also need to modify many header files and configurations. Do you find it complicated because there is no graphical interface for configuration?   Details Published on 2022-11-5 14:18
Personal signaturehttp://shop34182318.taobao.com/
https://shop436095304.taobao.com/?spm=a230r.7195193.1997079397.37.69fe60dfT705yr
 
 

6555

Posts

0

Resources
2
 

This ACM32F070 RTX OS porting method is great

This post is from Domestic Chip Exchange
 
 
 

5213

Posts

239

Resources
3
 

The transplantation of UCOS is too troublesome. Can you explain it in detail? I am curious.

This post is from Domestic Chip Exchange
Add and join groups EEWorld service account EEWorld subscription account Automotive development circle

Comments

UC/CPU porting package inserts 7 files: CPU_DEF.h, CPU_CORE.h, CPU_CORE.C, CPU_CFG.H, CPU_C.C and CPU_A.ASM UC/LIB package inserts 11 files: omitted UC/OS configuration file inserts 4 files: OS_CFG.h, OS_APP_HOOKS.H, OS_APP_HOOKS.C and OS_CFG_APP.H  Details Published on 2022-11-5 14:01
 
 
 

1w

Posts

16

Resources
4
 
nmg posted on 2022-11-4 11:58 The transplantation of UCOS is too troublesome. Can you explain it in detail? I'm curious

UC/CPU transplant file package inserts 7 files: CPU_DEF.h, CPU_CORE.h, CPU_CORE.C, CPU_CFG.H, CPU_C.C and CPU_A.ASM

UC/LIB file package inserts 11 files: omitted

UC/OS configuration file inserts 4 files: OS_CFG.h, OS_APP_HOOKS.H, OS_APP_HOOKS.C and OS_CFG_APP.H

The UC/CSP file includes 11 files:

slightly

UC/BSP files:

Includes 3 files:

This post is from Domestic Chip Exchange

Comments

nmg
I don't quite understand. I remember that for porting like Linux, you also need to modify a lot of header files and configurations. You feel it is complicated. Is it because there is no graphical interface for configuration?  Details Published on 2022-11-5 14:18
Personal signaturehttp://shop34182318.taobao.com/
https://shop436095304.taobao.com/?spm=a230r.7195193.1997079397.37.69fe60dfT705yr
 
 
 

5213

Posts

239

Resources
5
 
ddllxxrr posted on 2022-11-5 14:01 UC/CPU transplant file package inserts 7 files: CPU_DEF.h, CPU_CORE.h, CPU_CORE.C, CPU_CFG.H, CPU_C.C and CPU_A.ASM UC/LIB ...

I don't quite understand. I remember that for Linux and other transplants, you also need to modify many header files and configurations.

Do you find it complicated because there is no graphical interface for configuration?

This post is from Domestic Chip Exchange
Add and join groups EEWorld service account EEWorld subscription account Automotive development circle

Comments

Yes, UCOS does not have a graphical interface. Now I am very disgusted with Linux, which has a graphical interface. I feel that it is not as good as DOS.  Details Published on 2022-11-8 12:15
 
 
 

1w

Posts

16

Resources
6
 
nmg posted on 2022-11-5 14:18 I don't really understand. I remember that for porting like Linux, you also need to change a lot of header files and configurations. You feel it's complicated because there is no configured graphical interface...

Yes, UCOS does not have a graphical interface. Now I am very disgusted with Linux, which has a graphical interface. I feel that it is not as good as DOS.

This post is from Domestic Chip Exchange
Personal signaturehttp://shop34182318.taobao.com/
https://shop436095304.taobao.com/?spm=a230r.7195193.1997079397.37.69fe60dfT705yr
 
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list