2025-12-17 15:55:25 +08:00

54 lines
1.7 KiB
Markdown

# utils/bin_gen.py
To compose flash image binary file from separated binary files.
This script combines .bin files in folder, `flash_bin`, in a predefined order.
> Binary placing offset for KL520 flash should align with 4KB
## Prerequisite
```
pip install argparse numpy
```
## Command
```
$ python3 bin_gen.py <options>
usage: bin_gen.py [-h] [-p] [-f FLASH_SIZE] [-n]
optional arguments:
-h, --help show this help message and exit
-p, --CPU_ONLY FW only
-f FLASH_SIZE, --flash_size FLASH_SIZE
target board flash size in MB
-n, --no_usb_loader_mode
flash table for no usb loader mode
```
> Default flash size is 32 MB
## Note
**The following bin files are must**
```
flash_bin
├── boot_spl.bin // bool spl bin file
├── fw_loader.bin // LOADER bin file (or copied from plus/res/firmware/KL520)
├── fw_ncpu.bin // SCPU FW bin file (generated by Keil)
├── fw_scpu.bin // NCPU FW bin file (generated by Keil)
├── prog_fw_loader_flash-boot.bin // switch to flash boot bin file (or copied from kl520_sdk/utils/JLink_programmer/kdp2)
├── models_520.nef // model information(or copied from plus/res/models/KL520)
```
```
** if -n is specified (no usb loader mode) **
flash_bin
├── boot_spl.bin // bool spl bin file
├── fw_ncpu.bin // SCPU FW bin file (generated by Keil)
├── fw_scpu.bin // NCPU FW bin file (generated by Keil)
├── models_520.nef // model information(or copied from plus/res/models/KL520)
```