大家好
我最近在研究CC3200 OTA升级问题,我按照APPENDIX的过程做了,同时,修改了COMMON.h文件的路由器设置
然后我又在DROPBOX里面建立了文档,生成了“f80_sys_mcuimgA.bin”文件。
可是我不知道在附录提到的/sys/mcuimg1.bin 中的URL的“1st OTA Image” 是什么意思?这个IMAGE文件是在哪里可以找到呢?
然后我用TERA TERM出来的图片总是显示UPDATE ERROR RETRYING
请问下改如何解决这个问题?
谢谢了
Yameng Sun:
/sys/mcuimg1.bin 应该就是example/ota_update 工程生成的.bin文件吧?
请问一下你是怎么在dropbox里建立文档的?我按照说明做,DropBox网站都登不上怎么办
SZ1:
回复 Yameng Sun:
Yameng,
您好!
TI 目前OTA只有基于dropbox的demo,需要通过VPN登录。 如果不行的话,建议直接上自己的服务器,把dropbox那一段替换成自己的协议。谢谢!
GUIFANG WU:
回复 SZ1:
Edits_for_OTA.zip 这个下载链接还有?在OTA NOTE.pdf里面提及的。
Terry Han:
回复 GUIFANG WU:
(Edits_for_OTA.zip )file 中PDF的代码如下,
Include Section (To be added after osi.h)Global/Define Section12#include "flc_api.h"#include "ota_api.h"#define OTA_SERVER_NAME "api.dropbox.com"#define OTA_SERVER_IP_ADDRESS 0x00000000#define OTA_SERVER_SECURED 1#define OTA_SERVER_REST_UPDATE_CHK "/1/metadata/auto/" // returns files/folder list#define OTA_SERVER_REST_RSRC_METADATA "/1/media/auto" // returns A url that serves the media directly#define OTA_SERVER_REST_HDR "Authorization: Bearer "#define OTA_SERVER_REST_HDR_VAL "<access_token>"#define LOG_SERVER_NAME "api‐content.dropbox.com"#define OTA_SERVER_REST_FILES_PUT "/1/files_put/auto/"#define OTA_VENDOR_STRING "VId_PId_VerId"static OtaOptServerInfo_t g_otaOptServerInfo;? ?Function PrototypesLocal Variables (To be added to GetWeatherTask() FunctionOTA Initialization (To be added to GetWeatherTask() function after GPIO_IF_LedOn(MCU_GREEN_LED_GPIO) functioncall)OTA main construct/logic (To be added to GetWeatherTask() function after lRetVal =Network_IF_GetHostIP((char*)g_ServerAddress, &ulDestinationIP);)1213static OtaOptServerInfo_t g_otaOptServerInfo;static void *pvOtaApp;12int OTAServerInfoSet(void **pvOtaApp, char *vendorStr);static void RebootMCU();1234long OptionLen;unsigned char OptionVal;int SetCommitInt;unsigned char ucVendorStr[20];12345678//// Initialize OTA//pvOtaApp = sl_extLib_OtaInit(RUN_MODE_NONE_OS | RUN_MODE_BLOCKING,0);strcpy((char *)ucVendorStr, OTA_VENDOR_STRING);OTAServerInfoSet(&pvOtaApp, (char *)ucVendorStr);//// Check if this image is booted in test mode//sl_extLib_OtaGet(pvOtaApp, EXTLIB_OTA_GET_OPT_IS_PENDING_COMMIT, &OptionLen, (_u8 *)&OptionVal);UART_PRINT("EXTLIB_OTA_GET_OPT_IS_PENDING_COMMIT? %d \n\r", OptionVal);if (OptionVal == true) {UART_PRINT("OTA: PENDING COMMIT & WLAN OK ==> PERFORM COMMIT \n\r");SetCommitInt = OTA_ACTION_IMAGE_COMMITED;sl_extLib_OtaSet(pvOtaApp, EXTLIB_OTA_SET_OPT_IMAGE_COMMIT, sizeof(int), (_u8 *)&SetCommitInt);}else {UART_PRINT("Starting OTA\n\r");lRetVal = 0;while (!lRetVal) {lRetVal = sl_extLib_OtaRun(pvOtaApp);} UART_PRINT("OTA run = %d\n\r", lRetVal);if (lRetVal < 0) {UART_PRINT("OTA: Error with OTA server\n\r");} else if (lRetVal == RUN_STAT_NO_UPDATES) {? ? ? ?Banner Display (Replace “DisplayBanner(APP_NAME);” with the new code)New Functions (Added at the end of “main.c”)else if (lRetVal == RUN_STAT_NO_UPDATES) {UART_PRINT("OTA: RUN_STAT_NO_UPDATES\n\r");}else if (lRetVal && RUN_STAT_DOWNLOAD_DONE) {// Set OTA File for testinglRetVal = sl_extLib_OtaSet(pvOtaApp, EXTLIB_OTA_SET_OPT_IMAGE_TEST, sizeof(int), (_u8 *)&SetCommitInt);UART_PRINT("OTA: NEW IMAGE DOWNLOAD COMPLETE\n\r");UART_PRINT("Rebooting…\n\r");RebootMCU();}}1 DisplayBanner(OTA_VENDOR_STRING);//! Sets the OTA server info and vendor ID//!//! \param pvOtaApp pointer to OtaApp handler//! \param ucVendorStr vendor string//! \param pfnOTACallBack is pointer to callback function//!//! This function sets the OTA server info and vendor ID.//!//! \return None.////****************************************************************************int OTAServerInfoSet(void **pvOtaApp, char *vendorStr){unsigned char macAddressLen = SL_MAC_ADDR_LEN;//// Set OTA server info//g_otaOptServerInfo.ip_address = OTA_SERVER_IP_ADDRESS;g_otaOptServerInfo.secured_connection = OTA_SERVER_SECURED;strcpy((char *)g_otaOptServerInfo.server_domain, OTA_SERVER_NAME);strcpy((char *)g_otaOptServerInfo.rest_update_chk, OTA_SERVER_REST_UPDATE_CHK);strcpy((char *)g_otaOptServerInfo.rest_rsrc_metadata, OTA_SERVER_REST_RSRC_METADATA);strcpy((char *)g_otaOptServerInfo.rest_hdr, OTA_SERVER_REST_HDR);strcpy((char *)g_otaOptServerInfo.rest_hdr_val, OTA_SERVER_REST_HDR_VAL);strcpy((char *)g_otaOptServerInfo.log_server_name, LOG_SERVER_NAME);strcpy((char *)g_otaOptServerInfo.rest_files_put, OTA_SERVER_REST_FILES_PUT);sl_NetCfgGet(SL_MAC_ADDRESS_GET, NULL, &macAddressLen, (_u8 *)g_otaOptServerInfo.log_mac_address);//// Set OTA server Info//sl_extLib_OtaSet(*pvOtaApp, EXTLIB_OTA_SET_OPT_SERVER_INFO,sizeof(g_otaOptServerInfo), (_u8 *)&g_otaOptServerInfo);//// Set vendor ID.//sl_extLib_OtaSet(*pvOtaApp, EXTLIB_OTA_SET_OPT_VENDOR_ID, strlen(vendorStr),(_u8 *)vendorStr);//// Return ok status//return RUN_STAT_OK;} //****************************************************************************////! Reboot the MCU by requesting hibernate for a short duration//!//! \return None////****************************************************************************static void RebootMCU(){//// Configure hibernate RTC wakeup//PRCMHibernateWakeupSourceEnable(PRCM_HIB_SLOW_CLK_CTR);//// Delay loop//MAP_UtilsDelay(8000000);//// Set wake up time//PRCMHibernateIntervalSet(330);//// Request hibernate//PRCMHibernateEnter();//// Control should never reach here//while(1){ }}
GUIFANG WU:
回复 Terry Han:
谢谢提供的资料。