Added checksum calculator option for microcontroller.#1
Open
smlkdev wants to merge 1 commit intoLoEE:masterfrom
Open
Added checksum calculator option for microcontroller.#1smlkdev wants to merge 1 commit intoLoEE:masterfrom
smlkdev wants to merge 1 commit intoLoEE:masterfrom
Conversation
nazriel
approved these changes
Mar 12, 2019
lpc17prl.lua
Outdated
| if opts.mode == 'calculate' then | ||
| if not opts.fname then D.abort(2, "Binary file not provided") end | ||
|
|
||
| local f, err = io.open(opts.fname, "r+b") |
There was a problem hiding this comment.
Usually you see such order for open-mode.
Suggested change
| local f, err = io.open(opts.fname, "r+b") | |
| local f, err = io.open(opts.fname, "rb") |
but what you wrote seems to be good as well :)
mkgorski
reviewed
Mar 13, 2019
lpc17prl.lua
Outdated
| local bytes = f:read(4) | ||
| local int32 = B.dec32LE(bytes) | ||
| sum = sum + int32 | ||
| D.yellow''(byteno,int32,B.hex(int32)) |
There was a problem hiding this comment.
Although it's convenient for development purposes - I think user is not interested in those values
lpc17prl.lua
Outdated
|
|
||
| local sum = 0 | ||
|
|
||
| for byteno=1,7,1 do |
There was a problem hiding this comment.
nitpick: you can omit tailing 1:
for byteno=1,7 do
lpc17prl.lua
Outdated
| f:write(B.enc32LE(sum)) | ||
| f:close() | ||
|
|
||
| D.green'File saved! Checksum:'(sum,B.hex(sum)) |
There was a problem hiding this comment.
Again - not sure if it's really needed.
lpc17prl.lua
Outdated
|
|
||
| D.green'File saved! Checksum:'(sum,B.hex(sum)) | ||
|
|
||
| os.exit() |
There was a problem hiding this comment.
What if I'd like patch the file and write it to flash in one go?
Maybe we can think of supporting syntax like ./lpc17prl.lua -XW FILE
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.
Hello!
I would love to add this small functionality into your project!
Cheers,
smlkdev