1.1.6 UART Bootloader Host Script Help
Downloading the host script
To clone or download these host tools from Github,go to the main page of this repository and then click Clone button to clone this repo or download as zip file. This content can also be download using MCC content manager
Path of the tool within the repository is tools/btl_host.py
Setting up the Host PC
The Script is compatible with Python 3.x and higher
It requires pyserial package to communicate with device over UART. Use below command to install the pyserial package
pip3 install pyserial
Description
This host script should be used to communicate with the Bootloader running on the device via UART interface
It is a command line interface and implements the bootloader protocol required to communicate from host PC
If size of the input binary file is not aligned to device erase boundary it appends 0xFF to the binary to make it aligned and then sends the binary to the device
It should be used with -s (--swap) option when using bootloader in fail safe update mode to trigger a swap bank and reset
It should be used with -b (--boot) option with address as 0x0 when updating the bootloader itself on CORTEX-M based MCUs
Usage Examples
Below is the syntax to show help menu for the script
python <harmony3_path>/bootloader/tools/btl_host.py --help
Bootloader basic mode syntax and example
Below syntax and example can be used to program a binary and send a Reset command
python <harmony3_path>/bootloader/tools/btl_host.py -v -i <COM PORT> -d <Device Name> -a <address> -f <Application_binary_path>
python <harmony3_path>/bootloader/tools/btl_host.py -v -i COM18 -d same5x -a 0x2000 -f <harmony3_path>/bootloader_apps_uart/apps/uart_bootloader/test_app/firmware/sam_e54_xpro.X/dist/sam_e54_xpro/production/sam_e54_xpro.X.production.bin
Bootloader Fail Safe Update mode syntax and example
Below syntax and example can be used to program a binary in Inactive Bank and send a Swap Bank and Reset command
python <harmony3_path>/bootloader/tools/btl_host.py -v -s -i <COM PORT> -d <Device Name> -a <Inactive Bank address> -f <Path to application binary>
Example to send Bootloader binary in inactive bank
python <harmony3_path>/bootloader/tools/btl_host.py -v -s -i COM18 -d same5x -a 0x80000 -f <harmony3_path>/bootloader_apps_uart/apps/uart_fail_safe_bootloader/bootloader/firmware/sam_e54_xpro.X/dist/sam_e54_xpro/production/sam_e54_xpro.X.production.bin
Example to send Application binary in inactive bank
python <harmony3_path>/bootloader/tools/btl_host.py -v -s -i COM18 -d same5x -a 0x82000 -f <harmony3_path>/bootloader_apps_uart/apps/uart_fail_safe_bootloader/test_app/firmware/sam_e54_xpro.X/dist/sam_e54_xpro/production/sam_e54_xpro.X.production.bin
Example to send the merged binary in inactive bank using btl_host.py
python <harmony3_path>/bootloader/tools/btl_host.py -v -s -i COM18 -d same5x -a 0x80000 -f <Path_to_merged_binary>/btl_app_merged.bin
Example to send Device Configurations
Refer to Bootloader Device Configuration Input section for details on creating the Device Configuration text file
python <harmony3_path>/bootloader/tools/btl_host.py -v -s -i COM18 -d pic32cm -a 0x800 -f <harmony3_path>/bootloader_apps_uart/apps/trustZone/bootloader/Secure/firmware/pic32cm_ls60_cpro_Secure.X/dist/pic32cm_ls60_cpro/production/pic32cm_ls60_cpro_Secure.X.production.bin -c <path_to_dev_cfg_txt>/devcfg.txt
MPU UART Bootloader syntax and example
Below syntax and example can be used to program a binary and send a Reset command
python <harmony3_path>/bootloader/tools/btl_host.py -v -i <COM PORT> -d <Device Name> -f <Application_binary_path>
Example to send Application binary for SD/eMMC media
python <harmony3_path>/bootloader/tools/btl_host.py -v -i <COM PORT> -d sama5 -f <harmony3_path>/bootloader_apps_uart/apps/mpu_uart_bootloader/test_app/firmware/sam_a5d29_curiosity.X/dist/sam_a5d29_curiosity/production/harmony.bin
Example to send Application binary for Serial Flash media
python <harmony3_path>/bootloader/tools/btl_host.py -v -i <COM PORT> -d sama5 -p 256 -f <harmony3_path>/bootloader_apps_uart/apps/mpu_uart_bootloader/test_app/firmware/sam_a5d29_curiosity.X/dist/sam_a5d29_curiosity/production/harmony.bin
Example to send Application binary for NAND Flash media
python <harmony3_path>/bootloader/tools/btl_host.py -v -i <COM PORT> -d sam9x6 -p 4096 -f <harmony3_path>/bootloader_apps_uart/apps/mpu_uart_bootloader/test_app/firmware/sam_9x60_curiosity.X/dist/sam_9x60_curiosity/production/harmony.bin