-
Notifications
You must be signed in to change notification settings - Fork 125
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
Switch to read-modify-write flashing. #155
Switch to read-modify-write flashing. #155
Conversation
61b024a
to
1147466
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I'll give it a test run locally, and accept the changes if all good.
Trying to figure out why the tests are failing with |
This enables programming the chip without having to erase the entire contents. Instead, JLink will erase where needed while retaining the data that's within the same sectors but outside of the specified write area. Closes square#154, square#148
Co-authored-by: Ford Peprah <hkpeprah@users.noreply.github.com>
6bee16f
to
0256933
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Just one comment from my testing.
|
||
return res | ||
bytes_flashed = self._dll.JLINKARM_WriteMem(addr, len(data), data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debugging, it looks like data
has to be a bytes
vs. a list of integers, so if data
is a list of integers, this will fail. I think that means we have to call bytes(data)
here.
- Convert
data
to bytes if not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want to retain the signature (list of bytes) and convert to bytes
when needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think keeping the signature, and convert. What I found was that [1, 2, 3, 4]
failed, but bytes([1, 2, 3, 4])
succeeded, so maybe just a simple check like:
if not isinstance(data, bytes):
data = bytes(data)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made it a bit more strict and only convert if it's a list since that's what the function expects. Type annotations could be useful to soft enforce it.
Not tested yet :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to be working fine here.
flash() now accepts both list[int] and bytes.
191aca6
to
456ab14
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Will cut a new release later today.
Thanks for the submission. Should be available now in |
This enables programming the chip without having to erase the entire contents. Instead, JLink will erase where needed while retaining the data that's within the same sectors but outside of the specified write area.
I was only able to run some of the Behave tests as I don't have access to the hardware.
Closes #154, #148