avr-gcc-list
[Top][All Lists]
Advanced

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

RE: [avr-gcc-list] Strings in ROM


From: Stu Bell
Subject: RE: [avr-gcc-list] Strings in ROM
Date: Mon, 16 Mar 2009 08:14:39 -0600

> >> I cannot find where 'prog_char is defined and would like 
> to know how 
> >> I can force the compiler to put these strings in my 
> 'test1' section.
> >>     
> Thanks Stu, I am aware of this, but it does not address my problem.
> This works fine when a 'defalut' .text section is used.
> For me it breaks because I want the string in my defined 
> section (not .text).

As Eric said, prog_char is defined in prgmspace.h.  It's really nothing
more that a "char" with  a secion attribute added.

You can define your own sections as:

#define MYSTRING_SECTION   __attribute__ ((section (".mystring")))

const char my_Version   [] BOOTSTRING_SECTION = "0.8";
const char my_Prompt    [] BOOTSTRING_SECTION = "* ";
const char my_CRLF      [] BOOTSTRING_SECTION = "\r\n";
const char my_OK        [] BOOTSTRING_SECTION = "OK";
const char my_Huh       [] BOOTSTRING_SECTION = "Huh?";


And setting it up in the makefile as:

LDFLAGS += -Wl,--section-start=.mystring=0x3FA0

Make sure that the section is in the lower 64 K *Bytes* of memory or you
will need to use the pgm_read_*_far() functions to access them.  Do a
search on AVRFreaks.net for morepgmspace.h for macros to deal with
program strings beyond 64 Kbytes.


Best regards, 

Stu Bell 
DataPlay (DPHI, Inc.) 

 




reply via email to

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