移植FreeRTOS一定要修改startup_stm32f10x_hd.s的启动文件吗?

本文介绍在CortexM上使用FreeRTOS时,通过在FreeRTOSConfig.h中定义宏来映射FreeRTOS中断处理函数到CMSIS标准中断名称的方法,以解决因不同文件中的中断函数名称不一致导致的问题。

在Cortex M使用FreeRTOS时,建立工程项目,经常会应为start_xxx.s与port.c、portasm.s中的中断函数名不同困惑:是在start_xxx.s修改为:vPortSVCHandler/xPortPendSVHandler/xPortSysTickHandler?还是在port.c、portasm.s 修改为SVC_Handler/PendSV_Handler/SysTick_Handler?不管怎么样,都要修改文件,造成移植不便。

为了解决这个不便,可以在FreeRTOSConfig.h文件中增加下列几行:

/* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS
standard names. */

#define vPortSVCHandler SVC_Handler
#define xPortPendSVHandler PendSV_Handler
#define xPortSysTickHandler SysTick_Handler

即修改配置文件,可避免修改芯片厂商提供的库文件和FreeRTOS移植接口文件。

Rebuild started: Project: STM32+UCOS+LED *** Using Compiler 'V5.06 update 7 (build 960)', folder: 'D:\keil5\ARM\ARMCC\Bin' Rebuild target 'Target 1' assembling startup_stm32f10x_md.s... compiling misc.c... compiling stm32f10x_bkp.c... compiling core_cm3.c... compiling stm32f10x_can.c... compiling stm32f10x_cec.c... compiling main.c... .\BSP\led.h(64): warning: #1-D: last line of file ends without a newline #endif /* __LED_H */ User\main.c: 1 warning, 0 errors compiling stm32f10x_crc.c... compiling system_stm32f10x.c... compiling stm32f10x_it.c... compiling stm32f10x_adc.c... compiling stm32f10x_dac.c... compiling stm32f10x_dbgmcu.c... compiling stm32f10x_dma.c... compiling stm32f10x_exti.c... compiling stm32f10x_fsmc.c... compiling stm32f10x_flash.c... compiling stm32f10x_gpio.c... compiling stm32f10x_i2c.c... compiling stm32f10x_iwdg.c... compiling stm32f10x_pwr.c... compiling stm32f10x_rtc.c... compiling stm32f10x_rcc.c... compiling stm32f10x_sdio.c... compiling stm32f10x_spi.c... compiling BSP.c... BSP\BSP.c(11): warning: #223-D: function "SystemInit" declared implicitly SystemInit(); /* 扭謨系统时謸为72M */ BSP\BSP.c(12): warning: #223-D: function "SysTick_init" declared implicitly SysTick_init(); /* 鲁玫始禄炉虏垄使臏SysTick露篓时品 */ BSP\BSP.c(13): warning: #223-D: function "LED_GPIO_Config" declared implicitly LED_GPIO_Config(); /* LED 露丝诔玫始禄炉 */ BSP\BSP.c(22): error: #159: declaration is incompatible with previous "SysTick_init" (declared at line 12) void SysTick_init(void) BSP\BSP.c(24): warning: #223-D: function "SysTick_Config" declared implicitly SysTick_Config(SystemFrequency/OS_TICKS_PER_SEC);//鲁玫始禄炉虏垄使臏SysTick露篓时品 BSP\BSP.c(24): error: #20: identifier "SystemFrequency" is undefined SysTick_Config(SystemFrequency/OS_TICKS_PER_SEC);//鲁玫始禄炉虏垄使臏SysTick露篓时品 BSP\BSP.c(24): error: #20: identifier "OS_TICKS_PER_SEC" is undefined SysTick_Config(SystemFrequency/OS_TICKS_PER_SEC);//鲁玫始禄炉虏垄使臏SysTick露篓时品 BSP\BSP.c: 4 warnings, 3 errors compiling stm32f10x_usart.c... compiling stm32f10x_wwdg.c... compiling os_core.c... compiling stm32f10x_tim.c... compiling os_flag.c... compiling app.c... .\BSP\led.h(64): warning: #1-D: last line of file ends without a newline #endif /* __LED_H */ APP\app.c: 1 warning, 0 errors compiling led.c... BSP\led.h(64): warning: #1-D: last line of file ends without a newline #endif /* __LED_H */ BSP\led.c(91): warning: #1-D: last line of file ends without a newline /******************* (C) COPYRIGHT 2012 WildFire Team *****END OF FILE************/ BSP\led.c: 2 warnings, 0 errors compiling os_mbox.c... compiling os_mem.c... compiling os_mutex.c... compiling os_q.c... compiling os_sem.c... compiling os_task.c... compiling os_time.c... compiling os_tmr.c... assembling os_cpu_a.asm... compiling ucos_ii.c... compiling os_dbg.c... compiling os_cpu_c.c... compiling os_dbg_r.c... ".\STM32+UCOS+LED.axf" - 3 Error(s), 8 Warning(s). Target not created. Build Time Elapsed: 00:00:02
最新发布
11-23
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值