Hello everyone, I have to convert a .bin file to one .hex. Can anyone tell me how I can do? thank you and greetings. Fabrizio
thanks, these are all good solutions!
Regards
Fabrizio
As Philippe GRAILLE mentioned, if you are using MCUXpresso it can create the Hex file for you.
To do this automatically you can go in the settings and add the following to the post-build steps.
arm-none-eabi-objcopy -v -O ihex "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.hex"
if you prefer the MOTOROLA SRECORD format, use:
arm-none-eabi-objcopy -v -O srec "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.srec"
Converting from binary can be tricky as the binary files have no address location information.
So, if your code does not start at address 0, you need a tool where you can specify the memory location when converting.
Hi
See also the utilities in the uTasker project: http://www.utasker.com/forum/index.php?topic=1445.0
These allow flexible ways to convert between formats, combine boot and application files, or generate arrays based on images, web pages etc. for embedding into code or embedding code that is to be uploaded to other processors into code. The collection had been developed over 14 years of real project requirements so contains most of what embedded programmers need to be able to do in varied situations.
There is also support for Motorola binary format (output from older CW IDEs) or encrypting and authenticating applications for use by secure boot loaders.
Regards
Mark
use bin2hex.exe on windows. There is similar tools available for post build conversion on Linux.
Hope this helps
Hi,
In MCUXpresso :
Right click on your binary axf file
Binary Utility / Create HEX
In command line :
arm-none-eabi-objcopy -O binary "${FileName}" "${FileBaseName}.bin"
Philippe.
Hi Erich,
my problem is this: I'm using the application CreateImage (of PEMICRO) to create the image of my KEA128 kinetis firmware, using Cyclone FX. My firmware consists of two blocks, bootloader + application. Since CreateImage does not accept .bin formats it only accepts HEX formats, so I used an application, HexEdit 4.0 (I do not know if you know it) to export the file in Srec format (S2 Motorola record). I have just discovered, however, that when it generates this format the checksum is wrong, increasing the correct value by 1.
for example the record line:
S2240004000000000000000000FFFFFFFF82FFFFFF10B58A18914210D00302000A0C78034369 ends with 69 but the exact checksum is 68.
In practice, each record line ends with a value of +1 relative to the correct value.
That is why Cyclone FX rightly gives ERROR VERIFY.
The application that tips works correctly? does it also exist to convert Srec motorola format?
Thank you
Fabrizio
S record uses the 1's complement of the lower byte of the sum of all bytes, not the 2's complement as Intel Hex does.
The 2 in S2 is not part of the checksum. So 69 is the correct checksum for this S record.
my operating system is win 64bit...
Hi Fabrizio,
Converting Binary Files to Intel Hex Format with the SRecord Tool | MCU on Eclipse should be what you are asking for?
I hope this helps,
Erich