Is anybody doing flash “production” programming using OpenOCD?
I would like to program multiple identical boards/chips (LPC21xx) using basically the same flash image, but giving each a unique serial number (like e.g. the ethernet MAC address).
I currently have the following ideas:
- generating an unique image before downloading/flashing. However, this would mean modifying the .elf file... (not so easy)
- flashing two different images in two steps.
- First: flash the "base image" for the application code.
- Second: flash e.g. an easy to generate .hex file for just the serial number.
However, i am not sure what happens here: when using **flash write_image serno.hex**, will it erase/overwrite the whole flash sector? Or will it do an (incremental) update (read in to mem --> erase --> add mem+hex --> flash)?
- do some kind of in-memory modify, i.e. load application code and serial number into memory, effectively generating an in memory image, then flash this in-memory image (thats how abatron's BDI2000 works). I could not find anything about this - it looks like OpenOCD does not support this...
The trick here is: Programming flash means forcing flash bits to zero (after erasing flash, all memory locations are “FF”), so overwriting is no problem, if the first image contains “FF” bytes at the location where the serial number should be programmed. This is default, if the first image does not include data at the address where the serial number should be stored (e. g. _no_init modifier for variable).