EmbeddedRelated.com
Forums

ASCII Text to I8HEX Format Converter

Started by dohzer May 1, 2008
I have a large amount of text that I need to put on an EEPROM and I was
wondering if there is a program that will convert ASCII text to I8HEX Intel
HEX format.

Not just ASCII to HEX, but the full properly formatted and checksummed
I8HEX format, like shown here here: 

http://en.wikipedia.org/wiki/Intel_HEX

If anyone knows of a program that can do that it would help a lot.

Thanks for any suggestions.

dohzer wrote:
> I have a large amount of text that I need to put on an EEPROM and I was > wondering if there is a program that will convert ASCII text to I8HEX Intel > HEX format. > > Not just ASCII to HEX, but the full properly formatted and checksummed > I8HEX format, like shown here here: > > http://en.wikipedia.org/wiki/Intel_HEX > > If anyone knows of a program that can do that it would help a lot. > > Thanks for any suggestions.
http://srecord.sourceforge.net Converts anything to anything. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
On 2008-05-01, dohzer <dohzer@hotmail.com> wrote:
> I have a large amount of text that I need to put on an EEPROM and I was > wondering if there is a program that will convert ASCII text to I8HEX Intel > HEX format. > > Not just ASCII to HEX, but the full properly formatted and checksummed > I8HEX format, like shown here here: > > http://en.wikipedia.org/wiki/Intel_HEX > > If anyone knows of a program that can do that it would help a lot.
objcopy -I binary -O ihex input.txt output.hex http://sourceware.org/binutils/docs-2.18/binutils/objcopy.html -- Grant Edwards grante Yow! Gee, I feel kind of at LIGHT in the head now, visi.com knowing I can't make my satellite dish PAYMENTS!
>http://srecord.sourceforge.net > >Converts anything to anything. > > >Vladimir Vassilevsky >DSP and Mixed Signal Design Consultant >http://www.abvolt.com >
I saw that program, but I wasn't sure how to get it to run under Windows. Thanks, I'll see if I can figure it out.
>I have a large amount of text that I need to put on an EEPROM and I was > wondering if there is a program that will convert ASCII text to I8HEX > Intel > HEX format. > > Not just ASCII to HEX, but the full properly formatted and checksummed > I8HEX format, like shown here here: > > http://en.wikipedia.org/wiki/Intel_HEX > > If anyone knows of a program that can do that it would help a lot. > > Thanks for any suggestions.
Or roll your own. All respondents suggestions were good but the time it takes you to find such a tool is probably more than the effort it would take to write it yourself. JJS
dohzer ha scritto:
> Not just ASCII to HEX, but the full properly formatted and checksummed > I8HEX format, like shown here here: > http://en.wikipedia.org/wiki/Intel_HEX
uhm, what about eeprom starting address ?
On 2008-05-01, lowcost <die.spam@invalid.com> wrote:
> dohzer ha scritto: >> Not just ASCII to HEX, but the full properly formatted and checksummed >> I8HEX format, like shown here here: >> http://en.wikipedia.org/wiki/Intel_HEX > > uhm, what about eeprom starting address ?
I give up. What about it? -- Grant Edwards grante Yow! at BI-BI-BI-BI-BI-BI-BI-BI-BI-BI-BI-BI-BI-BI-BI-BI-BI-BI-BI-BI-BI-BI-BI-BI- visi.com
Grant Edwards ha scritto:
> I give up. What about it?
ehm, ASCII text file don't contain any address, HEX file records needs addresses; may be that the tool objcopy will make the good job starting with default address 0x00 ; else you should --set-start <addr> Set the start address to <addr> to match eeprom starting address. under windows i feed filein.cod to obsend.exe (st7 tools). obsend filein.cod,f,fileout.hex,i filein.cod = 4_byte_LH_address + 4byte_LH_lenght + ascii_file.txt easy to make with any hex editor. regards
On 2008-05-04, lowcost <die.spam@invalid.com> wrote:
> Grant Edwards ha scritto:
>> I give up. What about it? > > ehm, ASCII text file don't contain any address, HEX file > records needs addresses; may be that the tool objcopy will > make the good job starting with default address 0x00 ; else > you should --set-start <addr> Set the start address to <addr> > to match eeprom starting address.
The --set-start option doesn't do what you think it does. It sets the "entry point". It sets the address to which one is supposed to jump in order to start execution of the resulting image. The start address is sent using record type 0x03 and is typically located at the end of the hex file: $ objcopy -I binary -O ihex --set-start=0x5555 asdf.txt asdf.hex $ head -n3 asdf.hex; tail -n3 asdf.hex :100000000A546865207175657374696F6E206F6638 :1000100020656D756C6174696E672061207365720F :1000200069616C20706F727420696E2075736572DF :0A02C0002D200A4772616E740A0ACD :04000003000055554F :00000001FF If you want to relocate the output data to an address other than that of the input data [files of type "binary" have an implicit address of 0], you use the --change-addresses option: $ objcopy -I binary -O ihex --change-addresses=0x5555 asdf.txt asdf.hex $ head -n3 asdf.hex :105555000A546865207175657374696F6E206F668E :1055650020656D756C6174696E6720612073657265 :1055750069616C20706F727420696E207573657235 note that --change-addresses also changes the start address in addition to changing the load address: :0A5815002D200A4772616E740A0A22 :04000003000055554F :00000001FF
> under windows i feed filein.cod to obsend.exe (st7 tools). > obsend filein.cod,f,fileout.hex,i > > filein.cod = 4_byte_LH_address + 4byte_LH_lenght + ascii_file.txt > > easy to make with any hex editor.
-- Grant Edwards grante Yow! My face is new, my at license is expired, and I'm visi.com under a doctor's care!!!!
Grant Edwards ha scritto:
> If you want to relocate the output data to an address other > than that of the input data [files of type "binary" have an > implicit address of 0], you use the --change-addresses option: > > $ objcopy -I binary -O ihex --change-addresses=0x5555 asdf.txt asdf.hex
thank you Grant , this seems to be a quite right answer to the original question from Dohzer. please explain me how to obtain these two .hex records ( "qwerty" at address 0x22 ) from ascii .txt , under windows, avoiding record type 0x03 in I8HEX : it will be useful for me too. :060022007177657274792C :00000001FF regards