Mistake on this page?
Report an issue in GitHub or email us

Memory

This is a basic overview of the memory model in Mbed OS.

+---------------------+   Last address of RAM
| Scheduler/ISR stack |
+---------------------+
|          ^          |
|          |          |
|                     |
|      Heap cont.     |
|---------------------|
| User thread n stack |
|---------------------|
| User thread 2 stack |
|---------------------|
| User thread 1 stack |
|---------------------|
|          ^          |
|          |          |
|                     |
|        Heap         |
+---------------------+
|                     |
| ZI: Global data     |
|                     |
+---------------------+
| ZI: Idle stack      |
+---------------------+
| ZI: Timer stack     |
+---------------------+
| ZI: Main stack      |
+---------------------+
|                     |
| ZI: Global data     |
|                     |
+---------------------+
| RW: Vector table    |
+=====================+   First address of RAM
|                     |   Last address of flash
|                     |
|     Application     |
|                     |
|                     |
+---------------------+
|                     |
| Optional bootloader |
|                     |
+---------------------+
| RO: Vector table    |
+---------------------+   First address of flash

There are at least two kinds of memory in the system: flash and RAM.

RAM

Inside RAM, we can distinguish two logical types: static and dynamic memory. The system uses each of them in different ways:

  • Static:
    • Vector table (read/write).
    • Global data.
    • Static data.
    • Stacks for default threads (main, timer, idle, scheduler/ISR).
  • Dynamic:
    • Heap (dynamic data).
    • Stacks for user threads. Mbed OS will dynamically allocate memory on heap for user thread's stacks.

Stack checking is turned on for all threads, and the kernel errors if it detects an overflow condition.

Flash

Flash is a read only memory (ROM) that contains:

  • Vector table (read only).
  • Application code.
  • Application data.
  • Optional bootloader.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.