GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — New Extended Address record type mode saving in 'write_hex_file' function by fernandez85 · Pull Request #41 · python-intelhex/intelhex Conversation
|
|
Hmm, I didn't see that before, but there is a pull-up request (old one though), which is strongly related with this topic: #5
Right now I'm confused :) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
OK, my bad. It was 4 years ago. A long time ago in far far galaxy... |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I see no problem in "merging" both solutions. The only thing here is what You consider as common part and what is need to be changed. This can be done in several variants.
And I think that is all. Tell me what You think and I'll start to work on this :) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
OK. Let's do what is minimal accepted for you. I don't want to ask you for something you don't sign in. Converting start address is overkill for me. It's nice to have, but maybe as a separate method, if any? Your and older patches are both trying to fix the same problem. Let's name it in scrum terms )) "I want to have control over the type of extended address record when writing the hex file." What we need, the core part:
The second, bonus part:
So, about "auto" type of extended address record. It looks for me that we must check the maximum address of the data first, then if still segment is possible - check starting address record type, if no starting address record here - use linear. As we say before - linear was default behaviour in all previous releases. Does it make sense for you? I'd like to summarize, for every change (core and bonus parts) I'd like to have from your patch:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
I agree about exception. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Umm, and another option for auto. I think we can save the extended address type we read from source hex file. If there is only one type, you can save it for later use as another sign before inspecting starting addr type. This would make round trip better. Again - it's up to you. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Hi,
this is already done in my solution, but:
I can agree to preserve old the behavior, when possible. Nevertheless 'auto' mode is something new, which will be used only by people who will no something about it. Default option is 'linear', just like did with my current change.
'linear' option would be actually what we have in IntelHex right now. 'segment' would throw exception whenever Starting Linear Address is detected or data >=1MB. Both would not add any Extended Address records when when data <64KB.
I was thinking about this. But first of all the IntelHex internal structure data need to support this. And we need to always remember about this if we want to rely on that parameter. I would like add additionally, that besides 'bin2hex' we need to take care of 'hexmerge' as well - it uses 'write_to_hex' directly. I checked it today ;) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
| minaddr = addresses[0] | ||
| maxaddr = addresses[-1] | ||
|
|
||
| if extaddr_rectyp == -1: |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I think we should check maxaddr before checking start addr record type.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Reason why this is here, is because whole data are manged here. We have all necessary variables here. If we want to make checks for 'maxaddr' before Starting Address then I'm understanding this that You want to make this more important criteria than Start Address type for Extended Address resolving. If this was Your intention, then no problem - I will do a little change and refactor. If not then I suggest this would stay as it is now.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| while cur_addr <= maxaddr: | ||
| if need_offset_record: | ||
| if cur_addr > 0x0FFFFF and extaddr_rectyp == 2: |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
we should check this condition at the start of the operation. checking it here every time is waste of time.
if maxaddr > 0x0FFFFF
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
OK, agree. Need to find different suitable exception type :)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| bin[4] = b[0] # msb of high_ofs | ||
| bin[5] = b[1] # lsb of high_ofs | ||
| bin[5] = b[1] # lsb of high_ofs |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
don't add extra white spaces please
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, I haven't. Done now, for core part, except tests. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I've added a new option for 'ext_addr_mode' - 'none'. When selected it only checks if last address fits into 64KB. It's just to have consistent solution for all options ('segment', 'linear'). |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Please add something to NEWS and AUTHORS
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| BLOCK_SIZE = 128 # 128 bytes | ||
| for addr in range(0, EEPROM_SIZE, BLOCK_SIZE): | ||
| eeprom.i2c_write(addr, ih.tobinarray(start=addr, size=BLOCK_SIZE)) | ||
| Writing out data |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I spot different line-endings here. Can you double check please? I'd like to see actual changes in document, but diff shows me that all document was changed. Not good. I believe all my files are using LF line-endings. You can set git attributes for those text files if you wish. But please, don't blindly change line endings. It's bad practice.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
OK, I will recheck this. I checked few files and I thought they are OK.
Maybe the problem is that I'm using Windows and it does some "magically" things with the files :/
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I'm on Windows too. You can use smart text editor though, Visual Studio Code is very good and should preserve original line-endings IIRC.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I use VS Code as well. It looks like something went wrong.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| eol = IntelHex._get_eol_textfile(eolstyle, sys.platform) | ||
|
|
||
| addresses = dict_keys(self._buf) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I can't see unit tests for new feature. Can you add some? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Test for new 'none' option are there. I didn't do special test suite for it. Just added/changed to which I created before. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
I haven't noticed changes to tests - because it says diff too large. Again line edings. Please fix it. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
You mean to squash all the commits in this pull request? Is this even possible after everything is pushed on repo? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I think you will need to use |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
New 'ext_addr_mode' parameter responsible for Extended Address records.
88a2e42 to
1d8f5c8
Compare
|
I left 'X' in 'NEWS' on purpose, as I can't predict the future ;) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
@bialix I don't know if You get the notifications I had corrected everything that you requested. It's waiting for You to review :) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Sorry for delay! I can't review it right now. I'll try my best soon. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
does it support extended segment address write?
There was an error while loading. Please reload this page.