diff --git a/SUMMARY.md b/SUMMARY.md index 5d0e55c..697dee3 100644 --- a/SUMMARY.md +++ b/SUMMARY.md @@ -45,6 +45,7 @@ * [uf2ota.h reference](ltapi/uf2ota_8h.md) * Families * [Realtek - notes](docs/platform/realtek/README.md) + * [Beken 72xx - notes](docs/platform/beken-72xx/README.md) * Realtek AmebaZ Series * Boards * [WR3](boards/wr3/README.md) diff --git a/boards/_base/beken-7231t-tuya.json b/boards/_base/beken-7231t-tuya.json new file mode 100644 index 0000000..e8d5358 --- /dev/null +++ b/boards/_base/beken-7231t-tuya.json @@ -0,0 +1,21 @@ +{ + "build": { + "bkcrypt_coeffs": "510fb093a3cbeadc5993a17ec7adeb03", + "bkboot_version": "1.0.5-bk7231s" + }, + "flash": { + "bootloader": "0x000000+0x11000", + "app": "0x011000+0x119000", + "download": "0x132000+0xA6000", + "kvs": "0x1D8000+0x6000", + "userdata": "0x1DE000+0x22000" + }, + "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." + ] + } +} diff --git a/boards/_base/beken-7231t.json b/boards/_base/beken-7231t.json new file mode 100644 index 0000000..471b93d --- /dev/null +++ b/boards/_base/beken-7231t.json @@ -0,0 +1,14 @@ +{ + "build": { + "family": "BK7231T", + "ldscript_sdk": "bk7231_bsp.ld", + "ldscript_arduino": "bk7231_bsp.ld" + }, + "doc": { + "params": { + "extra": { + "Bluetooth": "BLE v4.2" + } + } + } +} diff --git a/boards/_base/beken-72xx.json b/boards/_base/beken-72xx.json new file mode 100644 index 0000000..36c7941 --- /dev/null +++ b/boards/_base/beken-72xx.json @@ -0,0 +1,38 @@ +{ + "build": { + "f_cpu": "120000000L" + }, + "connectivity": [ + "wifi", + "ble" + ], + "debug": { + "protocol": "openocd", + "protocols": [ + "openocd" + ], + "openocd_config": "bk72xx.cfg" + }, + "frameworks": [ + "beken-72xx-sdk" + ], + "upload": { + "maximum_ram_size": 262144, + "flash_size": 2097152 + }, + "doc": { + "params": { + "manufacturer": "Beken", + "series": "BK72XX", + "voltage": "3.0V - 3.6V", + "extra": { + "Wi-Fi": "802.11 b/g/n" + } + }, + "links": { + "General info": "../../docs/platform/beken-72xx/README.md", + "Flashing (Tuya manual)": "https://developer.tuya.com/en/docs/iot/burn-and-authorize-wb-series-modules?id=Ka78f4pttsytd", + "BkWriter v1.6.0": "https://images.tuyacn.com/smart/bk_writer1.60/bk_writer1.60.exe" + } + } +} diff --git a/boards/_base/realtek-ambz.json b/boards/_base/realtek-ambz.json index 19bcc61..7bd9ff1 100644 --- a/boards/_base/realtek-ambz.json +++ b/boards/_base/realtek-ambz.json @@ -40,6 +40,7 @@ } }, "links": { + "General info": "../../docs/platform/realtek/README.md", "Debugging": "../../docs/platform/realtek/debugging.md", "Flashing (Tuya manual)": "https://developer.tuya.com/en/docs/iot/burn-and-authorize-wr-series-modules?id=Ka789pjc581u8" }, diff --git a/boards/wb2l.json b/boards/wb2l.json new file mode 100644 index 0000000..afd1996 --- /dev/null +++ b/boards/wb2l.json @@ -0,0 +1,18 @@ +{ + "_base": [ + "beken-72xx", + "beken-7231t", + "beken-7231t-tuya" + ], + "build": { + "mcu": "bk7231t", + "variant": "wb2l" + }, + "name": "WB2L Wi-Fi Module", + "url": "https://developer.tuya.com/en/docs/iot/wb2l-datasheet?id=K9duegc9bualu", + "vendor": "Tuya Inc.", + "pcb": { + "templates": [], + "symbol": "WB2L" + } +} diff --git a/boards/wb2l/README.md b/boards/wb2l/README.md new file mode 100644 index 0000000..4ac52b2 --- /dev/null +++ b/boards/wb2l/README.md @@ -0,0 +1,38 @@ +# WB2L Wi-Fi Module + +*by Tuya Inc.* + +[Product page](https://developer.tuya.com/en/docs/iot/wb2l-datasheet?id=K9duegc9bualu) + +- [General info](../../docs/platform/beken-72xx/README.md) +- [Flashing (Tuya manual)](https://developer.tuya.com/en/docs/iot/burn-and-authorize-wb-series-modules?id=Ka78f4pttsytd) +- [BkWriter v1.6.0](https://images.tuyacn.com/smart/bk_writer1.60/bk_writer1.60.exe) + +Parameter | Value +-------------|------------- +MCU | BK7231T +Manufacturer | Beken +Series | BK72XX +Frequency | 120 MHz +Flash size | 2 MiB +RAM size | 256 KiB +Voltage | 3.0V - 3.6V +Wi-Fi | 802.11 b/g/n +Bluetooth | BLE v4.2 + +## Flash memory map + +Flash size: 2 MiB / 2,097,152 B / 0x200000 + +Hex values are in bytes. + +Name | Start | Length | End +----------------|----------|--------------------|--------- +Bootloader | 0x000000 | 68 KiB / 0x11000 | 0x011000 +App Image | 0x011000 | 1.1 MiB / 0x119000 | 0x12A000 +(reserved) | 0x12A000 | 32 KiB / 0x8000 | 0x132000 +OTA Image | 0x132000 | 664 KiB / 0xA6000 | 0x1D8000 +Key-Value Store | 0x1D8000 | 24 KiB / 0x6000 | 0x1DE000 +User Data | 0x1DE000 | 136 KiB / 0x22000 | 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/wr3/README.md b/boards/wr3/README.md index 1d91831..f67c6cd 100644 --- a/boards/wr3/README.md +++ b/boards/wr3/README.md @@ -4,6 +4,7 @@ [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) - [Flashing (Tuya manual)](https://developer.tuya.com/en/docs/iot/burn-and-authorize-wr-series-modules?id=Ka789pjc581u8) diff --git a/docs/families.md b/docs/families.md index f4dba7f..61a14d3 100644 --- a/docs/families.md +++ b/docs/families.md @@ -6,13 +6,13 @@ A list of families currently available in this project. The following list corresponds to UF2 OTA format family names, and is also [available as JSON](../families.json). The IDs are also present in [ChipType.h](../arduino/libretuya/core/ChipType.h). -Title | Name (parent) | Code | Short name & ID | Supported MCU(s) | Arduino Core | Source SDK -------------------------------------------------------|----------------|--------|-------------------------|------------------|--------------|-------------------------------------------------------------------------- -Realtek Ameba1 | `-` | `-` | `RTL8710A` (0x9FFFD543) | - | ❌ | - -[Realtek AmebaZ](https://www.amebaiot.com/en/amebaz/) | `realtek-ambz` | `ambz` | `RTL8710B` (0x22E0D6FC) | RTL8710BN | ✔️ | `framework-realtek-amb1` ([amb1_sdk](https://github.com/ambiot/amb1_sdk)) -Realtek AmebaZ2 | `-` | `-` | `RTL8720C` (0xE08F7564) | - | ❌ | - -Realtek AmebaD | `-` | `-` | `RTL8720D` (0x3379CFE2) | - | ❌ | - -Beken 7231T | `-` | `-` | `BK7231T` (0x675A40B0) | - | ❌ | - -Beken 7231N | `-` | `-` | `BK7231N` (0x7B3EF230) | - | ❌ | - -Boufallo 602 | `-` | `-` | `BL602` (0xDE1270B7) | - | ❌ | - -Xradiotech 809 | `-` | `-` | `XR809` (0x51E903A8) | - | ❌ | - +Title | Name (parent) | Code | Short name & ID | Supported MCU(s) | Arduino Core | Source SDK +-------------------------------------------------------------------|------------------------------|----------------------|-------------------------|---------------------------|--------------|---------------------------------------------------------------------------------- +Realtek Ameba1 | `-` | `-` | `RTL8710A` (0x9FFFD543) | - | ❌ | - +[Realtek AmebaZ](https://www.amebaiot.com/en/amebaz/) | `realtek-ambz` | `ambz` | `RTL8710B` (0x22E0D6FC) | RTL8710BN | ✔️ | `framework-realtek-amb1` ([amb1_sdk](https://github.com/ambiot/amb1_sdk)) +Realtek AmebaZ2 | `-` | `-` | `RTL8720C` (0xE08F7564) | - | ❌ | - +Realtek AmebaD | `-` | `-` | `RTL8720D` (0x3379CFE2) | - | ❌ | - +[Beken 7231T](http://www.bekencorp.com/en/goods/detail/cid/7.html) | `beken-7231t` (`beken-72xx`) | `bk7231t` (`bk72xx`) | `BK7231T` (0x675A40B0) | BK7231T, BK7231S, BK7231U | ❌ | `framework-beken-bdk` ([bdk_freertos](https://github.com/bekencorp/bdk_freertos)) +Beken 7231N | `-` | `-` | `BK7231N` (0x7B3EF230) | - | ❌ | - +Boufallo 602 | `-` | `-` | `BL602` (0xDE1270B7) | - | ❌ | - +Xradiotech 809 | `-` | `-` | `XR809` (0x51E903A8) | - | ❌ | - diff --git a/docs/platform/beken-72xx/README.md b/docs/platform/beken-72xx/README.md new file mode 100644 index 0000000..e561ee9 --- /dev/null +++ b/docs/platform/beken-72xx/README.md @@ -0,0 +1,24 @@ +# Beken 72xx - notes + +There are many chip variations in this SoC family: + +- BK7231 +- BK7231T +- BK7231N +- BK7231S +- BK7231U + +The "officially existing" ones are BK7231, BK7231N and BK7231U. These are supported by Beken SDKs, such as `bdk_freertos`, although `bk7231s_alios_sdk` also existed at some point. + +- BK7231N is substantially different than the other chips, so running T code on N (and vice versa) is not directly possible. +- BK7231 does not have eFuse. +- there are some references to U meaning USB support +- T seems to be exclusive to Tuya boards (that would explain the name); in the T SDK from Tuya, `CFG_SOC_NAME` is set to `SOC_BK7231U` +- T's bootloader greets with `BK7231S_1.0.5` on UART + +Regarding `bdk_freertos`: + +- `make` allows selecting for which MCU the code should be compiled +- `make bk7231` doesn't compile at all +- `make bk7231u` doesn't run on T with Tuya's bootloader (1.0.5), though it works just fine after replacing the bootloader with one of these included with `bdk_freertos` (1.0.8) (yes, even `bk7231n` bootloader) +- after making a few changes to `driver/entry` and `driver/intc` (so it looks more like the code from T SDK) `bdk_freertos` runs just fine diff --git a/families.json b/families.json index 4617138..3b4cada 100644 --- a/families.json +++ b/families.json @@ -30,7 +30,19 @@ { "id": "0x675A40B0", "short_name": "BK7231T", - "description": "Beken 7231T" + "description": "Beken 7231T", + "name": "beken-7231t", + "parent": "beken-72xx", + "code": "bk7231t", + "parent_code": "bk72xx", + "url": "http://www.bekencorp.com/en/goods/detail/cid/7.html", + "sdk": "https://github.com/bekencorp/bdk_freertos", + "framework": "framework-beken-bdk", + "mcus": [ + "BK7231T", + "BK7231S", + "BK7231U" + ] }, { "id": "0x7B3EF230", diff --git a/platform.json b/platform.json index 0f062f8..2863814 100644 --- a/platform.json +++ b/platform.json @@ -21,6 +21,11 @@ "tilte": "Realtek AmebaZ - Arduino", "package": "framework-realtek-amb1", "script": "builder/frameworks/realtek-ambz-arduino.py" + }, + "beken-72xx-sdk": { + "title": "Beken 72XX - SDK", + "package": "framework-beken-bdk", + "script": "builder/frameworks/beken-72xx-sdk.py" } }, "packages": { @@ -31,12 +36,22 @@ "manifest": { "description": "SDK for Ameba1" }, + "toolchain": "gccarmnoneeabi@~1.50401.0", "libraries": { "lwip": [ "v2.0.0-amb1" ] } }, + "framework-beken-bdk": { + "type": "framework", + "optional": true, + "version": "https://github.com/bekencorp/bdk_freertos", + "manifest": { + "description": "Beken Development Kit for FreeRTOS" + }, + "toolchain": "gccarmnoneeabi@~1.40804.0" + }, "framework-arduino-api": { "type": "framework", "optional": true, diff --git a/platform.py b/platform.py index c1fc62b..3a37493 100644 --- a/platform.py +++ b/platform.py @@ -98,20 +98,22 @@ class LibretuyaPlatform(PlatformBase): options.get("pioframework")[0] = framework framework_obj = self.frameworks[framework] + package_obj = self.packages[framework_obj["package"]] # set specific compiler versions - if framework.startswith("realtek-ambz"): - self.packages["toolchain-gccarmnoneeabi"]["version"] = "~1.50401.0" + if "toolchain" in package_obj: + (toolchain, version) = package_obj["toolchain"].split("@") + self.packages[f"toolchain-{toolchain}"]["version"] = version # make ArduinoCore-API required if "arduino" in framework: self.packages["framework-arduino-api"]["optional"] = False # mark framework SDK as required - self.packages[framework_obj["package"]]["optional"] = False + package_obj["optional"] = False # gather library dependencies - libraries = framework_obj["libraries"] if "libraries" in framework_obj else {} + libraries = package_obj["libraries"] if "libraries" in package_obj else {} for name, package in self.packages.items(): if "optional" in package and package["optional"]: continue diff --git a/platform/beken-72xx/ld/bk7231.ld b/platform/beken-72xx/ld/bk7231.ld new file mode 100644 index 0000000..c57eb07 --- /dev/null +++ b/platform/beken-72xx/ld/bk7231.ld @@ -0,0 +1,126 @@ +/* + * Script for GNU linker. + * Describes layout of sections, location of stack. + * + * In this case vectors are at location 0 (reset @ 0x08) + * + * +------------+ 0x00400020 + * data | + * end + * |(heap) | + * . . + * . . + * |(heap limit)| + * + * |- - - - - - | + * stack bottom 256k + * +------------+ + * + * +------------+ 0x0000000 + * |vectors | + * | | + * |------------+ + * |text | + * |data | + * | | 1024k + * +------------+ + */ + +/* Split memory into area for vectors and ram */ +MEMORY +{ + flash (rx) : ORIGIN = 0x00000000, LENGTH = 2M + ram (rw!x): ORIGIN = 0x00400100, LENGTH = 256k - 0x100 +} + +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") +OUTPUT_ARCH(arm) +ENTRY(_vector_start); +_vector_start = ORIGIN(flash); + +SECTIONS +{ + /* vectors go to vectors region */ + . = ORIGIN(flash); + .vectors : + { + KEEP(*(*.vectors)) + KEEP( *(*.boot)) + } > flash + + /* instructions go to the text region*/ + + . = ALIGN(0x8); + /* code, instructions.for example: i=i+1; */ + .text : + { + *(.text) + *(.text.*) + *(.stub) + /* .gnu.warning sections are handled specially by elf32.em. */ + *(.gnu.warning) + *(.gnu.linkonce.t*) + *(.glue_7t) *(.glue_7) + } > flash + + /* read only data.for example: const int rom_data[3]={1,2,3}; */ + .rodata ALIGN(8) : + { + *(.rodata) + *(.rodata.*) + *(.gnu.linkonce.r*) + } > flash + + .ARM.exidx : + { + *(.ARM.exidx*) + *(.gnu.linkonce.armexidx.*) + } > flash + + /* globals.for example: int ram_data[3]={4,5,6}; */ + /* VMA in RAM, but keep LMA in flash */ + _begin_data = .; + .data : AT ( _begin_data ) + { + *(.data .data.*) + *(.sdata) + *(.gnu.linkonce.d*) + SORT(CONSTRUCTORS) + } >ram + + /* Loader will copy data from _flash_begin to _ram_begin..ram_end */ + _data_flash_begin = LOADADDR(.data); + _data_ram_begin = ADDR(.data); + _data_ram_end = .; + + /* uninitialized data section - global int i; */ + .bss ALIGN(8): + { + _bss_start = .; + *boot_handlers.O(.bss .bss.* .scommon .sbss .dynbss COMMON) + *(.bss .bss.*) + *(.scommon) + *(.sbss) + *(.dynbss) + *(COMMON) + /* Align here to ensure that the .bss section occupies space up to + _end. Align after .bss to ensure correct alignment even if the + .bss section disappears because there are no input sections. */ + . = ALIGN(32 / 8); + _bss_end = .; + } > ram /* in RAM */ + + . = ALIGN (8); + _empty_ram = .; + + /* This symbol defines end of code/data sections. Heap starts here. */ + PROVIDE(end = .); +} + +GROUP( + libgcc.a + libg.a + libc.a + libm.a + libnosys.a +) diff --git a/platform/beken-72xx/ld/bk7231_bsp.ld b/platform/beken-72xx/ld/bk7231_bsp.ld new file mode 100644 index 0000000..95b1ed4 --- /dev/null +++ b/platform/beken-72xx/ld/bk7231_bsp.ld @@ -0,0 +1,126 @@ +/* + * Script for GNU linker. + * Describes layout of sections, location of stack. + * + * In this case vectors are at location 0 (reset @ 0x08) + * + * +------------+ 0x00400020 + * data | + * end + * |(heap) | + * . . + * . . + * |(heap limit)| + * + * |- - - - - - | + * stack bottom 256k + * +------------+ + * + * +------------+ 0x0000000 + * |vectors | + * | | + * |------------+ + * |text | + * |data | + * | | 1024k + * +------------+ + */ + +/* Split memory into area for vectors and ram */ +MEMORY +{ + flash (rx) : ORIGIN = 0x00010000, LENGTH = 1912K + ram (rw!x): ORIGIN = 0x00400100, LENGTH = 256k - 0x100 +} + +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") +OUTPUT_ARCH(arm) +ENTRY(_vector_start); +_vector_start = ORIGIN(flash); + +SECTIONS +{ + /* vectors go to vectors region */ + . = ORIGIN(flash); + .vectors : + { + KEEP(*(*.vectors)) + KEEP( *(*.boot)) + } > flash + + /* instructions go to the text region*/ + + . = ALIGN(0x8); + /* code, instructions.for example: i=i+1; */ + .text : + { + *(.text) + *(.text.*) + *(.stub) + /* .gnu.warning sections are handled specially by elf32.em. */ + *(.gnu.warning) + *(.gnu.linkonce.t*) + *(.glue_7t) *(.glue_7) + } > flash + + /* read only data.for example: const int rom_data[3]={1,2,3}; */ + .rodata ALIGN(8) : + { + *(.rodata) + *(.rodata.*) + *(.gnu.linkonce.r*) + } > flash + + .ARM.exidx : + { + *(.ARM.exidx*) + *(.gnu.linkonce.armexidx.*) + } > flash + + /* globals.for example: int ram_data[3]={4,5,6}; */ + /* VMA in RAM, but keep LMA in flash */ + _begin_data = .; + .data : AT ( _begin_data ) + { + *(.data .data.*) + *(.sdata) + *(.gnu.linkonce.d*) + SORT(CONSTRUCTORS) + } >ram + + /* Loader will copy data from _flash_begin to _ram_begin..ram_end */ + _data_flash_begin = LOADADDR(.data); + _data_ram_begin = ADDR(.data); + _data_ram_end = .; + + /* uninitialized data section - global int i; */ + .bss ALIGN(8): + { + _bss_start = .; + *boot_handlers.O(.bss .bss.* .scommon .sbss .dynbss COMMON) + *(.bss .bss.*) + *(.scommon) + *(.sbss) + *(.dynbss) + *(COMMON) + /* Align here to ensure that the .bss section occupies space up to + _end. Align after .bss to ensure correct alignment even if the + .bss section disappears because there are no input sections. */ + . = ALIGN(32 / 8); + _bss_end = .; + } > ram /* in RAM */ + + . = ALIGN (8); + _empty_ram = .; + + /* This symbol defines end of code/data sections. Heap starts here. */ + PROVIDE(end = .); +} + +GROUP( + libgcc.a + libg.a + libc.a + libm.a + libnosys.a +) diff --git a/platform/beken-72xx/openocd/bk72xx.cfg b/platform/beken-72xx/openocd/bk72xx.cfg new file mode 100644 index 0000000..19fda6b --- /dev/null +++ b/platform/beken-72xx/openocd/bk72xx.cfg @@ -0,0 +1,48 @@ +# BK72XX OpenOCD config +# credit: @xabean at https://www.elektroda.com/rtvforum/viewtopic.php?p=20028605#20028605 + +# we only have CEN (aka chip enable, system reset) +reset_config srst_only + +# CEN is normally pulled high, but sometimes it can help to force it high, not just low +reset_config srst_push_pull + +# on connect, deassert (reset to HIGH) the SRST pin +reset_config connect_deassert_srst + +# we have no TRST pin, tell OpenOCD to imagine it's tied to SRST +reset_config srst_pulls_trst + +# use JTAG +transport select jtag + +# 1000 kHz should work +adapter speed 1000 + +# wait 200ms after releasing srst before we send JTAG commands over TMS, +# we will never reset into halt because we have no tRST pin :( +adapter srst delay 200 + +if { [info exists CHIPNAME] } { + set _CHIPNAME $CHIPNAME +} else { + set _CHIPNAME bk7231t +} + +if { [info exists ENDIAN] } { + set _ENDIAN $ENDIAN +} else { + # this defaults to a little endian + set _ENDIAN little +} + +if { [info exists CPUTAPID] } { + set _CPUTAPID $CPUTAPID +} else { + set _CPUTAPID 0x15968001 +} + +jtag newtap $_CHIPNAME cpu -irlen 4 -expected-id $_CPUTAPID + +set _TARGETNAME $_CHIPNAME.cpu +target create $_TARGETNAME arm966e -endian $_ENDIAN -chain-position $_TARGETNAME diff --git a/tools/boardgen b/tools/boardgen index 0ea8d42..c4dedcf 160000 --- a/tools/boardgen +++ b/tools/boardgen @@ -1 +1 @@ -Subproject commit 0ea8d423039fa6407944fb4eedbc71d4f9d2e376 +Subproject commit c4dedcf6abc773b30a592c8ffa0293bd79e7c7f8 diff --git a/tools/util/bkutil.py b/tools/util/bkutil.py index 51d4ca3..5d37fd0 100644 --- a/tools/util/bkutil.py +++ b/tools/util/bkutil.py @@ -57,6 +57,10 @@ class RBL: container_size: int = 0 has_part_table: bool = False + @property + def container_size_crc(self) -> int: + return int(self.container_size + (self.container_size // 32) * 2) + def update(self, data: bytes): self.data_crc = crc32(data, self.data_crc) for byte in data: @@ -188,7 +192,7 @@ class BekenBinary: crc_total += 2 * (len(buf) // 32) # pad the entire container with 0xFF, excluding RBL and its CRC16 - pad_size = pad_up(rbl.data_size + crc_total, rbl.container_size) - 102 + pad_size = pad_up(rbl.data_size + crc_total, rbl.container_size_crc) - 102 for _ in range(pad_size): yield b"\xff" @@ -230,7 +234,9 @@ if __name__ == "__main__": "package", description="Package raw binary files as RBL containers" ) add_common_args(package) - package.add_argument("size", type=auto_int, help="RBL total size (dec/hex)") + package.add_argument( + "size", type=auto_int, help="RBL total size (excl. CRC) (dec/hex)" + ) package.add_argument( "-n", "--name", @@ -255,7 +261,9 @@ if __name__ == "__main__": unpackage.add_argument( "offset", type=auto_int, help="Offset in input file (dec/hex)" ) - unpackage.add_argument("size", type=auto_int, help="RBL total size (dec/hex)") + unpackage.add_argument( + "size", type=auto_int, help="Container total size (incl. CRC) (dec/hex)" + ) args = parser.parse_args() bk = BekenBinary(args.coeffs) @@ -293,7 +301,8 @@ if __name__ == "__main__": rbl.has_part_table = True print(f" - in bootloader mode; partition table unencrypted") rbl.container_size = args.size - print(f" - container size: 0x{args.size:X}") + print(f" - container size (excl. CRC): 0x{rbl.container_size:X}") + print(f" - container size (incl. CRC): 0x{rbl.container_size_crc:X}") gen = bk.package(f, args.addr, size, rbl) if args.action == "unpackage":