[fpc-devel] arm-embedded apps crash in exception handler initialization because heapmanager is not initialized

Michael Ring mail at michael-ring.org
Sun Mar 3 12:36:11 CET 2013


This helped me to understand another puzzle piece.

Please correct me if I am wrong:

sram - Memory is divided in several areas on arm-embedded:

_data starts at start of sram ($20000000 in my case)
_edata is end of _data segment ($200009b4)
_bss_start defines start of static vars ($200009b4)
_bss_end defines end of static vars ($20000e90)

all memory from here on is used for stack, stack grows from end of 
avaliable sram ($20010000) downto _bss_end

so what I could do is allocate memory for heap starting at address 
_bss_end with the size of _heapsize. or, perhaps even better:

I start using memory at address _stack_top - _stklen - _heapsize

Correct ??

Michael

Am 03.03.13 11:14, schrieb Sven Barth:
> On 03.03.2013 11:04, Michael Ring wrote:
>> For a little more flexible solution I would like to ask you one more
>> questions, it may seem dumb to you but I have never been that deep into
>> a compiler before so I am learning a lot atm.
>>
>> I can see that the compiler param -Ch can be used to define the
>> heapsize, I can also see in the assembler code of my main program that
>> when I set -Ch I also get a section:
>>
>> -Ch2048 results in this:
>>
>> .section .data.n___heapsize
>>          .balign 4
>> .globl  __heapsize
>> __heapsize:
>>          .long   2048
>>
>> but I do not seem to be able to access __heapsize in my code, how could
>> I use this information to make the heapsize configurable?
>
> Did you try
>
> === code begin ===
>
> var
>   heapsize: LongWord; external name '__heapsize';
>
> === code end ===
>
> ?
>
> Regards,
> Sven
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel
>




More information about the fpc-devel mailing list