[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] String in flash

From: David Breeze
Subject: Re: [avr-gcc-list] String in flash
Date: Tue, 14 Oct 2003 15:41:57 +0100

This works for me.

static u8  PROGMEM key_test[] = {"Any old string will do here"};

David Breeze

>>> Russell Shaw <address@hidden> 14 October 2003 15:31:02 >>>
E.Weddington wrote:
>>Both these put .string into the .data section. How do i 
> get it into
>>the .text section? (at90s4433, latest CVS avr-libc, avr-
> gcc 3.3.2,
>>avr-as 2.14, avr-ld 2.14)
>>   static PGM_P hex="0123456789abcdef";
>>   static const char* hex="0123456789abcdef";
> Read the avr-libc docs, IIRC the Program Space Utilities 
> section. The header file you need is
> <avr/pgmspace.h>.

I've read all the manual and header files. I've tried:

   static const char* hex="0123456789abcdef";
   static PGM_P hex="0123456789abcdef";
   static PGM_P hex=(prog_int8_t*)"0123456789abcdef";

but the "0123456789abcdef" string seems to go in the .data

   217                          .data
   218                  .LC0:
   219 0000 3031 3233           .string "0123456789abcdef"
   219      3435 3637
   219      3839 6162
   219      6364 6566
   219      00
   220                          .type   hex, @object
   221                          .size   hex, 2
   222                  hex:
   223 0011 0000                .word   .LC0

These give an error:

   static PGM_P hex =  pgm_read_byte("0123456789abcdef");
   static PGM_P hex =  PSTR("0123456789abcdef");
   error: braced-group within expression allowed only inside a function

avr-gcc-list mailing list

This email and any files transmitted with it are confidential and intended 
solely for the use of the individual or entity to whom they are addressed.  If 
an addressing or transmission error has misdirected this e-mail, please notify 
the author by replying to this e-mail.  If you are not the intended recipient 
you must not use, disclose, copy, print or rely on this e-mail.

Joy Mining Machinery Limited/P&H Minepro Services aims to prevent the 
propagation of viruses, but cannot guarantee that this email is virus free.  
You are advised to scan all attachments and open them at your own risk.

Joy Mining Machinery Limited/P&H Minepro Services may monitor outgoing and 
incoming e-mails and other telecommunications on its e-mail and 
telecommunication systems.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]