[SOLVED] Makefile for the Due

I've been wrestling with this Makefile for some time now and (finally :)) found that
-fpack-struct
wreaks havoc with register structs.

What I think happens is that -fpack-struct removes padding/alignment spaces in structs.
Especially for hardware register structs
(e.g. see CMSIS/Device/ATMEL/sam3xa/include/component/component_pmc.h )
this means the register addresses inside the struct may get shifted downward
while the actual hardware register addresses remain the same.
The program then writes to / reads from wrong register locations.

E.g. during init(), which is called before setup(),
a write to a wrong PMC->CKGR_MOR location
makes the program stall. SystemInit() hangs here in my case.

Having this flag enabled also breaks the Timer Counters and
I'm reasonable sure it will wreak havoc in other places (Serial?), too.

Conclusion:
Remove the "-fpack-struct" compiler flag
(The Arduino ide doesn't use it either.)