Hi there
So this may be useful to some of the makers and want-a-be programmers out there.
If you ever had a need to produce a finished project Production BIN file. A single file that is flashable to the Xiao ESP32x line of MCU’s without giving up the Source code or Sketch it’s derived from.
This is NOT for security (as no encryption is employed in this info) More over it’s ONLY meant for Flashing a single BIN file to speed production or Trouble-shoot the Compiler environment.
i.e. I compile a specific sketch and download the code that RUNS , AOK.
(Joe Third-Grader) Takes My Sketch and It fails to run but compiles ok?
What do you do? How can you troubleshoot that scenario?
with tools and ingenuity. This method allows you to freeze the compiler environment and build a BIN that will work no matter what (less defective Hardware)…
You ever see this Menu selection under “Sketch” in the IDE? " Export Compiled Binary"
It does exactly that, Outputs the necessary Binary files to Build a Flashable BIN file.
When you click it, You’ll get the 3 files of your sketch, (the main.ino.bin, the bootloader.bin, the partitions.bin) these three files and the Arduino boot_app0.bin (generated by IDE upload process)
all get combined to make a single production BIN file you can flash serially to 8*or so units at a time(Factory-Multi-Download Tab) production style.
You get the offsets of each file from the IDE upload process (by not selecting a com port or disconnecting the device) The Xiao ESP32C3 is on Com3 ( I pick com10 to avoid port not open problem with ESP RF test Tool, open at the same time and to get the offsets from IDE compiler output.
Cut and paste the highlighted line to notepad and word wrap it at the “bin” line. (pic 3)
Clear the error box and cut and paste the Highlighted line…
paste it in Notepad to get the offset Hex locations and file paths to paste into flash tool.
Lots of info on this line, It’s all about the Flash chip inside , (size matters) useful for Reading!
offsets are 0x0, 0x8000, 0xe000, 0x10000. we’ll use them to combine the bins into ONE production Flashable BIN file.
next we open the Tool to Flash ESP chips.
open it and you’ll see this.
select USB for load mode , hit ok,
You get to the Good Stuff. (also should be noted the PDF for this file is included in the download) all the steps listed and more are in there if you want to Stretch your reach with this stuff. Watch what I do in the next video with this tool set. but I digress…
You should see this screen
I will add the paths, file names, offsets and check marks.here
then press start, as long as the com port is not open on any other app it will Flash the chip and the progress bar will move across the bottom.
Press reset on the Xiao it will run.
To make the single Production BIN file after you verified the Bins run AOK , then you can press the “CombineBin” button, you’ll get this.
The “target.bin” and the success text… Now you can ZIP the file or Flash it to any new hardware.
just by selecting the single BIN. like this;
Here’s the example Drop it on a ESP32C3 Xiao on a Round Display with a SD card with a gif folder in it containing the Winking Chimp.gif file.
https://forum.seeedstudio.com/uploads/short-url/379lZ8kOsK8m5XceULKFnPJeUQq.zip
Hope that Helps
Ask me anything.
GL PJ
You can also use the esptool just as the IDE does. You just don’t see it easy. the command is like this: “esptool.exe” --chip esp32c3 --port “COM10” --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x0 “C:\Users\Dude\target.bin”
and worth Noting the Flashing of the four files is precisely what the IDE does under the hood with those offsets and esptool.
Bonus, Flashing the Target.bin file is the same as Flashing the Factory.bin as in the Getting Started WiKi for the Xiao ESP32C3 Here: using the EspRFTestTool_
same tech, different file.