Pre-programming flash at manufacturing

kostyan5
Posts: 50
Joined: Mon Mar 06, 2017 3:16 pm

Pre-programming flash at manufacturing

Postby kostyan5 » Wed Jun 07, 2017 1:30 pm

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

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: Pre-programming flash at manufacturing

Postby ESP_Angus » Thu Jun 08, 2017 2:06 am

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.

kostyan5
Posts: 50
Joined: Mon Mar 06, 2017 3:16 pm

Re: Pre-programming flash at manufacturing

Postby kostyan5 » Mon Nov 06, 2017 6:26 pm

What's the easiest way to combine the 3 separate bin files into one single bin?

User avatar
rudi ;-)
Posts: 1728
Joined: Fri Nov 13, 2015 3:25 pm

Re: Pre-programming flash at manufacturing

Postby rudi ;-) » Mon Aug 26, 2019 4:35 pm

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 8637 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 8635 times
pico-d4-SoC-program_2.jpg
pico-d4-SoC-program_2.jpg (288.84 KiB) Viewed 8635 times
Last edited by rudi ;-) on Mon Aug 26, 2019 6:12 pm, edited 2 times in total.
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪


Who is online

Users browsing this forum: No registered users and 109 guests