[boards] Add RTL8710BX board with 4 MiB flash

This commit is contained in:
Kuba Szczodrzyński
2022-09-23 12:25:30 +02:00
parent 05cb7f7947
commit 50fea2a8f0
13 changed files with 753 additions and 1 deletions

View File

@@ -4,6 +4,7 @@
- [Generic - BK7231T (Tuya QFN32)](../boards/generic-bk7231t-qfn32-tuya/README.md)
- [Generic - RTL8710BN (2M/468k)](../boards/generic-rtl8710bn-2mb-468k/README.md)
- [Generic - RTL8710BN (2M/788k)](../boards/generic-rtl8710bn-2mb-788k/README.md)
- [Generic - RTL8710BX (4M/980k)](../boards/generic-rtl8710bx-4mb-980k/README.md)
- [Generic - RTL8720CF (2M/992k)](../boards/generic-rtl8720cf-2mb-992k/README.md)
- [BW12](../boards/bw12/README.md)
- [BW15](../boards/bw15/README.md)

View File

@@ -0,0 +1,18 @@
{
"build": {
"ldscript_sdk": "rlx8711B-symbol-v02-img2_xip1_4M_cpp.ld",
"ldscript_arduino": "rlx8711B-symbol-v02-img2_xip1_4M_cpp.ld",
"amb_boot_all": "boot_all_C556.bin"
},
"flash": {
"ota1": "0x00B000+0xF5000",
"ota2": "0x100000+0xF5000",
"kvs": "0x1F5000+0x8000",
"userdata": "0x1FD000+0x202000",
"rdp": "0x3FF000+0x1000"
},
"upload": {
"flash_size": 4194304,
"maximum_size": 1003520
}
}

View File

@@ -0,0 +1,100 @@
{
"_base": [
"generic",
"realtek-ambz",
"realtek-ambz-4mb-980k",
"realtek-ambz-bx",
"pcb/ic-rtl8710bn"
],
"build": {
"mcu": "rtl8710bx",
"variant": "generic-rtl8710bx-4mb-980k"
},
"name": "Generic - RTL8710BX (4M/980k)",
"symbol": "RTL8710BX (4M/980k)",
"url": "https://kuba2k2.github.io/libretuya/boards/generic-rtl8710bx-4mb-980k/",
"vendor": "Generic",
"doc": {
"extra": [
"## Information",
"This is a generic board definition for RTL8710BX with 4 MiB of flash. It has a bigger application partition size (980 KiB). The used bootloader is also different from the standard Tuya one.",
"It can be found in [Ezviz T31 smart plug](https://www.ezviz.com/product/T31/2021) - bare chip soldered onto the manufacturer-made PCB. The plug is not Tuya/SmartLife-compatible and has a 25Q32CSIG flash chip. Refer to [libretuya#23](https://github.com/kuba2k2/libretuya/issues/23) for photos and more information.",
"Note that stock firmware seems to use smaller app images (0x80000 / 512 KiB). After 0x180000 some product-test data and device logs can be found. Because the OTA2 offset is 0x100000, the board definition was configured to use all available space."
]
},
"pcb": {
"pinout": {
"1": {
"IC": 16,
"ARD": "D0"
},
"2": {
"IC": 28,
"ARD": "D1"
},
"3": {
"IC": 18,
"ARD": "D2"
},
"4": {
"IC": 19,
"ARD": "D3"
},
"5": {
"IC": 20,
"ARD": "D4"
},
"6": {
"IC": 21,
"ARD": "D5"
},
"7": {
"IC": 22,
"ARD": "D6"
},
"8": {
"IC": 23,
"ARD": "D7"
},
"9": {
"IC": 17,
"ARD": "D8"
},
"10": {
"IC": 13,
"ARD": "D9"
},
"11": {
"IC": 14,
"ARD": "D10"
},
"12": {
"IC": 29,
"ARD": "D11"
},
"13": {
"IC": 30,
"ARD": [
"D12",
"A0"
]
},
"14": {
"IC": 31,
"ARD": "D13"
},
"15": {
"IC": 32,
"ARD": "D14"
},
"16": {
"IC": 2,
"ARD": "D15"
},
"17": {
"IC": 1,
"ARD": "D16"
}
}
}
}

View File

@@ -0,0 +1,90 @@
# Generic - RTL8710BX (4M/980k)
*by Generic*
[Product page](https://kuba2k2.github.io/libretuya/boards/generic-rtl8710bx-4mb-980k/)
- [General info](../../docs/platform/realtek/README.md)
- [Debugging](../../docs/platform/realtek/debugging.md)
- [Flashing guide](../../docs/platform/realtek-ambz/flashing.md)
- [ImageTool (AmebaZ/AmebaD)](https://images.tuyacn.com/smart/Image_Tool/Image_Tool.zip)
Parameter | Value
-------------|----------------------------------
Board code | `generic-rtl8710bx-4mb-980k`
MCU | RTL8710BX
Manufacturer | Realtek
Series | AmebaZ
Frequency | 62.5 MHz
Flash size | 4 MiB
RAM size | 256 KiB
Voltage | 3.0V - 3.6V
I/O | 17x GPIO, 6x PWM, 2x UART, 1x ADC
Wi-Fi | 802.11 b/g/n
## Usage
**Board code:** `generic-rtl8710bx-4mb-980k`
In `platformio.ini`:
```ini
[env:generic-rtl8710bx-4mb-980k]
platform = libretuya
board = generic-rtl8710bx-4mb-980k
framework = arduino
```
## Arduino Core pin mapping
No. | Pin | UART | I²C | SPI | PWM | Other
----|------------|-----------|----------|----------------------|------|------
D0 | PA00 | | | | PWM2 |
D1 | PA05 | | | | PWM4 |
D2 | PA06 | | | FCS | |
D3 | PA07 | | | FD1 | |
D4 | PA08 | | | FD2 | |
D5 | PA09 | | | FD0 | |
D6 | PA10 | | | FSCK | |
D7 | PA11 | | | FD3 | |
D8 | PA12 | | | | PWM3 |
D9 | PA14 | | | | PWM0 | SWCLK
D10 | PA15 | | | | PWM1 | SWDIO
D11 | PA18 | UART0_RX | I2C1_SCL | SPI0_SCK, SPI1_SCK | |
D12 | PA19 | UART0_CTS | I2C0_SDA | SPI0_CS, SPI1_CS | |
D13 | PA22 | UART0_RTS | I2C0_SCL | SPI0_MISO, SPI1_MISO | PWM5 |
D14 | PA23 | UART0_TX | I2C1_SDA | SPI0_MOSI, SPI1_MOSI | PWM0 |
D15 | PA29 | UART2_RX | I2C0_SCL | | PWM4 |
D16 | PA30 | UART2_TX | I2C0_SDA | | PWM4 |
A0 | PA19, ADC1 | | | | |
## Flash memory map
Flash size: 4 MiB / 4,194,304 B / 0x400000
Hex values are in bytes.
Name | Start | Length | End
----------------|----------|-------------------|---------
Boot XIP | 0x000000 | 16 KiB / 0x4000 | 0x004000
Boot RAM | 0x004000 | 16 KiB / 0x4000 | 0x008000
(reserved) | 0x008000 | 4 KiB / 0x1000 | 0x009000
System Data | 0x009000 | 4 KiB / 0x1000 | 0x00A000
Calibration | 0x00A000 | 4 KiB / 0x1000 | 0x00B000
OTA1 Image | 0x00B000 | 980 KiB / 0xF5000 | 0x100000
OTA2 Image | 0x100000 | 980 KiB / 0xF5000 | 0x1F5000
Key-Value Store | 0x1F5000 | 32 KiB / 0x8000 | 0x1FD000
User Data | 0x1FD000 | 2 MiB / 0x202000 | 0x3FF000
RDP | 0x3FF000 | 4 KiB / 0x1000 | 0x400000
RDP is most likely not used in Tuya firmwares, as the System Data partition contains an incorrect offset 0xFF000 for RDP, which is in the middle of OTA2 image.
Additionally, Tuya firmware uses an encrypted KV or file storage, which resides at the end of flash memory. This seems to overlap system RDP area.
## Information
This is a generic board definition for RTL8710BX with 4 MiB of flash. It has a bigger application partition size (980 KiB). The used bootloader is also different from the standard Tuya one.
It can be found in [Ezviz T31 smart plug](https://www.ezviz.com/product/T31/2021) - bare chip soldered onto the manufacturer-made PCB. The plug is not Tuya/SmartLife-compatible and has a 25Q32CSIG flash chip. Refer to [libretuya#23](https://github.com/kuba2k2/libretuya/issues/23) for photos and more information.
Note that stock firmware seems to use smaller app images (0x80000 / 512 KiB). After 0x180000 some product-test data and device logs can be found. Because the OTA2 offset is 0x100000, the board definition was configured to use all available space.

View File

@@ -0,0 +1 @@
#include "variant.h"

View File

@@ -0,0 +1,46 @@
/* This file was auto-generated from generic-rtl8710bx-4mb-980k.json using boardgen */
#include <Arduino.h>
extern "C" {
// clang-format off
PinInfo pinTable[PINS_COUNT] = {
// D0: PA00, PWM2
{PA_0, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0},
// D1: PA05, PWM4, WAKE1
{PA_5, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0},
// D2: PA06, FCS, SD_D2
{PA_6, PIN_GPIO | PIN_IRQ | PIN_SPI, PIN_NONE, 0},
// D3: PA07, FD1, SD_D3
{PA_7, PIN_GPIO | PIN_IRQ | PIN_SPI, PIN_NONE, 0},
// D4: PA08, FD2, SD_CMD
{PA_8, PIN_GPIO | PIN_IRQ | PIN_SPI, PIN_NONE, 0},
// D5: PA09, FD0, SD_CLK
{PA_9, PIN_GPIO | PIN_IRQ | PIN_SPI, PIN_NONE, 0},
// D6: PA10, FSCK, SD_D0
{PA_10, PIN_GPIO | PIN_IRQ | PIN_SPI, PIN_NONE, 0},
// D7: PA11, FD3, SD_D1
{PA_11, PIN_GPIO | PIN_IRQ | PIN_SPI, PIN_NONE, 0},
// D8: PA12, PWM3
{PA_12, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0},
// D9: PA14, PWM0, SWCLK
{PA_14, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_SWD, PIN_NONE, 0},
// D10: PA15, PWM1, SWDIO
{PA_15, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_SWD, PIN_NONE, 0},
// D11: PA18, UART0_RX, SPI0_SCK, SPI1_SCK, I2C1_SCL, SD_D2, TMR4_TRIG, I2S0_MCK, WAKE0
{PA_18, PIN_GPIO | PIN_IRQ | PIN_I2C | PIN_I2S | PIN_SPI | PIN_UART, PIN_NONE, 0},
// D12: PA19, ADC1, UART0_CTS, SPI0_CS, SPI1_CS, I2C0_SDA, SD_D3, TMR5_TRIG, I2S0_TX
{PA_19, PIN_GPIO | PIN_IRQ | PIN_ADC | PIN_I2C | PIN_I2S | PIN_SPI | PIN_UART, PIN_NONE, 0},
// D13: PA22, UART0_RTS, SPI0_MISO, SPI1_MISO, I2C0_SCL, SD_D0, PWM5, I2S0_WS, WAKE2
{PA_22, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_I2S | PIN_SPI | PIN_UART, PIN_NONE, 0},
// D14: PA23, UART0_TX, SPI0_MOSI, SPI1_MOSI, I2C1_SDA, SD_D1, PWM0, WAKE3
{PA_23, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_SPI | PIN_UART, PIN_NONE, 0},
// D15: PA29, UART2_RX, I2C0_SCL, PWM4
{PA_29, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_UART, PIN_NONE, 0},
// D16: PA30, UART2_TX, I2C0_SDA, PWM4
{PA_30, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_UART, PIN_NONE, 0},
};
// clang-format on
} // extern "C"

View File

@@ -0,0 +1,51 @@
/* This file was auto-generated from generic-rtl8710bx-4mb-980k.json using boardgen */
#pragma once
#include <WVariant.h>
// clang-format off
// Pins
// ----
#define PINS_COUNT 17
#define NUM_DIGITAL_PINS 17
#define NUM_ANALOG_INPUTS 1
#define NUM_ANALOG_OUTPUTS 0
// Analog pins
// -----------
#define PIN_A0 12u // PA_19
#define A0 PIN_A0
// SPI Interfaces
// --------------
#define SPI_INTERFACES_COUNT 2
#define PIN_SPI0_CS 12u // PA_19
#define PIN_SPI0_MISO 13u // PA_22
#define PIN_SPI0_MOSI 14u // PA_23
#define PIN_SPI0_SCK 11u // PA_18
#define PIN_SPI1_CS 12u // PA_19
#define PIN_SPI1_MISO 13u // PA_22
#define PIN_SPI1_MOSI 14u // PA_23
#define PIN_SPI1_SCK 11u // PA_18
// Wire Interfaces
// ---------------
#define WIRE_INTERFACES_COUNT 2
#define PIN_WIRE0_SCL_0 13u // PA_22
#define PIN_WIRE0_SCL_1 15u // PA_29
#define PIN_WIRE0_SDA_0 12u // PA_19
#define PIN_WIRE0_SDA_1 16u // PA_30
#define PIN_WIRE1_SCL 11u // PA_18
#define PIN_WIRE1_SDA 14u // PA_23
// Serial ports
// ------------
#define SERIAL_INTERFACES_COUNT 2
#define PIN_SERIAL0_CTS 12u // PA_19
#define PIN_SERIAL0_RTS 13u // PA_22
#define PIN_SERIAL0_RX 11u // PA_18
#define PIN_SERIAL0_TX 14u // PA_23
#define PIN_SERIAL2_RX 15u // PA_29
#define PIN_SERIAL2_TX 16u // PA_30