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

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

[avr-gcc-list] Problems linking .data/.bss to external memory


From: Dipl. Ing. Thomas Buchta
Subject: [avr-gcc-list] Problems linking .data/.bss to external memory
Date: Tue, 20 Dec 2005 14:36:24 +0100

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/patch-2005-05.zip)

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/user-manual/malloc.html#malloc_where
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





reply via email to

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