mirror of
https://github.com/openshwprojects/OpenBK7231T_App.git
synced 2026-02-04 20:45:32 +00:00
BK7231N OTA support - not tested yet (the OTA address seems different)
This commit is contained in:
@ -533,7 +533,7 @@ static int http_rest_post(http_request_t *request){
|
||||
return http_rest_post_reboot(request);
|
||||
}
|
||||
if (!strcmp(request->url, "api/ota")){
|
||||
return http_rest_post_flash(request, 0x132000);
|
||||
return http_rest_post_flash(request, START_ADR_OF_BK_PARTITION_OTA);
|
||||
}
|
||||
if (!strncmp(request->url, "api/flash/", 10)){
|
||||
return http_rest_get_flash_advanced(request);
|
||||
@ -736,7 +736,7 @@ static int http_rest_post_flash_advanced(http_request_t *request){
|
||||
int startaddr = 0;
|
||||
int sres;
|
||||
sres = sscanf(params, "%x", &startaddr);
|
||||
if (sres == 1 && startaddr >= 0x132000){
|
||||
if (sres == 1 && startaddr >= START_ADR_OF_BK_PARTITION_OTA){
|
||||
return http_rest_post_flash(request, startaddr);
|
||||
}
|
||||
return http_rest_error(request, -1, "invalid url");
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
|
||||
#include "ota.h"
|
||||
#include "../new_common.h"
|
||||
#include "typedef.h"
|
||||
#include "flash_pub.h"
|
||||
@ -108,7 +109,8 @@ int myhttpclientcallback(httprequest_t* request){
|
||||
switch(request->state){
|
||||
case 0: // start
|
||||
//init_ota(0xff000);
|
||||
init_ota(0x132000);
|
||||
|
||||
init_ota(START_ADR_OF_BK_PARTITION_OTA);
|
||||
addLog("\r\nmyhttpclientcallback state %d total %d/%d\r\n", request->state, total_bytes, request->client_data.response_content_len);
|
||||
break;
|
||||
case 1: // data
|
||||
|
||||
@ -1,5 +1,17 @@
|
||||
|
||||
|
||||
// NOTE: this offset was taken from BkDriverFlash.c
|
||||
// search for BK_PARTITION_OTA
|
||||
|
||||
#if PLATFORM_BK7231T
|
||||
#define START_ADR_OF_BK_PARTITION_OTA 0x132000
|
||||
#elif PLATFORM_BK7231N
|
||||
#define START_ADR_OF_BK_PARTITION_OTA 0x12A000
|
||||
#else
|
||||
// TODO
|
||||
#define START_ADR_OF_BK_PARTITION_OTA 0x132000
|
||||
#endif
|
||||
|
||||
// initialise OTA flash starting at startaddr
|
||||
int init_ota(unsigned int startaddr);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user