-
Notifications
You must be signed in to change notification settings - Fork 151
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
Micronucleus programmer shows 'error: unsupported memory type flash' #1244
Comments
Hopefully you have some good idea why this happens. This is a regression so we need to fix it before release. |
I can reproduce this issue using ATtiny85 DigiSpark Clone. So this is confirmed to be a regression. It was confirmed to work with PR #945. Firstly I made sure the bootloader works under ATTinyCore (LED is blinking). Click for more details
Then I burn the bootloader again and use avrdude git main. Edit: only the error message avrdude error: unsupported memory type flash is relevant, The other errors are due to the use of libusb-win32 driver.
|
Same problem with ATtiny88 (MH Tiny88). ATtinyCore works fine as it does not avrdude for programming. Edit: only the error message
|
| It appears that the flash is written, however, the padding code is not doing what it is supposed to Well, it does. Read on.
Padding fixes Issue #1050 that AVRDUDE used to treat flash and EEPROM as NOR-memory. Treating all flash as if it was NOR memory is wrong. Only some flash looks like NOR-memory where writing 0xff is a NOP. Whenever the programmer uses a page erase (newer devices) or when it's a bootloader that uses SPM page erase, writing 0xff, well, writes 0xff. This means if you ask these programmers to program 3.5 pages of flash, 4 pages are written and the remaining 0.5 page is overwritten with 0xff. In general, I'd argue that this is wrong. The user might have previously put an important table there. It is worse that this happens to EEPROM. So, this behaviour (false alarm) is an unfortunate combination of
I'd suggest converting line https://github.com/avrdudes/avrdude/blob/main/src/micronucleus.c#L827 from |
I think you can proceed with the change. It is good with an ATTiny85 (DigiSpark Clone, original FW which comes with the board). I still got a warning in the end though,
|
However, the current git main has more issues with the Micronucleus firmware bundled with ATTinyCore. Tested with both ATtiny85 (DigiSpark Clone) and ATtiny167.(DigiSpark Pro clone) Edit -- the issue is with libusb-win32 driver. Switching to WInUSB (or libusbk) will sort out the issue. |
@stefanrueger and @mariusgreuel In the end, it is due to the old libusb-win32 driver. If I switch to libusbk or WinUSB driver, there is no issue. The proposed changes by @stefanrueger is good to go.
|
The other warning is unrelated and may be useful. I suggest changing the message as well:
to emphasise that it's the reading that is not supported. |
Yes I agree with you that the other messgae is probably due to older Micronucleus bootloader firmware and/or due to the use of libusb-win32 driver. I have since upgraded to the latest FIrmware (either the version from Micronucleus or the version from @mariusgreuel) and switched to use WinUSB driver, the second error message goes away. And it is important to use WinUSB driver (preferred) and not libusb-win32 driver. That is already mentioned by @mariusgreuel in the wiki. And your mofification of the message is good to go. |
Maybe Avrdude can warn the user that the USB driver used for Micronucleus isn't preferred? |
Downgraded flash read unsupported err msg to notice. | Maybe Avrdude can warn the user that the USB driver used for Micronucleus isn't preferred? Good idea. Someone else to do who knows where to warn and what wording. |
I will create a new issue to see if we can warn the user for this. I am not so sure if this can be easily done or not. @mariusgreuel has the avrdude-libusb for Windows MSVC build and there is no problem with either WInUSB driver or libusb-win32 driver in this case. The issue is probably specific to libusb-1.0+libusb-compat-0.1 with MSYS2. Take note the official Windows binary will be the MSVC build and not MSYS2 MinGW build.
|
MSYS2 build with libusb-1.0 + libusb-compat-0.1. You can see these is no way to differentiate the three drivers now.
|
Two issues raised against libusb project |
Interestingly I can not reproduce the issue with ATtiny88, using avrdude git version 7.1-20230114 (5ec72e2), using libusb0.sys driver 1.2.7.3 version.
|
I can reproduce the issue with libusb0.sys 1.2.6.0 version.
|
When using the Micronucleus programmer, the error message 'error: unsupported memory type flash' appears:
I just took a quick, and it appears that the line is printed here: https://github.com/avrdudes/avrdude/blob/main/src/micronucleus.c#L827
which is called from
https://github.com/avrdudes/avrdude/blob/main/src/avr.c#L988
As the Micronucleus bootloader does not support reading from flash, the option
-V
must be used. It appears there is now some extra code that reads from flash inavr_write_mem
.with -vvv
Not sure how to fix this. It appears that the flash is written, however, the padding code is not doing what it is supposed to.
The text was updated successfully, but these errors were encountered: