TI工程师,你好:
就是我看那个文档里面有提及一个OTA的修改的压缩包,但是我网站搜索了一下,却没有看到相关的内容?
可不可以给我发送一个下载链接,我下载一下
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
TI工程师,你好:
就是我看那个文档里面有提及一个OTA的修改的压缩包,但是我网站搜索了一下,却没有看到相关的内容?
可不可以给我发送一个下载链接,我下载一下
(Edits_for_OTA.zip )file 代码如下:
Include Section (To be added after osi.h)
Global/Define Section
12
#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 Prototypes
Local Variables (To be added to GetWeatherTask() Function
OTA Initialization (To be added to GetWeatherTask() function after GPIO_IF_LedOn(MCU_GREEN_LED_GPIO) function
call)
OTA main construct/logic (To be added to GetWeatherTask() function after lRetVal =
Network_IF_GetHostIP((char*)g_ServerAddress, &ulDestinationIP);)
12
13
static OtaOptServerInfo_t g_otaOptServerInfo;
static void *pvOtaApp;
12
int OTAServerInfoSet(void **pvOtaApp, char *vendorStr);
static void RebootMCU();
1234
long 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);
}e
lse {
UART_PRINT("Starting OTA\n\r");
lRetVal = 0;
while (!lRetVal) {
lRetVal = sl_extLib_OtaRun(pvOtaApp);
} U
ART_PRINT("OTA run = %d\n\r", lRetVal);
if (lRetVal < 0) {
UART_PRINT("OTA: Error with OTA server\n\r");
} e
lse 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");
}e
lse if (lRetVal && RUN_STAT_DOWNLOAD_DONE) {
// Set OTA File for testing
lRetVal = 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