The PSTR() macro is commonly used with avr-gcc to place anonymous strings in flash. e.g.
printf_P(PSTR("This string is in flash\n"));
You can re-arrange the macro for CodeVision or ImageCraft and still get the desired behaviour.
According to the Rowley docs, you should also be able to cast these strings by:
#define PSTR(s) (const __code char *)(s)
But I have no success. The anonymous string is STILL copied into SRAM, and printf_c() is given the SRAM address. So it prints a string from flash with the SRAM address. (printf_c() is the Rowley equivalent of printf_P() )
A workaround is to name all the anonymous strings. This correctly places them in flash:
const __code char anon1[] = "string 1 in flash"; const __code char anon2[] = "string 2 in flash"; ... printf_c(anon1); ...
Does anyone know how to get the PSTR() macro to work ?
Otherwise, I can get Rowley to compile most of my code.
1. #if defined(__CROSSWORKS) ... identify Compiler 2. #include// calls reqd chip.h #if defined(__ATtiny2313_h) ... identify MCU 3. TCNT1 is called TCNT1W ... for 16 bit access 4. #define ISR(num) void ISR_##num(void) __interrupt [num]
David.