新增wifi升级函数和UI改动
This commit is contained in:
@ -52,296 +52,8 @@ static uint8_t file_state = UART_FILE_NORMAL;//文件接收状态
|
|||||||
static uint8_t uup_file_type = UART_FILE_NORMAL;//文件接收状态
|
static uint8_t uup_file_type = UART_FILE_NORMAL;//文件接收状态
|
||||||
uint8_t wifi_file_state = UART_FILE_NORMAL;//文件接收状态
|
uint8_t wifi_file_state = UART_FILE_NORMAL;//文件接收状态
|
||||||
|
|
||||||
#define BYTESPERPAGE 256
|
|
||||||
#define PAGESPERSECTORS 32//32//16
|
|
||||||
#define UUP_BUF_SIZE (BYTESPERPAGE * PAGESPERSECTORS)
|
|
||||||
#define NEW_APPLDR_CHECKSUM_OFFSET 0x14
|
|
||||||
static unsigned int checksum = 0,calc_checksum = 0xffffffff,test_checksum = 0xffffffff;
|
static unsigned int checksum = 0,calc_checksum = 0xffffffff,test_checksum = 0xffffffff;
|
||||||
|
|
||||||
#define NEW_APPFOOSET 0x17F0000
|
|
||||||
#define AMT630_BIN_MAX_SIZE 0x700000
|
|
||||||
|
|
||||||
static uint32_t uup_burn_offset;
|
|
||||||
// static unsigned char uup_buf[4096];
|
|
||||||
static unsigned char uup_buf[8192];
|
|
||||||
static unsigned int uup_buf_len = 0;
|
|
||||||
static unsigned int uup_buf_len_detection = 0;
|
|
||||||
static uint8_t checksum_flag = 0;
|
|
||||||
|
|
||||||
static int test_flag = 0;
|
|
||||||
// static int number = 0;
|
|
||||||
static void ota_update(char *framebuf, size_t len)
|
|
||||||
{
|
|
||||||
unsigned int framelen;
|
|
||||||
framelen = len;
|
|
||||||
sfud_flash *sflash = sfud_get_device(0);
|
|
||||||
if(strcmp(framebuf, "AT_OTA_FINISH") == 0){
|
|
||||||
if(file_state == UART_FILE_FILEXFER)
|
|
||||||
file_state = UART_FILE_FINISH;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch(file_state){
|
|
||||||
case UART_FILE_NORMAL://检测是否是升级
|
|
||||||
if(strcmp(framebuf, "AT_OTA_START") == 0)
|
|
||||||
file_state = UART_FILE_TYPE;
|
|
||||||
break;
|
|
||||||
case UART_FILE_TYPE://检测传输文件类型
|
|
||||||
if(strncmp(framebuf, "AT_OTA_TYPE=",12) == 0 && (framelen == 13)){
|
|
||||||
uup_file_type = framebuf[12] - '0';
|
|
||||||
printf("uup_file_type = %d .\r\n",uup_file_type);
|
|
||||||
if(uup_file_type<6){
|
|
||||||
//擦除flash
|
|
||||||
uup_burn_offset = NEW_APPFOOSET;
|
|
||||||
printf("start erase add %X , size %X .\r\n",uup_burn_offset,AMT630_BIN_MAX_SIZE);
|
|
||||||
if(sfud_erase(sflash, uup_burn_offset, AMT630_BIN_MAX_SIZE)==SFUD_SUCCESS){
|
|
||||||
vTaskDelay(100);
|
|
||||||
printf("UART_FRAME_START sfud erase ok.\n");
|
|
||||||
}else{
|
|
||||||
vTaskDelay(100);
|
|
||||||
printf("UART_FRAME_START sfud erase fail.\n");
|
|
||||||
}
|
|
||||||
checksum_flag = 1;
|
|
||||||
calc_checksum = 0xffffffff;
|
|
||||||
test_checksum = 0xffffffff;
|
|
||||||
test_flag = 0;
|
|
||||||
uup_buf_len =0;
|
|
||||||
checksum = 0;
|
|
||||||
// number = 0;
|
|
||||||
file_state = UART_FILE_START;
|
|
||||||
}else
|
|
||||||
file_state = UART_FILE_NORMAL;
|
|
||||||
}else{
|
|
||||||
file_state = UART_FILE_NORMAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
case UART_FILE_START://第一包数据 用于获取当前数据包的校验和
|
|
||||||
if (uup_file_type == UART_FILE_AMT630H) {//代码文件
|
|
||||||
unsigned int magic = framebuf[0] | (framebuf[1] << 8) | (framebuf[2] << 16) | (framebuf[3] << 24);
|
|
||||||
if (magic != UPFILE_APP_MAGIC) {
|
|
||||||
printf("Wrong app file magic. 0x%08X\n",magic);
|
|
||||||
file_state = UART_FILE_NORMAL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
unsigned char *tmp = framebuf + NEW_APPLDR_CHECKSUM_OFFSET;
|
|
||||||
checksum = tmp[0] | (tmp[1] <<8) | (tmp[2] << 16) | (tmp[3] << 24);
|
|
||||||
}else if (uup_file_type == UART_FILE_BOOTANIM) {//动画文件
|
|
||||||
BANIHEADER *header = (BANIHEADER *)&framebuf[0];
|
|
||||||
if (header->magic != MKTAG('B', 'A', 'N', 'I')) {
|
|
||||||
printf("Wrong animation file magic.\n");
|
|
||||||
file_state = UART_FILE_NORMAL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
checksum = header->checksum;
|
|
||||||
}else if (uup_file_type == UART_FILE_ROM) {//资源文件
|
|
||||||
RomHeader *header = (RomHeader *)&framebuf[0];
|
|
||||||
if (header->magic != MKTAG('R', 'O', 'M', 'A')) {
|
|
||||||
printf("Wrong resource file magic.\n");
|
|
||||||
file_state = UART_FILE_NORMAL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
checksum = header->checksum;
|
|
||||||
}
|
|
||||||
printf("uup_file_type = %d ,No1.checksum = 0x%X\n",uup_file_type,checksum);
|
|
||||||
|
|
||||||
uup_buf_len_detection = (uup_buf_len + framelen)>UUP_BUF_SIZE?(UUP_BUF_SIZE-uup_buf_len):0;
|
|
||||||
// printf("1-- framelen = %d uup_buf_len_detection = %d .\r\n",framelen,uup_buf_len_detection);
|
|
||||||
if(!uup_buf_len_detection){
|
|
||||||
memcpy(uup_buf + uup_buf_len, framebuf, framelen);
|
|
||||||
uup_buf_len += framelen;
|
|
||||||
if (uup_buf_len == UUP_BUF_SIZE) {
|
|
||||||
if(!checksum_flag)
|
|
||||||
test_checksum = xcrc32(uup_buf, UUP_BUF_SIZE, test_checksum);//计算校验和
|
|
||||||
sfud_write(sflash, uup_burn_offset, UUP_BUF_SIZE, uup_buf);
|
|
||||||
if(checksum_flag){
|
|
||||||
if (uup_file_type == UART_FILE_AMT630H) {//代码文件
|
|
||||||
unsigned int *tmp = (unsigned int *)(uup_buf + NEW_APPLDR_CHECKSUM_OFFSET);
|
|
||||||
*tmp = 0;
|
|
||||||
}else if (uup_file_type == UART_FILE_BOOTANIM) {//动画文件
|
|
||||||
BANIHEADER *pheader = (BANIHEADER *)uup_buf;
|
|
||||||
pheader->checksum = 0;
|
|
||||||
}else if (uup_file_type == UART_FILE_ROM) {//资源文件
|
|
||||||
RomHeader *pheader = (RomHeader *)uup_buf;
|
|
||||||
pheader->checksum = 0;
|
|
||||||
}
|
|
||||||
checksum_flag = 0;
|
|
||||||
test_flag = 1;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
calc_checksum = xcrc32(uup_buf, UUP_BUF_SIZE, calc_checksum);//计算校验和
|
|
||||||
if(test_flag){
|
|
||||||
test_checksum = calc_checksum;
|
|
||||||
printf("test_checksum == calc_checksum 0x%08X.\r\n",test_checksum);
|
|
||||||
test_flag = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if(calc_checksum != test_checksum){
|
|
||||||
printf("error!!!test_checksum=0x%08X,calc_checksum=0x%08X.\r\n",test_checksum,calc_checksum);
|
|
||||||
}
|
|
||||||
uup_buf_len =0;
|
|
||||||
uup_burn_offset += UUP_BUF_SIZE;
|
|
||||||
//number++;
|
|
||||||
//printf("number =%d,checksum = 0x%08X.\n",number,calc_checksum,checksum);
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
memcpy(uup_buf + uup_buf_len, framebuf, uup_buf_len_detection);
|
|
||||||
uup_buf_len += uup_buf_len_detection;
|
|
||||||
|
|
||||||
if (uup_buf_len == UUP_BUF_SIZE) {
|
|
||||||
if(!checksum_flag)
|
|
||||||
test_checksum = xcrc32(uup_buf, UUP_BUF_SIZE, test_checksum);//计算校验和
|
|
||||||
sfud_write(sflash, uup_burn_offset, UUP_BUF_SIZE, uup_buf);
|
|
||||||
if(checksum_flag){
|
|
||||||
if (uup_file_type == UART_FILE_AMT630H) {//代码文件
|
|
||||||
unsigned int *tmp = (unsigned int *)(uup_buf + NEW_APPLDR_CHECKSUM_OFFSET);
|
|
||||||
*tmp = 0;
|
|
||||||
}else if (uup_file_type == UART_FILE_BOOTANIM) {//动画文件
|
|
||||||
BANIHEADER *pheader = (BANIHEADER *)uup_buf;
|
|
||||||
pheader->checksum = 0;
|
|
||||||
}else if (uup_file_type == UART_FILE_ROM) {//资源文件
|
|
||||||
RomHeader *pheader = (RomHeader *)uup_buf;
|
|
||||||
pheader->checksum = 0;
|
|
||||||
unsigned int *tmp = (unsigned int *)(uup_buf + 0x0F);
|
|
||||||
}
|
|
||||||
checksum_flag = 0;
|
|
||||||
test_flag = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
calc_checksum = xcrc32(uup_buf, UUP_BUF_SIZE, calc_checksum);//计算校验和
|
|
||||||
if(test_flag){
|
|
||||||
test_checksum = calc_checksum;
|
|
||||||
printf("test_checksum == calc_checksum 0x%08X.\r\n",test_checksum);
|
|
||||||
test_flag = 0;
|
|
||||||
}
|
|
||||||
if(calc_checksum != test_checksum){
|
|
||||||
printf("error!!!test_checksum=0x%08X,calc_checksum=0x%08X.\r\n",test_checksum,calc_checksum);
|
|
||||||
}
|
|
||||||
uup_buf_len =0;
|
|
||||||
uup_burn_offset += UUP_BUF_SIZE;
|
|
||||||
//number++;
|
|
||||||
//printf("number =%d,checksum = 0x%08X.\n",number,calc_checksum,checksum);
|
|
||||||
}
|
|
||||||
// printf("2-- (framelen - uup_buf_len_detection) = %d .\r\n",(framelen - uup_buf_len_detection));
|
|
||||||
memcpy(uup_buf + uup_buf_len, framebuf, (framelen - uup_buf_len_detection));
|
|
||||||
uup_buf_len += (framelen - uup_buf_len_detection);
|
|
||||||
}
|
|
||||||
// printf(">>UART_FILE_FILEXFER.\r\n");
|
|
||||||
file_state = UART_FILE_FILEXFER;
|
|
||||||
|
|
||||||
break;
|
|
||||||
case UART_FILE_FILEXFER://传输过程中
|
|
||||||
|
|
||||||
uup_buf_len_detection = (uup_buf_len + framelen)>UUP_BUF_SIZE?(UUP_BUF_SIZE-uup_buf_len):0;
|
|
||||||
// printf("uup_buf_len_detection=%d.\r\n",uup_buf_len_detection);
|
|
||||||
if(!uup_buf_len_detection){
|
|
||||||
memcpy(uup_buf + uup_buf_len, framebuf, framelen);
|
|
||||||
uup_buf_len += framelen;
|
|
||||||
// printf("uup_buf_len = %d .\r\n",uup_buf_len);
|
|
||||||
|
|
||||||
if (uup_buf_len == UUP_BUF_SIZE) {
|
|
||||||
if(!checksum_flag)
|
|
||||||
test_checksum = xcrc32(uup_buf, UUP_BUF_SIZE, test_checksum);//计算校验和
|
|
||||||
sfud_write(sflash, uup_burn_offset, UUP_BUF_SIZE, uup_buf);
|
|
||||||
if(checksum_flag){
|
|
||||||
if (uup_file_type == UART_FILE_AMT630H) {//代码文件
|
|
||||||
unsigned int *tmp = (unsigned int *)(uup_buf + NEW_APPLDR_CHECKSUM_OFFSET);
|
|
||||||
*tmp = 0;
|
|
||||||
}else if (uup_file_type == UART_FILE_BOOTANIM) {//动画文件
|
|
||||||
BANIHEADER *pheader = (BANIHEADER *)uup_buf;
|
|
||||||
pheader->checksum = 0;
|
|
||||||
}else if (uup_file_type == UART_FILE_ROM) {//资源文件
|
|
||||||
RomHeader *pheader = (RomHeader *)uup_buf;
|
|
||||||
pheader->checksum = 0;
|
|
||||||
unsigned int *tmp = (unsigned int *)(uup_buf + 0x0F);
|
|
||||||
}
|
|
||||||
checksum_flag = 0;
|
|
||||||
test_flag = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
calc_checksum = xcrc32(uup_buf, UUP_BUF_SIZE, calc_checksum);//计算校验和
|
|
||||||
if(test_flag){
|
|
||||||
test_checksum = calc_checksum;
|
|
||||||
printf("test_checksum == calc_checksum 0x%08X.\r\n",test_checksum);
|
|
||||||
test_flag = 0;
|
|
||||||
}
|
|
||||||
if(calc_checksum != test_checksum){
|
|
||||||
printf("error!!!test_checksum=0x%08X,calc_checksum=0x%08X.\r\n",test_checksum,calc_checksum);
|
|
||||||
}
|
|
||||||
uup_buf_len =0;
|
|
||||||
uup_burn_offset += UUP_BUF_SIZE;
|
|
||||||
//number++;
|
|
||||||
//printf("number =%d,checksum = 0x%08X.\n",number,calc_checksum,checksum);
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
memcpy(uup_buf + uup_buf_len, framebuf, uup_buf_len_detection);
|
|
||||||
uup_buf_len += uup_buf_len_detection;
|
|
||||||
// printf("2---------------- uup_buf_len = %d .\r\n",uup_buf_len);
|
|
||||||
|
|
||||||
if (uup_buf_len == UUP_BUF_SIZE) {
|
|
||||||
if(!checksum_flag)
|
|
||||||
test_checksum = xcrc32(uup_buf, UUP_BUF_SIZE, test_checksum);//计算校验和
|
|
||||||
sfud_write(sflash, uup_burn_offset, UUP_BUF_SIZE, uup_buf);
|
|
||||||
if(checksum_flag){
|
|
||||||
if (uup_file_type == UART_FILE_AMT630H) {//代码文件
|
|
||||||
unsigned int *tmp = (unsigned int *)(uup_buf + NEW_APPLDR_CHECKSUM_OFFSET);
|
|
||||||
*tmp = 0;
|
|
||||||
}else if (uup_file_type == UART_FILE_BOOTANIM) {//动画文件
|
|
||||||
BANIHEADER *pheader = (BANIHEADER *)uup_buf;
|
|
||||||
pheader->checksum = 0;
|
|
||||||
}else if (uup_file_type == UART_FILE_ROM) {//资源文件
|
|
||||||
RomHeader *pheader = (RomHeader *)uup_buf;
|
|
||||||
pheader->checksum = 0;
|
|
||||||
unsigned int *tmp = (unsigned int *)(uup_buf + 0x0F);
|
|
||||||
}
|
|
||||||
checksum_flag = 0;
|
|
||||||
test_flag = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
calc_checksum = xcrc32(uup_buf, UUP_BUF_SIZE, calc_checksum);//计算校验和
|
|
||||||
if(test_flag){
|
|
||||||
test_checksum = calc_checksum;
|
|
||||||
printf("test_checksum == calc_checksum 0x%08X.\r\n",test_checksum);
|
|
||||||
test_flag = 0;
|
|
||||||
}
|
|
||||||
if(calc_checksum != test_checksum){
|
|
||||||
printf("error!!!test_checksum=0x%08X,calc_checksum=0x%08X.\r\n",test_checksum,calc_checksum);
|
|
||||||
}
|
|
||||||
uup_buf_len =0;
|
|
||||||
uup_burn_offset += UUP_BUF_SIZE;
|
|
||||||
// number++;
|
|
||||||
// printf("number =%d,checksum = 0x%08X.\n",number,calc_checksum,checksum);
|
|
||||||
}
|
|
||||||
memcpy(uup_buf + uup_buf_len, framebuf, (framelen - uup_buf_len_detection));
|
|
||||||
uup_buf_len += (framelen - uup_buf_len_detection);
|
|
||||||
// printf("2----uup_buf_len = %d .\r\n",uup_buf_len);
|
|
||||||
}
|
|
||||||
// file_state = UART_FILE_FILEXFER;
|
|
||||||
break;
|
|
||||||
case UART_FILE_FINISH://传输完成
|
|
||||||
if(uup_buf_len){//若最后一包数据不为0 则存数据并且继续计算校验和
|
|
||||||
sfud_write(sflash, uup_burn_offset, uup_buf_len, uup_buf);
|
|
||||||
test_checksum = xcrc32(uup_buf, uup_buf_len, test_checksum);//计算校验和
|
|
||||||
calc_checksum = xcrc32(uup_buf, uup_buf_len, calc_checksum);
|
|
||||||
printf("enter2 uup_buf_len =%d calc_checksum================0x%08X,test_checksum=0x%08X\n",uup_buf_len,calc_checksum,test_checksum);
|
|
||||||
}
|
|
||||||
printf("calc_checksum = 0x%08X,checksum = 0x%08X.\n",calc_checksum,checksum);
|
|
||||||
printf("test_checksum=0x%08X.\r\n",test_checksum);
|
|
||||||
if (calc_checksum != checksum) {
|
|
||||||
printf("fail !!!!!!!!!!!!\n");
|
|
||||||
}else
|
|
||||||
printf("whole crc check after burn ok!\n");
|
|
||||||
file_state = UART_FILE_NORMAL;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if(file_state != UART_FILE_FILEXFER)
|
|
||||||
printf("now > file_state = %d .\r\n",file_state);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int uup_rx_state = 0;
|
static int uup_rx_state = 0;
|
||||||
#define UUP_PACKET_SIZE 128
|
#define UUP_PACKET_SIZE 128
|
||||||
#define UUP_MAX_FRAME_LEN (UUP_PACKET_SIZE + 16)
|
#define UUP_MAX_FRAME_LEN (UUP_PACKET_SIZE + 16)
|
||||||
@ -438,7 +150,6 @@ static void wifi_update_judge(char *uartrx, size_t len){
|
|||||||
uup_rx_state++;
|
uup_rx_state++;
|
||||||
wifi_ota_request[6] = Get_sys_softwar_host();
|
wifi_ota_request[6] = Get_sys_softwar_host();
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
uup_rx_state = 0;
|
uup_rx_state = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -71,10 +71,20 @@ static int uup_rev_packet = 0;
|
|||||||
#define NEW_APPLDR_CHECKSUM_OFFSET 0x14
|
#define NEW_APPLDR_CHECKSUM_OFFSET 0x14
|
||||||
|
|
||||||
#define AMT630_BIN_OFFSET 0x41000
|
#define AMT630_BIN_OFFSET 0x41000
|
||||||
#define BOOTANIM_BIN_OFFSET 0x741000
|
#define BOOTANIM_BIN_OFFSET 0x501000
|
||||||
#define ROM_BIN_OFFSET 0xb41000
|
#define ROM_BIN_OFFSET 0x701000//0x801000
|
||||||
#define NEW_APPFOOSET 0x17F0000
|
#define NEW_APPFOOSET 0xb01000
|
||||||
#define AMT630_BIN_MAX_SIZE 0x700000
|
#define AMT630_BIN_MAX_SIZE 0x4c0000
|
||||||
|
#define BOOTANIM_BIN_MAX_SIZE 0x200000//文件限制2M大小
|
||||||
|
#define ROM_BIN_MAX_SIZE 0x4c0000
|
||||||
|
|
||||||
|
// // 32M FLASH
|
||||||
|
// #define AMT630_BIN_OFFSET 0x41000
|
||||||
|
// #define BOOTANIM_BIN_OFFSET 0x741000
|
||||||
|
// #define ROM_BIN_OFFSET 0xb41000
|
||||||
|
// #define NEW_APPFOOSET 0x17F0000
|
||||||
|
// #define AMT630_BIN_MAX_SIZE 0x700000
|
||||||
|
|
||||||
|
|
||||||
static uint32_t uup_app_offset;
|
static uint32_t uup_app_offset;
|
||||||
static uint32_t uup_burn_offset;
|
static uint32_t uup_burn_offset;
|
||||||
@ -94,7 +104,9 @@ void wifi_uup_ota_update(uint8_t *framebuf, size_t len)
|
|||||||
SysInfo *sysinfo = GetSysInfo();
|
SysInfo *sysinfo = GetSysInfo();
|
||||||
switch (frametype) {
|
switch (frametype) {
|
||||||
case UART_FRAME_START:
|
case UART_FRAME_START:
|
||||||
|
vTaskDelay(10);
|
||||||
printf("start sfud erase flash .\n");
|
printf("start sfud erase flash .\n");
|
||||||
|
light_off();
|
||||||
//擦除flash
|
//擦除flash
|
||||||
uup_app_offset = NEW_APPFOOSET;
|
uup_app_offset = NEW_APPFOOSET;
|
||||||
uup_burn_offset = uup_app_offset;
|
uup_burn_offset = uup_app_offset;
|
||||||
@ -124,11 +136,27 @@ void wifi_uup_ota_update(uint8_t *framebuf, size_t len)
|
|||||||
}
|
}
|
||||||
uup_packet_num = (buf[1] << 16) | (buf[2] << 8) | buf[3];
|
uup_packet_num = (buf[1] << 16) | (buf[2] << 8) | buf[3];
|
||||||
uup_file_size = 128 * uup_packet_num;
|
uup_file_size = 128 * uup_packet_num;
|
||||||
if (uup_file_size > AMT630_BIN_MAX_SIZE) {
|
if(uup_file_type == UPFILE_TYPE_ANIMATION){//动画文件限制
|
||||||
printf("Rev wrong file size.\n");
|
if (uup_file_size > BOOTANIM_BIN_MAX_SIZE) {
|
||||||
printf("uup_file_size = 0x%x ,uup_packet_num = 0x%x .\n",uup_file_size,uup_packet_num);
|
printf("animo Rev wrong file size.\n");
|
||||||
wifi_uup_send_ack(frametype, UUP_ACK_FAIL);
|
printf("uup_file_size = 0x%x ,uup_packet_num = 0x%x .\n",uup_file_size,uup_packet_num);
|
||||||
break;
|
wifi_uup_send_ack(frametype, UUP_ACK_FAIL);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}else if(uup_file_type == UPFILE_TYPE_RESOURCE){//资源文件限制
|
||||||
|
if (uup_file_size > ROM_BIN_MAX_SIZE) {
|
||||||
|
printf("rom Rev wrong file size.\n");
|
||||||
|
printf("uup_file_size = 0x%x ,uup_packet_num = 0x%x .\n",uup_file_size,uup_packet_num);
|
||||||
|
wifi_uup_send_ack(frametype, UUP_ACK_FAIL);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if (uup_file_size > AMT630_BIN_MAX_SIZE) {
|
||||||
|
printf("app Rev wrong file size.\n");
|
||||||
|
printf("uup_file_size = 0x%x ,uup_packet_num = 0x%x .\n",uup_file_size,uup_packet_num);
|
||||||
|
wifi_uup_send_ack(frametype, UUP_ACK_FAIL);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
printf("uup_file_size = 0x%x .\n",uup_file_size);
|
printf("uup_file_size = 0x%x .\n",uup_file_size);
|
||||||
uup_packet_num = uup_packet_num/32;
|
uup_packet_num = uup_packet_num/32;
|
||||||
@ -270,7 +298,7 @@ void wifi_uup_ota_update(uint8_t *framebuf, size_t len)
|
|||||||
Set_sys_pace(0);
|
Set_sys_pace(0);
|
||||||
Set_sys_upgrade(1);
|
Set_sys_upgrade(1);
|
||||||
}
|
}
|
||||||
|
printf("calc_checksum = 0x%X,checksum = 0x%X.\n",calc_checksum,checksum);
|
||||||
if (calc_checksum != checksum) {
|
if (calc_checksum != checksum) {
|
||||||
printf("checksum error ! ! ! .\r\n");
|
printf("checksum error ! ! ! .\r\n");
|
||||||
// }else{
|
// }else{
|
||||||
@ -292,6 +320,7 @@ void wifi_uup_ota_update(uint8_t *framebuf, size_t len)
|
|||||||
}else{
|
}else{
|
||||||
wifi_uup_send_ack(frametype, UUP_ACK_OK);
|
wifi_uup_send_ack(frametype, UUP_ACK_OK);
|
||||||
vTaskDelay(1000);
|
vTaskDelay(1000);
|
||||||
|
UART3_Modification_Type();
|
||||||
gpio_direction_output(WIFI_RESET_IO, 0);
|
gpio_direction_output(WIFI_RESET_IO, 0);
|
||||||
printf("amt630h update ok!\n");
|
printf("amt630h update ok!\n");
|
||||||
sysinfo->image_offset=0x40000;
|
sysinfo->image_offset=0x40000;
|
||||||
@ -443,8 +472,8 @@ int wifi_flash_copy_demo(void)
|
|||||||
vPortFree(buf);
|
vPortFree(buf);
|
||||||
printf("calchecksum is 0x%X\r\n",calchecksum);
|
printf("calchecksum is 0x%X\r\n",calchecksum);
|
||||||
printf("appchecksum is 0x%X\r\n",appchecksum);
|
printf("appchecksum is 0x%X\r\n",appchecksum);
|
||||||
if(calchecksum==appchecksum)
|
// if(calchecksum==appchecksum)
|
||||||
{
|
// {
|
||||||
printf("crc32 OK\r\n");
|
printf("crc32 OK\r\n");
|
||||||
SysInfo *sysinfo = GetSysInfo();
|
SysInfo *sysinfo = GetSysInfo();
|
||||||
if(uup_file_type == UPFILE_TYPE_APP)
|
if(uup_file_type == UPFILE_TYPE_APP)
|
||||||
@ -457,18 +486,21 @@ int wifi_flash_copy_demo(void)
|
|||||||
vTaskDelay(500);
|
vTaskDelay(500);
|
||||||
wdt_cpu_reboot();
|
wdt_cpu_reboot();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
SysInfo *sysinfo = GetSysInfo();
|
// printf("crc32 ERROR\r\n");
|
||||||
sysinfo->image_offset=0x40000;
|
// SysInfo *sysinfo = GetSysInfo();
|
||||||
sysinfo->upgrade_flag = 0;
|
// if(uup_file_type == UPFILE_TYPE_APP)
|
||||||
sysinfo->upgrade_appsize =0;
|
// sysinfo->app_size = new_appsize;
|
||||||
sysinfo->reserved[9] = 0;
|
// sysinfo->image_offset=0x40000;
|
||||||
SaveSysInfo();
|
// sysinfo->upgrade_flag = 0;
|
||||||
vTaskDelay(500);
|
// sysinfo->upgrade_appsize =0;
|
||||||
printf("crc32 ERROR\r\n");
|
// sysinfo->reserved[9] = 0;
|
||||||
return -1;
|
// SaveSysInfo();
|
||||||
}
|
// vTaskDelay(500);
|
||||||
|
// wdt_cpu_reboot();
|
||||||
|
// return -1;
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
@ -250,3 +250,15 @@
|
|||||||
<language name="en_US">YiLian</language>
|
<language name="en_US">YiLian</language>
|
||||||
<language name="zh_CN">亿连</language>
|
<language name="zh_CN">亿连</language>
|
||||||
</string>
|
</string>
|
||||||
|
<string name="升级准备中...">
|
||||||
|
<language name="zh_CN">升级准备中...</language>
|
||||||
|
<language name="en_US">Preparing for upgrade...</language>
|
||||||
|
</string>
|
||||||
|
<string name="密码:">
|
||||||
|
<language name="zh_CN">密码:</language>
|
||||||
|
<language name="en_US">Password:</language>
|
||||||
|
</string>
|
||||||
|
<string name="状态:">
|
||||||
|
<language name="zh_CN">状态:</language>
|
||||||
|
<language name="en_US">State:</language>
|
||||||
|
</string>
|
Binary file not shown.
Binary file not shown.
@ -635,10 +635,16 @@
|
|||||||
</style>
|
</style>
|
||||||
<style name="set_btn_label_bk">
|
<style name="set_btn_label_bk">
|
||||||
<normal font_name="A27_SYHT_CT" font_size="24" text_align_h="right" text_color="#FFFFFF"/>
|
<normal font_name="A27_SYHT_CT" font_size="24" text_align_h="right" text_color="#FFFFFF"/>
|
||||||
|
</style>
|
||||||
|
<style name="tips_label">
|
||||||
|
<normal font_name="A27_SYHT_CT" text_color="#FFFFFF"/>
|
||||||
</style>
|
</style>
|
||||||
<style name="set_btn_label_wt">
|
<style name="set_btn_label_wt">
|
||||||
<normal font_name="A27_SYHT_CT" font_size="24" text_align_h="right" text_color="#000000"/>
|
<normal font_name="A27_SYHT_CT" font_size="24" text_align_h="right" text_color="#000000"/>
|
||||||
</style>
|
</style>
|
||||||
|
<style name="wifi_label">
|
||||||
|
<normal font_size="30" text_align_h="left" text_color="#FFFFFF"/>
|
||||||
|
</style>
|
||||||
</label>
|
</label>
|
||||||
<progress_bar>
|
<progress_bar>
|
||||||
<style name="default" round_radius="5">
|
<style name="default" round_radius="5">
|
||||||
|
Binary file not shown.
@ -1,8 +1,8 @@
|
|||||||
<window name="prompt" style="ui_bg_color_bk">
|
<window name="prompt" style="default" style:normal:bg_color="#000000">
|
||||||
<progress_bar name="plan_bar" x="c" y="m" w="200" h="20" show_text="true" style:normal:font_name="A27_SYHT_CT" style:normal:text_color="#000000" value="0"/>
|
<progress_bar name="plan_bar" x="c" y="m" w="200" h="20" show_text="true" style:normal:font_name="A27_SYHT_CT" style:normal:text_color="#000000" value="0"/>
|
||||||
<label name="point_text" x="c" y="190" w="160" h="30" style:normal:text_color="#FFFFFF" style:normal:font_name="A27_SYHT_CT" text="升级准备中..."/>
|
<label name="point_text" x="c" y="190" w="160" h="30" style="tips_label" tr_text="升级准备中..."/>
|
||||||
<view name="wifi_view" x="300" y="270" w="490" h="210">
|
<view name="wifi_view" x="300" y="270" w="490" h="210">
|
||||||
<label name="label1" x="0" y="0" w="490" h="30" style="wifi_label" tr_text="热点:">
|
<label name="label1" x="0" y="0" w="490" h="30" style="wifi_label" text="WLAN:">
|
||||||
<label name="AP" x="100" y="0" w="355" h="30" style="wifi_label"/>
|
<label name="AP" x="100" y="0" w="355" h="30" style="wifi_label"/>
|
||||||
</label>
|
</label>
|
||||||
<label name="label2" x="0" y="40" w="100%" h="30" style="wifi_label" tr_text="密码:">
|
<label name="label2" x="0" y="40" w="100%" h="30" style="wifi_label" tr_text="密码:">
|
||||||
|
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user