Chinaunix首页 | 论坛 | 博客
  • 博客访问: 72291
  • 博文数量: 14
  • 博客积分: 1410
  • 博客等级: 上尉
  • 技术积分: 165
  • 用 户 组: 普通用户
  • 注册时间: 2008-05-06 23:59
文章分类

全部博文(14)

文章存档

2009年(14)

我的朋友

分类:

2009-05-19 10:14:18

本次移植的目标板是:easyARM2104. 用ADS1.2作为调试平台。
移植前,看了一下官方的一些参考治疗,我摘抄了一些:

1、configuration the Time tick interrupt. configuration in a function called prvSetupTimerInterrupt(), which located in Port.c

2. set the direction of the stack grown.

First, read the "How FreeRTOS works" section - a link to which can be found on the left menu frame - then ...

 

  1. Create a path to your new port under Source/portable. To be consistent, this should take the form ofSource/portable/[compiler_name]/[architecture].
  2. Create a new file called port.c and place it in the new directory.
  3. Source/include/portable.h contains prototypes for all the C functions your new port.c file must implement. Each existing port contains a port.c file that can be used as an example. I generally place the code to setup the RTOS tick ISR within sPortStartScheduler().
  4. Copy Source/portable/GCC/ATMega323/portmacro.h into the new directory - it is easier to start with an existing file than to create it from scratch. Examine the portmacro.h file and edit where necessary - in particular the portENTER_CRITICAL(), portEXIT_CRITICAL(), portENABLE_INTERRUPTS() and portDISABLE_INTERRUPT() definitions will require some consideration.
  5. Edit Source/include/portable.h so your new portmacro.h file gets included when the new port gets built. You will see how this is done for the existing ports.
  6. Use the RTOS tasks defined in the demo application files to test your new port - as easy as that ...

这次的移植过程还是很顺利的,因为FreeRTOS源码里面带有很多的demo,我们可以参考相关的demo进行一定的修改就可以了。很快,板上的LED就开始闪烁了。

要移植的函数有:
1、port.c
  • portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
  • portBASE_TYPE xPortStartScheduler( void )
  • void vPortEndScheduler( void )
  • static void prvSetupTimerInterrupt( void )
  • void vPortEnterCritical( void )
  • void vPortExitCritical( void )
  • void vTickISR( void )

2、port.s
  • void vPortISRStartFirstTask( void )
  • void vPortYieldProcessor( void )
  • void portDISABLE_INTERRUPTS( void )
  • void portENABLE_INTERRUPTS( void )
  • portRESTORE_CONTEXT()
  • portSAVE_CONTEXT() 

3、portMACRO.h
  • portEXIT_SWITCHING_ISR
  • #define portYIELD_FROM_ISR() vTaskSwitchContext()
    #define portYIELD() __asm ( "SWI" )


本次移植,基本上都是修改别人的代码,自己编写的不是很多,就不贴代码了。如果有需要的,给我发邮件:chengzi31#gmail.com
阅读(2377) | 评论(0) | 转发(0) |
0

上一篇:FreeRTOS学习笔记

下一篇:LCD Drive学习笔记

给主人留下些什么吧!~~