Go Down

Topic: avrdude: verification error, first mismatch at byte 0x7000 (Read 178 times) previous topic - next topic

nonlinearmind

I've been trying to run a sketch on a Red Bear Blend Micro and I keep running into this error:

avrdude: verification error, first mismatch at byte 0x7000

 I'm able to upload other sketches without a problem and I can even get the sketch I'm having problems with to successfully upload by removing lines of code. The amount of code I need to remove to make it work seems arbitrary. Sometimes it's just a single line of code that "tips it over" to the point of bringing up the error. Sometimes it's large sections. Does anyone know what this error is and how to fix it?  Thanks.




avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x7000
         0x61 != 0x55
avrdude: verification error; content mismatch
avrdude: Send: L [4c]
avrdude: Recv: . [0d]
avrdude: Send: E [45]
avrdude: Recv: . [0d]

avrdude done.  Thank you.


dmjlambert

Well, the end of sketch flash and beginning of bootloader flash is at memory location 0x7000.  So, it would appear your sketch is too big.   In the IDE preferences you can checkmark show verbose output on compile and on upload, and it will show you more detailed info.   Fix by optimizing your sketch, make it more efficient, do the same tasks with less code.


DrAzzy

What doesn't make sense is that it's giving that error.

0x7000 is 28672, which is the maximum sketch size for the micro.

It should be stopping you earlier and telling you the sketch is too big.
Instead, it's getting far enough that it tries to upload it, and only fails when it discovers that the parts of the program after that point haven't been written, because the bootloader refuses to overwrite itself (correctly).
ATtiny core for 841+1634+828 and x313/x4/x5/x61/x7/x8 series Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts (some assembled), mosfets and awesome prototyping board in my store http://tindie.com/stores/DrAzzy

nonlinearmind

I thought it might be because my sketch is to be, also, but it doesn't give me that warning. It's frustrating, because I can remove two lines of code somewhere and it will upload fine. And at three lines of code somewhere else, and it will still upload. There doesn't seem to be any rhyme or reason to it. I've attached my verbose output. Can either of you see if there's anything wrong and it?

DrAzzy

The issue is that your sketch is compiling to be too large, and the chip does not have enough space to store the program. By the time that log you posted is being recorded, you should already have received an error message saying the sketch is too big - at that point, OF COURSE it fails, it SHOULD FAIL TO UPLOAD because there IS NOT ENOUGH SPACE ON THE CHIP. Address 0x7000 (and everything after that) is used by the bootloader, and is not available for your sketch - which is why the bootloader refuses to write to it.

As you have noticed, it is often not immediately obvious what effect incremental additions to or removals from the code will have on the size - this is normal. A major determining factor is whether a new piece of code needs to be added behind the scenes to make it work, or whether that code has to be there anyway. So, if you can eliminate use of a certain function, that helps more (I've had sketches where I made space by eliminating use of pinMode()...)


The only thing that is going wrong is that you're not being told that the sketch is too big before it tries to upload - instead it's charging blindly forward and attempting to upload a sketch that's too big (and of course, failing).

When you compile your sketch, it says "xxxxx bytes used of maximum yyyyy bytes". What numbers are you seeing there?

What board do you have selected? Have you modified the boards.txt in any way? Are you using a custom core?
ATtiny core for 841+1634+828 and x313/x4/x5/x61/x7/x8 series Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts (some assembled), mosfets and awesome prototyping board in my store http://tindie.com/stores/DrAzzy

nonlinearmind

That's the thing, it tells me:

Binary sketch size: 28,360 bytes (of a 28,672 byte maximum)

 So if it is a size problem, it's not warning me at the point that it should. I'm using a red bear blend micro, unmodified.

DrAzzy

Why the hell would it be trying to write/read 0x7000 then? That makes no sense - that address should be used for the 28,673rd byte, so at 28360 bytes, it shouldn't be trying to go that high.

Can you export the .hex file and post it? (from one of the menus on 1.6.5 and later of the IDE)

Also, what IDE version?

Are you using the builtin arduino micro core, or a thrid party core for read bear boards? If third party core, link to it.
ATtiny core for 841+1634+828 and x313/x4/x5/x61/x7/x8 series Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts (some assembled), mosfets and awesome prototyping board in my store http://tindie.com/stores/DrAzzy

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy