?
Solved

"Dynamic Memory Allocation by 'C' for a target (That does not have any Operating System on it)

Posted on 2005-02-24
5
Medium Priority
?
190 Views
Last Modified: 2010-04-15
In 'C', for dynamic allocation, the Borland Compiler allocates memory on the Heap. I want to know, if i am developing  firmware for a target (AM186ER), which does not have any operating system on it, can i use dynamic allocation for that? If, yes then how heap memory allocation is to be taken care into the Firmware?
0
Comment
Question by:dhavalshah
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 8

Expert Comment

by:ssnkumar
ID: 13400644
Usually in firmwares dynamic memory allocation is not encouraged.
If you still want to do it, then you will have to know the memory layout of your firmware.
Also, you should understand how the processor works and manages memory.

-ssnkumar
0
 
LVL 23

Accepted Solution

by:
brettmjohnson earned 500 total points
ID: 13400653
The memory allocation heap is not an OS concept.  malloc(), calloc(), and realloc() are
functions in the standard C library.  When running on systems with a modern OS underneath,
these functions typically allocate large chunks of system memory, then parcel it out in small
bits for individual mallocs().  Embedded systems usually provide some or all of the standard
library functions, including malloc() and free().  The embedded environment may require you
to specify a region of memory on the device to be used as the memory allocation heap, either
as a compiler option or at process initialization time.



0
 
LVL 8

Expert Comment

by:novitiate
ID: 13401216
Does it has any memory manager? since you said it has no OS I presume you don't. In such a case there is no point in dynamic memory allocation, since you would need some thing to manage the memory (memory manager). check what your firmware support.

for more information visit:
http://www.mactech.com/articles/develop/issue_02/Mem_Mgr_v006.html

(novi)
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question