【iCore4 双核心板_ARM】例程三十五:HTTP_IAP_ARM实验——更新升级STM32

实验现象:

核心代码:

int main(void)
{    
    led.initialize();                                                       //LED³õʼ»¯
    key.initialize();
    
    if(ARM_KEY_STATE == KEY_UP){                                                                                  //°´¼üËÉ¿ª×´Ì¬Ö±½ÓÌøÏòÓ¦ÓóÌÐò
        goto start;
    } 
    
    system_clock.initialize();                                                                                        //ϵͳʱÖÓ³õʼ»¯    
  delay.initialize(216);                                                      //ÑÓʱ³õʼ»¯
    adc.initialize();                                                                                                            //AD³õʼ»¯
    my_malloc.initialize(SRAMIN);                                         //¶¯Ì¬ÄÚ´æ³õʼ»¯
    usart6.initialize(115200);                                                                                        //´®¿Ú²¨ÌØÉèÖÃ
    
    OSInit();                                                                       //UCOS³õʼ»¯
    
    while(lwip.initialize())                                                 //lwip³õʼ»¯
    {
     LED_RED_ON;
         usart6.printf("\r\nETH initialize error!\r\n\r\n");                                //ETH³õʼ»¯Ê§°Ü
    }
    
  web.initialize();                                                     //WEB³õʼ»¯

    OSTaskCreate(start_task,(void*)0,(OS_STK*)&START_TASK_STK[START_STK_SIZE-1],START_TASK_PRIO);
    OSStart(); //¿ªÆôUCOS    

start:
        
    //²âÊÔÓû§´úÂëÊÇ·ñ´ÓUSER_FLASH_FIRST_PAGE_ADDRESS±»±à³Ì
    if (((*(__IO uint32_t*)USER_FLASH_FIRST_PAGE_ADDRESS) & 0x2FFE0000 ) == 0x20000000)
    {
      /* Jump to user application */
      JumpAddress = *(__IO uint32_t*) (USER_FLASH_FIRST_PAGE_ADDRESS + 4);
      Jump_To_Application = (pFunction) JumpAddress;
      /* Initialize user application's Stack Pointer */
      __set_MSP(*(__IO uint32_t*) USER_FLASH_FIRST_PAGE_ADDRESS);
      Jump_To_Application();
      /* do nothing */
      while(1);    
            
        }else{
            //À¶ÂÌLEDµÆÑ­»·µãÁÁ
            while(1){
                
                LED_GREEN_ON;
                LED_BLUE_OFF;
        delay.ms(500);
                
                LED_GREEN_OFF;
                LED_BLUE_ON;
        delay.ms(500);
                
            }    
        }    

}

源代码下载链接:

链接: https://pan.baidu.com/s/1o7WBvVO 密码: dcsm

iCore4链接:

posted @ 2017-09-30 10:36  XiaomaGee  阅读(594)  评论(0编辑  收藏  举报