BrianSidebotham / arm-tutorial-rpi

Raspberry-Pi Bare Metal Programming in C Tutorial
https://www.valvers.com/open-software/raspberry-pi/bare-metal-programming-in-c-part-1/
MIT License
587 stars 177 forks source link

malloc (_sbrk) hangs in arm013 #1

Closed gergaly closed 9 years ago

gergaly commented 9 years ago

Hi,

Since you moved the stack from the end of the RAM to before the code (and before the heap) the _sbrk function will hang always because the following condition will be always true: (heap_end + incr) > _get_stack_pointer()

If the stack is before the heap then I would check something like this: (heap_end + incr) > _END_OFRAM

Regards, Bertalan

BrianSidebotham commented 9 years ago

Hi Bertalan,

Thanks for reporting this! Sorry I didn't see it earlier. I've just fixed it in the current code base.

Best Regards, Brian.