.. index:: cloning, ihex, turnkey, include forth files in binary image, hex file, custom binary or hex image file .. _cloning: Cloning, Manual =============== .. seealso:: :ref:`New version 5Jan2020` This page details cloning a Mecrisp-Stellaris image from a existing STM32F MCU or Board, complete with the Dictionary, Kernel, your user Words, the init Turnkey Word, ... everything. This reproduces exactly the same bootable system on another STM32F MCU or Board simply by flashing the cloned image to it. 1) Download the cloning file. It's named "f051-clone.fs" as I tested it on a STM32F051 Discovery Board. **Download** :download:`f051-clone.fs` .. note:: This code is essentialy code by Mattthias Koch found in his Mecrisp-Stellaris distribution in mecrisp-stellaris-x.x.x/lpc1114fn28/hexdump.txt 2) Set up something to capture the iHex file that will be generated by f051-clone.fs In the example I used the e4thcom terminal and the Unix 'tee' command to clone the terminal text into a logfile. You could use Picocom just as easily, or a logfile if your GUI serial terminal application has one. :: e4thcom -t mecrisp -d ttyUSB0 -b B115200 | tee e4thcom.log 3) Load f051-clone.fs onto your chip/board and run 'clone', you should see something like this:- :: clone :100000008C030020754800000547000005470000EC :1000100000000000000000000000000000000000E0 :100020000000000000000000000000002F4700005A ... lots more of the same :108DF00000000270720000B5FBF72EFAF9F758FC7C :108E0000043E2E732000F9F7F8FCF9F7EAFB00BDE9 :108E1000FFFFFFFF60080570722E66737047000049 :00000001FF 4) Remove any log preamble and postamble then save it as clone.hex 5) Create a binary file from the iHex file :: arm-none-eabi-objcopy -I ihex -O binary clone.hex clone.bin 6) Flash the binary to your STM32F chip/board :: st-flash write clone.bin 0x08000000 7) Test the Clone 8) Optional; make a MD5SUM of your Clone binary, as it may come in handy later to find the exact same binary. :: md5sum clone.bin > clone.bin.md5sum Finished! iHex ---- .. image:: pics/ihex-extended.jpg