This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Bare-metal: how to specify the heap size in the linker script


Hi all,

Using the Linaro aarch64 bare-metal toolchain (based on newlib), I need to specify the heap location in the linker script in order to be able of using C++ STL data structures with dynamic-memory (e.g. std::vector).

I've therefore defined the "end" symbol as shown below.

    .data   : {
      *(.data)
    }

    . = ALIGN(8);
    /* "end" is used by newlib's syscalls */
    PROVIDE(end = .);

    . = ALIGN(16);
    stack_bottom = .;
    . = ALIGN(4096);
    . = . + 0x10000;
    stack_top = .;

However, this way there is no way of checking if the heap has reached the maximum value (after which we get stack corruption).

I'd therefore like to know if newlib has some further symbol for specifying the maximum heap size in addition to the heap location.
Alternatively, is there any symbol for specifying the heap boundaries (i.e. beginning and end) ?

Many thanks,

             Claudio


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]