打印
[开发板]

【CW32L031CxTx StartKit评估板测评】移植freertos系统

[复制链接]
263|7
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
tlled|  楼主 | 2023-10-27 09:42 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
移植freertos系统到CW32L031CxTx StartKit评估板。
一、添加FreeRTOS系统

在之前创建的项目基础上,增加freertos系统。

1.1、添加系统源码


1.2、添加到工程文件


二、编译

添加源码后,编译项目,根据提示的错误,对文件进行修改,遇到的错误如下

2.1、文件重复定义


修改文件,屏蔽掉相关的函数






2.2、编译项目


编译完成,没有报错。

三、程序

编写测试程序

main.c
#include "main.h"
#include "led/led.h"
#include "key/key.h"
#include "usart/usart.h"

#include "FreeRTOS.h"
#include "task.h"

typedef enum {FAILED = 0, PASSED = !FAILED} TestStatus;

#define START_TASK_PRIO      1                  
#define START_STK_SIZE  64               
static TaskHandle_t            StartTask_Handler = NULL;

#define TASK1_PRIO      2                  
#define TASK1_STK_SIZE  64                 
static TaskHandle_t            Task1Task_Handler = NULL;  
           
#define TASK2_PRIO      3                  
#define TASK2_STK_SIZE  64                 
static TaskHandle_t            Task2Task_Handler = NULL;  

void start_task(void *pvParameters);
void task1(void *pvParameters);  
void task2(void *pvParameters);

void NVIC_Configuration(void);
void RCC_Configuration(void);

int main(void)
{
        RCC_Configuration();
  NVIC_Configuration();
        init_uart(115200);
        init_led();
        init_key();

        printf("cw32l031 board test! \r\n");
       
        xTaskCreate((TaskFunction_t )start_task,                  
                                                        (const char*    )"start_task",               
                                                        (uint16_t       )START_STK_SIZE,         
                                                        (void*          )NULL,                  
                                                        (UBaseType_t    )START_TASK_PRIO,            
                                                        (TaskHandle_t*  )&StartTask_Handler);           
        vTaskStartScheduler();
        return 0;
}


void start_task(void *pvParameters)
{
        taskENTER_CRITICAL();
        xTaskCreate((TaskFunction_t )task1,                  
                                                        (const char*    )"task1",               
                                                        (uint16_t       )TASK1_STK_SIZE,         
                                                        (void*          )NULL,                  
                                                        (UBaseType_t    )TASK1_PRIO,            
                                                        (TaskHandle_t*  )&Task1Task_Handler);
        xTaskCreate((TaskFunction_t )task2,                  
                                                        (const char*    )"task2",               
                                                        (uint16_t       )TASK2_STK_SIZE,        
                                                        (void*          )NULL,                  
                                                        (UBaseType_t    )TASK2_PRIO,            
                                                        (TaskHandle_t*  )&Task2Task_Handler);
                                                       
        vTaskDelete(StartTask_Handler);
        taskEXIT_CRITICAL();
}


//task1
void task1(void *pvParameters)
{
    while (1)
    {
        printf("cw32l031 task1 run ...\r\n");
        led1_tog();
        vTaskDelay(500);
    }
}

//task2
void task2(void *pvParameters)
{
    while (1)
    {       
                                led2_tog();
        printf("cw32l031 task2 run ...\r\n");
        vTaskDelay(100);
    }
}



四、程序运行

开发板运行后,串口输出

使用特权

评论回复
评论
forgot 2023-10-30 21:45 回复TA
赞 
沙发
foliages| | 2023-10-28 11:31 | 只看该作者
你的这个 是 基于那个型号 移植的 ?移植FreeRTOS ,好搞吗?

使用特权

评论回复
板凳
foliages| | 2023-10-28 11:51 | 只看该作者
我 的一个板子,是8K的ram,64K的flash.

可以的话,我也移植一下,玩玩

使用特权

评论回复
地板
tlled|  楼主 | 2023-10-30 08:25 | 只看该作者
foliages 发表于 2023-10-28 11:51
我 的一个板子,是8K的ram,64K的flash.

可以的话,我也移植一下,玩玩

ARM内核是可以的

使用特权

评论回复
5
foliages| | 2023-11-2 13:35 | 只看该作者
C:\Users\yuwell\Desktop\img
这个图片 怎么没有RTOS?

使用特权

评论回复
6
foliages| | 2023-11-2 13:40 | 只看该作者
你的第一个图片 中,RTOS 我的KEIL  里面怎么没有?
或者 我怎么做keil 中 才有?

使用特权

评论回复
7
foliages| | 2023-11-2 13:41 | 只看该作者
freertos_evr.c
port.c
stream_buffer.c

我使用的S FreeRTOS 9. 0  这几个文件 也 没有,

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

125

主题

689

帖子

6

粉丝