mirror of
https://github.com/cwyark/sdk-ameba-v4.0b_without_nda_gcc.git
synced 2025-07-31 20:31:07 +00:00
Initial commit
This commit is contained in:
commit
6f665866d6
3358 changed files with 1106791 additions and 0 deletions
32
component/common/example/ota_http/example_ota_http.c
Normal file
32
component/common/example/ota_http/example_ota_http.c
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
#include <ota_8195a.h>
|
||||
|
||||
#define PORT 8082
|
||||
#define HOST "192.168.1.53" //"m-apps.oss-cn-shenzhen.aliyuncs.com"
|
||||
#define RESOURCE "" //"051103061600.bin"
|
||||
|
||||
|
||||
#ifdef HTTP_OTA_UPDATE
|
||||
void http_update_ota_task(void *param){
|
||||
printf("\n\r\n\r\n\r\n\r<<<<<<Waiting for 1 minute to connect Wi-Fi>>>>>>>\n\r\n\r\n\r\n\r");
|
||||
vTaskDelay(60*1000);
|
||||
int ret = -1;
|
||||
|
||||
ret = http_update_ota(HOST, PORT, RESOURCE);
|
||||
|
||||
exit:
|
||||
printf("\n\r[%s] Update task exit", __FUNCTION__);
|
||||
if(!ret){
|
||||
printf("\n\r[%s] Ready to reboot", __FUNCTION__);
|
||||
ota_platform_reset();
|
||||
}
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
|
||||
|
||||
void example_ota_http(void){
|
||||
if(xTaskCreate(http_update_ota_task, (char const *)"http_update_ota_task", 1024, NULL, tskIDLE_PRIORITY + 1, NULL) != pdPASS){
|
||||
printf("\n\r[%s] Create update task failed", __FUNCTION__);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
6
component/common/example/ota_http/example_ota_http.h
Normal file
6
component/common/example/ota_http/example_ota_http.h
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#ifndef EXAMPLE_OTA_HTTP_H
|
||||
#define EXAMPLE_OTA_HTTP_H
|
||||
|
||||
void example_ota_http(void);
|
||||
|
||||
#endif /* EXAMPLE_OTA_HTTP_H */
|
||||
23
component/common/example/ota_http/readme.txt
Normal file
23
component/common/example/ota_http/readme.txt
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
OTA HTTP UPDATING EXAMPLE
|
||||
|
||||
Description:
|
||||
Download ota.bin from http download server(in tools\DownloadServer(HTTP))
|
||||
|
||||
Configuration:
|
||||
[example_ota_http.c]
|
||||
Modify PORT, HOST and RESOURCE based on your HTTP download server.
|
||||
eg: SERVER: http://m-apps.oss-cn-shenzhen.aliyuncs.com/051103061600.bin
|
||||
set: #define PORT 80
|
||||
#define HOST "m-apps.oss-cn-shenzhen.aliyuncs.com"
|
||||
#define RESOURCE "051103061600.bin"
|
||||
|
||||
[platform_opts.h]
|
||||
#define CONFIG_EXAMPLE_OTA_HTTP 1
|
||||
[ota_8195a.h]
|
||||
#define HTTP_OTA_UPDATE
|
||||
|
||||
Execution:
|
||||
Can make automatical Wi-Fi connection when booting by using wlan fast connect example.
|
||||
A http download example thread will be started automatically when booting.
|
||||
Using the example with the tool in tools\DownloadServer(HTTP)
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue