The OM6XXX contains a tiny bootloader which is capable of:
- Downloading an application via UART/BLE and programming the application image to the flash.
- Downloading an application to internal SRAM via UART/BLE and executing the application directly.
- Loading an application located in Flash to internal SRAM and executing the application.
- Execute an application located in Flash directly.
- Note
- If the chip supports Secure Boot, this bootloader will no longer be run.
Bootloader
OM6XXX bootloader flow show as follow:
OM6XXX Bootloader Flow
The GPIO4 is known as BOOT PIN. BOOT PIN can force OM6XXX into ISP mode.
The IO of external-flash is:
- MISO = IO7
- CS = IO8
- CLK = IO9
- MOSI = IO10
OM6XXX almost contains internal flash, so most application scenarios do not boot from external flash.
The application's VECTOR_TABLE[10] (defined in startup_xxx.s) is "App Run on SRAM" or "App Run on Flash" flag, If VECTOR_TABLE[10] == 0x46533252, app will run on FLASH directly, otherwise bootloader load FLASH app to SRAM and jump to SRAM.
ISP and BOOT mode
There are two modes in bootloader: ISP mode and BOOT mode.
- ISP Mode is used for burning application to SFlash or SRAM.
- BOOT Mode is used for loading application from SFlash to internal SRAM or executing flash application directly.
When OM6XXX power on or reset, the bootloader will check the boot pin. If the boot pin is LOW level, OM6XXX will be running in ISP mode. If the boot pin is HIGH level and sflash has a valid application, OM6XXX will come into BOOT mode, otherwise ISP mode is running.
OM6XXX ISP Mode
- Branch 1: Bootloader burns application image to FLASH.
- Branch 2: Bootloader burns application image to SRAM.
OM6XXX BOOT Mode
Read and write protection (lock SWD)
- If the customer does not set the write protection of Flash: After setting read and write protection (lock SWD) through ISP, you can unlock read and write protection (also unlock SWD) through ISP, and the unlock method is to erase all flash (keep the CPFT calibration area);
- If the customer sets the write protection of Flash: After setting the read and write protection (lock SWD) through the ISP, it can no longer be unlocked by the ISP. In this case, the upgrade can only be performed through OTA (or other custom upgrade methods of customers);
OTA
Please reference BLE OTA