> 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
Stick in a assembly source file (qwerty.s):
.section ".rodata"
.ascii "qwerty"
.end
Run it through an assembler, presumably a cross assembler for your
target architecture or the same byte ordering as your target (to
create a .o file), a linker with a linker script to set the rodata
section origin to 0x22 (to create an .elf file) and run objdump using
the -Oihex option (to create the .hex file).
Petter
--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Reply by Grant Edwards●May 6, 20082008-05-06
On 2008-05-06, lowcost <die.spam@invalid.com> wrote:
> 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
I don't see why you are about the start record, but it's
trivial to delete it:
$ echo -n qwerty >qwerty.txt
$ objcopy --change-address=0x22 -I binary -O ihex qwerty.txt qwerty.hex
$ sed -i '/^:04000003.*$/d' qwerty.hex
$ cat qwerty.hex
:060022007177657274792C
:00000001FF
You can put the objcopy and sed commands in a shell script so
they can be used as a "single command" if you want. If you're
crippled by Windows, you can install Cygwin to get a usable
shell and set of command-line utilities.
You can do the same thing with srecord, but since objcopy
"comes with" the Gnu toolchain and can also manipulate ELF
files, I tend to use it more often.
--
Grant Edwards grante Yow! Sometime in 1993
at NANCY SINATRA will lead a
visi.com BLOODLESS COUP on GUAM!!
Reply by lowcost●May 6, 20082008-05-06
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
Reply by Grant Edwards●May 5, 20082008-05-05
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!!!!
Reply by lowcost●May 4, 20082008-05-04
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
Reply by Grant Edwards●May 1, 20082008-05-01
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
>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
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.
Reply by Grant Edwards●May 1, 20082008-05-01
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.