打印
[CC3200]

CC32xx FreeRTOS 移植

[复制链接]
901|16
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
FreeRTOS 是开源实时操作系统。它的实现只有一组简约的功能:基本任务处理和内存管
理,并且没有提供网络通信,外部的硬件驱动程序,或访问文件系统。 但是,它包括以下特点:
 抢占任务;
 占用空间小;
 用 C 编写的,并且用不同的 C 编译器编译;
 无限数量的任务可以同时运行;
 实现队列、二进制和计数信号量,互斥;
 互联网通信任务是使用队列来完成的。  

使用特权

评论回复
评论
dirtwillfly 2019-7-31 21:53 回复TA
感谢分享 

相关帖子

沙发
dingbo95|  楼主 | 2019-7-31 21:27 | 只看该作者
应用说明
这个应用程序的目的是展示 FreeRTOS 特性, 例如多任务创建,使用队列来完成互联网通
信任务, 本例程创建两个任务和一个队列,一个任务发送一个常量信息到队列中,另一个任
务从队列中接收相同的信息,收到信息后,通过 UART 显示信息。

使用特权

评论回复
板凳
dingbo95|  楼主 | 2019-7-31 21:27 | 只看该作者
应用说明
这个应用程序的目的是展示 FreeRTOS 特性, 例如多任务创建,使用队列来完成互联网通
信任务, 本例程创建两个任务和一个队列,一个任务发送一个常量信息到队列中,另一个任
务从队列中接收相同的信息,收到信息后,通过 UART 显示信息。

使用特权

评论回复
地板
dingbo95|  楼主 | 2019-7-31 21:28 | 只看该作者
设置一个串行通信程序(超级终端/ TeraTerm)。终端设置如下:

使用特权

评论回复
5
dingbo95|  楼主 | 2019-7-31 21:29 | 只看该作者
运行参考程序(Flashing the bin/IAR/CCS)。 在终端上观察第二个任务的状态信息。运行结果如下图所示:

使用特权

评论回复
6
dingbo95|  楼主 | 2019-7-31 21:29 | 只看该作者
#ifndef USE_TIRTOS
/* in case of TI-RTOS don't include startup_*.c in app project */
#if defined(gcc) || defined(ccs)
extern void (* const g_pfnVectors[])(void);
#endif
#if defined(ewarm)
extern uVectorEntry __vector_table;
#endif
#endif

使用特权

评论回复
7
dingbo95|  楼主 | 2019-7-31 21:30 | 只看该作者
static void vTestTask1( void *pvParameters );
static void vTestTask2( void *pvParameters );
static void BoardInit();

使用特权

评论回复
8
dingbo95|  楼主 | 2019-7-31 21:30 | 只看该作者
void
vAssertCalled( const char *pcFile, unsigned long ulLine )
{
    //Handle Assert here
    while(1)
    {
    }
}

使用特权

评论回复
9
dingbo95|  楼主 | 2019-7-31 21:30 | 只看该作者
void
vApplicationIdleHook( void)
{
    //Handle Idle Hook for Profiling, Power Management etc
}

使用特权

评论回复
10
dingbo95|  楼主 | 2019-7-31 21:31 | 只看该作者
void vApplicationMallocFailedHook()
{
    //Handle Memory Allocation Errors
    while(1)
    {
    }
}

使用特权

评论回复
11
dingbo95|  楼主 | 2019-7-31 21:31 | 只看该作者
void vApplicationStackOverflowHook( OsiTaskHandle *pxTask,
                                   signed char *pcTaskName)
{
    //Handle FreeRTOS Stack Overflow
    while(1)
    {
    }
}

使用特权

评论回复
12
dingbo95|  楼主 | 2019-7-31 21:31 | 只看该作者
void vTestTask1( void *pvParameters )
{
        char pcMessage[MAX_MSG_LENGTH];
    for( ;; )
    {
            /* Wait for a message to arrive. */
            osi_MsgQRead(&MsgQ, pcMessage, OSI_WAIT_FOREVER);

                UART_PRINT("message = ");
                UART_PRINT(pcMessage);
                UART_PRINT("\n\r");
                osi_Sleep(200);
    }
}

使用特权

评论回复
13
dingbo95|  楼主 | 2019-7-31 21:32 | 只看该作者
void vTestTask2( void *pvParameters )
{
   unsigned long ul_2;
   const char *pcInterruptMessage[4] = {"Welcome","to","CC32xx"
           ,"development !\n"};

   ul_2 =0;

   for( ;; )
     {
       /* Queue a message for the print task to display on the UART CONSOLE. */
           osi_MsgQWrite(&MsgQ, (void*) pcInterruptMessage[ul_2 % 4], OSI_NO_WAIT);
           ul_2++;
           osi_Sleep(200);
     }
}

使用特权

评论回复
14
dingbo95|  楼主 | 2019-7-31 21:33 | 只看该作者
static void
DisplayBanner(char * AppName)
{

    Report("\n\n\n\r");
    Report("\t\t *************************************************\n\r");
    Report("\t\t    CC3200 %s Application       \n\r", AppName);
    Report("\t\t *************************************************\n\r");
    Report("\n\n\n\r");
}

使用特权

评论回复
15
dingbo95|  楼主 | 2019-7-31 21:33 | 只看该作者
static void
BoardInit(void)
{
/* In case of TI-RTOS vector table is initialize by OS itself */
#ifndef USE_TIRTOS
  //
  // Set vector table base
  //
#if defined(ccs) || defined(gcc)
    MAP_IntVTableBaseSet((unsigned long)&g_pfnVectors[0]);
#endif
#if defined(ewarm)
    MAP_IntVTableBaseSet((unsigned long)&__vector_table);
#endif
#endif
  //
  // Enable Processor
  //
  MAP_IntMasterEnable();
  MAP_IntEnable(FAULT_SYSTICK);

  PRCMCC3200MCUInit();
}

使用特权

评论回复
16
dingbo95|  楼主 | 2019-7-31 21:34 | 只看该作者
int main( void )
{
    //
    // Initialize the board
    //
    BoardInit();

    PinMuxConfig();

    //
    // Initializing the terminal
    //
    InitTerm();

    //
    // Clearing the terminal
    //
    ClearTerm();

    //
    // Diasplay Banner
    //
    DisplayBanner(APP_NAME);

    //
    // Creating a queue for 10 elements.
    //
    OsiReturnVal_e osi_retVal;
    osi_retVal = osi_MsgQCreate(&MsgQ, "MSGQ", MAX_MSG_LENGTH, 10);
    if(osi_retVal != OSI_OK)
    {
            // Queue was not created and must not be used.
            while(1);
    }

    //
    // Create the Queue Receive task
    //
    osi_TaskCreate( vTestTask1, "TASK1",\
                                                            OSI_STACK_SIZE, NULL, 1, NULL );

    //
    // Create the Queue Send task
    //
    osi_TaskCreate( vTestTask2, "TASK2",\
                                                            OSI_STACK_SIZE,NULL, 1, NULL );

    //
    // Start the task scheduler
    //
    osi_start();

    return 0;
}

使用特权

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

本版积分规则

52

主题

1197

帖子

5

粉丝