Memory allocation failure

Guest #1171738
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
Guest #1171739
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

Reply

Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.