39 Commits

Author SHA1 Message Date
Kuba Szczodrzyński
2450f8c64b [release] v0.12.4
Some checks failed
Lint check / Lint with clang-format (push) Has been cancelled
Lint check / Lint with black (push) Has been cancelled
PlatformIO Publish / publish (push) Has been cancelled
2023-01-26 11:28:25 +01:00
Kuba Szczodrzyński
676a9b1686 [core] Fix reinstalling ltchiptool 2023-01-26 11:28:09 +01:00
Kuba Szczodrzyński
b10db63c74 [realtek-ambz] Fix WiFi station BSSID retrieval 2023-01-19 17:38:45 +01:00
Kuba Szczodrzyński
4b25ef7516 [realtek-ambz] Fix resetting OTA switch when it reaches 0 2023-01-19 16:53:27 +01:00
Kuba Szczodrzyński
de0d19cda6 [docs] Update ltchiptool installation info 2023-01-19 12:29:59 +01:00
Kuba Szczodrzyński
c55386af0e [docs] Add icons to external links 2023-01-18 19:06:18 +01:00
Kuba Szczodrzyński
33fe1c7a54 Merge branch 'docs-refactor' 2023-01-18 18:39:11 +01:00
Kuba Szczodrzyński
bf6d05e92a [docs] Remove AmbZ doxygen build 2023-01-18 18:38:52 +01:00
Kuba Szczodrzyński
b6113d8d2b [docs] Configure MkDocs Material 2023-01-18 18:32:34 +01:00
Kuba Szczodrzyński
bc31154035 [docs] Add Tuya Pinout Config to resources 2023-01-18 17:59:51 +01:00
Kuba Szczodrzyński
edfe0329bf [docs] Update links in board docs 2023-01-18 17:59:19 +01:00
Kuba Szczodrzyński
1e11dd776a [docs] Move resources to chip family docs 2023-01-18 17:56:09 +01:00
Kuba Szczodrzyński
028526d22d [docs] Add ltchiptool GUI download button 2023-01-18 15:00:01 +01:00
Kuba Szczodrzyński
7ac2d854f2 [docs] Move tools docs to a subdirectory 2023-01-18 14:59:36 +01:00
Kuba Szczodrzyński
279c81e431 [docs] Update code block styles 2023-01-18 14:02:12 +01:00
Kuba Szczodrzyński
4e319b40ed [docs] Fix ltchiptool docs badges 2023-01-18 13:30:13 +01:00
Kuba Szczodrzyński
d082b39980 [docs] Add ltchiptool screenshot 2023-01-17 22:45:00 +01:00
Kuba Szczodrzyński
277402f577 [docs] Update chip flashing guides, fix mkdocs building 2023-01-17 22:33:57 +01:00
Kuba Szczodrzyński
9e95c507b1 [docs] Refactor docs structure, add project upload guides 2023-01-17 18:56:15 +01:00
Kuba Szczodrzyński
7440fc6f46 [core] Add parent_description key to families 2023-01-16 10:42:30 +01:00
Kuba Szczodrzyński
a24028f674 [beken-72xx] Fix RBL app size typo 2023-01-16 10:41:17 +01:00
Stroe Andrei Catalin
00913b013f [beken-72xx] Fix compilation on ARM systems (#58)
* Fix toolchain for BK7231 on ARM cpus

* Fix format

* PR comments

* PR Comments, part 2
2023-01-03 21:15:03 +01:00
Mihai Ambrosie
447d08d613 [realtek-ambz] Fix 4M/980k linker script name (#56) 2023-01-03 10:56:48 +01:00
Kuba Szczodrzyński
d4f7736b2d [release] v0.12.3
Some checks failed
Lint check / Lint with clang-format (push) Has been cancelled
Lint check / Lint with black (push) Has been cancelled
PlatformIO Publish / publish (push) Has been cancelled
2023-01-02 20:32:46 +01:00
Kuba Szczodrzyński
60f72fffdf [core] Fix installing ltchiptool, again 2023-01-02 20:32:29 +01:00
Kuba Szczodrzyński
77af9c1cba [release] v0.12.2
Some checks failed
Lint check / Lint with clang-format (push) Has been cancelled
Lint check / Lint with black (push) Has been cancelled
PlatformIO Publish / publish (push) Has been cancelled
2023-01-02 19:41:39 +01:00
Kuba Szczodrzyński
1b2414337f [core] Fix installing ltchiptool 2023-01-02 19:40:55 +01:00
Kuba Szczodrzyński
d41f1f2a4d [release] v0.12.1
Some checks failed
Lint check / Lint with clang-format (push) Has been cancelled
Lint check / Lint with black (push) Has been cancelled
PlatformIO Publish / publish (push) Has been cancelled
2023-01-02 17:06:16 +01:00
Kuba Szczodrzyński
f9967ff990 [core] Fix importing ltchiptool after updating 2023-01-02 17:05:35 +01:00
Kuba Szczodrzyński
db0ab41ea4 [realtek-ambz] Check SoftwareSerial before stopping 2023-01-02 16:03:49 +01:00
Kuba Szczodrzyński
da95cc30d3 [realtek-ambz] Move to GNU++11, update TODO.md 2023-01-02 16:02:57 +01:00
Ross Reedstrom
6b3001573e [docs] Fix link to supported boards (#53) 2023-01-01 14:05:57 +01:00
Kuba Szczodrzyński
b85f6f8c3f [release] v0.12.0
Some checks failed
Lint check / Lint with clang-format (push) Has been cancelled
Lint check / Lint with black (push) Has been cancelled
PlatformIO Publish / publish (push) Has been cancelled
2022-12-30 15:52:14 +01:00
Kuba Szczodrzyński
d036ac9fba [core] Migrate to ltchiptool v2.0.0 2022-12-30 15:51:32 +01:00
Kuba Szczodrzyński
f63a114371 [beken-72xx] Support compilation for BK7251 family 2022-12-08 20:16:44 +01:00
Kuba Szczodrzyński
8cb59661ac [boards] Add initial support for BK7252 2022-12-08 20:04:17 +01:00
Kuba Szczodrzyński
fc1da609f2 [beken-72xx] Add BL2028N to supported chips 2022-12-08 17:48:04 +01:00
Kuba Szczodrzyński
c6566323fd [boards] Move IC pinouts to separate directory 2022-12-08 17:26:46 +01:00
Kuba Szczodrzyński
30e1533ad9 [core] Rename BK7231T family to BK7231U 2022-12-08 17:19:42 +01:00
139 changed files with 2350 additions and 617 deletions

1
.gitignore vendored
View File

@@ -256,6 +256,5 @@ cython_debug/
# mkdocs
xml/
ltapi/
ltambz/
hashChanges.yaml
.piopm

View File

@@ -22,7 +22,7 @@ The main goal of this project is to provide a usable build environment for IoT d
the project focuses on developing working Arduino-compatible cores for supported families. The cores are inspired by Espressif's official core for ESP32,
which should make it easier to port/run existing ESP apps on Tuya IoT (and 3-rd party) modules.
LibreTuya also provides a common interface for all family implementations. The interface is based on ESP32 official libraries.
**There's an [ESPHome port](https://docs.libretuya.ml/docs/projects/esphome/) based on LibreTuya, which supports BK7231 and RTL8710B chips.**
**Note:** this project is work-in-progress.
@@ -31,11 +31,7 @@ LibreTuya also provides a common interface for all family implementations. The i
1. [Install PlatformIO](https://platformio.org/platformio-ide)
2. `platformio platform install https://github.com/kuba2k2/libretuya`
3. Create a project, build it and upload!
4. See the [docs](https://kuba2k2.github.io/libretuya/) for any questions/problems.
## Board List
See [Boards & CPU list](https://kuba2k2.github.io/libretuya/docs/status/supported/).
4. See the [docs](https://docs.libretuya.ml/) for any questions/problems.
## Arduino Core support status

View File

@@ -1,40 +1,30 @@
* [Home](README.md)
* 😊 Getting started
* [Start here](docs/getting-started/README.md)
* [Uploading](docs/getting-started/uploading.md)
* [Options & config](docs/reference/config.md)
* Examples
* [PinScan](examples/PinScan/README.md)
* [ESPHome port](docs/projects/esphome.md)
* [Using tuya-cloudcutter](docs/getting-started/cloudcutter.md)
* [Auto-download-reboot](docs/getting-started/adr.md)
* [💻 Boards & CPU list](docs/status/supported.md)
* [✔️ Implementation status](docs/status/arduino.md)
* Supported chip families
* Beken BK72xx
* [General info](docs/platform/beken-72xx/README.md)
* [Flashing](docs/platform/beken-72xx/flashing.md)
* [Dumping](docs/platform/beken-72xx/dumping.md)
* Realtek AmebaZ Series
* [General info](docs/platform/realtek/README.md)
* [Flashing (AmebaZ)](docs/platform/realtek-ambz/flashing.md)
* [Dumping (AmebaZ)](docs/platform/realtek-ambz/dumping.md)
* [Debugging](docs/platform/realtek/debugging.md)
* [Exception decoder](docs/platform/realtek/exception-decoder.md)
* C library
* [Built-in functions](docs/platform/realtek-ambz/stdlib.md)
* [Memory management](docs/platform/realtek-ambz/memory-management.md)
* [All supported boards](boards/)
* API & libraries
* [Options & config](docs/reference/config.md)
* [LibreTuya API](docs/reference/lt-api.md)
* [😊 Getting started](docs/getting-started/README.md)
* [ESPHome](docs/projects/esphome.md)
* [📲 Flashing/dumping](docs/flashing/)
* [💻 Supported boards & chips](docs/status/supported.md)
* 📖 Reference
* Chip families
* [Beken BK72xx](docs/platform/beken-72xx/README.md)
* [Realtek Ameba - info](docs/platform/realtek-amb/README.md)
* [Realtek AmebaZ](docs/platform/realtek-ambz/README.md)
* [Debugging](docs/platform/realtek-ambz/debugging.md)
* [Exception decoder](docs/platform/realtek-ambz/exception-decoder.md)
* C library
* [Built-in functions](docs/platform/realtek-ambz/stdlib.md)
* [Memory management](docs/platform/realtek-ambz/memory-management.md)
* [🔧 LT configuration](docs/reference/config.md)
* [✔️ Implementation status](docs/status/arduino.md)
* [🔌 Boards documentation](boards/)
* [🔋 Examples](examples/)
* [📖 LibreTuya API](docs/reference/lt-api.md)
* [LT class reference](ltapi/class_libre_tuya.md)
* [Common methods](ltapi/_libre_tuya_a_p_i_8h.md)
* [Wiring custom methods](ltapi/_libre_tuya_custom_8h.md)
* [Logger](ltapi/lt__logger_8h.md)
* [Chip & family IDs](ltapi/_chip_type_8h_source.md)
* [POSIX utilities](ltapi/lt__posix__api_8h.md)
* Common API
* 📖 Common API
* [FS](ltapi/classfs_1_1_f_s.md)
* [Preferences](ltapi/class_i_preferences.md)
* [SoftwareSerial](ltapi/class_software_serial.md)
@@ -42,7 +32,7 @@
* [TCP Client](ltapi/class_i_wi_fi_client.md)
* [SSL Client](ltapi/class_i_wi_fi_client_secure.md)
* [TCP Server](ltapi/class_i_wi_fi_server.md)
* [LibreTuya libraries](docs/libs-built-in.md)
* [📖 LibreTuya libraries](docs/libs-built-in.md)
* [base64](ltapi/classbase64.md)
* [Flash](ltapi/class_flash_class.md)
* [HTTPClient](ltapi/class_h_t_t_p_client.md)
@@ -64,6 +54,5 @@
* [✈️ OTA format](docs/ota/README.md)
* [uf2ota.py tool](docs/ota/uf2ota.md)
* [uf2ota.h library](docs/ota/library.md)
* [uf2ota.h reference](ltapi/uf2ota_8h.md)
* [📓 TODO](TODO.md)
* [🔗 Resources](docs/resources.md)
* [📓 TODO](TODO.md)
* [🔗 Resources](docs/resources/)

14
TODO.md
View File

@@ -2,6 +2,16 @@
## General
### Environment stability
Do not publish *any* SDK functions, macros, defines and includes. Define only what's needed in LT's public headers (like `Arduino.h`). Everything else is taken from `sdk_extern.h` or `WVariant.h` (TODO decide whether to keep WV public / make both private / get rid of WV and use sdk_extern only). Private headers are included by LT's .cpp units (maybe a dedicated private header that would include sdk_extern + Arduino.h).
Developers wanting to use SDK functions need to include them.
Explicit is better than implicit.
- consider moving to C++17 (GNU)? or any newer than C++11
### New families
- BL602
@@ -10,6 +20,7 @@
- RTL8720D
- W600 and/or W800
- LN8825
- BK7231Q
- host-native family
### Tools
@@ -30,7 +41,6 @@
## BK7231
- implement OTA
- fix WiFi on BK7231N, test other functionality
- fix SSL (mbedTLS)
- I2C (Wire)
@@ -39,5 +49,5 @@
## RTL8710B
- move to GNU++11 (and verify that it works) - take all stdio functions from stdio.h
- take all stdio functions from stdio.h
- rewrite most of Wiring (it was copied from `ambd_arduino`, and is ugly)

View File

@@ -16,6 +16,7 @@ void delayMilliseconds(unsigned long ms) {
}
static uint32_t getTicksCount() {
// copied from bk_timer_ctrl(), for speeds
uint32_t timeout = 0;
REG_WRITE(TIMER0_2_READ_CTL, (BKTIMER0 << 2) | 1);
while (REG_READ(TIMER0_2_READ_CTL) & 1) {
@@ -58,9 +59,6 @@ unsigned long millis() {
}
unsigned long micros() {
// copied from bk_timer_ctrl(), for speeds
uint32_t timeout = 0;
#if (CFG_SOC_NAME == SOC_BK7231)
#error "Not implemented"
#endif
@@ -91,6 +89,7 @@ unsigned long micros() {
return correctedMillis * 1000 + nowTicks / (CFG_XTAL_FREQUENCE / 1000 / 1000);
#else
#if 0
uint32_t timeout = 0;
REG_WRITE(TIMER3_5_READ_CTL, (BKTIMER3 << 2) | 1);
while (REG_READ(TIMER3_5_READ_CTL) & 1) {
timeout++;

View File

@@ -11,8 +11,9 @@ enum ChipFamily {
F_RTL8710B = 0x22E0D6FC, // Realtek AmebaZ (realtek-ambz)
F_RTL8720C = 0xE08F7564, // Realtek AmebaZ2
F_RTL8720D = 0x3379CFE2, // Realtek AmebaD
F_BK7231T = 0x675A40B0, // Beken 7231T
F_BK7231U = 0x675A40B0, // Beken 7231U/7231T
F_BK7231N = 0x7B3EF230, // Beken 7231N
F_BK7251 = 0x6A82CC42, // Beken 7251/7252
F_BL602 = 0xDE1270B7, // Boufallo 602
F_XR809 = 0x51E903A8, // Xradiotech 809
F_NATIVE = 0xDEADBEEF, // Host-native
@@ -29,6 +30,8 @@ enum ChipType {
RTL8711BN = CHIP_TYPE(F_RTL8710B, 0xFD), // CHIPID_8711BN / QFN48
RTL8711BU = CHIP_TYPE(F_RTL8710B, 0xFC), // CHIPID_8711BG / QFN68
// Beken 72XX
BK7231T = CHIP_TYPE(F_BK7231T, 0x1A), // *SCTRL_CHIP_ID = 0x7231a
BK7231T = CHIP_TYPE(F_BK7231U, 0x1A), // *SCTRL_CHIP_ID = 0x7231a
BK7231N = CHIP_TYPE(F_BK7231N, 0x1C), // *SCTRL_CHIP_ID = 0x7231c
BL2028N = CHIP_TYPE(F_BK7231N, 0x1C), // *SCTRL_CHIP_ID = 0x7231c
BK7252 = CHIP_TYPE(F_BK7251, 0x00), // TODO
};

View File

@@ -2,6 +2,8 @@
#include <LibreTuyaAPI.h>
#include <Flash.h>
extern "C" {
#include <flash_api.h>
#include <rtl8710b.h>
@@ -39,7 +41,7 @@ void LibreTuya::gpioRecover() {
ChipType LibreTuya::getChipType() {
uint8_t chipId;
EFUSE_OneByteReadROM(9902, 0xF8, &chipId, L25EOUTVOLTAGE);
return CHIP_TYPE_ENUM(F_RTL8710B, chipId);
return CHIP_TYPE_ENUM(FAMILY, chipId);
}
const char *LibreTuya::getChipModel() {
@@ -155,25 +157,24 @@ bool LibreTuya::otaSwitch(bool force) {
if (!force && otaGetRunning() != otaGetStoredIndex())
// OTA has already been switched
return true;
// this function does:
// - read OTA1 firmware magic from 0xB000
// - read OTA2 address from 0x9000
// - read OTA2 firmware magic from that address
// - read current OTA switch value from 0x9004
// - reset OTA switch to 0xFFFFFFFF if it's 0x0
// - check first non-zero bit of OTA switch
// - reset OTA switch to 0xFFFFFFFE if it's 0x0
// - else check first non-zero bit of OTA switch
// - write OTA switch with first non-zero bit cleared
// sys_clear_ota_signature();
// ok, this function is broken (crashes with HardFault)
if (!otaHasImage1() || !otaHasImage2())
return false;
uint32_t value = HAL_READ32(SPI_FLASH_BASE, FLASH_SYSTEM_OFFSET + 4);
if (value == 0) {
// TODO does this work at all?
FLASH_EreaseDwordsXIP(FLASH_SYSTEM_OFFSET + 4, 1);
uint8_t *system = (uint8_t *)malloc(64);
Flash.readBlock(FLASH_SYSTEM_OFFSET, system, 64);
// reset OTA switch
((uint32_t *)system)[1] = -2;
Flash.eraseSector(FLASH_SYSTEM_OFFSET);
return Flash.writeBlock(FLASH_SYSTEM_OFFSET, system, 64);
}
uint8_t i;
// find first non-zero bit
for (i = 0; i < 32; i++) {

View File

@@ -83,6 +83,8 @@ void SoftwareSerial::begin(unsigned long baudrate, uint16_t config) {
}
void SoftwareSerial::end() {
if (!(bool)this)
return;
gtimer_stop(OBJ);
gtimer_deinit(OBJ);
free(OBJ);

View File

@@ -201,9 +201,8 @@ const String WiFiClass::psk() {
}
uint8_t *WiFiClass::BSSID() {
uint8_t bssid[ETH_ALEN];
wext_get_bssid(NETNAME_STA, bssid);
return bssid;
wext_get_bssid(NETNAME_STA, wifi.bssid.octet);
return wifi.bssid.octet;
}
int8_t WiFiClass::RSSI() {

View File

@@ -2,6 +2,7 @@
- [Generic - BK7231N (Tuya QFN32)](../boards/generic-bk7231n-qfn32-tuya/README.md)
- [Generic - BK7231T (Tuya QFN32)](../boards/generic-bk7231t-qfn32-tuya/README.md)
- [Generic - BK7252](../boards/generic-bk7252/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)

View File

@@ -1,25 +1,6 @@
{
"build": {
"bkcrypt_coeffs": "510fb093a3cbeadc5993a17ec7adeb03",
"bkboot_version": "1.0.1-bk7231n",
"bkrbl_size_app": "0x107800"
},
"flash": {
"bootloader": "0x000000+0x11000",
"app": "0x011000+0x119000",
"download": "0x12A000+0xA6000",
"calibration": "0x1D0000+0x1000",
"net": "0x1D1000+0x1000",
"tlv": "0x1D2000+0x1000",
"kvs": "0x1D3000+0x8000",
"userdata": "0x1DB000+0x25000"
},
"upload": {
"maximum_size": 1083136
},
"doc": {
"extra": [
"Bootloader and app partitions contain CRC16 sums every 32 bytes. That results in the actual flash offsets/sizes not aligned to sector boundaries. To simplify calculations, the values shown in the table (extracted from bootloader's partition table) were aligned to 4096 bytes."
]
"bkboot_version": "1.0.1-bk7231n"
}
}

View File

@@ -2,11 +2,27 @@
"build": {
"family": "BK7231N",
"ldscript_sdk": "bk7231n_bsp.ld",
"ldscript_arduino": "bk7231n_bsp.ld"
"ldscript_arduino": "bk7231n_bsp.ld",
"bkboot_version": "1.0.1-bk7231n",
"bkrbl_size_app": "0x108700"
},
"flash": {
"bootloader": "0x000000+0x11000",
"app": "0x011000+0x119000",
"download": "0x12A000+0xA6000",
"calibration": "0x1D0000+0x1000",
"net": "0x1D1000+0x1000",
"tlv": "0x1D2000+0x1000",
"kvs": "0x1D3000+0x8000",
"userdata": "0x1DB000+0x25000"
},
"upload": {
"maximum_size": 1083136,
"speed": 460800
},
"connectivity": [
"ble"
],
"doc": {
"params": {
"extra": {

View File

@@ -1,25 +1,6 @@
{
"build": {
"bkcrypt_coeffs": "510fb093a3cbeadc5993a17ec7adeb03",
"bkboot_version": "1.0.5-bk7231s",
"bkrbl_size_app": "0x107800"
},
"flash": {
"bootloader": "0x000000+0x11000",
"app": "0x011000+0x121000",
"download": "0x132000+0xA6000",
"kvs": "0x1D8000+0x8000",
"calibration": "0x1E0000+0x1000",
"tlv": "0x1E1000+0x1000",
"net": "0x1E2000+0x1000",
"userdata": "0x1E3000+0x1D000"
},
"upload": {
"maximum_size": 1083136
},
"doc": {
"extra": [
"Bootloader and app partitions contain CRC16 sums every 32 bytes. That results in the actual flash offsets/sizes not aligned to sector boundaries. To simplify calculations, the values shown in the table (extracted from bootloader's partition table) were aligned to 4096 bytes."
]
"bkboot_version": "1.0.5-bk7231s"
}
}

View File

@@ -1,17 +0,0 @@
{
"build": {
"family": "BK7231T",
"ldscript_sdk": "bk7231_bsp.ld",
"ldscript_arduino": "bk7231_bsp.ld"
},
"upload": {
"speed": 921600
},
"doc": {
"params": {
"extra": {
"Bluetooth": "BLE v4.2"
}
}
}
}

View File

@@ -0,0 +1,33 @@
{
"build": {
"family": "BK7231U",
"ldscript_sdk": "bk7231_bsp.ld",
"ldscript_arduino": "bk7231_bsp.ld",
"bkboot_version": "1.0.8-bk7231u",
"bkrbl_size_app": "0x108700"
},
"flash": {
"bootloader": "0x000000+0x11000",
"app": "0x011000+0x121000",
"download": "0x132000+0xA6000",
"kvs": "0x1D8000+0x8000",
"calibration": "0x1E0000+0x1000",
"tlv": "0x1E1000+0x1000",
"net": "0x1E2000+0x1000",
"userdata": "0x1E3000+0x1D000"
},
"upload": {
"maximum_size": 1083136,
"speed": 921600
},
"connectivity": [
"ble"
],
"doc": {
"params": {
"extra": {
"Bluetooth": "BLE v4.2"
}
}
}
}

View File

@@ -0,0 +1,40 @@
{
"build": {
"family": "BK7251",
"f_cpu": "180000000L",
"ldscript_sdk": "bk7231_bsp.ld",
"ldscript_arduino": "bk7231_bsp.ld",
"bkboot_version": "0.1.3-bk7252",
"bkrbl_size_app": "0x1A0000"
},
"flash": {
"bootloader": "0x000000+0x11000",
"app": "0x011000+0x1BA000",
"filesystem": "0x1CB000+0x119000",
"kvs": "0x2E4000+0x8000",
"download": "0x2EC000+0x112000",
"calibration": "0x3FE000+0x1000",
"tlv": "0x3FF000+0x1000"
},
"debug": {
"gdb_init": [
"mem 0x200000 0x400000 ro"
]
},
"upload": {
"maximum_ram_size": 524288,
"flash_size": 4194304,
"maximum_size": 1703936,
"speed": 921600
},
"connectivity": [
"ble"
],
"doc": {
"params": {
"extra": {
"Bluetooth": "BLE v5.0"
}
}
}
}

View File

@@ -10,8 +10,7 @@
}
},
"connectivity": [
"wifi",
"ble"
"wifi"
],
"debug": {
"protocol": "openocd",
@@ -47,8 +46,10 @@
},
"links": {
"General info": "../../docs/platform/beken-72xx/README.md",
"Flashing guide": "../../docs/platform/beken-72xx/flashing.md",
"BkWriter v1.6.0": "https://images.tuyacn.com/smart/bk_writer1.60/bk_writer1.60.exe"
}
"Flashing guide": "../../docs/platform/beken-72xx/flashing.md"
},
"extra": [
"Bootloader and app partitions contain CRC16 sums every 32 bytes. That results in the actual flash offsets/sizes not aligned to sector boundaries. To simplify calculations, the values shown in the table (extracted from bootloader's partition table) were aligned to 4096 bytes."
]
}
}

View File

@@ -0,0 +1,186 @@
{
"pcb": {
"ic": {
"10": {
"C_NAME": "GPIO25",
"GPIO": "P25",
"IRQ": null,
"USB": "DP"
},
"11": {
"C_NAME": "GPIO33",
"GPIO": "P33",
"IRQ": null,
"DVP": "PD1"
},
"12": {
"C_NAME": "GPIO32",
"GPIO": "P32",
"IRQ": null,
"DVP": "PD0"
},
"13": {
"C_NAME": "GPIO29",
"GPIO": "P29",
"IRQ": null,
"DVP": "PCLK"
},
"14": {
"C_NAME": "GPIO27",
"GPIO": "P27",
"IRQ": null,
"DVP": "MCLK"
},
"15": {
"C_NAME": "GPIO30",
"GPIO": "P30",
"IRQ": null,
"DVP": "HSYNC"
},
"16": {
"C_NAME": "GPIO31",
"GPIO": "P31",
"IRQ": null,
"DVP": "VSYNC"
},
"17": {
"C_NAME": "GPIO34",
"GPIO": "P34",
"IRQ": null,
"DVP": "PD2"
},
"18": {
"C_NAME": "GPIO35",
"GPIO": "P35",
"IRQ": null,
"DVP": "PD3"
},
"19": {
"C_NAME": "GPIO36",
"GPIO": "P36",
"IRQ": null,
"DVP": "PD4"
},
"20": {
"C_NAME": "GPIO37",
"GPIO": "P37",
"IRQ": null,
"DVP": "PD5"
},
"21": {
"C_NAME": "GPIO38",
"GPIO": "P38",
"IRQ": null,
"DVP": "PD6"
},
"22": {
"C_NAME": "GPIO39",
"GPIO": "P39",
"IRQ": null,
"DVP": "PD7"
},
"23": {
"C_NAME": "GPIO14",
"GPIO": "P14",
"IRQ": null,
"SD": "CLK",
"SPI": "SCK"
},
"24": {
"C_NAME": "GPIO16",
"GPIO": "P16",
"IRQ": null,
"SD": "D0",
"SPI": "MOSI"
},
"25": {
"C_NAME": "GPIO15",
"GPIO": "P15",
"IRQ": null,
"SD": "CMD",
"SPI": "CS"
},
"26": {
"C_NAME": "GPIO17",
"GPIO": "P17",
"IRQ": null,
"SD": "D1",
"SPI": "MISO"
},
"27": {
"C_NAME": "GPIO23",
"GPIO": "P23",
"IRQ": null,
"ADC": 3,
"JTAG": "TDO",
"FLASH": "FSO"
},
"28": {
"C_NAME": "GPIO22",
"GPIO": "P22",
"IRQ": null,
"JTAG": "TDI",
"FLASH": "FSI"
},
"29": {
"C_NAME": "GPIO21",
"GPIO": "P21",
"IRQ": null,
"I2C": "1_SDA",
"JTAG": "TMS",
"I2S": "MCLK",
"FLASH": "^FCS"
},
"30": {
"C_NAME": "GPIO20",
"GPIO": "P20",
"IRQ": null,
"I2C": "1_SCL",
"JTAG": "TCK",
"FLASH": "FSCK"
},
"31": {
"IO": "I",
"CTRL": "CEN"
},
"32": {
"C_NAME": "GPIO8",
"GPIO": "P8",
"IRQ": null,
"PWM": 2
},
"33": {
"C_NAME": "GPIO9",
"GPIO": "P9",
"IRQ": null,
"PWM": 3
},
"34": {
"C_NAME": "GPIO10",
"GPIO": "P10",
"IRQ": null,
"UART": "1_RX"
},
"35": {
"C_NAME": "GPIO11",
"GPIO": "P11",
"IRQ": null,
"UART": "1_TX"
},
"36": {
"C_NAME": "GPIO1",
"GPIO": "P1",
"IRQ": null,
"UART": "2_RX",
"I2C": "2_SDA"
},
"37": {
"C_NAME": "GPIO0",
"GPIO": "P0",
"IRQ": null,
"UART": "2_TX",
"I2C": "2_SCL"
}
}
}
}

View File

@@ -0,0 +1,259 @@
{
"pcb": {
"ic": {
"13": {
"C_NAME": "GPIO28",
"GPIO": "P28",
"IRQ": null,
"USB": "DN"
},
"14": {
"C_NAME": "GPIO25",
"GPIO": "P25",
"IRQ": null,
"USB": "DP"
},
"16": {
"C_NAME": "GPIO12",
"GPIO": "P12",
"IRQ": null,
"ADC": 6,
"UART": "1_CTS"
},
"17": {
"C_NAME": "GPIO13",
"GPIO": "P13",
"IRQ": null,
"ADC": 7,
"UART": "1_RTS"
},
"18": {
"C_NAME": "GPIO33",
"GPIO": "P33",
"IRQ": null,
"DVP": "PD1"
},
"19": {
"C_NAME": "GPIO32",
"GPIO": "P32",
"IRQ": null,
"DVP": "PD0"
},
"20": {
"C_NAME": "GPIO29",
"GPIO": "P29",
"IRQ": null,
"DVP": "PCLK"
},
"21": {
"C_NAME": "GPIO27",
"GPIO": "P27",
"IRQ": null,
"DVP": "MCLK"
},
"22": {
"C_NAME": "GPIO30",
"GPIO": "P30",
"IRQ": null,
"DVP": "HSYNC"
},
"23": {
"C_NAME": "GPIO31",
"GPIO": "P31",
"IRQ": null,
"DVP": "VSYNC"
},
"24": {
"C_NAME": "GPIO34",
"GPIO": "P34",
"IRQ": null,
"DVP": "PD2"
},
"25": {
"C_NAME": "GPIO35",
"GPIO": "P35",
"IRQ": null,
"DVP": "PD3"
},
"26": {
"C_NAME": "GPIO36",
"GPIO": "P36",
"IRQ": null,
"DVP": "PD4"
},
"27": {
"C_NAME": "GPIO37",
"GPIO": "P37",
"IRQ": null,
"DVP": "PD5"
},
"28": {
"C_NAME": "GPIO38",
"GPIO": "P38",
"IRQ": null,
"DVP": "PD6"
},
"29": {
"C_NAME": "GPIO39",
"GPIO": "P39",
"IRQ": null,
"DVP": "PD7"
},
"30": {
"C_NAME": "GPIO19",
"GPIO": "P19",
"IRQ": null,
"SD": "D1"
},
"31": {
"C_NAME": "GPIO17",
"GPIO": "P17",
"IRQ": null,
"SD": "D1",
"SPI": "MISO"
},
"32": {
"C_NAME": "GPIO14",
"GPIO": "P14",
"IRQ": null,
"SD": "CLK",
"SPI": "SCK"
},
"33": {
"C_NAME": "GPIO16",
"GPIO": "P16",
"IRQ": null,
"SD": "D0",
"SPI": "MOSI"
},
"34": {
"C_NAME": "GPIO15",
"GPIO": "P15",
"IRQ": null,
"SD": "CMD",
"SPI": "CS"
},
"35": {
"C_NAME": "GPIO18",
"GPIO": "P18",
"IRQ": null,
"SD": "D2"
},
"36": {
"C_NAME": "GPIO24",
"GPIO": "P24",
"IRQ": null,
"PWM": 4
},
"37": {
"C_NAME": "GPIO26",
"GPIO": "P26",
"IRQ": null,
"PWM": 5,
"IRDA": null
},
"38": {
"C_NAME": "GPIO23",
"GPIO": "P23",
"IRQ": null,
"ADC": 3,
"JTAG": "TDO",
"FLASH": "FSO"
},
"39": {
"C_NAME": "GPIO22",
"GPIO": "P22",
"IRQ": null,
"JTAG": "TDI",
"FLASH": "FSI"
},
"40": {
"C_NAME": "GPIO21",
"GPIO": "P21",
"IRQ": null,
"I2C": "1_SDA",
"JTAG": "TMS",
"I2S": "MCLK",
"FLASH": "^FCS"
},
"41": {
"C_NAME": "GPIO20",
"GPIO": "P20",
"IRQ": null,
"I2C": "1_SCL",
"JTAG": "TCK",
"FLASH": "FSCK"
},
"43": {
"IO": "I",
"CTRL": "CEN"
},
"45": {
"C_NAME": "GPIO5",
"GPIO": "P5",
"IRQ": null,
"ADC": 2,
"I2S": "DOUT"
},
"46": {
"C_NAME": "GPIO3",
"GPIO": "P3",
"IRQ": null,
"ADC": 5,
"I2S": "WS"
},
"47": {
"C_NAME": "GPIO4",
"GPIO": "P4",
"IRQ": null,
"ADC": 1,
"I2S": "DIN"
},
"48": {
"C_NAME": "GPIO2",
"GPIO": "P2",
"IRQ": null,
"ADC": 4,
"I2S": "SCK"
},
"49": {
"C_NAME": "GPIO6",
"GPIO": "P6",
"IRQ": null,
"PWM": 0
},
"50": {
"C_NAME": "GPIO7",
"GPIO": "P7",
"IRQ": null,
"PWM": 1
},
"62": {
"C_NAME": "GPIO10",
"GPIO": "P10",
"IRQ": null,
"UART": "1_RX"
},
"63": {
"C_NAME": "GPIO11",
"GPIO": "P11",
"IRQ": null,
"UART": "1_TX"
},
"64": {
"C_NAME": "GPIO1",
"GPIO": "P1",
"IRQ": null,
"UART": "2_RX",
"I2C": "2_SDA"
},
"65": {
"C_NAME": "GPIO0",
"GPIO": "P0",
"IRQ": null,
"UART": "2_TX",
"I2C": "2_SCL"
}
}
}
}

View File

@@ -1,7 +1,7 @@
{
"build": {
"ldscript_sdk": "rlx8711B-symbol-v02-img2_xip1_4M_cpp.ld",
"ldscript_arduino": "rlx8711B-symbol-v02-img2_xip1_4M_cpp.ld",
"ldscript_sdk": "rlx8711B-symbol-v02-img2_xip1_4M_980k_cpp.ld",
"ldscript_arduino": "rlx8711B-symbol-v02-img2_xip1_4M_980k_cpp.ld",
"amb_boot_all": "boot_all_C556.bin"
},
"flash": {

View File

@@ -47,10 +47,9 @@
}
},
"links": {
"General info": "../../docs/platform/realtek/README.md",
"Debugging": "../../docs/platform/realtek/debugging.md",
"General info": "../../docs/platform/realtek-amb/README.md",
"Flashing guide": "../../docs/platform/realtek-ambz/flashing.md",
"ImageTool (AmebaZ/AmebaD)": "https://images.tuyacn.com/smart/Image_Tool/Image_Tool.zip"
"Debugging": "../../docs/platform/realtek-ambz/debugging.md"
},
"extra": [
"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.",

View File

@@ -29,7 +29,7 @@
"voltage": "3.0V - 3.6V"
},
"links": {
"General info": "../../docs/platform/realtek/README.md"
"General info": "../../docs/platform/realtek-amb/README.md"
}
}
}

View File

@@ -3,7 +3,7 @@
"realtek-ambz",
"realtek-ambz-2mb-468k",
"realtek-ambz-bx",
"pcb/ic-rtl8710bn",
"ic/rtl8710bn",
"pcb/bw12"
],
"build": {

View File

@@ -4,10 +4,9 @@
[Product page](http://www.ai-thinker.com/pro_view-13.html)
- [General info](../../docs/platform/realtek/README.md)
- [Debugging](../../docs/platform/realtek/debugging.md)
- [General info](../../docs/platform/realtek-amb/README.md)
- [Flashing guide](../../docs/platform/realtek-ambz/flashing.md)
- [ImageTool (AmebaZ/AmebaD)](https://images.tuyacn.com/smart/Image_Tool/Image_Tool.zip)
- [Debugging](../../docs/platform/realtek-ambz/debugging.md)
- [Vendor datasheet](https://docs.ai-thinker.com/_media/rtl8710/hardware/bw12_datasheet_en.pdf)
Parameter | Value

View File

@@ -3,7 +3,7 @@
"realtek-ambz2",
"realtek-ambz2-8720",
"realtek-ambz2-2mb-992k",
"pcb/ic-rtl8720cf",
"ic/rtl8720cf",
"pcb/bw15"
],
"build": {

View File

@@ -4,7 +4,7 @@
[Product page](https://docs.ai-thinker.com/_media/rtl8710/docs/bw15_datasheet_en.pdf)
- [General info](../../docs/platform/realtek/README.md)
- [General info](../../docs/platform/realtek-amb/README.md)
- [Vendor datasheet](https://docs.ai-thinker.com/_media/rtl8710/docs/bw15_datasheet_en.pdf)
Parameter | Value

View File

@@ -3,7 +3,7 @@
"beken-72xx",
"beken-7231n",
"beken-7231n-tuya",
"pcb/ic-bk7231-qfn32",
"ic/bk7231-qfn32",
"pcb/cb2l",
"pcb/cb2l-test"
],

View File

@@ -6,7 +6,6 @@
- [General info](../../docs/platform/beken-72xx/README.md)
- [Flashing guide](../../docs/platform/beken-72xx/flashing.md)
- [BkWriter v1.6.0](https://images.tuyacn.com/smart/bk_writer1.60/bk_writer1.60.exe)
Parameter | Value
-------------|------------------------------------------

View File

@@ -3,7 +3,7 @@
"beken-72xx",
"beken-7231n",
"beken-7231n-tuya",
"pcb/ic-bk7231-qfn32",
"ic/bk7231-qfn32",
"pcb/cb2s",
"pcb/cb2s-test"
],

View File

@@ -6,7 +6,6 @@
- [General info](../../docs/platform/beken-72xx/README.md)
- [Flashing guide](../../docs/platform/beken-72xx/flashing.md)
- [BkWriter v1.6.0](https://images.tuyacn.com/smart/bk_writer1.60/bk_writer1.60.exe)
Parameter | Value
-------------|------------------------------------------

View File

@@ -3,7 +3,7 @@
"beken-72xx",
"beken-7231n",
"beken-7231n-tuya",
"pcb/ic-bk7231-qfn32",
"ic/bk7231-qfn32",
"pcb/cb3l"
],
"build": {

View File

@@ -6,7 +6,6 @@
- [General info](../../docs/platform/beken-72xx/README.md)
- [Flashing guide](../../docs/platform/beken-72xx/flashing.md)
- [BkWriter v1.6.0](https://images.tuyacn.com/smart/bk_writer1.60/bk_writer1.60.exe)
Parameter | Value
-------------|------------------------------------------

View File

@@ -3,7 +3,7 @@
"beken-72xx",
"beken-7231n",
"beken-7231n-tuya",
"pcb/ic-bk7231-qfn32",
"ic/bk7231-qfn32",
"pcb/cb3s"
],
"build": {

View File

@@ -6,7 +6,6 @@
- [General info](../../docs/platform/beken-72xx/README.md)
- [Flashing guide](../../docs/platform/beken-72xx/flashing.md)
- [BkWriter v1.6.0](https://images.tuyacn.com/smart/bk_writer1.60/bk_writer1.60.exe)
Parameter | Value
-------------|------------------------------------------

View File

@@ -3,7 +3,7 @@
"beken-72xx",
"beken-7231n",
"beken-7231n-tuya",
"pcb/ic-bk7231-qfn32",
"ic/bk7231-qfn32",
"pcb/cb3se"
],
"build": {

View File

@@ -6,7 +6,6 @@
- [General info](../../docs/platform/beken-72xx/README.md)
- [Flashing guide](../../docs/platform/beken-72xx/flashing.md)
- [BkWriter v1.6.0](https://images.tuyacn.com/smart/bk_writer1.60/bk_writer1.60.exe)
Parameter | Value
-------------|--------------------------------------------

View File

@@ -4,7 +4,7 @@
"beken-72xx",
"beken-7231n",
"beken-7231n-tuya",
"pcb/ic-bk7231-qfn32"
"ic/bk7231-qfn32"
],
"build": {
"mcu": "bk7231n",

View File

@@ -6,7 +6,6 @@
- [General info](../../docs/platform/beken-72xx/README.md)
- [Flashing guide](../../docs/platform/beken-72xx/flashing.md)
- [BkWriter v1.6.0](https://images.tuyacn.com/smart/bk_writer1.60/bk_writer1.60.exe)
Parameter | Value
-------------|----------------------------------

View File

@@ -2,9 +2,9 @@
"_base": [
"generic",
"beken-72xx",
"beken-7231t",
"beken-7231u",
"beken-7231t-tuya",
"pcb/ic-bk7231-qfn32"
"ic/bk7231-qfn32"
],
"build": {
"mcu": "bk7231t",

View File

@@ -6,7 +6,6 @@
- [General info](../../docs/platform/beken-72xx/README.md)
- [Flashing guide](../../docs/platform/beken-72xx/flashing.md)
- [BkWriter v1.6.0](https://images.tuyacn.com/smart/bk_writer1.60/bk_writer1.60.exe)
Parameter | Value
-------------|----------------------------------

193
boards/generic-bk7252.json Normal file
View File

@@ -0,0 +1,193 @@
{
"_base": [
"generic",
"beken-72xx",
"beken-7252",
"ic/bk7252-qfn68"
],
"build": {
"mcu": "bk7252",
"variant": "generic-bk7252"
},
"name": "Generic - BK7252",
"symbol": "BK7252",
"url": "https://kuba2k2.github.io/libretuya/boards/generic-bk7252/",
"vendor": "Generic",
"pcb": {
"pinout": {
"1": {
"IC": 65,
"ARD": "D0"
},
"2": {
"IC": 64,
"ARD": "D1"
},
"3": {
"IC": 48,
"ARD": [
"D2",
"A5"
]
},
"4": {
"IC": 46,
"ARD": [
"D3",
"A4"
]
},
"5": {
"IC": 47,
"ARD": [
"D4",
"A1"
]
},
"6": {
"IC": 45,
"ARD": [
"D5",
"A2"
]
},
"7": {
"IC": 49,
"ARD": "D6"
},
"8": {
"IC": 50,
"ARD": "D7"
},
"9": {
"IC": 62,
"ARD": "D8"
},
"10": {
"IC": 63,
"ARD": "D9"
},
"11": {
"IC": 16,
"ARD": [
"D10",
"A6"
]
},
"12": {
"IC": 17,
"ARD": [
"D11",
"A7"
]
},
"13": {
"IC": 32,
"ARD": "D12"
},
"14": {
"IC": 34,
"ARD": "D13"
},
"15": {
"IC": 33,
"ARD": "D14"
},
"16": {
"IC": 31,
"ARD": "D15"
},
"17": {
"IC": 35,
"ARD": "D16"
},
"18": {
"IC": 30,
"ARD": "D17"
},
"19": {
"IC": 41,
"ARD": "D18"
},
"20": {
"IC": 40,
"ARD": "D19"
},
"21": {
"IC": 39,
"ARD": "D20"
},
"22": {
"IC": 38,
"ARD": [
"D21",
"A3"
]
},
"23": {
"IC": 36,
"ARD": "D22"
},
"24": {
"IC": 14,
"ARD": "D23"
},
"25": {
"IC": 37,
"ARD": "D24"
},
"26": {
"IC": 21,
"ARD": "D25"
},
"27": {
"IC": 13,
"ARD": "D26"
},
"28": {
"IC": 20,
"ARD": "D27"
},
"29": {
"IC": 22,
"ARD": "D28"
},
"30": {
"IC": 23,
"ARD": "D29"
},
"31": {
"IC": 19,
"ARD": "D30"
},
"32": {
"IC": 18,
"ARD": "D31"
},
"33": {
"IC": 24,
"ARD": "D32"
},
"34": {
"IC": 25,
"ARD": "D33"
},
"35": {
"IC": 26,
"ARD": "D34"
},
"36": {
"IC": 27,
"ARD": "D35"
},
"37": {
"IC": 28,
"ARD": "D36"
},
"38": {
"IC": 29,
"ARD": "D37"
}
}
}
}

View File

@@ -0,0 +1,112 @@
# Generic - BK7252
*by Generic*
[Product page](https://kuba2k2.github.io/libretuya/boards/generic-bk7252/)
- [General info](../../docs/platform/beken-72xx/README.md)
- [Flashing guide](../../docs/platform/beken-72xx/flashing.md)
Parameter | Value
-------------|----------------------------------
Board code | `generic-bk7252`
MCU | BK7252
Manufacturer | Beken
Series | BK72XX
Frequency | 180 MHz
Flash size | 4 MiB
RAM size | 512 KiB
Voltage | 3.0V - 3.6V
I/O | 38x GPIO, 4x PWM, 2x UART, 7x ADC
Wi-Fi | 802.11 b/g/n
Bluetooth | BLE v5.0
## Usage
**Board code:** `generic-bk7252`
In `platformio.ini`:
```ini
[env:generic-bk7252]
platform = libretuya
board = generic-bk7252
framework = arduino
```
In ESPHome YAML:
```yaml
libretuya:
board: generic-bk7252
framework:
version: dev
```
## Arduino Core pin mapping
No. | Pin | UART | I²C | SPI | PWM | Other
----|-----------|-----------|----------|------|------|----------
D0 | P0 | UART2_TX | I2C2_SCL | | |
D1 | P1 | UART2_RX | I2C2_SDA | | |
D2 | P2 | | | | |
D3 | P3 | | | | |
D4 | P4 | | | | |
D5 | P5 | | | | |
D6 | P6 | | | | PWM0 |
D7 | P7 | | | | PWM1 |
D8 | P10 | UART1_RX | | | |
D9 | P11 | UART1_TX | | | |
D10 | P12 | UART1_CTS | | | |
D11 | P13 | UART1_RTS | | | |
D12 | P14 | | | SCK | |
D13 | P15 | | | CS | |
D14 | P16 | | | MOSI | |
D15 | P17 | | | MISO | |
D16 | P18 | | | | |
D17 | P19 | | | | |
D18 | P20 | | I2C1_SCL | | | TCK
D19 | P21 | | I2C1_SDA | | | TMS
D20 | P22 | | | | | TDI
D21 | P23 | | | | | TDO
D22 | P24 | | | | PWM4 |
D23 | P25 | | | | |
D24 | P26 | | | | PWM5 |
D25 | P27 | | | | | DVP_MCLK
D26 | P28 | | | | |
D27 | P29 | | | | | DVP_PCLK
D28 | P30 | | | | | DVP_HSYNC
D29 | P31 | | | | | DVP_VSYNC
D30 | P32 | | | | | DVP_PD0
D31 | P33 | | | | | DVP_PD1
D32 | P34 | | | | | DVP_PD2
D33 | P35 | | | | | DVP_PD3
D34 | P36 | | | | | DVP_PD4
D35 | P37 | | | | | DVP_PD5
D36 | P38 | | | | | DVP_PD6
D37 | P39 | | | | | DVP_PD7
A1 | P4, ADC1 | | | | |
A2 | P5, ADC2 | | | | |
A3 | P23, ADC3 | | | | |
A4 | P3, ADC5 | | | | |
A5 | P2, ADC4 | | | | |
A6 | P12, ADC6 | | | | |
A7 | P13, ADC7 | | | | |
## Flash memory map
Flash size: 4 MiB / 4,194,304 B / 0x400000
Hex values are in bytes.
Name | Start | Length | End
----------------|----------|--------------------|---------
Bootloader | 0x000000 | 68 KiB / 0x11000 | 0x011000
App Image | 0x011000 | 1.7 MiB / 0x1BA000 | 0x1CB000
File System | 0x1CB000 | 1.1 MiB / 0x119000 | 0x2E4000
Key-Value Store | 0x2E4000 | 32 KiB / 0x8000 | 0x2EC000
OTA Image | 0x2EC000 | 1.1 MiB / 0x112000 | 0x3FE000
Calibration | 0x3FE000 | 4 KiB / 0x1000 | 0x3FF000
TLV Store | 0x3FF000 | 4 KiB / 0x1000 | 0x400000
Bootloader and app partitions contain CRC16 sums every 32 bytes. That results in the actual flash offsets/sizes not aligned to sector boundaries. To simplify calculations, the values shown in the table (extracted from bootloader's partition table) were aligned to 4096 bytes.

View File

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

View File

@@ -0,0 +1,88 @@
/* This file was auto-generated from generic-bk7252.json using boardgen */
#include <Arduino.h>
extern "C" {
// clang-format off
PinInfo pinTable[PINS_COUNT] = {
// D0: P0, UART2_TX, I2C2_SCL
{GPIO0, PIN_GPIO | PIN_IRQ | PIN_I2C | PIN_UART, PIN_NONE, 0},
// D1: P1, UART2_RX, I2C2_SDA
{GPIO1, PIN_GPIO | PIN_IRQ | PIN_I2C | PIN_UART, PIN_NONE, 0},
// D2: P2, ADC4, SCK
{GPIO2, PIN_GPIO | PIN_IRQ | PIN_ADC | PIN_I2S, PIN_NONE, 0},
// D3: P3, ADC5, WS
{GPIO3, PIN_GPIO | PIN_IRQ | PIN_ADC | PIN_I2S, PIN_NONE, 0},
// D4: P4, ADC1, DIN
{GPIO4, PIN_GPIO | PIN_IRQ | PIN_ADC | PIN_I2S, PIN_NONE, 0},
// D5: P5, ADC2, DOUT
{GPIO5, PIN_GPIO | PIN_IRQ | PIN_ADC | PIN_I2S, PIN_NONE, 0},
// D6: P6, PWM0
{GPIO6, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0},
// D7: P7, PWM1
{GPIO7, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0},
// D8: P10, UART1_RX
{GPIO10, PIN_GPIO | PIN_IRQ | PIN_UART, PIN_NONE, 0},
// D9: P11, UART1_TX
{GPIO11, PIN_GPIO | PIN_IRQ | PIN_UART, PIN_NONE, 0},
// D10: P12, ADC6, UART1_CTS
{GPIO12, PIN_GPIO | PIN_IRQ | PIN_ADC | PIN_UART, PIN_NONE, 0},
// D11: P13, ADC7, UART1_RTS
{GPIO13, PIN_GPIO | PIN_IRQ | PIN_ADC | PIN_UART, PIN_NONE, 0},
// D12: P14, SD_CLK, SCK
{GPIO14, PIN_GPIO | PIN_IRQ | PIN_SPI, PIN_NONE, 0},
// D13: P15, SD_CMD, CS
{GPIO15, PIN_GPIO | PIN_IRQ | PIN_SPI, PIN_NONE, 0},
// D14: P16, SD_D0, MOSI
{GPIO16, PIN_GPIO | PIN_IRQ | PIN_SPI, PIN_NONE, 0},
// D15: P17, SD_D1, MISO
{GPIO17, PIN_GPIO | PIN_IRQ | PIN_SPI, PIN_NONE, 0},
// D16: P18, SD_D2
{GPIO18, PIN_GPIO | PIN_IRQ, PIN_NONE, 0},
// D17: P19, SD_D1
{GPIO19, PIN_GPIO | PIN_IRQ, PIN_NONE, 0},
// D18: P20, I2C1_SCL, TCK, FSCK
{GPIO20, PIN_GPIO | PIN_IRQ | PIN_I2C | PIN_JTAG, PIN_NONE, 0},
// D19: P21, I2C1_SDA, TMS, MCLK, ^FCS
{GPIO21, PIN_GPIO | PIN_IRQ | PIN_I2C | PIN_I2S | PIN_JTAG, PIN_NONE, 0},
// D20: P22, TDI, FSI
{GPIO22, PIN_GPIO | PIN_IRQ | PIN_JTAG, PIN_NONE, 0},
// D21: P23, ADC3, TDO, FSO
{GPIO23, PIN_GPIO | PIN_IRQ | PIN_ADC | PIN_JTAG, PIN_NONE, 0},
// D22: P24, PWM4
{GPIO24, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0},
// D23: P25, DP
{GPIO25, PIN_GPIO | PIN_IRQ, PIN_NONE, 0},
// D24: P26, PWM5, IRDA
{GPIO26, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0},
// D25: P27, DVP_MCLK
{GPIO27, PIN_GPIO | PIN_IRQ, PIN_NONE, 0},
// D26: P28, DN
{GPIO28, PIN_GPIO | PIN_IRQ, PIN_NONE, 0},
// D27: P29, DVP_PCLK
{GPIO29, PIN_GPIO | PIN_IRQ, PIN_NONE, 0},
// D28: P30, DVP_HSYNC
{GPIO30, PIN_GPIO | PIN_IRQ, PIN_NONE, 0},
// D29: P31, DVP_VSYNC
{GPIO31, PIN_GPIO | PIN_IRQ, PIN_NONE, 0},
// D30: P32, DVP_PD0
{GPIO32, PIN_GPIO | PIN_IRQ, PIN_NONE, 0},
// D31: P33, DVP_PD1
{GPIO33, PIN_GPIO | PIN_IRQ, PIN_NONE, 0},
// D32: P34, DVP_PD2
{GPIO34, PIN_GPIO | PIN_IRQ, PIN_NONE, 0},
// D33: P35, DVP_PD3
{GPIO35, PIN_GPIO | PIN_IRQ, PIN_NONE, 0},
// D34: P36, DVP_PD4
{GPIO36, PIN_GPIO | PIN_IRQ, PIN_NONE, 0},
// D35: P37, DVP_PD5
{GPIO37, PIN_GPIO | PIN_IRQ, PIN_NONE, 0},
// D36: P38, DVP_PD6
{GPIO38, PIN_GPIO | PIN_IRQ, PIN_NONE, 0},
// D37: P39, DVP_PD7
{GPIO39, PIN_GPIO | PIN_IRQ, PIN_NONE, 0},
};
// clang-format on
} // extern "C"

View File

@@ -0,0 +1,119 @@
/* This file was auto-generated from generic-bk7252.json using boardgen */
#pragma once
#include <WVariant.h>
// clang-format off
// Pins
// ----
#define PINS_COUNT 38
#define NUM_DIGITAL_PINS 38
#define NUM_ANALOG_INPUTS 7
#define NUM_ANALOG_OUTPUTS 0
// Analog pins
// -----------
#define PIN_A5 2u // GPIO2
#define PIN_A4 3u // GPIO3
#define PIN_A1 4u // GPIO4
#define PIN_A2 5u // GPIO5
#define PIN_A6 10u // GPIO12
#define PIN_A7 11u // GPIO13
#define PIN_A3 21u // GPIO23
#define A5 PIN_A5
#define A4 PIN_A4
#define A1 PIN_A1
#define A2 PIN_A2
#define A6 PIN_A6
#define A7 PIN_A7
#define A3 PIN_A3
// SPI Interfaces
// --------------
#define SPI_INTERFACES_COUNT 0
// Wire Interfaces
// ---------------
#define WIRE_INTERFACES_COUNT 2
#define PIN_WIRE1_SCL 18u // GPIO20
#define PIN_WIRE1_SDA 19u // GPIO21
#define PIN_WIRE2_SCL 0u // GPIO0
#define PIN_WIRE2_SDA 1u // GPIO1
// Serial ports
// ------------
#define SERIAL_INTERFACES_COUNT 2
#define PIN_SERIAL1_CTS 10u // GPIO12
#define PIN_SERIAL1_RTS 11u // GPIO13
#define PIN_SERIAL1_RX 8u // GPIO10
#define PIN_SERIAL1_TX 9u // GPIO11
#define PIN_SERIAL2_RX 1u // GPIO1
#define PIN_SERIAL2_TX 0u // GPIO0
// Pin function macros
// -------------------
#define PIN_FUNCTION_ADC1 4u // GPIO4
#define PIN_FUNCTION_ADC2 5u // GPIO5
#define PIN_FUNCTION_ADC3 21u // GPIO23
#define PIN_FUNCTION_ADC4 2u // GPIO2
#define PIN_FUNCTION_ADC5 3u // GPIO3
#define PIN_FUNCTION_ADC6 10u // GPIO12
#define PIN_FUNCTION_ADC7 11u // GPIO13
#define PIN_FUNCTION_CS 13u // GPIO15
#define PIN_FUNCTION_CTS1 10u // GPIO12
#define PIN_FUNCTION_MISO 15u // GPIO17
#define PIN_FUNCTION_MOSI 14u // GPIO16
#define PIN_FUNCTION_P0 0u // GPIO0
#define PIN_FUNCTION_P1 1u // GPIO1
#define PIN_FUNCTION_P2 2u // GPIO2
#define PIN_FUNCTION_P3 3u // GPIO3
#define PIN_FUNCTION_P4 4u // GPIO4
#define PIN_FUNCTION_P5 5u // GPIO5
#define PIN_FUNCTION_P6 6u // GPIO6
#define PIN_FUNCTION_P7 7u // GPIO7
#define PIN_FUNCTION_P10 8u // GPIO10
#define PIN_FUNCTION_P11 9u // GPIO11
#define PIN_FUNCTION_P12 10u // GPIO12
#define PIN_FUNCTION_P13 11u // GPIO13
#define PIN_FUNCTION_P14 12u // GPIO14
#define PIN_FUNCTION_P15 13u // GPIO15
#define PIN_FUNCTION_P16 14u // GPIO16
#define PIN_FUNCTION_P17 15u // GPIO17
#define PIN_FUNCTION_P18 16u // GPIO18
#define PIN_FUNCTION_P19 17u // GPIO19
#define PIN_FUNCTION_P20 18u // GPIO20
#define PIN_FUNCTION_P21 19u // GPIO21
#define PIN_FUNCTION_P22 20u // GPIO22
#define PIN_FUNCTION_P23 21u // GPIO23
#define PIN_FUNCTION_P24 22u // GPIO24
#define PIN_FUNCTION_P25 23u // GPIO25
#define PIN_FUNCTION_P26 24u // GPIO26
#define PIN_FUNCTION_P27 25u // GPIO27
#define PIN_FUNCTION_P28 26u // GPIO28
#define PIN_FUNCTION_P29 27u // GPIO29
#define PIN_FUNCTION_P30 28u // GPIO30
#define PIN_FUNCTION_P31 29u // GPIO31
#define PIN_FUNCTION_P32 30u // GPIO32
#define PIN_FUNCTION_P33 31u // GPIO33
#define PIN_FUNCTION_P34 32u // GPIO34
#define PIN_FUNCTION_P35 33u // GPIO35
#define PIN_FUNCTION_P36 34u // GPIO36
#define PIN_FUNCTION_P37 35u // GPIO37
#define PIN_FUNCTION_P38 36u // GPIO38
#define PIN_FUNCTION_P39 37u // GPIO39
#define PIN_FUNCTION_PWM0 6u // GPIO6
#define PIN_FUNCTION_PWM1 7u // GPIO7
#define PIN_FUNCTION_PWM4 22u // GPIO24
#define PIN_FUNCTION_PWM5 24u // GPIO26
#define PIN_FUNCTION_RTS1 11u // GPIO13
#define PIN_FUNCTION_RX1 8u // GPIO10
#define PIN_FUNCTION_RX2 1u // GPIO1
#define PIN_FUNCTION_SCK 12u // GPIO14
#define PIN_FUNCTION_SCL1 18u // GPIO20
#define PIN_FUNCTION_SCL2 0u // GPIO0
#define PIN_FUNCTION_SDA1 19u // GPIO21
#define PIN_FUNCTION_SDA2 1u // GPIO1
#define PIN_FUNCTION_TX1 9u // GPIO11
#define PIN_FUNCTION_TX2 0u // GPIO0

View File

@@ -3,7 +3,7 @@
"generic",
"realtek-ambz",
"realtek-ambz-2mb-468k",
"pcb/ic-rtl8710bn"
"ic/rtl8710bn"
],
"build": {
"mcu": "rtl8710bn",

View File

@@ -4,10 +4,9 @@
[Product page](https://kuba2k2.github.io/libretuya/boards/generic-rtl8710bn-2mb-468k/)
- [General info](../../docs/platform/realtek/README.md)
- [Debugging](../../docs/platform/realtek/debugging.md)
- [General info](../../docs/platform/realtek-amb/README.md)
- [Flashing guide](../../docs/platform/realtek-ambz/flashing.md)
- [ImageTool (AmebaZ/AmebaD)](https://images.tuyacn.com/smart/Image_Tool/Image_Tool.zip)
- [Debugging](../../docs/platform/realtek-ambz/debugging.md)
Parameter | Value
-------------|----------------------------------

View File

@@ -3,7 +3,7 @@
"generic",
"realtek-ambz",
"realtek-ambz-2mb-788k",
"pcb/ic-rtl8710bn"
"ic/rtl8710bn"
],
"build": {
"mcu": "rtl8710bn",

View File

@@ -4,10 +4,9 @@
[Product page](https://kuba2k2.github.io/libretuya/boards/generic-rtl8710bn-2mb-788k/)
- [General info](../../docs/platform/realtek/README.md)
- [Debugging](../../docs/platform/realtek/debugging.md)
- [General info](../../docs/platform/realtek-amb/README.md)
- [Flashing guide](../../docs/platform/realtek-ambz/flashing.md)
- [ImageTool (AmebaZ/AmebaD)](https://images.tuyacn.com/smart/Image_Tool/Image_Tool.zip)
- [Debugging](../../docs/platform/realtek-ambz/debugging.md)
Parameter | Value
-------------|----------------------------------

View File

@@ -4,7 +4,7 @@
"realtek-ambz",
"realtek-ambz-4mb-980k",
"realtek-ambz-bx",
"pcb/ic-rtl8710bn"
"ic/rtl8710bn"
],
"build": {
"mcu": "rtl8710bx",

View File

@@ -4,10 +4,9 @@
[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)
- [General info](../../docs/platform/realtek-amb/README.md)
- [Flashing guide](../../docs/platform/realtek-ambz/flashing.md)
- [ImageTool (AmebaZ/AmebaD)](https://images.tuyacn.com/smart/Image_Tool/Image_Tool.zip)
- [Debugging](../../docs/platform/realtek-ambz/debugging.md)
Parameter | Value
-------------|----------------------------------

View File

@@ -4,7 +4,7 @@
"realtek-ambz2",
"realtek-ambz2-8720",
"realtek-ambz2-2mb-992k",
"pcb/ic-rtl8720cf"
"ic/rtl8720cf"
],
"build": {
"mcu": "rtl8720cf",

View File

@@ -4,7 +4,7 @@
[Product page](https://kuba2k2.github.io/libretuya/boards/generic-rtl8720cf-2mb-992k/)
- [General info](../../docs/platform/realtek/README.md)
- [General info](../../docs/platform/realtek-amb/README.md)
Parameter | Value
-------------|-----------------------------

View File

@@ -3,7 +3,7 @@
"beken-72xx",
"beken-7231n",
"beken-7231n-tuya",
"pcb/ic-bk7231-qfn32",
"ic/bk7231-qfn32",
"pcb/lsc-lma35"
],
"build": {

View File

@@ -6,7 +6,6 @@
- [General info](../../docs/platform/beken-72xx/README.md)
- [Flashing guide](../../docs/platform/beken-72xx/flashing.md)
- [BkWriter v1.6.0](https://images.tuyacn.com/smart/bk_writer1.60/bk_writer1.60.exe)
Parameter | Value
-------------|----------------------------------

View File

@@ -1,9 +1,9 @@
{
"_base": [
"beken-72xx",
"beken-7231t",
"beken-7231u",
"beken-7231t-tuya",
"pcb/ic-bk7231-qfn32",
"ic/bk7231-qfn32",
"pcb/wb2l",
"pcb/wb2l-test"
],

View File

@@ -6,7 +6,6 @@
- [General info](../../docs/platform/beken-72xx/README.md)
- [Flashing guide](../../docs/platform/beken-72xx/flashing.md)
- [BkWriter v1.6.0](https://images.tuyacn.com/smart/bk_writer1.60/bk_writer1.60.exe)
Parameter | Value
-------------|------------------------------------------

View File

@@ -1,9 +1,9 @@
{
"_base": [
"beken-72xx",
"beken-7231t",
"beken-7231u",
"beken-7231t-tuya",
"pcb/ic-bk7231-qfn32",
"ic/bk7231-qfn32",
"pcb/wb2s",
"pcb/wb2s-test"
],

View File

@@ -6,7 +6,6 @@
- [General info](../../docs/platform/beken-72xx/README.md)
- [Flashing guide](../../docs/platform/beken-72xx/flashing.md)
- [BkWriter v1.6.0](https://images.tuyacn.com/smart/bk_writer1.60/bk_writer1.60.exe)
Parameter | Value
-------------|------------------------------------------

View File

@@ -1,9 +1,9 @@
{
"_base": [
"beken-72xx",
"beken-7231t",
"beken-7231u",
"beken-7231t-tuya",
"pcb/ic-bk7231-qfn32",
"ic/bk7231-qfn32",
"pcb/wb3l"
],
"build": {

View File

@@ -6,7 +6,6 @@
- [General info](../../docs/platform/beken-72xx/README.md)
- [Flashing guide](../../docs/platform/beken-72xx/flashing.md)
- [BkWriter v1.6.0](https://images.tuyacn.com/smart/bk_writer1.60/bk_writer1.60.exe)
Parameter | Value
-------------|------------------------------------------

View File

@@ -1,9 +1,9 @@
{
"_base": [
"beken-72xx",
"beken-7231t",
"beken-7231u",
"beken-7231t-tuya",
"pcb/ic-bk7231-qfn32",
"ic/bk7231-qfn32",
"pcb/wb3s"
],
"build": {

View File

@@ -6,7 +6,6 @@
- [General info](../../docs/platform/beken-72xx/README.md)
- [Flashing guide](../../docs/platform/beken-72xx/flashing.md)
- [BkWriter v1.6.0](https://images.tuyacn.com/smart/bk_writer1.60/bk_writer1.60.exe)
Parameter | Value
-------------|------------------------------------------

View File

@@ -2,7 +2,7 @@
"_base": [
"realtek-ambz",
"realtek-ambz-2mb-788k",
"pcb/ic-rtl8710bn",
"ic/rtl8710bn",
"pcb/wr2-base",
"pcb/wr2"
],

View File

@@ -4,10 +4,9 @@
[Product page](https://developer.tuya.com/en/docs/iot/wifiwr2module?id=K9605tko0juc3)
- [General info](../../docs/platform/realtek/README.md)
- [Debugging](../../docs/platform/realtek/debugging.md)
- [General info](../../docs/platform/realtek-amb/README.md)
- [Flashing guide](../../docs/platform/realtek-ambz/flashing.md)
- [ImageTool (AmebaZ/AmebaD)](https://images.tuyacn.com/smart/Image_Tool/Image_Tool.zip)
- [Debugging](../../docs/platform/realtek-ambz/debugging.md)
Parameter | Value
-------------|----------------------------------------

View File

@@ -2,7 +2,7 @@
"_base": [
"realtek-ambz",
"realtek-ambz-2mb-788k",
"pcb/ic-rtl8710bn",
"ic/rtl8710bn",
"pcb/wr2-base",
"pcb/wr2e"
],

View File

@@ -4,10 +4,9 @@
[Product page](https://developer.tuya.com/en/docs/iot/wr2e?id=K97scnsjhue4h)
- [General info](../../docs/platform/realtek/README.md)
- [Debugging](../../docs/platform/realtek/debugging.md)
- [General info](../../docs/platform/realtek-amb/README.md)
- [Flashing guide](../../docs/platform/realtek-ambz/flashing.md)
- [ImageTool (AmebaZ/AmebaD)](https://images.tuyacn.com/smart/Image_Tool/Image_Tool.zip)
- [Debugging](../../docs/platform/realtek-ambz/debugging.md)
Parameter | Value
-------------|------------------------------------------

View File

@@ -3,7 +3,7 @@
"realtek-ambz",
"realtek-ambz-2mb-788k",
"realtek-ambz-bx",
"pcb/ic-rtl8710bn",
"ic/rtl8710bn",
"pcb/wr2l-base",
"pcb/wr2l"
],

View File

@@ -4,10 +4,9 @@
[Product page](https://developer.tuya.com/en/docs/iot/wifiwr2lmodule?id=K9605tnbj7gva)
- [General info](../../docs/platform/realtek/README.md)
- [Debugging](../../docs/platform/realtek/debugging.md)
- [General info](../../docs/platform/realtek-amb/README.md)
- [Flashing guide](../../docs/platform/realtek-ambz/flashing.md)
- [ImageTool (AmebaZ/AmebaD)](https://images.tuyacn.com/smart/Image_Tool/Image_Tool.zip)
- [Debugging](../../docs/platform/realtek-ambz/debugging.md)
Parameter | Value
-------------|------------------------------------------

View File

@@ -3,7 +3,7 @@
"realtek-ambz",
"realtek-ambz-2mb-788k",
"realtek-ambz-bx",
"pcb/ic-rtl8710bn",
"ic/rtl8710bn",
"pcb/wr2l-base",
"pcb/wr2le"
],

View File

@@ -4,10 +4,9 @@
[Product page](https://developer.tuya.com/en/docs/iot/wr2le?id=K9eio9y9e8i8c)
- [General info](../../docs/platform/realtek/README.md)
- [Debugging](../../docs/platform/realtek/debugging.md)
- [General info](../../docs/platform/realtek-amb/README.md)
- [Flashing guide](../../docs/platform/realtek-ambz/flashing.md)
- [ImageTool (AmebaZ/AmebaD)](https://images.tuyacn.com/smart/Image_Tool/Image_Tool.zip)
- [Debugging](../../docs/platform/realtek-ambz/debugging.md)
Parameter | Value
-------------|-------------------------

View File

@@ -2,7 +2,7 @@
"_base": [
"realtek-ambz",
"realtek-ambz-2mb-788k",
"pcb/ic-rtl8710bn",
"ic/rtl8710bn",
"pcb/wr3-base",
"pcb/wr3"
],

View File

@@ -4,10 +4,9 @@
[Product page](https://developer.tuya.com/en/docs/iot/wr3-module-datasheet?id=K9g3ainzbj9z1)
- [General info](../../docs/platform/realtek/README.md)
- [Debugging](../../docs/platform/realtek/debugging.md)
- [General info](../../docs/platform/realtek-amb/README.md)
- [Flashing guide](../../docs/platform/realtek-ambz/flashing.md)
- [ImageTool (AmebaZ/AmebaD)](https://images.tuyacn.com/smart/Image_Tool/Image_Tool.zip)
- [Debugging](../../docs/platform/realtek-ambz/debugging.md)
Parameter | Value
-------------|----------------------------------------

View File

@@ -2,7 +2,7 @@
"_base": [
"realtek-ambz",
"realtek-ambz-2mb-788k",
"pcb/ic-rtl8710bn",
"ic/rtl8710bn",
"pcb/wr3-base",
"pcb/wr3e"
],

View File

@@ -4,10 +4,9 @@
[Product page](https://developer.tuya.com/en/docs/iot/wr3e-module-datasheet?id=K9elwlqbfosbc)
- [General info](../../docs/platform/realtek/README.md)
- [Debugging](../../docs/platform/realtek/debugging.md)
- [General info](../../docs/platform/realtek-amb/README.md)
- [Flashing guide](../../docs/platform/realtek-ambz/flashing.md)
- [ImageTool (AmebaZ/AmebaD)](https://images.tuyacn.com/smart/Image_Tool/Image_Tool.zip)
- [Debugging](../../docs/platform/realtek-ambz/debugging.md)
Parameter | Value
-------------|------------------------------------------

View File

@@ -3,7 +3,7 @@
"realtek-ambz",
"realtek-ambz-2mb-788k",
"realtek-ambz-bx",
"pcb/ic-rtl8710bn",
"ic/rtl8710bn",
"pcb/wr3l-base",
"pcb/wr3"
],

View File

@@ -4,10 +4,9 @@
[Product page](https://developer.tuya.com/en/docs/iot/wifiwr3lmodule?id=K9605tt0kveqm)
- [General info](../../docs/platform/realtek/README.md)
- [Debugging](../../docs/platform/realtek/debugging.md)
- [General info](../../docs/platform/realtek-amb/README.md)
- [Flashing guide](../../docs/platform/realtek-ambz/flashing.md)
- [ImageTool (AmebaZ/AmebaD)](https://images.tuyacn.com/smart/Image_Tool/Image_Tool.zip)
- [Debugging](../../docs/platform/realtek-ambz/debugging.md)
Parameter | Value
-------------|------------------------------------------

View File

@@ -3,7 +3,7 @@
"realtek-ambz",
"realtek-ambz-2mb-788k",
"realtek-ambz-bx",
"pcb/ic-rtl8710bn",
"ic/rtl8710bn",
"pcb/wr3l-base",
"pcb/wr3e"
],

View File

@@ -4,10 +4,9 @@
[Product page](https://developer.tuya.com/en/docs/iot/wr3le?id=K986l7a1ha8tm)
- [General info](../../docs/platform/realtek/README.md)
- [Debugging](../../docs/platform/realtek/debugging.md)
- [General info](../../docs/platform/realtek-amb/README.md)
- [Flashing guide](../../docs/platform/realtek-ambz/flashing.md)
- [ImageTool (AmebaZ/AmebaD)](https://images.tuyacn.com/smart/Image_Tool/Image_Tool.zip)
- [Debugging](../../docs/platform/realtek-ambz/debugging.md)
Parameter | Value
-------------|--------------------------------------------

View File

@@ -2,7 +2,7 @@
"_base": [
"realtek-ambz",
"realtek-ambz-2mb-788k",
"pcb/ic-rtl8710bn",
"ic/rtl8710bn",
"pcb/wr3-base",
"pcb/wr3n"
],

View File

@@ -4,10 +4,9 @@
[Product page](https://developer.tuya.com/en/docs/iot/wr3n-datasheet?id=K98zdx31ztdge)
- [General info](../../docs/platform/realtek/README.md)
- [Debugging](../../docs/platform/realtek/debugging.md)
- [General info](../../docs/platform/realtek-amb/README.md)
- [Flashing guide](../../docs/platform/realtek-ambz/flashing.md)
- [ImageTool (AmebaZ/AmebaD)](https://images.tuyacn.com/smart/Image_Tool/Image_Tool.zip)
- [Debugging](../../docs/platform/realtek-ambz/debugging.md)
Parameter | Value
-------------|------------------------------------------

View File

@@ -32,7 +32,7 @@ SOC_BK7236 = 6
SOC_NAMES = {
SOC_BK7231: "bk7231",
SOC_BK7231U: "bk7231u",
SOC_BK7221U: "bk7221u",
SOC_BK7251: "bk7251",
SOC_BK7271: "bk7271",
SOC_BK7231N: "bk7231n",
SOC_BK7236: "bk7236",
@@ -517,7 +517,7 @@ if env.Cfg("ATSVR_CFG"):
"+<*>",
],
)
if env.Cfg("CFG_USB"):
if env.Cfg("CFG_USB") or env.Cfg("CFG_USE_SDCARD_HOST"):
env.AddLibrary(
name="bdk_driver_usb",
base_dir=ROOT_DIR,

View File

@@ -31,7 +31,7 @@ env.Append(
],
CXXFLAGS=[
# borrowed from RtlDuino/development/rtl87xx/platform.txt
"-std=c++11",
"-std=gnu++11",
"-MMD",
"-fno-exceptions",
"-fno-rtti",
@@ -100,7 +100,6 @@ env.AddLibrary(
"+<component/common/api/lwip_netconf.c>",
"+<component/common/drivers/wlan/realtek/src/osdep/lwip_intf.c>",
"+<component/common/network/dhcp/dhcps.c>",
"+<component/common/network/sntp/sntp.c>",
"+<component/common/network/ssl/ssl_ram_map/ssl_ram_map.c>",
"+<component/os/freertos/freertos_v8.1.2/Source/portable/MemMang/heap_5.c>",
"+<component/os/freertos/freertos_v8.1.2/Source/portable/GCC/ARM_CM4F/port.c>",

View File

@@ -16,7 +16,7 @@ env.SConscript("utils/config.py", exports="env")
env.SConscript("utils/env.py", exports="env")
env.SConscript("utils/flash.py", exports="env")
env.SConscript("utils/libs.py", exports="env")
env.SConscript("utils/uf2.py", exports="env")
env.SConscript("utils/ltchiptool.py", exports="env")
# Vendor-specific library ports
env.SConscript("libs/flashdb.py", exports="env")
env.SConscript("libs/lwip.py", exports="env")
@@ -69,7 +69,7 @@ targets = [target_elf]
if "UF2OTA" in env:
target_uf2 = env.BuildUF2OTA(target_elf)
targets.append(target_uf2)
env.AddUF2Uploader(target_uf2)
env.AddFlashWriter(target_uf2)
elif "IMG_FW" in env:
target_fw = env.subst("$IMG_FW")
env.AddPlatformTarget("upload", target_fw, env["UPLOAD_ACTIONS"], "Upload")

View File

@@ -74,8 +74,10 @@ def env_add_defaults(env, platform, board):
VARIANT=board.get("build.variant"),
LDSCRIPT_SDK=board.get("build.ldscript_sdk"),
LDSCRIPT_ARDUINO=board.get("build.ldscript_arduino"),
# ltchiptool variables
LTCHIPTOOL='"${PYTHONEXE}" -m ltchiptool',
# ltchiptool config:
# -r output raw log messages
# -i 1 indent log messages
LTCHIPTOOL='"${PYTHONEXE}" -m ltchiptool -r -i 1',
# Fix for link2bin to get tmpfile name in argv
LINKCOM="${LINK} ${LINKARGS}",
LINKARGS="${TEMPFILE('-o $TARGET $LINKFLAGS $__RPATH $SOURCES $_LIBDIRFLAGS $_LIBFLAGS', '$LINKCOMSTR')}",

View File

@@ -53,7 +53,7 @@ def env_uf2ota(env, *args, **kwargs):
env.Execute(" ".join(cmd))
def env_uf2upload(env, target):
def env_flash_write(env, target):
protocol = env.subst("${UPLOAD_PROTOCOL}")
actions = []
# from platform-espressif32/builder/main.py
@@ -61,7 +61,7 @@ def env_uf2upload(env, target):
# upload via UART
env["UPLOADERFLAGS_UF2"] = [
"${UF2OUT}",
"uart",
"-d",
"${UPLOAD_PORT}",
"-b",
"${UPLOAD_SPEED}",
@@ -79,7 +79,7 @@ def env_uf2upload(env, target):
# add main upload target
env.Replace(
UPLOADER="${LTCHIPTOOL} uf2 upload",
UPLOADER="${LTCHIPTOOL} flash write",
UPLOADCMD="${UPLOADER} ${UPLOADERFLAGS_UF2} ${UPLOADERFLAGS}",
)
actions.append(env.VerboseAction("${UPLOADCMD}", "Uploading ${UF2OUT_BASE}"))
@@ -93,4 +93,4 @@ env.Append(
)
)
)
env.AddMethod(env_uf2upload, "AddUF2Uploader")
env.AddMethod(env_flash_write, "AddFlashWriter")

10
docs/flashing/SUMMARY.md Normal file
View File

@@ -0,0 +1,10 @@
# Flashing/dumping methods & guides
* [Flashing PlatformIO projects](platformio.md)
* [Flashing ESPHome](esphome.md)
* [Using ltchiptool GUI](tools/ltchiptool.md)
* [Converting with tuya-cloudcutter](tools/cloudcutter.md)
* 🔌 Chip connection guide
* [Beken BK72xx](../platform/beken-72xx/flashing.md)
* [Realtek RTL8710Bx](../platform/realtek-ambz/flashing.md)
* [Auto-download-reboot](tools/adr.md)

40
docs/flashing/esphome.md Normal file
View File

@@ -0,0 +1,40 @@
# Flashing ESPHome
ESPHome can be flashed in few different ways, depending on your needs.
!!! abstract
All binary files generated by ESPHome will be in `.esphome/build/<yourdevice>/.pioenvs/<yourdevice>/`. The methods described below may require you to get a file from that directory.
This path will be referred to as **build directory**.
## Built-in flasher
The flasher program built-in LibreTuya is also available for ESPHome.
- use `python -m esphome run yourdevice.yml` to recompile AND upload the firmware
- use `python -m esphome upload yourdevice.yml` to upload without recompiling
{%
include-markdown "inc/uart-info.md"
%}
If your device is already running ESPHome, refer to the OTA guide below.
## Over-the-Air (OTA)
This method requires having ESPHome already installed on your device.
- If you've added the Web Server component, navigate to the device's IP address (or `.local` name) in your web browser. Grab `firmware.uf2` from the build directory and drop it on the "OTA Update" field.
- You can also use ESPHome CLI to flash via OTA. Add a `--device` argument to the command, as such: `python -m esphome upload yourdevice.yml --device yourdevice.local`
{%
include-markdown "inc/uart-ltchiptool.md"
%}
{%
include-markdown "inc/ota-cloudcutter.md"
%}
{%
include-markdown "inc/ota-openbeken.md"
%}

View File

@@ -0,0 +1,8 @@
## Converting devices with tuya-cloudcutter
!!! note
This currently applies to BK7231T and BK7231N only. `tuya-cloudcutter` can't be used for other chips.
Grab the `bk7231x_app.ota.ug.bin` file from the build directory - take care to choose the correct file. It must have "OTA" and "UG" in its name.
Next, refer to [Using tuya-cloudcutter](../tools/cloudcutter.md) guide.

View File

@@ -0,0 +1,5 @@
## Migrating from OpenBeken (OTA)
[OpenBeken](https://github.com/openshwprojects/OpenBK7231T_App) is a custom, Tasmota-like firmware for non-ESP chips. Currently, this part of the guide applies to BK7231 only, as that's the only chip supported both by LT and OBK.
OBK is compatible with standard Beken OTA packages, but the web panel does a filename check to prevent chip type mismatch. Grab the `bk7231x_app.ota.bin` file from build directory (note: without "UG" in the name!), rename it to something like `OpenBK7231T_esphome.rbl` (change T to N depending on the chip type), and drop it on the OTA panel.

View File

@@ -0,0 +1 @@
The device needs to be connected to your PC with a UART-TTL adapter. Refer to chip connection guides (see: menu on the left) to learn how to connect your device.

View File

@@ -0,0 +1,6 @@
## Using ltchiptool (wired, via UART)
You can use the [ltchiptool](https://github.com/libretuya/ltchiptool) GUI or CLI to manually flash the firmware. Grab the `firmware.uf2` file from the build directory. Then, follow the [ltchiptool usage guide](../tools/ltchiptool.md) to flash it to the device.
!!! tip
The UF2 file may have a different name, depending on the project you're building. Usually it's best to grab the latest (sorted by date) file with UF2 extension from the build directory.

View File

@@ -0,0 +1,28 @@
# Flashing PlatformIO projects
PlatformIO projects developed with LibreTuya can be flashed just like any other PIO project.
!!! abstract
All binary files generated by PlatformIO will be in `.pio/build/<my_board>/`. The methods described below may require you to get a file from that directory.
This path will be referred to as **build directory**.
## Built-in flasher
LibreTuya has a built-in firmware uploader, based on [ltchiptool](tools/ltchiptool.md). Pressing `Upload` in PlatformIO IDE does all the work for you.
If you have more than one COM port, configure your PIO project first:
```ini title="platformio.ini"
[env:my_board]
monitor_port = COM96
upload_port = COM96
```
{%
include-markdown "inc/uart-info.md"
%}
{%
include-markdown "inc/uart-ltchiptool.md"
%}

View File

@@ -1,10 +1,12 @@
# Flashing with tuya-cloudcutter
# Converting with tuya-cloudcutter
[`tuya-cloudcutter`](https://github.com/tuya-cloudcutter/tuya-cloudcutter) is a tool that disconnects IoT devices from the Tuya cloud, while also allowing **remote firmware flashing**. This means you can flash ESPHome without even connecting USB-UART to the device.
!!! note
This currently applies to BK7231T and BK7231N only. `tuya-cloudcutter` can't be used for other chips.
This is an unofficial guide, that worked for me during testing. The steps may not work for every device; you should also refer to the cloudcutter's manual pages.
[`tuya-cloudcutter`](https://github.com/tuya-cloudcutter/tuya-cloudcutter) is a tool that disconnects IoT devices from the Tuya cloud, while also allowing **remote firmware flashing**. This means you can flash ESPHome without even disassembling it.
**Currently, `tuya-cloudcutter` works for BK7231T and BK7231N only.**
!!! warning
This guide might be outdated. For an up-to-date guide, always refer to [tuya-cloudcutter/INSTRUCTIONS.md](https://github.com/tuya-cloudcutter/tuya-cloudcutter/blob/main/INSTRUCTIONS.md).
If your device doesn't have a profile yet, it will probably not work. You can contribute by [taking a device dump](https://github.com/tuya-cloudcutter/tuya-cloudcutter#device-dumps) and posting it on cloudcutter's issues page.
@@ -20,13 +22,13 @@ If your device doesn't have a profile yet, it will probably not work. You can co
### Firmware building
1. [Compile ESPHome](../projects/esphome.md), or your custom firmware based on LibreTuya.
1. [Compile ESPHome](../../projects/esphome.md), or your custom firmware based on LibreTuya.
2. Get the firmware binary, named `bk7231x_app.ota.ug.bin` from the build directory (`.pio/build/<board>/` or `.esphome/build/<board>/.pioenvs/<board>/`).
3. Put the file to `custom-firmware` of tuya-cloudcutter.
3. Put it in the `custom-firmware` directory of tuya-cloudcutter.
### Pairing and flashing
1. Run `./run_flash.sh` from the cloudcutter directory.
1. Run `./tuya-cloudcutter.sh` from the cloudcutter directory.
2. Answer questions about the desired firmware file, the device vendor and profile.
3. Put the device to AP mode: (**)
- Bulbs (devices without buttons) usually need to be power-cycled a few times, until they start blinking slowly.

View File

@@ -0,0 +1,127 @@
# ltchiptool
[ltchiptool](https://github.com/libretuya/ltchiptool) is a universal, easy-to-use GUI flashing/dumping tool for BK7231, RTL8710B and RTL8720C. It also contains some CLI utilities for binary firmware manipulation.
<div align="center" markdown>
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![PyPI](https://img.shields.io/pypi/v/ltchiptool)](https://pypi.org/project/ltchiptool/)
[![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/libretuya/ltchiptool?include_prereleases&label=GUI%20release)](https://github.com/libretuya/ltchiptool/releases/latest)
<img src="https://raw.githubusercontent.com/libretuya/ltchiptool/master/.github/screenshot.png" style="height:500px">
</div>
## Installation
<div align="center" markdown>
[:material-download-outline: Download Windows GUI](https://github.com/libretuya/ltchiptool/releases/latest){ .md-button }
</div>
### CLI program
Install the package from PyPI, using `pip install ltchiptool`. Run the CLI using `python -m ltchiptool` or just `ltchiptool`.
### GUI application
???+ quote "Windows 7 and newer"
Download the latest release .EXE from the [GitHub Releases page](https://github.com/libretuya/ltchiptool/releases/latest). Open the file, and you're ready to go!
??? quote "Windows (manual installation)"
Install the package from PyPI (**including GUI extras**), using `pip install ltchiptool[gui]`. Note that Python 3.10 or newer is required for the GUI. I recommend Python 3.10 since it has [prebuilt wheels](https://pypi.org/project/wxPython/4.2.0/#files) of wxPython, which doesn't require C++ build dependencies.
??? quote "Linux (Ubuntu)"
Install the package from PyPI, using `pip install ltchiptool`. Python 3.10 or newer is required.
Make sure you have wxPython installed. Install it from PyPI (if you have the necessary build dependencies), or refer to the [wxPython Downloads](https://wxpython.org/pages/downloads/index.html) page to install prebuilt wheels (recommended).
Next, open a terminal and run `ltchiptool gui` (or `python -m ltchiptool gui`).
??? quote "MacOS (untested)"
Install the package from PyPI, using `pip install ltchiptool`. Python 3.10 or newer is required.
Install wxPython from PyPI as well. Version 4.2.0 (latest at the time of writing) has some wheels for MacOS, so that should work.
## GUI Usage
The main window is somewhat similar to [NodeMCU PyFlasher](https://github.com/marcelstoer/nodemcu-pyflasher).
- For dumping, choose `Read flash`. If you've previously chosen an input or output file, it will generate a dump filename with the current timestamp and chip type. Otherwise, click `Browse` and choose the output file. By default, the tool will attempt to read the entire flash chip (usually 2 MiB).
- For flashing, choose `Write flash`. Click `Browse` and select *any* valid firmware file. The file type and chip type will be auto-detected, along with correct flash offset and length. No need to worry about overwriting the bootloader anymore!
- If the file you're selecting is `Unrecognized` or `Not flashable`, it's most likely not a valid firmware file. Refer to usage guides of the custom firmware project of choice, to find which file is meant for flashing.
- **It's best to leave `Auto-detect advanced parameters` checked**. If you're an experienced user and want to flash custom areas of the flash, uncheck the box and specify the parameters manually.
- When you're ready, hit `Start`. The tool will try to connect to the chip on the selected UART port. The black log window will print any warnings/errors, as well as **a short guide on how to put the chip in download mode**.
!!! info
LibreTuya generates multiple firmware files in the build directory. **You usually want to flash the `.uf2` file**, but since ltchiptool can detect file types, you can choose a different firmware file and it'll tell you if that works.
## CLI Usage
!!! note
If you're here to learn how to flash or dump firmware files, use the instructions above.
The content below serves as a short documentation page for [`ltchiptool`](https://github.com/libretuya/ltchiptool) and is mostly meant for advanced users.
```console
$ ltchiptool --help
Usage: ltchiptool [OPTIONS] COMMAND [ARGS]...
Tools for working with LT-supported IoT chips
Options:
-v, --verbose Output debugging messages (repeat to output more)
-T, --traceback Print complete exception traceback
-t, --timed Prepend log lines with timing info
-r, --raw-log Output logging messages with no additional styling
-i, --indent INTEGER Indent log messages using graph lines
-V, --version Show the version and exit.
-h, --help Show this message and exit.
Commands:
dump Capture or process device dumps
elf2bin Generate firmware binaries from ELF file
flash Flashing tool - reading/writing
link2bin Link code to binary format
list List boards, families, etc.
soc Run SoC-specific tools
uf2 Work with UF2 files
```
### Flashing/dumping
There are three main commands used for flashing:
- `ltchiptool flash file <FILE>` - detect file type based on its contents (i.e. chip from which a dump was acquired), similar to Linux `file` command
- `ltchiptool flash read <FAMILY> <FILE>` - make a full flash dump of the connected device; specifying the family is required
- `ltchiptool flash write <FILE>` - upload a file to the device; detects file type automatically (just like the `file` command above)
Supported device families can be checked using `ltchiptool list families` command. In the commands above, you can use any of the family names (name/code/short name/etc).
The upload UART port and baud rate is detected automatically. To override it, use `-d COMx` or `-d /dev/ttyUSBx`. To change the target baud rate, use `-b 460800`.
Note that the baud rate is changed after linking. Linking is performed using chip-default baud rate.
It's not required to specify chip family for writing files - `ltchiptool` tries to recognize contents of the file, and chooses the best settings automatically.
If you want to flash unrecognized/raw binaries (or fine-tune the flashing parameters), specify `-f <FAMILY>` and `-s <START OFFSET>`.
### UF2 Example
```console
$ ltchiptool uf2 info ./arduinotest_22.08.01_wb2l_BK7231T_lt0.8.0.uf2
Family: BK7231T / Beken 7231T
Tags:
- BOARD: wb2l
- DEVICE_ID: d80e20c2
- LT_VERSION: 0.8.0
- FIRMWARE: arduinotest
- VERSION: 22.08.01
- OTA_VERSION: 01
- DEVICE: LibreTuya
- BUILD_DATE: 6d08e862
- LT_HAS_OTA1: 01
- LT_HAS_OTA2: 00
- LT_PART_1: app
- LT_PART_2:
Data chunks: 1871
Total binary size: 478788
```

View File

@@ -13,16 +13,9 @@ Using LibreTuya is simple, just like every other PlatformIO development platform
- Click on the board name. From the documentation page, note the board code.
- Use this code to create a PlatformIO project.
## GPIO usage
## Run community projects
!!! important
This can be confusing at first, so make sure to read this part carefully to understand it.
Input/output pin numbers in Arduino code (i.e. `digitalWrite()`) use Arduino pin numbers - for example `D1`, `D3`. This is the same as simply `1` or `3`, but it cannot be confused with CPU GPIO numbers.
On the board pinout page, the purple blocks represent Arduino pins, while the dark red blocks refer to GPIO numbers.
Projects like ESPHome also use Arduino pin numbering.
LibreTuya was developed with popular community projects in mind. Currently, unofficial [ESPHome port](../projects/esphome.md) is available ([the PR](https://github.com/esphome/esphome/pull/3509) will hopefully be merged into upstream at some point).
## Develop your own project
@@ -31,8 +24,24 @@ If you're developing your own embedded software, and want it to run on LibreTuya
- use PlatformIO IDE (PIO Home -> Open -> New Project)
- run `pio project init` in your desired project directory
Next, read [Uploading](uploading.md) guide to run your project!
Next, read one of the [flashing guides](../flashing/SUMMARY.md) to run your project!
## Run community projects
### LT configuration
LibreTuya was developed with popular community projects in mind. Currently, unofficial [ESPHome port](../projects/esphome.md) is available ([the PR](https://github.com/esphome/esphome/pull/3509) will hopefully be merged into upstream at some point).
LibreTuya has a few configuration options that change its behavior or features. Refer to [LT configuration](../reference/config.md) for details.
### GPIO usage
!!! important
This can be confusing at first, so make sure to read this part carefully to understand it.
Input/output pin numbers in Arduino code (i.e. `digitalWrite()`) use Arduino pin numbers - for example `D1`, `D3`. This is the same as simply `1` or `3`, but it cannot be confused with CPU GPIO numbers.
On the board pinout page, the purple blocks represent Arduino pins, while the dark red blocks refer to GPIO numbers.
### Examples
{%
include-markdown "../../examples/SUMMARY.md"
start="# Examples\n"
%}

Some files were not shown because too many files have changed in this diff Show More