If you dig microcontrollers, and also you such as to explore exactly how they function, Elecia White intends to assist you browse their innermost keys with the assistance of memory map documents. In this refreshingly amusing, yet really deep keynote talk from the 2021 Hackaday Remoticon, Elecia overviews us with among one of the most challenging artefacts of collection– a data that details where every little thing is being placed in the microcontroller’s memory– and also explains spots that assist to make it extra accessible.
And also when you require to explore the map data, you possibly actually requirement to explore the map data. When your ingrained widget strangely retires, memory issues are a few of the common suspects. Perhaps you lacked RAM or flash storage area, perhaps you have some weird difficult mistake and also you would like to know what component of the program is creating the problem, or perhaps you require to do some rate profiling to make it all run quicker. In all of these situations, you obtain an outright memory address. What lives there? Look it up in the memory map!
Charting a Training Course
Elecia starts with the map data from a “hey there globe” program, yet it’s a hello there globe operating on an RTOS, so currently there suffices meat to explore. She starts with the high-level introduction: blink for the code and also RAM for the program to make use of. In flash, the code stays in
message and also
const, and also RAM has areas that must recognize to you like
load and also
pile, yet likewise
information and also
bss The memory map data likewise follows this framework: initially a summary, after that the area pens, and after that the information of what’s inside each area.
If you obtain a collision, as an example, and also you understand where the mathematical worth of program counter when it went all pear-shaped, the
message area details the feature name where that occurred. The area with worldwide variable meanings, noted alphabetically? You can possibly simply scroll on by that– there’s a great deal of redundancy in the map data, in some cases arranged by memory address, in some cases arranged alphabetically. You do not wish to read a map data, you simply wish to dip in, obtain what you require, and also venture out. Obtained a variable that you assume is obtaining overwritten? Locate it in the area noted by address, and also take a look at its next-door neighbors– among them may be overwhelming.
Yet the genuine celebrity of the program is the attractive map Elecia made in the design of a parlor game. Throughout the River of Initialization from the Fixed Shores, you’ll locate RAMlandia, the high aircrafts of the Stacks, the reduced boggy Lot Hallows, and also the Port of (memory mapped) Outer Registers. There are in fact dragons in the Sea of Extra Address Room. By switching over backward and forward in between this enjoyable, yet helpful, map and also the real message memory map data, Elecia connects an unforgettable sight of memory with the thick message of the map data as it stays in your job folder.
And also no speak about memory in microcontrollers is full without keeping in mind the threats of what occurs when the RAM’s load, which expands down, kisses the RAM’s pile, which expands up. What occurs after that? Another feature phone call and also the features begin overwriting your information. “This is great. Like a pet being in a coffee shop ablaze.” The trouble is, this is the component of memory monitoring that’s vibrant, features call various other features and also memory is alloted and also gotten rid of. Individual input modifications which components of the program run, and also therefore where information is kept. Below is the one location where the memory map will not assist you, other than to discover what neighbors where the collision occurred. Yet truth response to “Just how much RAM do I have currently?” genuinely is ineffably “I dunno.”
If you’re brand-new to ingrained style, maybe the very first twenty mins of the talk is for you, and also also if you’re a hard professional, you’ll discover something from the later areas. I completely appreciated Elecia’s talk, therefore will certainly you. You can enjoy it ingrained simply listed below. Bring a duplicate of the slides along also.