millwood:
stevech:
And, it doesn’t have the dreaded dual address space flash/RAM making compilers a PITA.
unless you are writing the compiler, why should you care about that?
I am an AVR fan. Having been through the PIC’s small segment paging memory mess and graduated. I do offer this, in context of this thread…
Writing C code for AVR/PIC is a PITA where one puts strings and other constants in Flash so they don’t use RAM at run-time. This leads to the need for two kinds of pointers, and two forms of many C library routines. Example, we all know:
printf("The value of n is %d\n\r", n)
is used in all single-address processors. If used in a dual address Harvard processor, the quoted string constant is stored in both flash and copied to RAM during initialization prior to main(). There it sits, using up RAM for a constant that’s also in flash.
So GCC’s solution is
printf_P(PSTR("The value of n is %d\n\r"), n)
where printf_P is a twin of printf, to access the string constant from flash
and
PSTR() is a macro that causes the string to live in flash and not be copied to RAM by the initialization.
And so on for many other library routines. And macros to declare numeric constants to be flash-only. This gets complicated and impossible, with GCC, for, say, an array of pointers to flash-resident strings. I don’t think GCC can do such due to use of macros rather than in-built. Otherwise, GCC does a great job on the AVR and has been a boon to many students.
Commercial compilers for the AVR (and I suppose, PIC), add to the compiler in-built solutions for this that eliminate PSTR() and the like, and make the code more standard and portable.
The scheme in the ARM7, for example, is to have flash and RAM, in a single address space (von Neuman). The processor accesses flash differently than RAM, e.g., since flash is slower, NXP and others do a very wide single-read from flash and reconstitute it as instruction-width data. This keeps the pipe full. Being von Neuman, the ARMs can, for debugging, execute code out of RAM.
No doubt, if one is doing development for a volume product, none of this matters since the non-recurring-engineering cost is often of low importance, and code portability is not sorely needed.