Contiki compile error, “ ERROR: address 0x820003 o

2019-08-15 13:49发布

问题:

I started to use contiki operating system with atmel atmega128rfa1. I can compile my example, but the hex file is bad. The error is: ERROR: address 0x820003 out of range at line 1740 of ipso.hex (i am not using IPSO, just i kept this name).

When I compile in linux system the code is program size is 27804 byte and the data is 4809byte.

When I compile in windows the program is 28292 and the data is 4791.

I use only one process and one etimer, I would like to turn on and off 1 led. the makefile consinst of: `

TARGET=avr-atmega128rfa1
CONTIKI = ../..
include $(CONTIKI)/Makefile.include

all: 
make -f Makefile.ipso TARGET=avr-atmega128rfa1 ipso.elf 
avr-objcopy -O ihex -R .eeprom ipso.elf ipso.hex 
avr-size -C --mcu=atmega128rfa1 ipso.elf `

i can't program the controller. What is the problem?

thank you.

回答1:

Special sections in the .elf file start above 0x810000 and must be removed when generating a hex file for programming a particular memory, e.g.

$ avr-objdump -h webserver6.avr-atmega128rfa1

webserver6.avr-atmega128rfa1:     file format elf32-avr

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .data         00001bda  00800200  0000e938  0000ea2c  2**0
              CONTENTS, ALLOC, LOAD, DATA
  1 .text         0000e938  00000000  00000000  000000f4  2**1
              CONTENTS, ALLOC, LOAD, READONLY, CODE
  2 .bss          000031a6  00801dda  00801dda  00010606  2**0
              ALLOC
  3 .eeprom       00000029  00810000  00810000  00010606  2**0
              CONTENTS, ALLOC, LOAD, DATA
  4 .fuse         00000003  00820000  00820000  0001062f  2**0
              CONTENTS, ALLOC, LOAD, DATA
  5 .signature    00000003  00840000  00840000  00010632  2**0
              CONTENTS, ALLOC, LOAD, READONLY, DATA

So,

avr-objcopy -O ihex -R .eeprom -R .fuse -R signature ipso.elf ipso.hex

alternately, only copy the desired sections:

avr-objcopy -O ihex -j .text -j .data ipso.elf ipso.hex