EFlash Loader is the program that runs on #BL602 to flash all firmware ... The ELF was uploaded recently (no source available) ... Let's look inside with Ghidra
https://github.com/bouffalolab/bl_iot_sdk/tree/master/flash_tool/chips/bl602/eflash_loader
Decompiled #BL602 EFlash Loader is here ... 10,000 lines of C to skim for goodies 👍
https://github.com/lupyuen/bl602-eflash-loader/blob/main/eflash_loader.c
#BL602 EFlash Loader's Main Function is surprisingly readable ... Decompiled from ELF by Ghidra
https://github.com/lupyuen/bl602-eflash-loader/blob/main/eflash_loader.c#L2803-L2863
Here's the #BL602 EFlash Loader's Main Loop that executes Flashing Commands
https://github.com/lupyuen/bl602-eflash-loader/blob/main/eflash_loader.c#L4031-L4108
What are the Flash Commands executed by the #BL602 EFlash Loader? 🤔
https://github.com/lupyuen/bl602-eflash-loader/blob/main/eflash_loader.c#L3814-L3844
Here are the 24 Flashing Commands supported by the #BL602 EFlash Loader ... Thanks to Ghidra 🎉
https://github.com/lupyuen/bl602-eflash-loader#flashing-commands
So cute that the #BL602 Flashing Commands are all ASCII ... Perfect for UART! 👍
https://github.com/lupyuen/bl602-eflash-loader#flashing-commands
You can't tell which way the train went by looking at the tracks ... So let's study the #BL602 Firmware Flasher ... And see what Flashing Commands it sends to the EFlash Loader
#BL602 Firmware Flasher works like a State Machine ... Each Flashing State triggers a Flashing Command ... Let's trace the Flashing States
https://github.com/bouffalolab/BLOpenFlasher/blob/main/utils/util_program.go#L195-L245