你的浏览器版本过低,可能导致网站不能正常访问!
为了你能正常使用网站功能,请使用这些浏览器。

【STM32F429心得\疑问】+最新FreeRtos(版本8.0)上手指南

[复制链接]
52mcu 发布时间:2014-4-21 21:16
【STM32F429心得\疑问】+最新FreeRtos(版本8.0)上手指南
最近折腾一块stm32f107rc的板子,摸索了一下FreeRTOS 的使用
发现起步不太难有点经验和大家分享。
1,先从官网http://www.freertos.org/下载 FreeRTOS 8.0.0 
2,用标准库(STM32F10x_StdPeriph_Lib_V3.5.0)模板建工程
3, 在工程中添加FreeRTOS 文件。tasks.c  list.c queue.c heap_2.c
   port.c  其中port.C是cotex M3的移植文件。选择目录..\..\Source\portable\RVDS\ARM_CM3\
   下的port.c
 
3,修改启动代码(.s文件)如下,主要是链接FreeRTOS的三个中断函数
 
                                IMPORT xPortPendSVHandler
                                IMPORT xPortSysTickHandler
                                IMPORT vPortSVCHandler
                                .....
                                DCD     vPortSVCHandler           ; SVCall Handler
        DCD     DebugMon_Handler          ; Debug Monitor Handler
        DCD     0                         ; Reserved
        DCD     xPortPendSVHandler        ; PendSV Handler
        DCD     xPortSysTickHandler       ; SysTick Handler                       
                               
4.在main中建立自己任务开始 rtos
 
  /* Create one task. */
    xTaskCreate(    vTask1,     /* Pointer to the function that implements the task. */
                    "Task 1",   /* Text name for the task.  This is to facilitate debugging only. */
                    200,        /* Stack depth in words. */
                    NULL,       /* We are not using the task parameter. */
                    1,          /* This task will run at priority 1. */
                    NULL );     /* We are not using the task handle. */
 
    /* Create one task. */
    xTaskCreate(    vTask2,     /* Pointer to the function that implements the task. */
                    "Task 2",   /* Text name for the task.  This is to facilitate debugging only. */
                    200,        /* Stack depth in words. */
                    NULL,       /* We are not using the task parameter. */
                    2,          /* This task will run at priority 1. */
                    NULL );     /* We are not using the task handle. */
 
    /* Start the scheduler so our tasks start executing. */
    vTaskStartScheduler();
..............
..............
 
void vTask1( void *pvParameters )
{
    /* As per most tasks, this task is implemented in an infinite loop. */
    while(1)
    {
        LED_Toggle(0);
                LED_Toggle(2);
        vTaskDelay(800);
    }
}
 
void vTask2( void *pvParameters )
{
    /* As per most tasks, this task is implemented in an infinite loop. */
    while(1)
    {
        LED_Toggle(1);
                LED_Toggle(3);
        vTaskDelay(1600);
    }
}
收藏 1 评论0 发布时间:2014-4-21 21:16

举报

0个回答
关于
我们是谁
投资者关系
意法半导体可持续发展举措
创新与技术
意法半导体官网
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
官方最新发布
STM32N6 AI生态系统
STM32MCU,MPU高性能GUI
ST ACEPACK电源模块
意法半导体生物传感器
STM32Cube扩展软件包
关注我们
st-img 微信公众号
st-img 手机版