adafruit / adafruit/Adafruit_CircuitPython_AVRprog

Hex-files spanning more than 64K not supported

Open
#24 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
35
Forks
19
PR merge metrics
No merged PRs in 30d

Description

Having little knowledge on all things github, I will refrain from trying to commit stuff that'll break more than it fixes, and in stead upload information + test files to document an observed anomaly. I hope maintainers will find the below info useful:

The AVR ATmega2560 comes with 256KBytes of internal flash. However, trying to program in excess of 64K fails, as the expanded memory range record type 04 in intel Hex file format is not supported.

Run the attached code.py with the attached 128K test file on an ATmega2560 target and you will get the following output:
```
code.py output:
**************************************************************
* AVR ATmega2560 programmer *
* 02-11-2021 *
* Type 'g' to start: *g
**************************************************************
Working with an ATmega2560 CPU. Good!
Read lockbits: ['0xf7', '0x17', '0x4', '0x3f']
Erasing chip...
Re-read lockbits: ['0xf7', '0x17', '0x4', '0x3f']
Programming flash with Tester_128K.hex
Traceback (most recent call last):
File "code.py", line 68, in
File "adafruit_avrprog.py", line 139, in program_file
File "adafruit_avrprog.py", line 425, in read_hex_page
RuntimeError: Unsupported record type 4 on line 1

Code done running.
```
*Unsupported record type 4 on line 1*
On line 1 of the HEX-file you find
```
:020000040000FA
```
which, according to https://en.wikipedia.org/wiki/Intel_HEX#Record_types
is an extended memory specifier allowing for up to 4GByte address range, of which we need up to 0x3FFFF.

Programming with a HEX file that uses Record type 4 is not supported.

[ExtMemCode.zip](https://github.com/adafruit/Adafruit_CircuitPython_AVRprog/files/7461750/ExtMemCode.zip)

Contributor guide

No contributing guide indexed for this repository

Research direction

Run the attached code.py with Tester_128K.hex against an ATmega2560 to reproduce the failure. Read adafruit_avrprog.py at program_file and read_hex_page, where the traceback reports unsupported record type 4. Done means the supplied HEX file can be programmed beyond 64K without the record-type error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
embedded-iot
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.