[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] Re:Strings in ROM
From: |
Robert von Knobloch |
Subject: |
[avr-gcc-list] Re:Strings in ROM |
Date: |
Tue, 17 Mar 2009 11:32:42 +0100 |
User-agent: |
Thunderbird 1.5.0.14 (X11/20060911) |
From: Eric Weddington:
This sounds like a linker error. It would help if you could post the actual
output from the toolchain.
OK Eric, here goes. I have shortened everything to make it more readable (and
less boring).
There are 10 sections of each type in fact.
The result of 'Make' is:
address@hidden:~/Version 0.8> make
avr-gcc -g -Wall -Os -mmcu=atmega644 -DF_CPU=20000000 -c -o main.o
main.c
tests.c:227: error: press_button causes a section type conflict
make: *** [main.o] Error 1
address@hidden:~/Version 0.8>
Where the makefile contains:
PRG = main
OBJ = $(PRG).o
MCU_TARGET = atmega644
OPTIMIZE = -Os
F_CPU = 20000000
DEFS = -DF_CPU=$(F_CPU)
LIBS =
CC = avr-gcc
CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS)
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 \
-Wl,--section-start=.flashimage=0x8000 \
-Wl,--section-start=.bootloader=0xe000 \
-Wl,--section-start=.functions=0xff00
In "hardware.h" (included in main) the mapping of the sections:
#define TESTIMAGE 0x2600 // Base address of test images
#define TEST0_SECTION __attribute__((section (".test0")))
#define TEST1_SECTION __attribute__((section (".test1")))
#define TESTPARMS0_SECTION __attribute__((section (".testparms0")))
#define TESTPARMS1_SECTION __attribute__((section (".testparms1")))
#define FUNCTION_SECTION __attribute__((section (".functions")))
And in "tests.c" (inluded in main):
/*
******************************************************************************
* Tester routine 1
******************************************************************************
*/
#undef CODESECTION
#define CODESECTION TEST1_SECTION
extern char press_button[];
extern char button_timeout[];
CODESECTION uint16_t test1(void)
{
... test programme
}
CODESECTION char press_button[] = ">> Press UUT button <<";
//***** This one produces the error.
// If the preceding function test1() is removed (only other object in
this section), the error goes away.
#undef PARMSECTION
#define PARMSECTION TESTPARMS1_SECTION
PARMSECTION uint16_t flash1 = 1024; // Bytes
PARMSECTION uint16_t eep1 = 64; // Bytes
PARMSECTION uint8_t sig1[] = {0x00, 0x00, 0x00}; // Test file
PARMSECTION uint8_t fuse1[] = {0xfb, 0x13}; // Big-Endian
PARMSECTION uint8_t np1 = 32; // Flash
PARMSECTION uint8_t ps1 = 16; // In 16-bit words
PARMSECTION uint8_t ts1 = 1; // Slot in NKP
tester[0-9]
PARMSECTION uint8_t tr1 = 1; // Routine in tester[0-9]
PARMSECTION char pn1[] = "RKB Test V0.01 "; // Pad to
exactly 24 chars
//Local constants
PARMSECTION char button_timeout[] = "******* Timeout ******* ";
//***** This one works OK, but I have insufficient space here.
So my conlusion is that the toolchain is treating a section containing a
function as .text and refusing to place the string in it.
When the section contains no function, then it is accepted.
Hope this makes sense.
Regards,
Robert
- [avr-gcc-list] Re:Strings in ROM,
Robert von Knobloch <=