Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
不穿格子衫的农民
TencentOS Tiny
提交
b01d2d75
T
TencentOS Tiny
项目概览
不穿格子衫的农民
/
TencentOS Tiny
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TencentOS Tiny
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
b01d2d75
编写于
6月 24, 2020
作者:
S
Supowang
提交者:
GitHub
6月 24, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #187 from Mculover666/master
add more ota_err_code support for ota bootloader
上级
fcae48c9
43af8867
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
108 addition
and
103 deletion
+108
-103
board/TencentOS_tiny_EVB_MX_Plus/KEIL/ota/ota_application_download_through_http/TencentOS_tiny.uvoptx
...a_application_download_through_http/TencentOS_tiny.uvoptx
+4
-4
board/TencentOS_tiny_EVB_MX_Plus/KEIL/ota/ota_application_download_through_http/TencentOS_tiny.uvprojx
..._application_download_through_http/TencentOS_tiny.uvprojx
+23
-7
board/TencentOS_tiny_EVB_MX_Plus/KEIL/ota/ota_application_download_through_http/system_stm32l4xx.c
.../ota_application_download_through_http/system_stm32l4xx.c
+1
-1
board/TencentOS_tiny_EVB_MX_Plus/KEIL/ota/ota_bootloader_recovery/MDK-ARM/TencentOS_tiny.uvoptx
...ota/ota_bootloader_recovery/MDK-ARM/TencentOS_tiny.uvoptx
+10
-42
board/TencentOS_tiny_EVB_MX_Plus/KEIL/ota/ota_bootloader_recovery/Src/main.c
...y_EVB_MX_Plus/KEIL/ota/ota_bootloader_recovery/Src/main.c
+7
-7
components/ota/common/env/ota_env.c
components/ota/common/env/ota_env.c
+1
-1
components/ota/common/info/ota_info.c
components/ota/common/info/ota_info.c
+4
-5
components/ota/common/info/ota_info.h
components/ota/common/info/ota_info.h
+4
-1
components/ota/common/partition/ota_partition.c
components/ota/common/partition/ota_partition.c
+2
-2
components/ota/common/partition/ota_partition.h
components/ota/common/partition/ota_partition.h
+2
-2
components/ota/recovery/include/ota_err.h
components/ota/recovery/include/ota_err.h
+21
-3
components/ota/recovery/include/ota_recovery.h
components/ota/recovery/include/ota_recovery.h
+2
-1
components/ota/recovery/ota_recovery.c
components/ota/recovery/ota_recovery.c
+20
-20
examples/ota_download_through_http/ota_download_through_http_sample.c
..._download_through_http/ota_download_through_http_sample.c
+6
-6
net/at/src/tos_at.c
net/at/src/tos_at.c
+1
-1
未找到文件。
board/TencentOS_tiny_EVB_MX_Plus/KEIL/ota/ota_application_download_through_http/TencentOS_tiny.uvoptx
浏览文件 @
b01d2d75
...
...
@@ -145,7 +145,7 @@
<SetRegEntry>
<Number>
0
</Number>
<Key>
ST-LINKIII-KEIL_SWO
</Key>
<Name>
-U
303030303030303030303031 -O10446 -SF4000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P1 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC1000 -FN1 -FF0STM32L4xx_256.FLM -FS08000000 -FL040
000 -FP0($$Device:STM32L431RCTx$CMSIS\Flash\STM32L4xx_256.FLM)
</Name>
<Name>
-U
51FF68064965575333151687 -O10446 -SF10000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P1 -N00("ARM CoreSight SW-DP (ARM Core") -D00(2BA01477) -L00(0) -TO131090 -TC10000000 -TT10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC1000 -FN1 -FF0STM32L4xx_256.FLM -FS08007800 -FL019
000 -FP0($$Device:STM32L431RCTx$CMSIS\Flash\STM32L4xx_256.FLM)
</Name>
</SetRegEntry>
</TargetDriverDllRegistry>
<Breakpoint/>
...
...
@@ -213,7 +213,7 @@
<pMultCmdsp></pMultCmdsp>
<DebugDescription>
<Enable>
1
</Enable>
<EnableFlashSeq>
1
</EnableFlashSeq>
<EnableFlashSeq>
0
</EnableFlashSeq>
<EnableLog>
0
</EnableLog>
<Protocol>
2
</Protocol>
<DbgClock>
10000000
</DbgClock>
...
...
@@ -383,7 +383,7 @@
<Group>
<GroupName>
examples
</GroupName>
<tvExp>
0
</tvExp>
<tvExp>
1
</tvExp>
<tvExpOptDlg>
0
</tvExpOptDlg>
<cbSel>
0
</cbSel>
<RteFlg>
0
</RteFlg>
...
...
@@ -1283,7 +1283,7 @@
<Group>
<GroupName>
ota_download
</GroupName>
<tvExp>
0
</tvExp>
<tvExp>
1
</tvExp>
<tvExpOptDlg>
0
</tvExpOptDlg>
<cbSel>
0
</cbSel>
<RteFlg>
0
</RteFlg>
...
...
board/TencentOS_tiny_EVB_MX_Plus/KEIL/ota/ota_application_download_through_http/TencentOS_tiny.uvprojx
浏览文件 @
b01d2d75
...
...
@@ -10,14 +10,14 @@
<TargetName>
TencentOS_tiny
</TargetName>
<ToolsetNumber>
0x4
</ToolsetNumber>
<ToolsetName>
ARM-ADS
</ToolsetName>
<pCCUsed>
5060750::V5.06 update 6 (build 750)::ARMCC
</pCCUsed>
<pCCUsed>
5060750::V5.06 update 6 (build 750)::
.\
ARMCC
</pCCUsed>
<uAC6>
0
</uAC6>
<TargetOption>
<TargetCommonOption>
<Device>
STM32L431RCTx
</Device>
<Vendor>
STMicroelectronics
</Vendor>
<PackID>
Keil.STM32L4xx_DFP.2.
0
.0
</PackID>
<PackURL>
http
://www.keil.com/pack
</PackURL>
<PackID>
Keil.STM32L4xx_DFP.2.
4
.0
</PackID>
<PackURL>
http
s://www.keil.com/pack/
</PackURL>
<Cpu>
IRAM(0x20000000-0x2000FFFF) IROM(0x8000000-0x803FFFF) CLOCK(8000000) FPU2 CPUTYPE("Cortex-M4")
</Cpu>
<FlashUtilSpec></FlashUtilSpec>
<StartupFile></StartupFile>
...
...
@@ -185,6 +185,7 @@
<uocXRam>
0
</uocXRam>
<RvdsVP>
2
</RvdsVP>
<RvdsMve>
0
</RvdsMve>
<RvdsCdeCp>
0
</RvdsCdeCp>
<hadIRAM2>
0
</hadIRAM2>
<hadIROM2>
0
</hadIROM2>
<StupSel>
8
</StupSel>
...
...
@@ -274,8 +275,8 @@
</OCR_RVCT3>
<OCR_RVCT4>
<Type>
1
</Type>
<StartAddress>
0x800
80
00
</StartAddress>
<Size>
0x
40
000
</Size>
<StartAddress>
0x800
78
00
</StartAddress>
<Size>
0x
19
000
</Size>
</OCR_RVCT4>
<OCR_RVCT5>
<Type>
1
</Type>
...
...
@@ -338,7 +339,7 @@
<MiscControls></MiscControls>
<Define>
USE_HAL_DRIVER,STM32L431xx,
</Define>
<Undefine></Undefine>
<IncludePath>
..\..\..\BSP\Inc;..\..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Inc;..\..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Legacy;..\..\..\..\..\platform\vendor_bsp\st\CMSIS\Device\ST\STM32L4xx\Include;..\..\..\..\..\platform\vendor_bsp\st\CMSIS\Include;..\..\..\..\..\kernel\core\include;..\..\..\TOS-CONFIG;..\..\..\..\..\platform\arch\arm\cortex-m4\keil;..\..\..\..\..\kernel\pm\include;..\..\..\..\..\osal\cmsis_os;..\..\..\..\..\arch\arm\arm-v7m\common\include;..\..\..\..\..\arch\arm\arm-v7m\cortex-m4\armcc;..\..\..\BSP\Hardware\DHT11;..\..\..\BSP\Hardware\OLED;..\..\..\BSP\Hardware\BH1750;..\..\..\..\..\devices\esp8266;..\..\..\..\..\net\at\include;..\..\..\..\..\kernel\hal\include;..\..\..\..\..\net\sal_module_wrapper;..\..\..\..\..\components\ota\download\include;..\..\..\..\..\components\ota\common\crc;..\..\..\..\..\components\ota\common\image;..\..\..\..\..\components\ota\common\flash;..\..\..\..\..\components\ota\common\partition;..\..\..\..\..\components\ota\common\env;..\..\..\..\..\components\fs\kv\include;..\..\..\..\..\components\ota\common\info
</IncludePath>
<IncludePath>
..\..\..\BSP\Inc;..\..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Inc;..\..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Legacy;..\..\..\..\..\platform\vendor_bsp\st\CMSIS\Device\ST\STM32L4xx\Include;..\..\..\..\..\platform\vendor_bsp\st\CMSIS\Include;..\..\..\..\..\kernel\core\include;..\..\..\TOS-CONFIG;..\..\..\..\..\platform\arch\arm\cortex-m4\keil;..\..\..\..\..\kernel\pm\include;..\..\..\..\..\osal\cmsis_os;..\..\..\..\..\arch\arm\arm-v7m\common\include;..\..\..\..\..\arch\arm\arm-v7m\cortex-m4\armcc;..\..\..\BSP\Hardware\DHT11;..\..\..\BSP\Hardware\OLED;..\..\..\BSP\Hardware\BH1750;..\..\..\..\..\devices\esp8266;..\..\..\..\..\net\at\include;..\..\..\..\..\kernel\hal\include;..\..\..\..\..\net\sal_module_wrapper;..\..\..\..\..\components\ota\download\include;..\..\..\..\..\components\ota\common\crc;..\..\..\..\..\components\ota\common\image;..\..\..\..\..\components\ota\common\flash;..\..\..\..\..\components\ota\common\partition;..\..\..\..\..\components\ota\common\env;..\..\..\..\..\components\fs\kv\include;..\..\..\..\..\components\ota\common\info
;..\..\..\..\..\components\ota\recovery\include
</IncludePath>
</VariousControls>
</Cads>
<Aads>
...
...
@@ -351,7 +352,7 @@
<NoWarn>
0
</NoWarn>
<uSurpInc>
0
</uSurpInc>
<useXO>
0
</useXO>
<
uClangAs>
0
</uClangAs
>
<
ClangAsOpt>
4
</ClangAsOpt
>
<VariousControls>
<MiscControls></MiscControls>
<Define></Define>
...
...
@@ -919,4 +920,19 @@
<files/>
</RTE>
<LayerInfo>
<Layers>
<Layer>
<LayName>
<
Project Info
>
</LayName>
<LayDesc></LayDesc>
<LayUrl></LayUrl>
<LayKeys></LayKeys>
<LayCat></LayCat>
<LayLic></LayLic>
<LayTarg>
0
</LayTarg>
<LayPrjMark>
1
</LayPrjMark>
</Layer>
</Layers>
</LayerInfo>
</Project>
board/TencentOS_tiny_EVB_MX_Plus/KEIL/ota/ota_application_download_through_http/system_stm32l4xx.c
浏览文件 @
b01d2d75
...
...
@@ -123,7 +123,7 @@
/*!< Uncomment the following line if you need to relocate your vector Table in
Internal SRAM. */
/* #define VECT_TAB_SRAM */
#define VECT_TAB_OFFSET 0x
80
00
/*!< Vector Table base offset field.
#define VECT_TAB_OFFSET 0x
78
00
/*!< Vector Table base offset field.
This value must be a multiple of 0x200. */
/******************************************************************************/
/**
...
...
board/TencentOS_tiny_EVB_MX_Plus/KEIL/ota/ota_bootloader_recovery/MDK-ARM/TencentOS_tiny.uvoptx
浏览文件 @
b01d2d75
...
...
@@ -184,22 +184,6 @@
<Bp>
<Number>
2
</Number>
<Type>
0
</Type>
<LineNumber>
63
</LineNumber>
<EnabledFlag>
1
</EnabledFlag>
<Address>
134240906
</Address>
<ByteObject>
0
</ByteObject>
<HtxType>
0
</HtxType>
<ManyObjects>
0
</ManyObjects>
<SizeOfObject>
0
</SizeOfObject>
<BreakByAccess>
0
</BreakByAccess>
<BreakIfRCount>
1
</BreakIfRCount>
<Filename>
..\Src\main.c
</Filename>
<ExecCommand></ExecCommand>
<Expression>
\\TencentOS_tiny\../Src/main.c\63
</Expression>
</Bp>
<Bp>
<Number>
3
</Number>
<Type>
0
</Type>
<LineNumber>
287
</LineNumber>
<EnabledFlag>
1
</EnabledFlag>
<Address>
134243064
</Address>
...
...
@@ -214,23 +198,7 @@
<Expression>
\\TencentOS_tiny\../../../../../../components/ota/recovery/ota_recovery.c\287
</Expression>
</Bp>
<Bp>
<Number>
4
</Number>
<Type>
0
</Type>
<LineNumber>
61
</LineNumber>
<EnabledFlag>
1
</EnabledFlag>
<Address>
0
</Address>
<ByteObject>
0
</ByteObject>
<HtxType>
0
</HtxType>
<ManyObjects>
0
</ManyObjects>
<SizeOfObject>
0
</SizeOfObject>
<BreakByAccess>
0
</BreakByAccess>
<BreakIfRCount>
0
</BreakIfRCount>
<Filename>
..\Src\main.c
</Filename>
<ExecCommand></ExecCommand>
<Expression></Expression>
</Bp>
<Bp>
<Number>
5
</Number>
<Number>
3
</Number>
<Type>
0
</Type>
<LineNumber>
310
</LineNumber>
<EnabledFlag>
0
</EnabledFlag>
...
...
@@ -246,10 +214,10 @@
<Expression></Expression>
</Bp>
<Bp>
<Number>
6
</Number>
<Number>
4
</Number>
<Type>
0
</Type>
<LineNumber>
65
</LineNumber>
<EnabledFlag>
1
</EnabledFlag>
<LineNumber>
120
</LineNumber>
<EnabledFlag>
0
</EnabledFlag>
<Address>
0
</Address>
<ByteObject>
0
</ByteObject>
<HtxType>
0
</HtxType>
...
...
@@ -257,15 +225,15 @@
<SizeOfObject>
0
</SizeOfObject>
<BreakByAccess>
0
</BreakByAccess>
<BreakIfRCount>
0
</BreakIfRCount>
<Filename>
..\
Src\mai
n.c
</Filename>
<Filename>
..\
..\..\..\..\..\components\ota\common\partition\ota_partitio
n.c
</Filename>
<ExecCommand></ExecCommand>
<Expression></Expression>
</Bp>
<Bp>
<Number>
7
</Number>
<Number>
5
</Number>
<Type>
0
</Type>
<LineNumber>
120
</LineNumber>
<EnabledFlag>
0
</EnabledFlag>
<LineNumber>
63
</LineNumber>
<EnabledFlag>
1
</EnabledFlag>
<Address>
0
</Address>
<ByteObject>
0
</ByteObject>
<HtxType>
0
</HtxType>
...
...
@@ -273,7 +241,7 @@
<SizeOfObject>
0
</SizeOfObject>
<BreakByAccess>
0
</BreakByAccess>
<BreakIfRCount>
0
</BreakIfRCount>
<Filename>
..\
..\..\..\..\..\components\ota\common\partition\ota_partitio
n.c
</Filename>
<Filename>
..\
Src\mai
n.c
</Filename>
<ExecCommand></ExecCommand>
<Expression></Expression>
</Bp>
...
...
@@ -1172,7 +1140,7 @@
<Group>
<GroupName>
ota_recovery
</GroupName>
<tvExp>
0
</tvExp>
<tvExp>
1
</tvExp>
<tvExpOptDlg>
0
</tvExpOptDlg>
<cbSel>
0
</cbSel>
<RteFlg>
0
</RteFlg>
...
...
board/TencentOS_tiny_EVB_MX_Plus/KEIL/ota/ota_bootloader_recovery/Src/main.c
浏览文件 @
b01d2d75
...
...
@@ -55,17 +55,17 @@ int main(void)
return
-
1
;
}
#if
1
if
(
ota_recovery_xip
()
!=
0
)
{
printf
(
"recovery failed
!
\n
"
);
#if
0
if (
(ret = ota_recovery_xip()) != OTA_ERR_NONE
) {
printf("recovery failed
, OTA errcode = %d!\r\n", ret
);
} else {
printf
(
"recovery successfully!
\n
"
);
printf("recovery successfully!\
r\
n");
}
#else
if
(
ota_recovery
()
!=
0
)
{
printf
(
"recovery failed
!
\n
"
);
if
(
(
ret
=
ota_recovery
())
!=
OTA_ERR_NONE
)
{
printf
(
"recovery failed
, OTA errcode = %d!
\r\n
"
,
ret
);
}
else
{
printf
(
"recovery successfully!
\n
"
);
printf
(
"recovery successfully!
\
r\
n
"
);
}
#endif
...
...
components/ota/common/env/ota_env.c
浏览文件 @
b01d2d75
...
...
@@ -35,7 +35,7 @@ ota_err_t ota_env_init(ota_updt_type_t updt_type, uint32_t partition_addr, ota_f
ota_partition_end
(
OTA_PARTITION_KV
),
(
kv_flash_drv_t
*
)
flash_drv
,
(
kv_flash_prop_t
*
)
flash_prop
)
!=
KV_ERR_NONE
)
{
return
OTA_ERR_KV_FAIL
;
return
OTA_ERR_KV_
INIT_
FAIL
;
}
return
OTA_ERR_NONE
;
...
...
components/ota/common/info/ota_info.c
浏览文件 @
b01d2d75
...
...
@@ -16,7 +16,6 @@
*---------------------------------------------------------------------------*/
#include "tos_kv.h"
#include "ota_image.h"
#include "ota_info.h"
#include "ota_partition.h"
...
...
@@ -35,19 +34,19 @@ ota_img_vs_t ota_info_curr_version(void)
return
version
;
}
in
t
ota_info_update
(
ota_img_vs_t
new_version
)
ota_err_
t
ota_info_update
(
ota_img_vs_t
new_version
)
{
kv_err_t
err
;
err
=
tos_kv_del
(
"new_version"
);
if
(
err
!=
KV_ERR_NONE
&&
err
!=
KV_ERR_NOT_EXIST
)
{
return
-
1
;
return
OTA_ERR_KV_DEL_FAIL
;
}
if
(
tos_kv_set
(
"cur_version"
,
&
new_version
,
sizeof
(
ota_img_vs_t
))
!=
KV_ERR_NONE
)
{
return
-
1
;
return
OTA_ERR_KV_SET_FAIL
;
}
return
0
;
return
OTA_ERR_NONE
;
}
components/ota/common/info/ota_info.h
浏览文件 @
b01d2d75
...
...
@@ -18,9 +18,12 @@
#ifndef _OTA_INFO_H_
#define _OTA_INFO_H_
#include "ota_err.h"
#include "ota_image.h"
ota_img_vs_t
ota_info_curr_version
(
void
);
in
t
ota_info_update
(
ota_img_vs_t
new_version
);
ota_err_
t
ota_info_update
(
ota_img_vs_t
new_version
);
#endif
/* _OTA_INFO_H_ */
components/ota/common/partition/ota_partition.c
浏览文件 @
b01d2d75
...
...
@@ -20,7 +20,7 @@
static
ota_pt_ctrl_t
ctrl
;
static
in
t
partitions_verify
(
ota_pt_t
*
pts
,
int
n
)
static
ota_err_
t
partitions_verify
(
ota_pt_t
*
pts
,
int
n
)
{
int
i
=
0
;
...
...
@@ -34,7 +34,7 @@ static int partitions_verify(ota_pt_t *pts, int n)
}
}
return
0
;
return
OTA_ERR_NONE
;
}
ota_err_t
ota_partition_load
(
ota_updt_type_t
updt_type
,
uint32_t
partition_addr
)
...
...
components/ota/common/partition/ota_partition.h
浏览文件 @
b01d2d75
...
...
@@ -109,12 +109,12 @@ typedef struct ota_ping_pong_partitions_st {
}
ota_pp_pts_t
;
typedef
union
ip_un
{
ota_pt_t
pts
[
3
];
ota_pt_t
pts
[
sizeof
(
ota_ip_pts_t
)
/
sizeof
(
ota_pt_t
)
];
ota_ip_pts_t
ip_pts
;
}
ip_u
;
typedef
union
pp_un
{
ota_pt_t
pts
[
4
];
ota_pt_t
pts
[
sizeof
(
ota_pp_pts_t
)
/
sizeof
(
ota_pt_t
)
];
ota_pp_pts_t
pp_pts
;
}
pp_u
;
...
...
components/ota/recovery/include/ota_err.h
浏览文件 @
b01d2d75
...
...
@@ -23,15 +23,33 @@ typedef enum ota_err_en {
OTA_ERR_FLASH_INIT_FAIL
=
1u
,
OTA_ERR_PARTITION_READ_FAIL
=
2u
,
OTA_ERR_PARTITION_READ_FAIL
=
2u
,
OTA_ERR_PARTITION_MAGIC_NOT_SAME
,
OTA_ERR_PARTITION_ADDR_FAIL
,
OTA_ERR_PARTITION_NOT_ALIGN
,
OTA_ERR_PARTITION_CRC_FAIL
,
OTA_ERR_UPDT_TYPE_UNKOWN
,
OTA_ERR_UPDT_TYPE_UNKOWN
=
7u
,
OTA_ERR_KV_INIT_FAIL
=
8u
,
OTA_ERR_KV_GET_FAIL
,
OTA_ERR_KV_SET_FAIL
,
OTA_ERR_KV_DEL_FAIL
,
OTA_ERR_PATCH_READ_FAIL
=
12u
,
OTA_ERR_PATCH_MAGIC_NOT_SAME
,
OTA_ERR_PATCH_CRC_FAIL
,
OTA_ERR_ACTIVE_APP_READ_FAIL
=
15u
,
OTA_ERR_ACTIVE_APP_CRC_FAIL
,
OTA_ERR_NEW_VERSION_NOT_SAME
=
17u
,
OTA_ERR_OLD_VERSION_NOT_SAME
,
OTA_ERR_BACK_UP_FAIL
=
19u
,
OTA_ERR_RECOVERRY_FAIL
,
OTA_ERR_KV_FAIL
}
ota_err_t
;
#endif
/* _OTA_ERR_H_ */
...
...
components/ota/recovery/include/ota_recovery.h
浏览文件 @
b01d2d75
...
...
@@ -23,8 +23,9 @@
#include "ota_flash.h"
#include "ota_image.h"
#include "ota_patch.h"
#include "ota_err.h"
in
t
ota_recovery
(
void
);
ota_err_
t
ota_recovery
(
void
);
int
ota_recovery_xip
(
void
);
...
...
components/ota/recovery/ota_recovery.c
浏览文件 @
b01d2d75
...
...
@@ -29,7 +29,7 @@
#define MIN(a, b) ((a) < (b) ? (a) : (b))
static
in
t
patch_verify
(
ota_img_hdr_t
*
img_hdr
)
static
ota_err_
t
patch_verify
(
ota_img_hdr_t
*
img_hdr
)
{
#define BUF_SIZE 128
static
uint8_t
buf
[
BUF_SIZE
];
...
...
@@ -42,29 +42,29 @@ static int patch_verify(ota_img_hdr_t *img_hdr)
/* drag the ota_img_hdr out of the flash */
if
(
ota_flash_read
(
patch_start
,
img_hdr
,
sizeof
(
ota_img_hdr_t
))
<
0
)
{
return
-
1
;
return
OTA_ERR_PATCH_READ_FAIL
;
}
/* 1. check whether new version patch downloaded */
if
(
tos_kv_get
(
"new_version"
,
&
new_version
,
sizeof
(
ota_img_vs_t
),
&
version_len
)
!=
KV_ERR_NONE
)
{
return
-
1
;
return
OTA_ERR_KV_GET_FAIL
;
}
if
(
new_version
.
major
!=
img_hdr
->
new_version
.
major
||
new_version
.
minor
!=
img_hdr
->
new_version
.
minor
)
{
return
-
1
;
return
OTA_ERR_NEW_VERSION_NOT_SAME
;
}
/* 2. verify magic */
if
(
img_hdr
->
magic
!=
OTA_IMAGE_MAGIC
)
{
return
-
1
;
return
OTA_ERR_PATCH_MAGIC_NOT_SAME
;
}
/* 3. is this patch for current version? */
cur_version
=
ota_info_curr_version
();
if
(
cur_version
.
major
!=
img_hdr
->
old_version
.
major
||
cur_version
.
minor
!=
img_hdr
->
old_version
.
minor
)
{
return
-
1
;
return
OTA_ERR_OLD_VERSION_NOT_SAME
;
}
/* 4. verify the patch crc checksum */
...
...
@@ -75,7 +75,7 @@ static int patch_verify(ota_img_hdr_t *img_hdr)
while
(
remain_len
>
0
)
{
read_len
=
MIN
(
sizeof
(
buf
),
remain_len
);
if
(
ota_flash_read
(
patch_start
,
buf
,
read_len
)
<
0
)
{
return
-
1
;
return
OTA_ERR_PATCH_READ_FAIL
;
}
crc
=
crc8
(
crc
,
buf
,
read_len
);
...
...
@@ -85,7 +85,7 @@ static int patch_verify(ota_img_hdr_t *img_hdr)
}
if
(
crc
!=
img_hdr
->
patch_crc
)
{
return
-
1
;
return
OTA_ERR_PATCH_CRC_FAIL
;
}
/* 5. verify the old crc checksum */
...
...
@@ -95,7 +95,7 @@ static int patch_verify(ota_img_hdr_t *img_hdr)
while
(
remain_len
>
0
)
{
read_len
=
MIN
(
sizeof
(
buf
),
remain_len
);
if
(
ota_flash_read
(
active_app_start
,
buf
,
read_len
)
<
0
)
{
return
-
1
;
return
OTA_ERR_ACTIVE_APP_READ_FAIL
;
}
crc
=
crc8
(
crc
,
buf
,
read_len
);
...
...
@@ -105,10 +105,10 @@ static int patch_verify(ota_img_hdr_t *img_hdr)
}
if
(
crc
!=
img_hdr
->
old_crc
)
{
return
-
1
;
return
OTA_ERR_ACTIVE_APP_CRC_FAIL
;
}
return
0
;
return
OTA_ERR_NONE
;
}
static
int
do_recovery
(
ota_img_hdr_t
*
hdr
)
...
...
@@ -154,12 +154,13 @@ static int app_copy(uint32_t dst, uint32_t dst_size, uint32_t src, uint32_t src_
return
0
;
}
in
t
ota_recovery
(
void
)
ota_err_
t
ota_recovery
(
void
)
{
ota_err_t
ret
;
ota_img_hdr_t
img_hdr
;
if
(
patch_verify
(
&
img_hdr
)
)
{
return
-
1
;
if
(
(
ret
=
patch_verify
(
&
img_hdr
))
!=
OTA_ERR_NONE
)
{
return
ret
;
}
/* backup */
...
...
@@ -168,11 +169,10 @@ int ota_recovery(void)
ota_partition_size
(
OTA_PARTITION_BACKUP_APP
),
ota_partition_start
(
OTA_PARTITION_ACTIVE_APP
),
ota_partition_size
(
OTA_PARTITION_ACTIVE_APP
))
<
0
)
{
return
-
1
;
return
OTA_ERR_BACK_UP_FAIL
;
}
if
(
do_recovery
(
&
img_hdr
)
!=
0
)
{
printf
(
"recovery failed
\n
"
);
/* restore */
if
(
ota_partition_is_pingpong
())
{
...
...
@@ -181,13 +181,13 @@ int ota_recovery(void)
ota_partition_start
(
OTA_PARTITION_BACKUP_APP
),
ota_partition_size
(
OTA_PARTITION_BACKUP_APP
));
}
return
-
1
;
return
OTA_ERR_RECOVERRY_FAIL
;
}
if
(
ota_info_update
(
img_hdr
.
new_version
)
!=
0
)
{
return
-
1
;
if
(
(
ret
=
ota_info_update
(
img_hdr
.
new_version
))
!=
OTA_ERR_NONE
)
{
return
ret
;
}
return
0
;
return
OTA_ERR_NONE
;
}
examples/ota_download_through_http/ota_download_through_http_sample.c
浏览文件 @
b01d2d75
...
...
@@ -3,7 +3,7 @@
#include "sal_module_wrapper.h"
#include "cmsis_os.h"
#include "
tos_
ota_download.h"
#include "ota_download.h"
extern
ota_flash_drv_t
stm32l4_norflash_onchip_drv_ota
;
extern
ota_flash_prop_t
stm32l4_norflash_onchip_prop_ota
;
...
...
@@ -25,7 +25,7 @@ void user_task(void *arg)
while
(
K_TRUE
)
{
tos_task_delay
(
1000
);
printf
(
"do sth(v
1
.1)...
\n
"
);
printf
(
"do sth(v
0
.1)...
\n
"
);
if
(
++
iter
==
2
)
{
printf
(
"trigger ota download
\n
"
);
...
...
@@ -39,16 +39,16 @@ void ota_download_task(void *arg)
tos_sem_pend
(
&
sem
,
TOS_TIME_FOREVER
);
esp8266_sal_init
(
HAL_UART_PORT_0
);
esp8266_join_ap
(
"
SheldonDai"
,
"srnr6x9xbhmb0
"
);
esp8266_join_ap
(
"
Mculover666"
,
"mculover666
"
);
uint32_t
partition_addr
=
0x080
24
800
;
uint32_t
partition_addr
=
0x080
3f
800
;
if
(
tos_
ota_env_init
(
OTA_UPDATE_IN_POSITION
,
partition_addr
,
&
stm32l4_norflash_onchip_drv_ota
,
&
stm32l4_norflash_onchip_prop_ota
)
<
0
)
{
if
(
ota_env_init
(
OTA_UPDATE_IN_POSITION
,
partition_addr
,
&
stm32l4_norflash_onchip_drv_ota
,
&
stm32l4_norflash_onchip_prop_ota
)
<
0
)
{
printf
(
"env init failed!
\n
"
);
return
;
}
if
(
!
tos_ota_download_http
(
"http://39.108.190.129
:8000/patch.bin"
))
{
if
(
!
ota_download_http
(
"http://122.51.89.94
:8000/patch.bin"
))
{
printf
(
"download successfully!
\n
"
);
}
else
{
printf
(
"download failed!
\n
"
);
...
...
net/at/src/tos_at.c
浏览文件 @
b01d2d75
...
...
@@ -298,7 +298,7 @@ __STATIC__ void at_parser(void *arg)
at_parse_status
=
at_uart_line_parse
();
if
(
at_parse_status
==
AT_PARSE_STATUS_OVERFLOW
)
{
// TODO: fix me
tos_kprintln
(
"AT parse overflow!"
);
continue
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录