Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Microcontroller memory allocation

Status
Not open for further replies.

allen_poper

Newbie level 3
Newbie level 3
Joined
Mar 6, 2014
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
23
I want to understand how the memory will store in microcontroller. I have read the wiki page of Microcontroller. But i didn't get much information about the memory segmantation of microcontroller.


1. The Text segment, stack segment, Data Segment and Heap are in RAM of memory or Flash/ROM of microcontroller.If my microcontroller(cc2530) have 8kb RAM and 256 kb Flash. Which memory i need to consider while programming

2. If i port a OS on any micro controller, In which memory OS will occupy and where the application image will occupy

3. What is the difference between compiler and Toolchain.
 

What goes where is usually determined by the linker script that defines where in the memory map to place which segments.

Generally .Text, .ROData (All the stuff you declare static const), and any structure initialisers go in the flash. Stack, heap and anything else you define as a RW segment must clearly go in ram.

Note that flash can be slower then ram so there is usually a mechanism to declare that speed critical text should be copied to ram and executed from there, but linker scripts are black magic.

In the small microcontroller world we do not usually have a particularly clean OS/Application separation (They often share the same memory space after all as most small devices lack an MMU), so all the code gets linked together and placed in .Text, stacks and such end up in ram and life goes on.

Note that dynamic memory allocation is usually a really bad idea in small embedded applications as memory fragmentation is a real issue, so don't do that.

Ram is often a bigger issue then flash, get good at using bitfields rather then bools.

A compiler converts your source files into object code, a toolchain compiles then links the object files together, links in required libraries, resolves any required relocations and (possibly) spits out a hex file to load onto the chip.

Regards, Dan.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top