How Microcontroller Memory Works | Embedded System Project Series #16

Artful Bytes Artful Bytes

112,187
2 năm trước
Practical Notes on Embedded (starts with a guide to learning embedded by building): https://artfulbytes.com/
------
I explain how microcontroller memory works with a code example. I use my IDE's memory browser to see where different variables end up in memory, and I demonstrate two command line tools to track how much flash memory my code occupies. Overall, knowing how memory works is important because microcontrollers have a limited amount of it, and if we are not mindful of how we write our code, we may run out of it.

0:00 Overview
1:30 Flash and RAM
3:22 From source code to memory
7:12 Code example
8:07 Different variables
12:20 Program code
13:13 Linker script
14:55 Memory browser and Map file
24:22 Surprising flash usage
27:30 Tool 1: Total flash usage
31:38 Tool 2: readelf
33:53 git commit
33:15 Last advice

#embeddedsystems #cprogramming #microcontroller

Code:

🌍 Links related to this video
https://interrupt.memfault.com/blog/zero-to-main-1
https://embeddedartistry.com/blog/2019/04/08/a-general-overview-of-what-happens-before-main/
https://github.com/artfulbytes/nsumo_video

🌍 Find me here
GitHub - https://github.com/artfulbytes
Website - https://www.artfulbytes.com

👨‍💻 About me
Hi and welcome. I'm Niklas, an embedded systems engineer from Sweden. On this channel, I make practical videos about embedded systems or, in general terms, about building and programming hardware.