Max Program Size When Using Arduino Build...

I know the Due has 512K of FLASH, which I seem to recall is in two 256K pages. I'm wondering if the Arduino build actually supports programs larger than 256K? I have an application that has been working fine. I made some minor changes, which kicked it just over the 256K boundary, and I'm now seeing completely irrational behavior that cannot be explained by the code as written.

Regards,
Ray L.

Well, it is in two pages but they're contiguous so you don't really have to worry about that most of the time. The first 256k page gets mirrored to address 0 before program execution and then address 0 is used for the stack frame, something like 128 bytes are used for interrupt vectors, I believe address 4 starts the reset vector where it actually begins execution from. The arduino linker script sets FLASH to 0x80000 which is where all 512k live in a single run. If you look at the binary image produced for your sketch you should see that your reset vector is up above address 0x80000. This long story is all to say, it should work fine as the whole 512k is in one chunk and the load properly sets all addresses to be based at 0x80000. But, I have not tried to compile a sketch that large to see what happens. I have a sketch that runs around 180k but that's still a far cry from 256k.

Collin80:
Well, it is in two pages but they're contiguous so you don't really have to worry about that most of the time. The first 256k page gets mirrored to address 0 before program execution and then address 0 is used for the stack frame, something like 128 bytes are used for interrupt vectors, I believe address 4 starts the reset vector where it actually begins execution from. The arduino linker script sets FLASH to 0x80000 which is where all 512k live in a single run. If you look at the binary image produced for your sketch you should see that your reset vector is up above address 0x80000. This long story is all to say, it should work fine as the whole 512k is in one chunk and the load properly sets all addresses to be based at 0x80000. But, I have not tried to compile a sketch that large to see what happens. I have a sketch that runs around 180k but that's still a far cry from 256k.

The reason I ask is I recall seeing a thread here quite a while back on the topic of using the second bank of FLASH. I had the impression that using that part of the FLASH required jumping through some hoops. Didn't make sense to me, but I didn't really follow the thread closely.

Still baffled as to why making a few minor changes to my code now has it doing truly bizarre things, where it all worked perfectly yesterday. For example:

   DebugMsg("updating display: |%s|, pStrMainMenu");  // This line outputs a message to a telnet client
   printf(4, 1, pStrMainMenu);  // This line outputs a message to the LCD display

The DebugMsg works correctly, the printf does, seemingly, nothing at all! All worked perfectly a few hours ago, and printf works fine called from countless other places in the code. Nothing in the printf code has been touched, and the changes had nothing to do with this part of the code.

Regards,
Ray L.

Oh, the joys of Arduino! Seems the build dependencies don't work all that reliably. I did a clean build, and all is working properly again. Sadly, I've seen this once or twice before....

Regards,
Ray L.

Ray, which IDE do you use ?

I use the Eclipse IDE with Arduino plugin by Jantje, I more often then not do a clean and then build, as I have found if I make some small change in one of the header files it doesn't always get picked up, resulting in a incremental compile and effectively no new code compiled.

I have seen this many times with , and haven't worried too much about it, just 'Clean' and then 'Build All'.


Paul VK7KPA

rockwallaby:
Ray, which IDE do you use ?

I use the Eclipse IDE with Arduino plugin by Jantje, I more often then not do a clean and then build, as I have found if I make some small change in one of the header files it doesn't always get picked up, resulting in a incremental compile and effectively no new code compiled.

I have seen this many times with , and haven't worried too much about it, just 'Clean' and then 'Build All'.


Paul VK7KPA

I use VisualStudio with the VisualMicro plug-in. I've seen bad builds at random intervals for as long as I've done Arduino stuff, though usually after fairly major changes to the code. It just took me longer than usual to think of that and do a clean build this time.

Regards,
Ray L.