Problems linking .data/.bss to external memory

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi!
I have a inscrutable problem with avr-gcc linker and an atmega128 device with 32k external RAM.
Using avr-toolchain

binutils-2.16.1
gcc-3.4.4
avr-libc-1.4.0
(patch for gcc an binutils from http://www.kieltech.de/~ufechner...)

within an linux environment causes a problem with linking .bss and .data section to external ram space.

Setting the Linker Options
-Wl,-Tdata=0x801100,--defsym=__heap_end=0x807fff
does not achieve the desired output.

avr-nm -n -S appl.elf shows that strange behaviour

00800100 00000010 D TBU_tester
00800100 D __data_start
00800110 00000040 D selected_shuffler_LED_table
00800229 0000006c D aCommandTypes
0080029c 00000002 D __malloc_heap_end
0080029e 00000002 D __malloc_heap_start
008002a0 00000002 D __malloc_margin
008002a2 B __bss_start
008002a2 D __data_end
008002a2 D _edata
008002a2 00000001 b j.0
008002a3 00000001 B fatalErrorStateRemember
008002a4 00000001 B checksum_transfer_global
008002a5 00000021 B timer0
008002c6 00000017 B rx0Data
008002dd 00000002 B ptrKeyboard_global
008002df 00000001 B MonitorApplicationON
...
0080046a 00000008 B StepCounter
00800472 00000008 B oldShifterValue
0080047a 00000008 B interpolCountABS
00800482 00000008 B EventCounter
0080048a 00000008 B oldRMSLevel_dB
00800492 00000002 B __brkval
00800494 00000002 B __flp
00800496 B __bss_end
00800496 ? __heap_start
00800496 ? _end
00807fff A __heap_end
00810000 ? __eeprom_end

You can see, that .bss and .data section remains in internal RAM

But compiling the application with the latest winAVR Release 20050214 does this linking job correct:
00801100 00000010 D TBU_tester
00801100 D __data_start
00801110 00000040 D selected_shuffler_LED_table
00801229 0000006c D aCommandTypes
0080129c 00000002 D __malloc_heap_end
0080129e 00000002 D __malloc_heap_start
008012a0 00000002 D __malloc_margin
008012a2 B __bss_start
008012a2 D __data_end
008012a2 D _edata
008012a2 00000001 b j.0
008012a3 00000001 B fatalErrorStateRemember
008012a4 00000001 B checksum_transfer_global
008012a5 00000021 B timer0
008012c6 00000017 B rx0Data
008012dd 00000002 B ptrKeyboard_global
008012df 00000001 B MonitorApplicationON
...
0080146a 00000008 B StepCounter
00801472 00000008 B oldShifterValue
0080147a 00000008 B interpolCountABS
00801482 00000008 B EventCounter
0080148a 00000008 B oldRMSLevel_dB
00801492 00000002 B __brkval
00801494 00000002 B __flp
00801496 B __bss_end
00801496 ? __heap_start
00801496 ? _end
00807fff A __heap_end
00810000 ? __eeprom_end

What is going wrong. I've tried it with different linker option variations descriped within
http://www.nongnu.org/avr-libc/u...
but no linker option bring's me the expected result, except
-Wl,--defsym=__heap_start=0x801100,--defsym=__heap_end=0x807fff
which sets the heap to external RAM

Are there importand binutils and gcc paches available solving this kind of problem?

Regards,
Thomas

PS: This was originaly send to avr-gcc list

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

> What is going wrong.

Bug in binutils 2.16. Use -Wl,--section-start,.data=0x801100 instead.
For whatever reason, they broke -Tdata, but strangely enough only for
the AVR platform. (-Ttext works still.)

Hmm, I thought I already reported that once, but apparently did not.
I have to enter a bug for that...

> PS: This was originaly send to avr-gcc list

Strange, I haven't seen it there. Do you have a Message-ID for that?

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

dl8dtl wrote:
> What is going wrong.

Bug in binutils 2.16. Use -Wl,--section-start,.data=0x801100 instead.
For whatever reason, they broke -Tdata, but strangely enough only for
the AVR platform. (-Ttext works still.)

Hmm, I thought I already reported that once, but apparently did not.
I have to enter a bug for that...

Should we patch binutils as well?

dl8dtl wrote:

> PS: This was originaly send to avr-gcc list

Strange, I haven't seen it there. Do you have a Message-ID for that?

I saw it come across on avr-gcc...

Eric

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

> Should we patch binutils as well?

Do you have a patch? ;-)

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanxs Jörg for the quick answer!
I'm realy happy!

Thomas