Posted 2014-12-02 13:59:44 +0100

blogs->all

# Visualising your memory usage

The linker in the GCC toolchain, ld, produces a *.Map file which shows you how the memory on your micro is being used. This file is a goldmine of information but it's a bit difficult for humans to absorb.

I've whipped up a web page which uses the excellent D3.js library to draw a visualisation of your memory usage, using the *.Map file as input. Blocks of memory are drawn proportionally so it's easy to see how much memory you have left and where it's all being used. Click on a block to zoom in on it.

You can run the tool right off the github project page, or download it and modify it for your needs. Pull requests welcome.

https://github.com/eliotstock/memory

Cheers,

Eliot

## 4 comments

Posted Dec. 2, 2014, 5:30 p.m.

Nice! Did you use specific flags to get more information? I only see FLASH and RAM and very little used out of both. See this prog.map file.

Posted Dec. 2, 2014, 5:56 p.m.

Because you have very long symbol names, like this...

.text.ZN4func6detail16function_manager19templated_call_copyIPFvbESaIS4_EEEvRNS0_20manager_storage_typeERKS6

... ld is wrapping the memory details onto the next line which is breaking the tool.

Posted Dec. 3, 2014, 2:30 p.m.

Ah, you are right. If I join the lines together with .text in them:

ex -c '%g/\.text/j' -c "wq" prog.map


then I get a lot more info. A better one would be the one that leaves alone the lines that are already on one line:

ex -c '%g/\.text\S*[\s]*\$/j' -c "wq" prog.map


And succeeded by replacing .text.blah with .text:

sed -i 's/\.text\S*/.text/g' prog.map


The only thing left is that the items get really small when you're program gets big. I've to look in the zooming options in your code, but thanks again!

Posted Dec. 3, 2014, 5:48 p.m.

Thanks for the pull request! Merged.

Sign in to comment.

or sign up

## Recent blog posts

• ### Estudando Projetos do SDK 10 para nRF5x com Eclipse Oxygen (Portuguese)

Posted 2017-11-12 00:08:55 by Carlos Delfino
• ### Configurando o Eclipse Oxygen para Desenvolvimento com nRF5x (Portuguese)

Posted 2017-11-10 21:15:47 by Carlos Delfino
• ### How to use Git for embedded software development

Posted 2017-11-06 13:21:55 by Yaniv Nis
• ### Thingy:52 based Weather Station

Posted 2017-10-29 22:31:15 by Krzysztof Szewczyk
• ### How to build continuous integration and delivery process for embedded SW development

Posted 2017-10-03 11:01:29 by Yaniv Nis

## Recent questions

• ### Issues running imported Keil project in Segger Studio

Posted 2017-11-19 08:21:24 by Nick
• ### I2C Write issue

Posted 2017-11-19 08:13:39 by adityaj
• ### Programming Sparkfun nRF52832 Breakout with Keil

Posted 2017-11-19 07:01:46 by Nick
• ### BLE_GAP_SEC_STATUS_DHKEY_FAILURE numeric comparison

Posted 2017-11-18 23:08:29 by Arepa
• ### Multi-tasking and event-handling

Posted 2017-11-18 20:21:08 by Roger