WXing 发表于 2010-5-23 14:40:22

uCOS在STM32移植笔记AN1018的一点疑惑?

在AN1018中写到:
    The ARM Cortex-M3 has a built-in timer which was designed specifically for RTOS use. The timer can be configured to run at just about any tick rate. The application’s BSP should set this timer to OS_TICKS_PER_SEC.
    我想问下这个过程是如何实现的,即用定时器如何实现OS_TICKS_PER_SEC为所设定的值,在AN1913中写到:
    BSP_Init() is called by the application code to initialize critical processor features (particularly the μC/OS-II tick interrupt) after multitasking has started (i.e., OS_Start() has been called). This function should be called before any other BSP functions are used. See Listing 5-1 for more details.
    即在BSP_Init中完成了定时器的初始化,来实现μC/OS-II tick interrupt,再看BSP_Init()函数,如下:
    void BSP_Init (void) {
                BSP_RCC_Init();
                BSP_ADC_Init();
                BSP_LED_Init();
                BSP_PB_Init();
                BSP_Joy_Init();
               }
    我想应该是在BSP_RCC_Init();中初始化定时器的,BSP_RCC_Init()代码如下:
   staticvoidBSP_RCC_Init (void)
{   
    CPU_INT32Urcc_to;                                          /* RCC registers timeout                                    */
      
                  
    RCC_DeInit();                                                /*Reset the RCC clock config to the default reset state   */

    RCC_HSEConfig(RCC_HSE_ON);                                 /*HSE Oscillator ON                                       */      
   
   
    rcc_to = BSP_RCC_TO_VAL;
   
    while ((rcc_to > 0) &&
         (RCC_WaitForHSEStartUp() != SUCCESS)) {               /* Wait until the oscilator is stable                     */
      rcc_to--;
    }
      
    FLASH_SetLatency(FLASH_Latency_2);
    FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);
   
    RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_9);         /* Fcpu = (PLL_src * PLL_MUL) = (8 Mhz / 1) * (9) = 72Mhz   */
    RCC_PLLCmd(ENABLE);

    rcc_to = BSP_RCC_TO_VAL;

    while ((rcc_to > 0) &&
         (RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET)) {
      rcc_to--;
    }

    RCC_HCLKConfig(RCC_SYSCLK_Div1);                           /* Set system clock dividers                              */                           
    RCC_PCLK2Config(RCC_HCLK_Div1);   
    RCC_PCLK1Config(RCC_HCLK_Div2);   
    RCC_ADCCLKConfig(RCC_PCLK2_Div6);

    FLASH_SetLatency(FLASH_Latency_2);                           /* Embedded Flash Configuration                           */
    FLASH_HalfCycleAccessCmd(FLASH_HalfCycleAccess_Disable);
    FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);

    RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);

}
    不知道是怎么用那个built-in timer来实现μC/OS-II tick interrupt的,请大虾指教,谢谢。

WXing 发表于 2010-5-23 14:45:09

不好意思,点错板块了,麻烦版主将其移植STM32板块中,谢了。

biansf2001 发表于 2010-5-23 15:50:54

就是那个systick啊,把systick配置放到ucos调用的地方就行了。用官方移植好的,只需要改动启动文件的中断入口名称。

WXing 发表于 2010-5-23 17:02:26

谢谢。
官方的那个移植好的uCOSII-ST-STM32F103ZE-SK,乱七八糟的东西很多,高手指教下如何利用官方那个来建立自己的工程,我想用官方的那个,应该只需要Ports和Source文件夹就可以了,不知是否?3Q

110600735 发表于 2010-5-23 22:20:54

回复【3楼】WXing
能不能把你之前做的FPGA控制595 LED点阵的程序借我参考一下?谢谢啦,我只会做静态的,动态弄不出来,我的邮箱:421529991@qq.com
谢谢啦

WXing 发表于 2010-5-24 09:03:55

我也没弄好呢,所以才发帖问的,记得有下面这个帖子,可以参考下
http://www.ourdev.cn/bbs/bbs_content.jsp?bbs_sn=3688810&bbs_page_no=1&search_mode=4&search_text=WXing&bbs_id=9999
继续顶上,高手指教下。

BlueDream1701 发表于 2010-10-26 13:32:21

STM32 中的内置定时器就是 Systick,官方移植的代码有问题。
页: [1]
查看完整版本: uCOS在STM32移植笔记AN1018的一点疑惑?