Skip to content

Commit e970f03

Browse files
ambiotM-ichae-l
andauthored
Release 2.0.10 patch 03 (#3)
Version 2.0.10 – 2021/03/04 Patch update (2021/08/10): - Add watchdog support - minor issues of naming Patch update (2021/06/17): - Update wlan lib and related lib Feature: - Update SDK structure - Update wlan lib and related lib - Minor bug fix Misc: - Add offline SDK patch installation tools Co-authored-by: zhangzhenwu <[email protected]>
1 parent 85e7cde commit e970f03

File tree

12 files changed

+243
-22
lines changed

12 files changed

+243
-22
lines changed

Arduino_package/hardware/boards.txt

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
ameba_rtl8195a.name=Ameba RTL8195A
2+
ameba_rtl8195a.name=RTL8195AM
33
ameba_rtl8195a.vid.0=0x2341
44
ameba_rtl8195a.pid.0=0x003d
55
ameba_rtl8195a.upload.tool=ameba_1_tools
@@ -10,14 +10,14 @@ ameba_rtl8195a.upload.wait_for_upload_port=false
1010
ameba_rtl8195a.upload.native_usb=false
1111
ameba_rtl8195a.build.mcu=cortex-m3
1212
ameba_rtl8195a.build.f_cpu=166666666L
13-
ameba_rtl8195a.build.usb_product="Ameba RTL8195A"
13+
ameba_rtl8195a.build.usb_product="RTL8195AM"
1414
ameba_rtl8195a.build.board=AMEBA
1515
ameba_rtl8195a.build.core=arduino
1616
ameba_rtl8195a.build.extra_flags=-mthumb -DBOARD_RTL8195A {build.usb_flags}
1717
ameba_rtl8195a.build.ldscript=linker_scripts/gcc/rtl8195a-symbol-v03-img2_arduino_arduino.ld
1818
ameba_rtl8195a.build.variant=rtl8195a
1919

20-
ameba_rtl8710.name=Ameba RTL8710
20+
ameba_rtl8710.name=RTL8710AF
2121
ameba_rtl8710.vid.0=0x2341
2222
ameba_rtl8710.pid.0=0x003d
2323
ameba_rtl8710.upload.tool=ameba_1_tools
@@ -28,15 +28,15 @@ ameba_rtl8710.upload.wait_for_upload_port=false
2828
ameba_rtl8710.upload.native_usb=false
2929
ameba_rtl8710.build.mcu=cortex-m3
3030
ameba_rtl8710.build.f_cpu=83333333L
31-
ameba_rtl8710.build.usb_product="Ameba RTL8710"
31+
ameba_rtl8710.build.usb_product="RTL8710AF"
3232
ameba_rtl8710.build.board=AMEBA
3333
ameba_rtl8710.build.core=arduino
3434
ameba_rtl8710.build.extra_flags=-mthumb -DBOARD_RTL8710 {build.usb_flags}
3535
ameba_rtl8710.build.ldscript=linker_scripts/gcc/rtl8710-symbol-v03-img2_arduino_arduino.ld
3636
ameba_rtl8710.build.sym_bklist=linker_scripts/gcc/symbol_black_list.txt
3737
ameba_rtl8710.build.variant=rtl8710
3838

39-
ameba_rtl81711am.name=Ameba RTL8711AM
39+
ameba_rtl81711am.name=RTL8711AM
4040
ameba_rtl81711am.vid.0=0x2341
4141
ameba_rtl81711am.pid.0=0x003d
4242
ameba_rtl81711am.upload.tool=ameba_1_tools
@@ -47,7 +47,7 @@ ameba_rtl81711am.upload.wait_for_upload_port=false
4747
ameba_rtl81711am.upload.native_usb=false
4848
ameba_rtl81711am.build.mcu=cortex-m3
4949
ameba_rtl81711am.build.f_cpu=166666666L
50-
ameba_rtl81711am.build.usb_product="Ameba RTL8195A"
50+
ameba_rtl81711am.build.usb_product="RTL8711AM"
5151
ameba_rtl81711am.build.board=AMEBA
5252
ameba_rtl81711am.build.core=arduino
5353
ameba_rtl81711am.build.extra_flags=-mthumb -DBOARD_RTL8195A -DBOARD_RTL8711AM {build.usb_flags}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/**
2+
* This example describes how to use watchdog api.
3+
* In this example, watchdog is setup to 5s timeout.
4+
* Watchdog won't bark if we refresh it before timeout in smallTask.
5+
* The timer is also reloaded after refresh.
6+
* Otherwise, while running bigTask, watchdog will restart system in default or call callback function if registered.
7+
*/
8+
#include "WDT.h"
9+
10+
#define RUN_CALLBACK_IF_WATCHDOG_BARKS (0)
11+
WDT wdt;
12+
13+
void setup() {
14+
Serial.begin(9600);
15+
wdt.InitWatchdog(5000); // setup 5s watchdog
16+
17+
#if RUN_CALLBACK_IF_WATCHDOG_BARKS
18+
wdt.InitWatchdogIRQ(my_watchdog_irq_handler, 0);
19+
#else
20+
// system would restart in default when watchdog barks
21+
#endif
22+
23+
wdt.StartWatchdog(); // enable watchdog timer
24+
Small_Task();
25+
Big_Task();
26+
while(1);
27+
}
28+
29+
void loop() {
30+
delay(1000);
31+
}
32+
33+
void Small_Task(void) {
34+
Serial.println("......doing small task......");
35+
for (int i = 0; i < 50000000; i++) { // dummy task
36+
asm(" nop");
37+
}
38+
Serial.println("Small_Task finished refresh watchdog.");
39+
wdt.RefreshWatchdog();
40+
}
41+
42+
/* If Big_Task unable to reach #10, watchdog barks. */
43+
void Big_Task(void) {
44+
Serial.println("......doing big task, up to 10......");
45+
for (int i = 1; i <= 10; i++) {
46+
Serial.print("doing dummy task #");
47+
Serial.println(i, DEC);
48+
49+
for (int j = 0; j < 50000000; j++) { // dummy task
50+
asm(" nop");
51+
}
52+
}
53+
Serial.println("Big_Task finished refresh watchdog.");
54+
wdt.RefreshWatchdog();
55+
}
56+
57+
void my_watchdog_irq_handler(uint32_t id) {
58+
Serial.println("watchdog barks!!!");
59+
wdt.StopWatchdog();
60+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#######################################
2+
# Syntax Coloring Map for Watchdog
3+
#######################################
4+
5+
#######################################
6+
# Datatypes (KEYWORD1)
7+
#######################################
8+
9+
AmebaWatchdog KEYWORD1
10+
11+
#######################################
12+
# Methods and Functions (KEYWORD2)
13+
#######################################
14+
15+
InitWatchdog KEYWORD2
16+
StartWatchdog KEYWORD2
17+
StopWatchdog KEYWORD2
18+
RefreshWatchdog KEYWORD2
19+
InitWatchdogIRQ KEYWORD2
20+
21+
#######################################
22+
# Constants (LITERAL1)
23+
#######################################
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name=AmebaWatchdog
2+
version=1.0.0
3+
author=Realtek
4+
maintainer=Realtek <[email protected]>
5+
sentence=With this library you can find useful Watchdog application.
6+
paragraph=
7+
category=
8+
url=
9+
architectures=Ameba1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
#include "WDT.h"
2+
3+
#define ENABLE 1
4+
#define DISABLE 0
5+
6+
WDT::WDT(){};
7+
WDT::~WDT(){};
8+
9+
/**
10+
* @brief Initializes the watch dog, include time setting, mode register
11+
* @param timeout_ms: the watch-dog timer timeout value, in ms.
12+
* default action of timeout is to reset the whole system.
13+
* @retval none
14+
*/
15+
void WDT::InitWatchdog(uint32_t timeout_ms) {
16+
#if 0
17+
WDG_InitTypeDef WDG_InitStruct;
18+
u32 CountProcess;
19+
u32 DivFacProcess;
20+
21+
WDG_Scalar(timeout_ms, &CountProcess, &DivFacProcess);
22+
23+
WDG_InitStruct.CountProcess = CountProcess;
24+
WDG_InitStruct.DivFacProcess = DivFacProcess;
25+
26+
WDG_Init(&WDG_InitStruct);
27+
#else
28+
watchdog_init(timeout_ms); // setup 5s watchdog
29+
#endif
30+
}
31+
32+
/**
33+
* @brief Start the watchdog counting
34+
* @param None
35+
* @retval none
36+
*/
37+
void WDT::StartWatchdog(void) {
38+
#if 0
39+
WDG_Cmd(ENABLE); // WDG_Cmd used to disable or enable watchdog
40+
#else
41+
watchdog_start();
42+
#endif
43+
}
44+
45+
/**
46+
* @brief Stop the watchdog counting
47+
* @param None
48+
* @retval none
49+
*/
50+
void WDT::StopWatchdog(void) {
51+
#if 0
52+
WDG_Cmd(DISABLE); // WDG_Cmd used to disable or enable watchdog
53+
#else
54+
watchdog_irq_init(NULL, 0); //disable second interrupt
55+
watchdog_stop();
56+
#endif
57+
}
58+
59+
/**
60+
* @brief Refresh the watchdog counting to prevent WDT timeout
61+
* @param None
62+
* @retval none
63+
*/
64+
void WDT::RefreshWatchdog(void) {
65+
#if 0
66+
WDG_Refresh();
67+
#else
68+
watchdog_refresh();
69+
#endif
70+
}
71+
72+
/**
73+
* @brief Switch the watchdog timer to interrupt mode and
74+
* register a watchdog timer timeout interrupt handler.
75+
* The interrupt handler will be called when the watch-dog
76+
* timer is timeout.
77+
* @param handler: the callback function for WDT timeout interrupt.
78+
* @param id: the parameter for the callback function
79+
* @retval none
80+
*/
81+
void WDT::InitWatchdogIRQ(wdt_irq_handler handler, uint32_t id) {
82+
#if 0
83+
WDG_IrqInit((VOID*)handler, (u32)id);
84+
#else
85+
watchdog_irq_init(handler, id);
86+
#endif
87+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#ifndef __WDT_H__
2+
#define __WDT_H__
3+
4+
#include <Arduino.h>
5+
6+
#ifdef __cplusplus
7+
extern "C" {
8+
#endif
9+
10+
#include "device.h"
11+
#include "diag.h"
12+
#include "main.h"
13+
#include "wdt_api.h"
14+
15+
#ifdef __cplusplus
16+
}
17+
#endif
18+
19+
20+
class WDT {
21+
public:
22+
WDT(void);
23+
~WDT(void);
24+
25+
void InitWatchdog(uint32_t timeout_ms);
26+
void StartWatchdog(void);
27+
void StopWatchdog(void);
28+
void RefreshWatchdog(void);
29+
void InitWatchdogIRQ(wdt_irq_handler handler, uint32_t id);
30+
};
31+
#endif

Arduino_package/hardware/platform.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
# For more info:
66
# https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5-3rd-party-Hardware-specification
77

8-
name=Ameba ARM (32-bits) Boards
9-
version=2.0.9
8+
name=Ameba1 ARM (32-bits) Boards
9+
version=2.0.10
1010

1111
# Ameba project settings
1212
# ----------------------

Arduino_package/hardware/system/libameba/sdk/component/common/mbed/hal_ext/wdt_api.h

+11
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,17 @@ void watchdog_stop(void);
5454
*/
5555
void watchdog_refresh(void);
5656

57+
/**
58+
* @brief Switch the watchdog timer to interrupt mode and
59+
* register a watchdog timer timeout interrupt handler.
60+
* The interrupt handler will be called when the watch-dog
61+
* timer is timeout.
62+
* @param handler: the callback function for WDT timeout interrupt.
63+
* @param id: the parameter for the callback function
64+
* @retval none
65+
*/
66+
void watchdog_irq_init(wdt_irq_handler handler, uint32_t id);
67+
5768
#ifdef __cplusplus
5869
}
5970
#endif

Arduino_package/package_realtek.com_ameba1_index.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@
1818
"help": {
1919
"online": "http://www.amebaiot.com/"
2020
},
21-
"url": "https://github.com/ambiot/amb1_arduino/raw/master/Arduino_package/release/ameba_1-2.0.10-v2.tar.gz",
22-
"archiveFileName": "ameba_1-2.0.10-v2.tar.gz",
23-
"checksum": "SHA-256:00391097eed30468ac900dde685f4811d7b5b644a25afa400b77f401d1f2c806",
24-
"size": "18773638",
21+
"url": "https://github.com/ambiot/amb1_arduino/raw/master/Arduino_package/release/ameba_1-2.0.10-v3.tar.gz",
22+
"archiveFileName": "ameba_1-2.0.10-v3.tar.gz",
23+
"checksum": "SHA-256:828e31c4108d69f98c2ab827d153b8e5a745b0222d17f137d5829789dd67185d",
24+
"size": "18772303",
2525
"boards": [
26-
{"name": "Ameba RTL8195A"},
27-
{"name": "Ameba RTL8710"},
28-
{"name": "Ameba RTL8711AM"}
26+
{"name": "RTL8195AM"},
27+
{"name": "RTL8710AF"},
28+
{"name": "RTL8711AM"}
2929
],
3030
"toolsDependencies": [
3131
{

Arduino_package/package_realtek.com_ameba1_raw_index.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@
1818
"help": {
1919
"online": "http://www.amebaiot.com/"
2020
},
21-
"url": "https://raw.githubusercontent.com/ambiot/amb1_arduino/master/Arduino_package/release/ameba_1-2.0.10-v2.tar.gz",
22-
"archiveFileName": "ameba_1-2.0.10-v2.tar.gz",
23-
"checksum": "SHA-256:00391097eed30468ac900dde685f4811d7b5b644a25afa400b77f401d1f2c806",
24-
"size": "18773638",
21+
"url": "https://raw.githubusercontent.com/ambiot/amb1_arduino/master/Arduino_package/release/ameba_1-2.0.10-v3.tar.gz",
22+
"archiveFileName": "ameba_1-2.0.10-v3.tar.gz",
23+
"checksum": "SHA-256:828e31c4108d69f98c2ab827d153b8e5a745b0222d17f137d5829789dd67185d",
24+
"size": "18772303",
2525
"boards": [
26-
{"name": "Ameba RTL8195A"},
27-
{"name": "Ameba RTL8710"},
28-
{"name": "Ameba RTL8711AM"}
26+
{"name": "RTL8195AM"},
27+
{"name": "RTL8710AF"},
28+
{"name": "RTL8711AM"}
2929
],
3030
"toolsDependencies": [
3131
{
17.9 MB
Binary file not shown.

0 commit comments

Comments
 (0)