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

2009-03-16 Thread Stu Bell
  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.) 

 


___
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list


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

2009-03-13 Thread Stu Bell
Check out
http://www.avrfreaks.net/index.php?name=PNphpBB2file=viewtopict=38003

Best regards, 

Stu Bell 
DataPlay (DPHI, Inc.) 

 

 -Original Message-
 From: avr-gcc-list-bounces+sbell=dataplay@nongnu.org 
 [mailto:avr-gcc-list-bounces+sbell=dataplay@nongnu.org] 
 On Behalf Of Robert von Knobloch
 Sent: Friday, March 13, 2009 6:51 AM
 To: avr-gcc-list@nongnu.org
 Subject: [avr-gcc-list] Strings in ROM
 
 Dear GCC-List,
 
 I am writing an application that uses loadable portions of 
 code (it is a tester for embedded products, where the target 
 code and test routines will be sent to a remote location [the 
 factory] and loaded into the tester via an Intel Hex download 
 routine]. These 'test modules' are in pre-defined memory 
 areas of the processor (Mega644), so no contention occurs. 
 Writing these loadable modules requires that I only use 
 resources inside these memory areas. I need to output strings 
 to an LCD display in these modules. Clearly printf 
 something would require entries in the base .text area 
 which would move my main routines. I want to use 'prog_char[] 
 =Something, but the compiler won't let me put this in a section.
 
 e.g.
 
 #define SECTION TEST1_SECTION
 
 SECTION prog_char press_button[]=   Press UUT button  ;
 SECTION prog_char button_timeout[]  = *** Error - Timeout! ***;
 
 where the linker sees:
 LDFLAGS   = -Wl,-Map,$(PRG).map \
 -Wl,--section-start=.test0=0x2600 \
 -Wl,--section-start=.testparms0=0x2e80 \
 -Wl,--section-start=.test1=0x2f00 \
 -Wl,--section-start=.testparms1=0x3780
 
 'make' results in:
 
 avr-gcc -g -Wall -Os -mmcu=atmega644 -DF_CPU=2000  -c 
 -o main.o
 main.c
 In file included from main.c:25:
 tests.c:138: error: section of 'press_button' conflicts with 
 previous declaration
 tests.c:139: error: section of 'button_timeout' conflicts 
 with previous declaration
 
 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.
 
 Many thanks,
 
 Robert
 
 
 
 
 
 ___
 AVR-GCC-list mailing list
 AVR-GCC-list@nongnu.org
 http://lists.nongnu.org/mailman/listinfo/avr-gcc-list
 


___
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list


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

2009-03-13 Thread Robert von Knobloch
Stu Bell wrote:
 Check out
 http://www.avrfreaks.net/index.php?name=PNphpBB2file=viewtopict=38003

 Best regards, 

 Stu Bell 
 DataPlay (DPHI, Inc.) 

  
   
 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).

Robert.



___
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list