use of stack in lcf file.

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

use of stack in lcf file.

1,709 次查看
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.

标签 (1)
0 项奖励
回复
3 回复数

946 次查看
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 项奖励
回复

946 次查看
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 项奖励
回复

946 次查看
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 项奖励
回复