<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="moz-cite-prefix">On 4/21/20 12:11 PM, Volker Kuhlmann
wrote:<br>
</div>
<blockquote type="cite" cite="mid:20200421001153.GA2343@top.geek.nz">
<blockquote type="cite" style="color: #000000;">
<pre class="moz-quote-pre" wrap="">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
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">Uhhmm, (0x3FFFF - (2*0x2000) + 1) = 0x3C000
</pre>
</blockquote>
This is my C inexperience showing...<br>
<br>
I of course used good old never fails BODMAS... (until C! )<br>
Brackets (0x3FFFF - (2*0x2000) + 1) becomes (0x3FFFF - 0x4000 + 1)<br>
Addition (0x3FFFF - 0x4000 +1) becomes (0x3FFFF - 0x4001) <br>
Subtraction (0x3FFFF - 0x4001) becomes 0x3BFFE<br>
<br>
But C doesn't do this... I had totally forgotten this. <br>
+ and - are equal, and Associativity is left-right <br>
So it is interpreted as ((0x3FFFF - 0x4000) +1) becomes (0x3BFFF +
1) <br>
Resulting in the magical 0x3C000
<p><br>
</p>
<p> <br>
</p>
<p><br>
</p>
<p><br>
</p>
<p><br>
</p>
<p><br>
</p>
<p><br>
</p>
<p><br>
</p>
</body>
</html>