NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Support Forum » PSTR ?

NerdKits » Forums » Support Forum » PSTR ? (4 posts)
September 16, 2012
by Noter
Noter's Avatar

Noticed I don't have to use PSTR now for string constants. And, I can initialize constants where they are declared. Using gcc 4.5.3

These statements work fine -

printf("Switch Cntrl");

volatile uint16_t wave_events[WAVE_EVENTS]={1000, 9000, 1000, 9000};

Any reason to keep coding the old way?

September 16, 2012
by Noter
Noter's Avatar

I meant initialize variables where they are declared ...

September 20, 2012
by pcbolt
pcbolt's Avatar

Noter -

Are you using this string in your makefile...

avr-objcopy -j .text -j .data -O ihex

I think that lets you get away with the array initialization. As for the "printf", I always thought PSTR was used in the "printf_P" family of functions. The only downside of "printf" is the strings get stored in RAM I believe.

September 20, 2012
by Noter
Noter's Avatar

Yes, I do have that in my makefile. You are correct, I eventually ran out of ram so even though it works a few kb is not much space. Went back and changed to PSTR's and all is well again. Thanks for your post.

Post a Reply

Please log in to post a reply.

Did you know that you can build a circuit to convert the "dit" and "dah" of Morse code back into letters automatically? Learn more...