How to Modify BK7238 Partition Table

How to Modify BK7238 Partition Table

Relationship between physical address and logical address #

To ensure the accuracy of the data stored in the flash, 2 bytes of CRC check bits will be added for every 32 bytes (the CRC check is automatically completed by the hardware. The comparison relationship is shown in Figure 1 below: (The left side is the logical address, the right side is the physical address, the red font is CRC check)

logic

Figure1: Comparison of physical address and logical address

The composition of partition modification #

Modifying a partition involves four parts:

important

  • Partition table planning
  • Configuration file modification of packaging script
  • Bootloader partition table modification

Use Case #

Taking bk7238 as an example, when the user adds code based on the SDK, the following compilation error occurs, as shown in Figure 2. What should I do?

build_fail_1

Figure 2 Compilation error icon

out_bin_1

Figure 3 Compiled output firmware

There are two solutions:

  • Solution 1: Check beken7238_crc.bin. The APP partition that exceeds the size is very small. You can turn off some unnecessary functions and reduce the code size. If the code size exceeds a large size, you can only implement Solution 2.
  • Option 2: If the exceeded code size is large, you need to modify the partition table again.

The steps to create a partition table are as follows:

  • 1. App partition table production: If the total physical length of flash is 2M, the partition_start_addr (physical address) and partition_length (physical length) of each partition need to be set in beken378/func/user_driver/BkDriverFlash.c;

bk_partition

Figure 4 Illustration of partition table

  • 2. Packaging script configuration: Just modify the start_addr and size in tools/beken_packager/beken_packager_wrapper according to the size of each partition in the partition table in Figure 4, (where start_addr = partition_start_addr, size = partition_length;

bk_package

Figure 5 Packaging script configuration diagram

  • 3. Use the tools/rt_partition_tool/rt_partition_tool.exe tool to modify the partition table into which the new bootloader is inserted. See Figure 6. The brief steps are as follows:
    • Open the rt_partition_tool.exe tool
    • Load tools/beken_packager/bootloader_bk7238_uart1_v1.0.14.bin
    • Modify the corresponding partition table. Note that offset and length here are both logical addresses, that is, without CRC.
    • File/save partition table to bootloader

bk_partition_tool

Figure 6 rt_partition_tool icon

Introduction to partition functions #

The functions of each partition are introduced as shown in the table

partition namestart addresslengthfunctional description
bootloader0x000000000xf000Store bootloader
app0x110000x121000Store application image
ota0x1320000xAE000store updating image
RF_Firmware0x1E10000x1000Store calibration parameters
NEI_info0x1E20000x1000Store wifi mac address and fast connection parameter

Title

Cionlabs

Cionlabs is formed by a group of experts with extensive domain knowledge coming from the leading technology and consulting firms around the globe with the aim to deliver The Best in the industry. We have the capability to develop comprehensive solutions to tackle the industry challenges, create value, and improve profitability and sustainability for our customers.

CONTACT US

Go to Top