跳至主要內容
Knowledgebase
Home
Renesas Electronics Taiwan - Knowledgebase

Which section of the HEAP area is to be allocated to reserve mega bytes?

Latest Updated:12/01/2011

Question:

I want to reserve several mega bytes (8 to 10 MB) for a HEAP area.
However, I don't know which section the HEAP area is to be allocated to.

Answer:

The HEAP area is defined as shown below:

----------------------------------------------------------
#define SIZEOF_HEAP 0x800000
int __sysheap[SIZEOF_HEAP>>2];
size_t __sizeof_sysheap = SIZEOF_HEAP;
----------------------------------------------------------

By changing the section name as shown below, create a section other than the .bss section.

----------------------------------------------------------
#define SIZEOF_HEAP 0x1000
#pragma section data "sss" begin
int __sysheap[SIZEOF_HEAP>>2];
size_t __sizeof_sysheap = SIZEOF_HEAP;
#pragma section data "sss" end
----------------------------------------------------------

Specify the location of this newly created section using a link directive file.

-----------Excerpts from the link directive---------------
DATA1   : !LOAD ?RW V0x100000 L0x900000{
    sss.data    = $PROGBITS ?AW sss.data;
    sss.bss     = $NOBITS   ?AW sss.bss;
};

DATA    : !LOAD ?RW V0xffffc000 {
    .data   = $PROGBITS ?AW .data;
    .sdata  = $PROGBITS ?AWG .sdata;
    .sbss   = $NOBITS   ?AWG .sbss;
    .bss    = $NOBITS   ?AW .bss;
};

__tp_TEXT @ %TP_SYMBOL;
__gp_DATA @ %GP_SYMBOL &__tp_TEXT{DATA DATA1};
__ep_DATA @ %EP_SYMBOL;
----------------------------------------------------------
Suitable Products