[coldfire-gnu-discuss] M52235EVB - Problem using malloc - Access Error Attempted Write to Write-Protected Space
Nathan Sidwell
nathan at codesourcery.com
Wed Feb 28 13:35:48 UTC 2007
Daniel McLean wrote:
> the first lot of code that makes use of malloc. I’ve provided an
> implementation of sbrk so that it can request sections of memory.
> However it seems that malloc attempts to access write protected space
> and causes an interrupt. This is displayed via a printf on the serial
> port. It says that the program counter is at 0x000040CA when this
> occurs.. Below is the appropriate section of my map file:
> Any suggestions would be appreciated…
unfortunately, without an actual test case it's not possible to determine what
is happening. Have you verified your sbrk is returning the values you expect it to?
> I’d also be interested in knowing what compiler options the newlib
> libraries were compiled with? I am assuming that they are at least
> compiled with re-entrancy support considering the inclusion of files
> such as _/malloc/_r by the linker…
Newlib is compiled with -O2 -mcpu=FOO
for appropriate FOO values. You're correct that newlib is configured to be
reentrant.
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery
nathan at codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk
More information about the coldfire-gnu-discuss
mailing list