use of stack in lcf file.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

use of stack in lcf file.

1,079 Views
ash_aricent
Contributor I

Please help me. I am stuck with this for more than a month.

 

Here are some content of a standard lcf file.

 

.custom :
    {
        ___HEAP_START    = .;
        ___heap_addr    = ___HEAP_START;
        ___HEAP_END        = ___HEAP_START + ___heap_size;
        ___SP_END        = ___HEAP_END;
        ___SP_INIT        = ___SP_END + ___stack_size;
        ___free_mem     = ___SP_INIT;

        . = ALIGN (0x4);
    } >> userram

 

 

Where does RTOS/Compiler use this heap and stack ?

 

We are working with MCF520X mp.

Labels (1)
0 Kudos
3 Replies

316 Views
CrasyCat
Specialist III

Hello

 

The startup code is initializing the stack according to the value of __SP_INIT in file CF_startup.c.

 

The heap is allocated in alloc.c according to settings of ___heap_addr.

 

CF_Startup.c is stored in {Install}\ColdFire_Support\Runtime\Runtime_ColdFire\Source

alloc.c can be found in {Install}\ColdFire_Support\msl\MSL_C\MSL_Common\Src

 

CrasyCat

0 Kudos

316 Views
ash_aricent
Contributor I

Let me explain my question.

 

Is it used for

 

a) Global variable

b) local variable

c) function calls

d) thread context switch

e) dynamic memory allocation

 

Consider that we are using some RTOS also.

0 Kudos

316 Views
CrasyCat
Specialist III

Hello

 

Basically and this is a standard way of operation for an ANSI C compiler

   - Heap is used for dynamic memory allocation

   - stack is used for function calls, local variables and parameters.

 

CrasyCat

0 Kudos