[SOLVED] generate .HEX file

Post here first, or if you can't find a relevant section!
Locked
KHODIDAS11
Posts: 15
Joined: Sun Aug 20, 2017 4:35 pm

[SOLVED] generate .HEX file

Post by KHODIDAS11 » Tue Jan 30, 2018 6:37 am

Hi
All,

I am using black STM32F407VET6 and STM32F100 Value Line discovery board. For hat i am using geniric STM32F407 sseries/ Black 407VET/ZET board and STM32VLD TO FLASh respectively. After compiling any programm Arduino IDE generates. *.elf and *.bin files in temp folder. Now I want *.hex file
while using UNO, MEGA, DUE it generates *.HEX file and in this STM cores it not.
If anyone can help?

fpiSTM
Posts: 316
Joined: Fri Sep 16, 2016 12:33 pm
Location: Le Mans, France

Re: generate .HEX file

Post by fpiSTM » Tue Jan 30, 2018 8:34 am

Using the objcopy with

Code: Select all

-O ihex
intead of

Code: Select all

-O binary
Edit: I've made a PR to STM core to generate it, this is not the first time I saw this request.
https://github.com/stm32duino/Arduino_C ... 2/pull/211
If you use Roger core, you will have to update the platform.txt to add the recipe.

alexandros
Posts: 76
Joined: Mon Oct 02, 2017 6:51 pm

Re: generate .HEX file

Post by alexandros » Tue Jan 30, 2018 11:46 pm

if we make the update to platform.txt , whats next? where do we have to set that ?

i changed the platform.txt with yours and i get something like

arm-none-eabi-g++: error: missing argument to '-mcpu='

arm-none-eabi-g++: error: unrecognized command line option '-std=gnu++14'

exit status 1
:(

fpiSTM
Posts: 316
Joined: Fri Sep 16, 2016 12:33 pm
Location: Le Mans, France

Re: generate .HEX file

Post by fpiSTM » Wed Jan 31, 2018 6:08 am

Alexandros,
you should not use all the plateform.txt.
This is the one for the Arduino_Core_STM32 (STM core) not the same than Arduino_STM32 (Roger's core base on leaflabs).
I gave the PR as an example of what to do to generate the hex file. Check only the difference to add it to your platform.txt

Here:
https://github.com/rogerclarkmelbourne/ ... rm.txt#L96

KHODIDAS11
Posts: 15
Joined: Sun Aug 20, 2017 4:35 pm

Re: generate .HEX file

Post by KHODIDAS11 » Wed Jan 31, 2018 9:55 am

Hi
thank you for help. it works and creates a proper hex file.

Now i have another relevent issue, my kit uploads *.bin file, while as you have given steps for *.hex file, after creating hex file i observed that separate *.bin bile is not created.
If it is so, we can have *.bin as well as *.hex, and *.bin can be uploaded directly thorugh arduino ide, and *.hex can be uploaded through separate kit.

User avatar
mrburnette
Posts: 2216
Joined: Mon Apr 27, 2015 12:50 pm
Location: Greater Atlanta
Contact:

Re: generate .HEX file

Post by mrburnette » Wed Jan 31, 2018 12:58 pm

KHODIDAS11 wrote:
Wed Jan 31, 2018 9:55 am
Hi
thank you for help. it works and creates a proper hex file.

Now i have another relevent issue, my kit uploads *.bin file, while as you have given steps for *.hex file, after creating hex file i observed that separate *.bin bile is not created.
If it is so, we can have *.bin as well as *.hex, and *.bin can be uploaded directly thorugh arduino ide, and *.hex can be uploaded through separate kit.
You are using a GNU utility. Please read the documentation which can be found by Googling...

Extending an inquiry into a teaching lesson creates a situation where information becomes lost in a convoluted thread. After you have a proper answer to the question asked in the original post, mark the topic [SOLVED] and create another if a second inquiry is pertinent.

The real question is: Are -O binary and -O ihex mutually exclusive. This is something you can research on your own and do some experimenting to answer your own question. Or, perhaps you will have to construct a batch program to perform the second conversion for you if you choose to not do it manually.

I have marked the thread [SOLVED]

Ray

Code: Select all

objcopy [-F bfdname|--target=bfdname]
        [-I bfdname|--input-target=bfdname]
        [-O bfdname|--output-target=bfdname]
        [-B bfdarch|--binary-architecture=bfdarch]
        [-S|--strip-all]
        [-g|--strip-debug]
        [--strip-unneeded]
        [-K symbolname|--keep-symbol=symbolname]
        [-N symbolname|--strip-symbol=symbolname]
        [--strip-unneeded-symbol=symbolname]
        [-G symbolname|--keep-global-symbol=symbolname]
        [--localize-hidden]
        [-L symbolname|--localize-symbol=symbolname]
        [--globalize-symbol=symbolname]
        [-W symbolname|--weaken-symbol=symbolname]
        [-w|--wildcard]
        [-x|--discard-all]
        [-X|--discard-locals]
        [-b byte|--byte=byte]
        [-i [breadth]|--interleave[=breadth]]
        [--interleave-width=width]
        [-j sectionpattern|--only-section=sectionpattern]
        [-R sectionpattern|--remove-section=sectionpattern]
        [--remove-relocations=sectionpattern]
        [-p|--preserve-dates]
        [-D|--enable-deterministic-archives]
        [-U|--disable-deterministic-archives]
        [--debugging]
        [--gap-fill=val]
        [--pad-to=address]
        [--set-start=val]
        [--adjust-start=incr]
        [--change-addresses=incr]
        [--change-section-address sectionpattern{=,+,-}val]
        [--change-section-lma sectionpattern{=,+,-}val]
        [--change-section-vma sectionpattern{=,+,-}val]
        [--change-warnings] [--no-change-warnings]
        [--set-section-flags sectionpattern=flags]
        [--add-section sectionname=filename]
        [--dump-section sectionname=filename]
        [--update-section sectionname=filename]
        [--rename-section oldname=newname[,flags]]
        [--long-section-names {enable,disable,keep}]
        [--change-leading-char] [--remove-leading-char]
        [--reverse-bytes=num]
        [--srec-len=ival] [--srec-forceS3]
        [--redefine-sym old=new]
        [--redefine-syms=filename]
        [--weaken]
        [--keep-symbols=filename]
        [--strip-symbols=filename]
        [--strip-unneeded-symbols=filename]
        [--keep-global-symbols=filename]
        [--localize-symbols=filename]
        [--globalize-symbols=filename]
        [--weaken-symbols=filename]
        [--add-symbol name=[section:]value[,flags]
        [--alt-machine-code=index]
        [--prefix-symbols=string]
        [--prefix-sections=string]
        [--prefix-alloc-sections=string]
        [--add-gnu-debuglink=path-to-file]
        [--keep-file-symbols]
        [--only-keep-debug]
        [--strip-dwo]
        [--extract-dwo]
        [--extract-symbol]
        [--writable-text]
        [--readonly-text]
        [--pure]
        [--impure]
        [--file-alignment=num]
        [--heap=size]
        [--image-base=address]
        [--section-alignment=num]
        [--stack=size]
        [--subsystem=which:major.minor]
        [--compress-debug-sections]
        [--decompress-debug-sections]
        [--elf-stt-common=val]
        [--merge-notes]
        [--no-merge-notes]
        [-v|--verbose]
        [-V|--version]
        [--help] [--info]
        infile [outfile]

Locked