[Top][All Lists]

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

Re: [avr-gcc-list] Variable __data_end variable not passed through to li

From: Ned Konz
Subject: Re: [avr-gcc-list] Variable __data_end variable not passed through to linker for use in __heap_start?
Date: Mon, 10 Apr 2006 09:04:39 -0700

On Apr 9, 2006, at 8:41 PM, <address@hidden> <address@hidden> wrote:

Hi all:

I am running winavr 2006*, on an atmega128 with 32k of XRAM mapped to
0x8000->0xFFFF. I would like the .bss memory section to be allocated by the linker in the internal RAM, while I'd like the .data section and the __malloc_heap_start to both be in XRAM. .bss being in IRAM is not really negotiable, and I'd much prefer .data to live in XRAM, due to the larger
size of that section.

Unfortunately, the makefile I'm using doesn't seem to want to allocate
the __malloc_heap_start variable to the __data_end.

I've tried adding the following options, with no success:

    LDFLAGS += -Wl,--section-start,.bss=0x800100 \
              -Wl,--section-start,.data=0x808000) \
              -Wl,--defsym,__heap_start=__data_end \
              -Wl,--defsym,__heap_end=0x80FFFF \

The problem I have is that any memory I allocate with malloc ends up in
the internal RAM, straight after .bss.

However, if I hard-code the __heap_start variable (to, say, 0x809000), I have no problems - the malloc'ed memory is allocated in XRAM. This is a less than ideal situation, obviously, however I don't seem to be able to pass through the __data_end variable into the __heap_start (and onwards
to __malloc_heap_start).

Anyone run into this before, and/or any suggestions??

Sure: why not just define a custom linker script?

It's quicker than all that command-line stuff anyway.

Anyhow, seems like someone was complaining that the command-line args didn't work anyhow.

Try the attached.

It results in:

.data           0x00808000        0x6
                0x00808000                PROVIDE (__data_start, .)
                0x00808002                __malloc_heap_start
                0x00808000                __malloc_heap_end
                0x00808004                __malloc_margin
                0x00808006                _edata = .
                0x00808006                PROVIDE (__data_end, .)
                0x00808006                PROVIDE (__heap_start, .)

.bss            0x00800060        0x4
                0x00800060                PROVIDE (__bss_start, .)
                0x0080ffff                __heap_end = 0x80ffff

Ned Konz

Attachment: xx.x
Description: Binary data

Attachment: xx.c
Description: Binary data

reply via email to

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