Embedded heap allocation?

I've done a number of embedded ARM7 projects using ADS1.2 without much trouble. Now all of a sudden I can't get the heap to allocate correctly.

My entry.s code does some standard startup things like setting the stacks, clocks, etc. It ends by branching to __main as usual. When I make the first call to malloc() looking for about 24Kbytes, it doesn't have enough space. There should be 3 MB. I am using a simple stackheap.s shown below.

__main calls _init_alloc to create the heap. I have some old code that shows that it puts the bottom of the heap in R0 and the bottom of the stack in R1. If I make a manual call to this with the values filled in I get a

3MB heap. If I break on __main calling this, it has the bottom of heap in both registers and I get no heap.

Anyone have any suggestions?

Scott

AREA stacks, DATA, NOINIT

EXPORT top_of_stacks EXPORT top_of_memory ; ; Physical location of our memory system ;

MEMORY_Limit EQU 0x20400000

top_of_memory equ MEMORY_Limit ; ; = Total 4M SDRAM on Pixter2005 board, end of memory is 0x003f, ffff ; ; We will mirror the memory 0x20000000 to 0x203fffff at 0x00000000 to

0x003fffff ; with the MMU. This is done so that we have a copy of the interrupt vectors at ; 0x0 as required for the ARM ; Stack_Limit EQU MEMORY_Limit - 0x100 SVC_Stack EQU Stack_Limit ; = 0x400 bytes ABT_Stack EQU SVC_Stack - 0x100 ; = 0x200 bytes UNDEF_Stack EQU ABT_Stack - 0x100 ; = 0x200 bytes IRQ_Stack EQU UNDEF_Stack - 0x100 ; = 0x200 bytes FIQ_Stack EQU IRQ_Stack - 0x100 ; = 0x200

; Create dummy variable used to locate stacks in memory

top_of_stacks SPACE 1

AREA heap, DATA, NOINIT

EXPORT bottom_of_heap

; Create dummy variable used to locate bottom of heap

bottom_of_heap SPACE 1

END

Reply to
Not Really Me
Loading thread data ...

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.