We use IHEX to load ADSP firmware.
For implementation I used specification here:
http://www.interlog.com/~speff/usefulinfo/Hexfrmt.pdf
Also wiki article may seem useful
https://en.wikipedia.org/wiki/Intel_HEX
Paths
| Differential D60270
[llvm-objcopy] Add support for Intel HEX output format ClosedPublic Authored by evgeny777 on Apr 4 2019, 8:37 AM.
Details Summary We use IHEX to load ADSP firmware. For implementation I used specification here: Also wiki article may seem useful
Diff Detail Event TimelineComment Actions Thanks for sending this! I assigned PR39841 to you since this should fix that bug. I ran this on some internal ihex files we have, and it seems to be dropping one of the sections, so I'll have to poke around to see what the bug is. But some ihex support is better than none, so it's not necessarily blocking :)
evgeny777 added inline comments.
Comment Actions Line parser moved to IHexRecord::parse Comment Actions
FYI, most of the other llvm-objcopy developers are still away following Euro LLVM, so it may not be until next week that you get an comments from @rupprecht. I don't currently have time to read up on ihex, I'm afraid, but if you don't get any feedback next week, I'll try to look into it if I have time. Comment Actions
Ah, I see. Ok, there is no rush. Comment Actions
Sorry, I should have mentioned earlier that I was going to be busy last week. (In advance: I'm here this week, but I'll be out next week). btw, some people at euro llvm also requested srec supprt, which seems extremely similar to ihex -- so it might be good to think about how generic this handling can be, e.g. maybe most of it should just be a "record" parser which is shared with ihex and srec. I don't think premature specialization should be done to make it more general than it should be, but just don't do anything that would be hostile towards refactoring it :) Comment Actions
For me it doesn't look extremely similar to IHEX, except both formats use hexadecimal byte representation. I think if we implement SREC then part of section builder functionality from IHexELFBuilder::addDataSections can be moved to a common base class, Still I expect writer and parser to be completely separate. Comment Actions There's a lot of code to review here. I'll keep reviewing it everyday but this is going to take a while to review. Any help on splitting this up and making into smaller chunks would be helpful. Splitting reading and writing up into two separate patches would be helpful and removing features that we can add later would be helpful.
Comment Actions
I've responded to some of the comments, meanwhile I'm splitting patch into writer (will go first) and reader (will go next). Will update the review soon
Comment Actions Looked mostly at the test for now, going to take a pass over the code today.
Comment Actions Some insight into the differences:
evgeny777 marked 7 inline comments as done. Comment Actions
rupprecht marked an inline comment as done. Comment ActionsI ran a few internal tests and this produces identical ihex output for every file I checked! \ o /
This revision is now accepted and ready to land.May 28 2019, 2:19 PM evgeny777 retitled this revision from [llvm-objcopy] Add support for Intel HEX input/output format to [llvm-objcopy] Add support for Intel HEX output format.May 29 2019, 3:11 AM Closed by commit rL361949: [llvm-objcopy] Implement IHEX writer (authored by evgeny777). · Explain WhyMay 29 2019, 4:37 AM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 193910 include/llvm/Support/Error.h
test/tools/llvm-objcopy/ELF/Inputs/ihex-elf-pt-null.yaml
test/tools/llvm-objcopy/ELF/Inputs/ihex-elf-sections.yaml
test/tools/llvm-objcopy/ELF/Inputs/ihex-elf-sections2.yaml
test/tools/llvm-objcopy/ELF/Inputs/ihex-elf-segments.yaml
test/tools/llvm-objcopy/ELF/Inputs/sections.hex
test/tools/llvm-objcopy/ELF/ihex-reader.test
test/tools/llvm-objcopy/ELF/ihex-writer.test
tools/llvm-objcopy/CopyConfig.cpp
tools/llvm-objcopy/ELF/ELFObjcopy.h
tools/llvm-objcopy/ELF/ELFObjcopy.cpp
tools/llvm-objcopy/ELF/Object.h
tools/llvm-objcopy/ELF/Object.cpp
tools/llvm-objcopy/llvm-objcopy.h
tools/llvm-objcopy/llvm-objcopy.cpp
|
size_t here and below is kind of confusing, can we use uint32_t?