After a lot of messing around with different micro USB cables... it works.

One thing amazes me though .. If I compile "blink" for a Mega 2560 - it generates 1662 bytes of code.

Doing the same thing for Due produces 9668 bytes of code!

Am I missing something here? The Due only has twice as much flash memory as the Mega 2560, so it would appear that there could be BIG problems with moving over some of my bigger code (compiling to about 60-70K on the Mega currently)Is there something hugely inefficient going on in the IDE for Due??I thought ARM code was renowned for compact-ness :~

Even then, the mega and uno sizes are still off, the pinMode, digitalWrite functions have a PGM table overhead, which is only added once, but not until pin manipulation functions are called ( compiler optimisation ). As I understand the due does not use this style of pin control.

This means most of the Uno and Mega 'incremental' size is actually setup size.

A more complex example would be required, like drawing something on an LCD.

// the loop routine runs over and over again forever:void loop() { FastDigitalIO< 13 > p; p.write( HIGH ); delay(1000); // wait for a second p.write( LOW ); delay(1000); // wait for a second}

I get values like ( taken off real bare minimum, not the one I posted above ):

Quote

UNO direct IO: 706, difference 240Mega direct IO: 898, difference 232

That sounds better.. if the basic initialisation code is a little bulky, BUT program code is then fairly efficient ,there is less to worry about than I thought. I have some code that ends up >50Kb on a Mega at the moment. Some of it won't easily transplant until libraries are sorted out, but it looks hopeful

// the loop routine runs over and over again forever:void loop() { do1000( digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(led, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second )}

This bears out my general experience with the Due - the larger code sizes are because it has a more comprehensive runtime. Ignoring the overhead, code for code the Due seems to be slightly better than the Mega.

Like I explained above, the AVR version of arduino does not use direct port IO, I provided a version above which puts it more on par.Here is a 1000 loop mega version unrolled that is almost half the size of the due.

// the loop routine runs over and over again forever:void loop() { do1000( digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(led, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second )}

This bears out my general experience with the Due - the larger code sizes are because it has a more comprehensive runtime. Ignoring the overhead, code for code the Due seems to be slightly better than the Mega.

I reworked some of my bulkier code and compiled for both Due / Mega. As everybody has acknowledged, there is more overhead, but there is also a lot more performance.