Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can you add hex file support for TI C28x DSP? #34

Open
xjtuecho opened this issue Aug 4, 2019 · 7 comments
Open

Can you add hex file support for TI C28x DSP? #34

xjtuecho opened this issue Aug 4, 2019 · 7 comments

Comments

@xjtuecho
Copy link

xjtuecho commented Aug 4, 2019

The ram and rom width of TI C28x DSP such as TMS320F28335 is 16 bits, and data word is big endian. I use command below to generate hex file from ELF file.

hex2000.exe --memwidth=16 --romwidth=16 --intel -o dat.hex firmware.out

Here is a segment of hex file of C28x. Word on address 0x3F2132 is 0x835E and word on address 0x3F2142 is 0x0000 and word on address 0x3F2152 is 0xAAAB.

:02000004003FBB
:20213200835E3F6C09083F71FA0B3F7453F83F7814BE3F7B3AAC3F7DC46D3F7EB10F3F7FEC
:2021420000003F8000004300F98341A20FDB3D49007F00000000BF00AAABBE2AAAAB3E2A74
:0C215200AAAB3D2A88893C088889BC089B
:00000001FF

When I use IntexHex16bit to parse the hex file, it raised AddressOverlapError. Can you add support for C28x? Thank you.

@benfre
Copy link

benfre commented Aug 5, 2019

I make a PR #33 , add feature of any bit_length word mode (class IntelHexWord). The hex file using with word address not byte address. It not not merged for now. You can check my fork .

from intelhex import IntelHexWord

h16 = IntelHexWord('test_16bit.hex', word_length=16)
h16.write_hex_file('test_16bit.out.hex', byte_count=32)
print('{:x}'.format(h16[0x3F2132]))

@eerimoq
Copy link

eerimoq commented Sep 23, 2019

@xjtuecho Maybe you can use the bincopy package instead?

import bincopy

HEX = '''\
:02000004003FBB
:20213200835E3F6C09083F71FA0B3F7453F83F7814BE3F7B3AAC3F7DC46D3F7EB10F3F7FEC
:2021420000003F8000004300F98341A20FDB3D49007F00000000BF00AAABBE2AAAAB3E2A74
:0C215200AAAB3D2A88893C088889BC089B
:00000001FF
'''

bf = bincopy.BinFile(word_size_bits=16)
bf.add_ihex(HEX)

print("0x3F2132 = 0x{:04X}".format(bf[0x3F2132]))
print("0x3F2142 = 0x{:04X}".format(bf[0x3F2142]))
print("0x3F2152 = 0x{:04X}".format(bf[0x3F2152]))

The output is:

0x3F2132 = 0x835E
0x3F2142 = 0x0000
0x3F2152 = 0xAAAB

@bialix
Copy link
Member

bialix commented Sep 27, 2019

Sorry for not working on your issue. I'm looking for a new maintainer for Python IntelHex project. I hope someone will help.

@bialix
Copy link
Member

bialix commented Jul 9, 2020

I need file format description. Do you have any document?

@benfre
Copy link

benfre commented Jul 11, 2020

I believe this is docs for hex2000 with --intel option
@xjtuecho Can you confirm?

@xjtuecho
Copy link
Author

xjtuecho commented Jul 12, 2020

I believe this is docs for hex2000 with --intel option
@xjtuecho Can you confirm?

Yes.
We created hex file from cof file with command line below:

hex2000.exe -romwidth=16 -memwidth=16 --intel -o=OUT.hex IN.out

@xjtuecho
Copy link
Author

xjtuecho commented Jul 12, 2020

I need file format description. Do you have any document?

This is a snippet of a hex file.

:020000040032C8
:048000000072B05802
:20800200761F0006E2AF0000761F0005E8500000E2AF013CE7200008E2AF013EE694000138
:20801200AD146424E2AF003C761F0006E2AF0100E8500009761F0005E7100008E2AF013E61
:20802200E6940001AD146204063C1E3E6F1B761F0006E2AF0000761F0005E2AF013EE720D7
:2080320000087700E203003E6F0DE2AF003E761F0006E2AF0100E7100008761F0005E20396
:20804200003E0006761F0006E2AF0006E8500000E2AF0102E7200008E2AF0104E6940001BC
:20805200AD14641DE2AF0002E2AF0106E85000097700E7100008E2AF0104E6940001AD1418
:20806200620406021E046F14E2AF0006E2AF0104E72000087700E20300046F0AE2AF000441
:20807200E2AF0106E71000087700E20300040006E590761F0003E203000E761F0002E20375
:208082000026761F0002E203000E761F0003E2030010761F0002E2030028761F0002E20381

and the actual memory contents after flashing the hex file.

memrd 328000

0x328000 0072 B058 761F 0006 E2AF 0000 761F 0005
0x328008 E850 0000 E2AF 013C E720 0008 E2AF 013E
0x328010 E694 0001 AD14 6424 E2AF 003C 761F 0006
0x328018 E2AF 0100 E850 0009 761F 0005 E710 0008
0x328020 E2AF 013E E694 0001 AD14 6204 063C 1E3E
0x328028 6F1B 761F 0006 E2AF 0000 761F 0005 E2AF
0x328030 013E E720 0008 7700 E203 003E 6F0D E2AF
0x328038 003E 761F 0006 E2AF 0100 E710 0008 761F
0x328040 0005 E203 003E 0006 761F 0006 E2AF 0006
0x328048 E850 0000 E2AF 0102 E720 0008 E2AF 0104
0x328050 E694 0001 AD14 641D E2AF 0002 E2AF 0106
0x328058 E850 0009 7700 E710 0008 E2AF 0104 E694
0x328060 0001 AD14 6204 0602 1E04 6F14 E2AF 0006
0x328068 E2AF 0104 E720 0008 7700 E203 0004 6F0A
0x328070 E2AF 0004 E2AF 0106 E710 0008 7700 E203
0x328078 0004 0006 E590 761F 0003 E203 000E 761F

TI_c28x_16bits.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants