Repository navigation
TODO fixes: safe CLI merge and typed start address - #40
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves two of the open TODOs:
hexcli mergeno longer overwrites overlapping data silently, and the start address record is stored as a typed value instead of raw record text.hexcli mergemerge_safeby default: overlapping data or differing start address records stop the merge with an error that names the file, e.g.app.hex overlaps an earlier input at 0x100 (use --overwrite ...). No output file is written. Before, the later input won without a word, so a wrong:addrcould corrupt another image--overwriteswitch restores the old behavior (later inputs replace overlapping data and the start address record).hexinput with a start address record is moved with:addr: relocation moves only the data, so the merged file may point to the old entry point. No warning if:addrequals where the data already startsparse_argssupports switches (flags without a value) viaSWITCH_FLAGS. Unsupported / repeated switches are rejected like other flagsStart address record
IntelHex::start_addrisOption<StartAddress>instead ofOption<[u8; 18]>(the record's ASCII text). Breaking change of the library APIStartAddressenum:Segment { cs, ip }(record type 03) andLinear(u32)(record type 05, EIP), withrecord_type(),to_bytes()andDisplay(0x11223344 (EIP),0xF000:0x000A (CS:IP))write_hexcreates the record from the value, so it is always uppercase with a valid checksum. Before, the input text was copied as is (a lowercase record stayed lowercase)merge_safecompares values: the same start address written in upper and lower case is no longer a conflicthexcli infoshows the start address if the file has onefingerprint.rskeeps working unchanged (StartAddressderivesHash)Tests
--overwrite, differing start addresses fail by default / later one kept with--overwrite, identical start addresses accepted, relocation warning shown / not shown,--overwriterejected byconvertand when repeated,infoshows the start address--overwriteintelhex.rs: parsing both start record types and lowercase input, merge of start addresses differing only in case,write_hexround trip for both types. Existing tests useStartAddressvalues instead of raw byte arraysrecord.rs:StartAddressfrom a record, record type and payload bytes, display textupdate_slicefailure test also checks that the buffer is left unchanged (replaces atodo: failcomment)