Skip to main content
Visitor II
January 14, 2005
Question

RVDK and malloc

  • January 14, 2005
  • 3 replies
  • 1036 views
Posted on January 14, 2005 at 07:46

RVDK and malloc

    This topic has been closed for replies.

    3 replies

    marcus23Author
    Visitor II
    January 7, 2005
    Posted on January 07, 2005 at 09:23

    Hi all,

    did anyone of you succeed in using malloc()? If so, is there something I have to take care of ( besides using free())? If we try to use malloc, the processor enters the FIQ-Handler before even calling malloc (?!?!?)

    Thx for your help

    marcus23Author
    Visitor II
    January 11, 2005
    Posted on January 11, 2005 at 16:37

    hello RISC,

    could you send me a sample project with user defined stack and heap?

    Thx

    Visitor II
    January 13, 2005
    Posted on January 13, 2005 at 07:19

    Hello.

    we'd like to configure the linker / compiler to use internal memory for the stack and external memory for the heap (e.g. to use malloc ). For such a kind of memory configuration, there is an example in an107, chapter 4.2.3. ''Two-region model'', where a procedure is described for 71x_init.s. There is made an import of __use_two_region_memory. However, we want to configure it all using the scatterfile and retarget.c. What do we have to do?

    Our configuration is as follows:

    ---scatter loading file--------------------------

    RAM_MODE 0x20000000 0x420FFFFF

    {

    RAM 0x20000000

    {

    71x_vect.o (Vect, +First)

    71x_init.o (Init)

    * (+RO)

    * (+RW)

    }

    SRAM 0x62000000 UNINIT

    {

    * (+ZI)

    }

    }

    ---retarget.c--------------------------------------

    __value_in_regs struct R0_R3

    {

    unsigned heap_base, stack_base, heap_limit, stack_limit;

    }

    __user_initial_stackheap(unsigned int R0, unsigned int SP, unsigned int R2, unsigned int SL)

    {

    struct R0_R3 config;

    extern unsigned int Image$$SRAM$$ZI$$Base;

    config.stack_base = SP;

    config.heap_base = (unsigned int)Image$$SRAM$$ZI$$Base;

    return config;

    }

    ---------------------------------------------------

    When executing the code, the error message ''Out of heap memory'' is displayed.

    Where's the error?