[chbot] Anyone seen this error ? avrdude: verification error, first mismatch at byte 0x3c000 on atmega2560

Peter Ellens ellensp at gmail.com
Tue Apr 21 03:20:39 BST 2020


On 4/21/20 12:11 PM, Volker Kuhlmann wrote:
>> FLASHEND is 0x3FFFF on atmega2560's so the the BOOTSIZE is set to
>> 8192, but the APP_END is set to (0x3FFFF - (2*0x2000) + 1) = 0x3BFFE
> Uhhmm, (0x3FFFF - (2*0x2000) + 1) = 0x3C000
>
This is my C inexperience showing...

I of course used good old never fails BODMAS...  (until C! )
Brackets (0x3FFFF - (2*0x2000) + 1) becomes (0x3FFFF - 0x4000 + 1)
Addition (0x3FFFF - 0x4000 +1) becomes (0x3FFFF - 0x4001)
Subtraction (0x3FFFF - 0x4001) becomes 0x3BFFE

But C doesn't do this...  I had totally forgotten this.
+ and - are equal, and Associativity is left-right
So it is interpreted as ((0x3FFFF - 0x4000) +1)  becomes (0x3BFFF + 1)
Resulting in the magical 0x3C000









-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ourshack.com/pipermail/chchrobotics/attachments/20200421/950bce0f/attachment.html>


More information about the Chchrobotics mailing list