Page 1 of 1

Pre-programming flash at manufacturing

Posted: Wed Jun 07, 2017 1:30 pm
by kostyan5
I have a custom board with ESP32 chip and serial flash. I'd like the board to be loaded with firmware at manufacturing. The manufacturer has the ability to program the serial flash before it's put on the board. Are there any instructions on how to properly do this? Do I just tell them to flash .bin file starting at 0? Should I generate a hex file instead?

Thanks,

K

Re: Pre-programming flash at manufacturing

Posted: Thu Jun 08, 2017 2:06 am
by ESP_Angus
Hi kostyan,

In order to program a working ESP32, a number of pieces of data need to be flashed at different offsets. If you run "make" in IDF then it will output a flashing command at the end of the build:

Code: Select all

...
AR libnvs_flash.a
LD hello-world.elf
esptool.py v2.0-beta3
To flash all build output, run 'make flash' or:
python /home/gus/esp/32/idf/components/esptool_py/esptool/esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0x1000 /home/gus/esp/32/idf/examples/get-started/hello_world/build/bootloader/bootloader.bin 0x10000 /home/gus/esp/32/idf/examples/get-started/hello_world/build/hello-world.bin 0x8000 /home/gus/esp/32/idf/examples/get-started/hello_world/build/partitions_singleapp_coredump.bin
The part at the end contains the flash offsets and file names of all the binary files required to flash the app. In the above output:

Code: Select all

0x1000 /home/gus/esp/32/idf/examples/get-started/hello_world/build/bootloader/bootloader.bin
0x10000 /home/gus/esp/32/idf/examples/get-started/hello_world/build/hello-world.bin
0x8000 /home/gus/esp/32/idf/examples/get-started/hello_world/build/partitions_singleapp_coredump.bin
(The exact output may/will vary depending on configuration.)

You can convert these to a single .bin file for easier flashing if you wish, or if your manufacturer doesn't support flashing from multiple files.

Regarding .bin vs .hex, this depends on what file format(s) your manufacturer accepts. The .bin files from IDF are raw binary files (no formatting.)

Another tip, set the flash size in "make menuconfig" (under "Serial Flasher Parameters") before building the firmware - the default is "detect" but this depends on esptool.py being used for flashing. You may also want to double-check the related settings in this menu.

Re: Pre-programming flash at manufacturing

Posted: Mon Nov 06, 2017 6:26 pm
by kostyan5
What's the easiest way to combine the 3 separate bin files into one single bin?

Re: Pre-programming flash at manufacturing

Posted: Mon Aug 26, 2019 4:35 pm
by rudi ;-)
kostyan5 wrote:
Mon Nov 06, 2017 6:26 pm
What's the easiest way to combine the 3 separate bin files into one single bin?

( know it is an old question but usefull for same questions in other postings,
here an answere )

combine it
the Flash Download Tools (ESP8266 & ESP32) / windows GUI flasher tool can do this

Image

for esptool it was marked as enhancement request

refer to an other post

you can do create an own script / expand esptool for combine the files, you must know about your addresses for each file,
or wait for futureing / update it in the esptool.

hope this helps.

best wishes
rudi ;-)

edit:
refere to an other post

add an example pic
check the params on your used clk, spi ram .. also the option "do not chng bin" ..
like you use/need this.

Image

if you then want flash to the esp, simple flash the target.bin to 0x0

if you want multplex flash,
multi_flash.png
multi_flash.png (67.82 KiB) Viewed 8640 times
or need testings interfaces further tools

custom solution example for Pico-D4 (credit: Kjashzhvyktsul )
pico-d4-SoC-program_1.jpg
pico-d4-SoC-program_1.jpg (254.71 KiB) Viewed 8638 times
pico-d4-SoC-program_2.jpg
pico-d4-SoC-program_2.jpg (288.84 KiB) Viewed 8638 times

Re: Pre-programming flash at manufacturing

Posted: Mon Aug 26, 2019 5:39 pm
by chegewara