From 2a75bdbeda39eecf850f805e2de9e0f8f6e4c6e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Szczodrzy=C5=84ski?= Date: Sat, 1 Oct 2022 15:01:38 +0200 Subject: [PATCH] [beken-72xx] Update TLV and calibration flash layout --- boards/_base/beken-7231n-tuya.json | 5 +++-- boards/_base/beken-7231t-tuya.json | 5 +++-- boards/cb2l/README.md | 5 +++-- boards/cb2s/README.md | 5 +++-- boards/cb3l/README.md | 5 +++-- boards/cb3s/README.md | 5 +++-- boards/cb3se/README.md | 5 +++-- boards/generic-bk7231n-qfn32-tuya/README.md | 5 +++-- boards/generic-bk7231t-qfn32-tuya/README.md | 5 +++-- boards/lsc-lma35/README.md | 5 +++-- boards/wb2l/README.md | 5 +++-- boards/wb2s/README.md | 5 +++-- boards/wb3l/README.md | 5 +++-- boards/wb3s/README.md | 5 +++-- platform/beken-72xx/fixups/wrap_BkDriverFlash.c | 8 ++++---- 15 files changed, 46 insertions(+), 32 deletions(-) diff --git a/boards/_base/beken-7231n-tuya.json b/boards/_base/beken-7231n-tuya.json index 452e7f9..254b479 100644 --- a/boards/_base/beken-7231n-tuya.json +++ b/boards/_base/beken-7231n-tuya.json @@ -8,8 +8,9 @@ "bootloader": "0x000000+0x11000", "app": "0x011000+0x119000", "download": "0x12A000+0xA6000", - "tlv": "0x1D0000+0x1000", - "net": "0x1D1000+0x2000", + "calibration": "0x1D0000+0x1000", + "net": "0x1D1000+0x1000", + "tlv": "0x1D2000+0x1000", "kvs": "0x1D3000+0x8000", "userdata": "0x1DB000+0x25000" }, diff --git a/boards/_base/beken-7231t-tuya.json b/boards/_base/beken-7231t-tuya.json index cbc3c46..74ae877 100644 --- a/boards/_base/beken-7231t-tuya.json +++ b/boards/_base/beken-7231t-tuya.json @@ -9,8 +9,9 @@ "app": "0x011000+0x121000", "download": "0x132000+0xA6000", "kvs": "0x1D8000+0x8000", - "tlv": "0x1E0000+0x1000", - "net": "0x1E1000+0x2000", + "calibration": "0x1E0000+0x1000", + "tlv": "0x1E1000+0x1000", + "net": "0x1E2000+0x1000", "userdata": "0x1E3000+0x1D000" }, "upload": { diff --git a/boards/cb2l/README.md b/boards/cb2l/README.md index 9b519a6..12a981e 100644 --- a/boards/cb2l/README.md +++ b/boards/cb2l/README.md @@ -65,8 +65,9 @@ Name | Start | Length | End Bootloader | 0x000000 | 68 KiB / 0x11000 | 0x011000 App Image | 0x011000 | 1.1 MiB / 0x119000 | 0x12A000 OTA Image | 0x12A000 | 664 KiB / 0xA6000 | 0x1D0000 -TLV Store | 0x1D0000 | 4 KiB / 0x1000 | 0x1D1000 -Network Data | 0x1D1000 | 8 KiB / 0x2000 | 0x1D3000 +Calibration | 0x1D0000 | 4 KiB / 0x1000 | 0x1D1000 +Network Data | 0x1D1000 | 4 KiB / 0x1000 | 0x1D2000 +TLV Store | 0x1D2000 | 4 KiB / 0x1000 | 0x1D3000 Key-Value Store | 0x1D3000 | 32 KiB / 0x8000 | 0x1DB000 User Data | 0x1DB000 | 148 KiB / 0x25000 | 0x200000 diff --git a/boards/cb2s/README.md b/boards/cb2s/README.md index a807cb1..1f1a389 100644 --- a/boards/cb2s/README.md +++ b/boards/cb2s/README.md @@ -68,8 +68,9 @@ Name | Start | Length | End Bootloader | 0x000000 | 68 KiB / 0x11000 | 0x011000 App Image | 0x011000 | 1.1 MiB / 0x119000 | 0x12A000 OTA Image | 0x12A000 | 664 KiB / 0xA6000 | 0x1D0000 -TLV Store | 0x1D0000 | 4 KiB / 0x1000 | 0x1D1000 -Network Data | 0x1D1000 | 8 KiB / 0x2000 | 0x1D3000 +Calibration | 0x1D0000 | 4 KiB / 0x1000 | 0x1D1000 +Network Data | 0x1D1000 | 4 KiB / 0x1000 | 0x1D2000 +TLV Store | 0x1D2000 | 4 KiB / 0x1000 | 0x1D3000 Key-Value Store | 0x1D3000 | 32 KiB / 0x8000 | 0x1DB000 User Data | 0x1DB000 | 148 KiB / 0x25000 | 0x200000 diff --git a/boards/cb3l/README.md b/boards/cb3l/README.md index caa26a7..294bbaf 100644 --- a/boards/cb3l/README.md +++ b/boards/cb3l/README.md @@ -69,8 +69,9 @@ Name | Start | Length | End Bootloader | 0x000000 | 68 KiB / 0x11000 | 0x011000 App Image | 0x011000 | 1.1 MiB / 0x119000 | 0x12A000 OTA Image | 0x12A000 | 664 KiB / 0xA6000 | 0x1D0000 -TLV Store | 0x1D0000 | 4 KiB / 0x1000 | 0x1D1000 -Network Data | 0x1D1000 | 8 KiB / 0x2000 | 0x1D3000 +Calibration | 0x1D0000 | 4 KiB / 0x1000 | 0x1D1000 +Network Data | 0x1D1000 | 4 KiB / 0x1000 | 0x1D2000 +TLV Store | 0x1D2000 | 4 KiB / 0x1000 | 0x1D3000 Key-Value Store | 0x1D3000 | 32 KiB / 0x8000 | 0x1DB000 User Data | 0x1DB000 | 148 KiB / 0x25000 | 0x200000 diff --git a/boards/cb3s/README.md b/boards/cb3s/README.md index 6c13393..43e76fe 100644 --- a/boards/cb3s/README.md +++ b/boards/cb3s/README.md @@ -71,8 +71,9 @@ Name | Start | Length | End Bootloader | 0x000000 | 68 KiB / 0x11000 | 0x011000 App Image | 0x011000 | 1.1 MiB / 0x119000 | 0x12A000 OTA Image | 0x12A000 | 664 KiB / 0xA6000 | 0x1D0000 -TLV Store | 0x1D0000 | 4 KiB / 0x1000 | 0x1D1000 -Network Data | 0x1D1000 | 8 KiB / 0x2000 | 0x1D3000 +Calibration | 0x1D0000 | 4 KiB / 0x1000 | 0x1D1000 +Network Data | 0x1D1000 | 4 KiB / 0x1000 | 0x1D2000 +TLV Store | 0x1D2000 | 4 KiB / 0x1000 | 0x1D3000 Key-Value Store | 0x1D3000 | 32 KiB / 0x8000 | 0x1DB000 User Data | 0x1DB000 | 148 KiB / 0x25000 | 0x200000 diff --git a/boards/cb3se/README.md b/boards/cb3se/README.md index cb0edbe..e1dbb84 100644 --- a/boards/cb3se/README.md +++ b/boards/cb3se/README.md @@ -74,8 +74,9 @@ Name | Start | Length | End Bootloader | 0x000000 | 68 KiB / 0x11000 | 0x011000 App Image | 0x011000 | 1.1 MiB / 0x119000 | 0x12A000 OTA Image | 0x12A000 | 664 KiB / 0xA6000 | 0x1D0000 -TLV Store | 0x1D0000 | 4 KiB / 0x1000 | 0x1D1000 -Network Data | 0x1D1000 | 8 KiB / 0x2000 | 0x1D3000 +Calibration | 0x1D0000 | 4 KiB / 0x1000 | 0x1D1000 +Network Data | 0x1D1000 | 4 KiB / 0x1000 | 0x1D2000 +TLV Store | 0x1D2000 | 4 KiB / 0x1000 | 0x1D3000 Key-Value Store | 0x1D3000 | 32 KiB / 0x8000 | 0x1DB000 User Data | 0x1DB000 | 148 KiB / 0x25000 | 0x200000 diff --git a/boards/generic-bk7231n-qfn32-tuya/README.md b/boards/generic-bk7231n-qfn32-tuya/README.md index 4c1f293..8936fda 100644 --- a/boards/generic-bk7231n-qfn32-tuya/README.md +++ b/boards/generic-bk7231n-qfn32-tuya/README.md @@ -71,8 +71,9 @@ Name | Start | Length | End Bootloader | 0x000000 | 68 KiB / 0x11000 | 0x011000 App Image | 0x011000 | 1.1 MiB / 0x119000 | 0x12A000 OTA Image | 0x12A000 | 664 KiB / 0xA6000 | 0x1D0000 -TLV Store | 0x1D0000 | 4 KiB / 0x1000 | 0x1D1000 -Network Data | 0x1D1000 | 8 KiB / 0x2000 | 0x1D3000 +Calibration | 0x1D0000 | 4 KiB / 0x1000 | 0x1D1000 +Network Data | 0x1D1000 | 4 KiB / 0x1000 | 0x1D2000 +TLV Store | 0x1D2000 | 4 KiB / 0x1000 | 0x1D3000 Key-Value Store | 0x1D3000 | 32 KiB / 0x8000 | 0x1DB000 User Data | 0x1DB000 | 148 KiB / 0x25000 | 0x200000 diff --git a/boards/generic-bk7231t-qfn32-tuya/README.md b/boards/generic-bk7231t-qfn32-tuya/README.md index 8dc029e..ec9f65b 100644 --- a/boards/generic-bk7231t-qfn32-tuya/README.md +++ b/boards/generic-bk7231t-qfn32-tuya/README.md @@ -72,8 +72,9 @@ Bootloader | 0x000000 | 68 KiB / 0x11000 | 0x011000 App Image | 0x011000 | 1.1 MiB / 0x121000 | 0x132000 OTA Image | 0x132000 | 664 KiB / 0xA6000 | 0x1D8000 Key-Value Store | 0x1D8000 | 32 KiB / 0x8000 | 0x1E0000 -TLV Store | 0x1E0000 | 4 KiB / 0x1000 | 0x1E1000 -Network Data | 0x1E1000 | 8 KiB / 0x2000 | 0x1E3000 +Calibration | 0x1E0000 | 4 KiB / 0x1000 | 0x1E1000 +TLV Store | 0x1E1000 | 4 KiB / 0x1000 | 0x1E2000 +Network Data | 0x1E2000 | 4 KiB / 0x1000 | 0x1E3000 User Data | 0x1E3000 | 116 KiB / 0x1D000 | 0x200000 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. diff --git a/boards/lsc-lma35/README.md b/boards/lsc-lma35/README.md index 5fb3bae..de4c08a 100644 --- a/boards/lsc-lma35/README.md +++ b/boards/lsc-lma35/README.md @@ -71,8 +71,9 @@ Name | Start | Length | End Bootloader | 0x000000 | 68 KiB / 0x11000 | 0x011000 App Image | 0x011000 | 1.1 MiB / 0x119000 | 0x12A000 OTA Image | 0x12A000 | 664 KiB / 0xA6000 | 0x1D0000 -TLV Store | 0x1D0000 | 4 KiB / 0x1000 | 0x1D1000 -Network Data | 0x1D1000 | 8 KiB / 0x2000 | 0x1D3000 +Calibration | 0x1D0000 | 4 KiB / 0x1000 | 0x1D1000 +Network Data | 0x1D1000 | 4 KiB / 0x1000 | 0x1D2000 +TLV Store | 0x1D2000 | 4 KiB / 0x1000 | 0x1D3000 Key-Value Store | 0x1D3000 | 32 KiB / 0x8000 | 0x1DB000 User Data | 0x1DB000 | 148 KiB / 0x25000 | 0x200000 diff --git a/boards/wb2l/README.md b/boards/wb2l/README.md index af59ebe..f564451 100644 --- a/boards/wb2l/README.md +++ b/boards/wb2l/README.md @@ -71,8 +71,9 @@ Bootloader | 0x000000 | 68 KiB / 0x11000 | 0x011000 App Image | 0x011000 | 1.1 MiB / 0x121000 | 0x132000 OTA Image | 0x132000 | 664 KiB / 0xA6000 | 0x1D8000 Key-Value Store | 0x1D8000 | 32 KiB / 0x8000 | 0x1E0000 -TLV Store | 0x1E0000 | 4 KiB / 0x1000 | 0x1E1000 -Network Data | 0x1E1000 | 8 KiB / 0x2000 | 0x1E3000 +Calibration | 0x1E0000 | 4 KiB / 0x1000 | 0x1E1000 +TLV Store | 0x1E1000 | 4 KiB / 0x1000 | 0x1E2000 +Network Data | 0x1E2000 | 4 KiB / 0x1000 | 0x1E3000 User Data | 0x1E3000 | 116 KiB / 0x1D000 | 0x200000 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. diff --git a/boards/wb2s/README.md b/boards/wb2s/README.md index 0a239a0..bd6708e 100644 --- a/boards/wb2s/README.md +++ b/boards/wb2s/README.md @@ -72,8 +72,9 @@ Bootloader | 0x000000 | 68 KiB / 0x11000 | 0x011000 App Image | 0x011000 | 1.1 MiB / 0x121000 | 0x132000 OTA Image | 0x132000 | 664 KiB / 0xA6000 | 0x1D8000 Key-Value Store | 0x1D8000 | 32 KiB / 0x8000 | 0x1E0000 -TLV Store | 0x1E0000 | 4 KiB / 0x1000 | 0x1E1000 -Network Data | 0x1E1000 | 8 KiB / 0x2000 | 0x1E3000 +Calibration | 0x1E0000 | 4 KiB / 0x1000 | 0x1E1000 +TLV Store | 0x1E1000 | 4 KiB / 0x1000 | 0x1E2000 +Network Data | 0x1E2000 | 4 KiB / 0x1000 | 0x1E3000 User Data | 0x1E3000 | 116 KiB / 0x1D000 | 0x200000 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. diff --git a/boards/wb3l/README.md b/boards/wb3l/README.md index 7e56a61..08e9217 100644 --- a/boards/wb3l/README.md +++ b/boards/wb3l/README.md @@ -74,8 +74,9 @@ Bootloader | 0x000000 | 68 KiB / 0x11000 | 0x011000 App Image | 0x011000 | 1.1 MiB / 0x121000 | 0x132000 OTA Image | 0x132000 | 664 KiB / 0xA6000 | 0x1D8000 Key-Value Store | 0x1D8000 | 32 KiB / 0x8000 | 0x1E0000 -TLV Store | 0x1E0000 | 4 KiB / 0x1000 | 0x1E1000 -Network Data | 0x1E1000 | 8 KiB / 0x2000 | 0x1E3000 +Calibration | 0x1E0000 | 4 KiB / 0x1000 | 0x1E1000 +TLV Store | 0x1E1000 | 4 KiB / 0x1000 | 0x1E2000 +Network Data | 0x1E2000 | 4 KiB / 0x1000 | 0x1E3000 User Data | 0x1E3000 | 116 KiB / 0x1D000 | 0x200000 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. diff --git a/boards/wb3s/README.md b/boards/wb3s/README.md index 6378314..d3e5f23 100644 --- a/boards/wb3s/README.md +++ b/boards/wb3s/README.md @@ -73,8 +73,9 @@ Bootloader | 0x000000 | 68 KiB / 0x11000 | 0x011000 App Image | 0x011000 | 1.1 MiB / 0x121000 | 0x132000 OTA Image | 0x132000 | 664 KiB / 0xA6000 | 0x1D8000 Key-Value Store | 0x1D8000 | 32 KiB / 0x8000 | 0x1E0000 -TLV Store | 0x1E0000 | 4 KiB / 0x1000 | 0x1E1000 -Network Data | 0x1E1000 | 8 KiB / 0x2000 | 0x1E3000 +Calibration | 0x1E0000 | 4 KiB / 0x1000 | 0x1E1000 +TLV Store | 0x1E1000 | 4 KiB / 0x1000 | 0x1E2000 +Network Data | 0x1E2000 | 4 KiB / 0x1000 | 0x1E3000 User Data | 0x1E3000 | 116 KiB / 0x1D000 | 0x200000 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. diff --git a/platform/beken-72xx/fixups/wrap_BkDriverFlash.c b/platform/beken-72xx/fixups/wrap_BkDriverFlash.c index e113a7e..8b7bf4a 100644 --- a/platform/beken-72xx/fixups/wrap_BkDriverFlash.c +++ b/platform/beken-72xx/fixups/wrap_BkDriverFlash.c @@ -29,15 +29,15 @@ static const bk_logic_partition_t bk7231_partitions[BK_PARTITION_MAX] = { { .partition_owner = BK_FLASH_EMBEDDED, .partition_description = "RF Firmware", - .partition_start_addr = FLASH_TLV_OFFSET, - .partition_length = FLASH_TLV_LENGTH, + .partition_start_addr = FLASH_CALIBRATION_OFFSET, + .partition_length = FLASH_CALIBRATION_LENGTH, .partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_DIS, }, { .partition_owner = BK_FLASH_EMBEDDED, .partition_description = "NET info", - .partition_start_addr = FLASH_NET_OFFSET, - .partition_length = FLASH_NET_LENGTH, + .partition_start_addr = FLASH_TLV_OFFSET, + .partition_length = FLASH_TLV_LENGTH, .partition_options = PAR_OPT_READ_EN | PAR_OPT_WRITE_DIS, }, };