實驗現象:
核心程式碼:
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連結: