EmbDev.net

Forum: ARM programming with GCC/GNU tools Memory allocation failure


von Guest (Guest)


Rate this post
useful
not useful
Hi all,
I have a c code which contains memory allocation functions calloc.I have
ported the code to ARM7 using Winarm.I have provided the system call
wrappers while porting.But while running the code in arm board memory
allocation fails.i Have 64 mb ram on board.Does the code need any
initialization??

Regards
mk

von Martin Thomas (Guest)


Rate this post
useful
not useful
Guest wrote:

> I have a c code which contains memory allocation functions calloc.I have
> ported the code to ARM7 using Winarm.I have provided the system call
> wrappers while porting.

Please show your sbrk-implementation. It is difficult to comment without
seeing the implemenation.

> But while running the code in arm board memory
> allocation fails.i Have 64 mb ram on board.Does the code need any
> initialization??

Which target? There might be an some kind of memory-bus initialisation
needed or some kind of remapping. Please show the startup-code.

- Is the the heap-start-address set correctly in the linker-script?
(something like "provide (end = _HEAP_START_)" or "provide (end = .)")
if the label "end" is used for the sbrk-init
- Is the (correct) heap-start-address value visible to sbrk?

Create a minimal example for the toolchain for which the original code
has been developed. Verify it works. Port the minimal example to the
GNU-toolchain, verify you see the same problem as with your "real"
application, pack everything (source incl. startup-code, linker-script,
makefile) together and place it on an "internet-server" and post the URL
here. If the other toolchain does not use linker-scripts and makefiles
try to find the "linker-setup-files" and "project-defintion-files" and
include them in the archive.

> Regards
> mk
Personaly I still prefer real names instead of pseudonyms and initials.


Martin Thomas

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.