Logo

dev-resources.site

for different kinds of informations.

The Power of Memory Map

Published at
11/2/2024
Categories
bsp
memory
hardware
soc
Author
lsahn
Categories
4 categories in total
bsp
open
memory
open
hardware
open
soc
open
Author
5 person written this
lsahn
open
The Power of Memory Map

Since early this year, I’ve been working on a BSP project. The biggest challenge was understanding physical memory layout, specifically why certain addresses are defined in the DTS and don’t fall within other expected ranges.

To tackle this, I created a complete memory map of the chip1, which helped me gain a clear understanding, and use the resources of the reference board2 to explain.


Fortunately, NXP has made the kernel source and reference manuals for the S32G3 chipset publicly available. This allows us to practice designing memory map diagrams freely using these resources—big thanks to NXP!

The image below shows the complete memory map, including kernel-reserved memory regions.

s32g3-memory-map-diagram

The S32G3 chip includes five categories of memory ranges:

  • Extended Address Map
  • External DRAM
  • Peripherals
  • RAM
  • QSPI Memory

Extended Address Map

A 4GB DRAM can be mapped within a 32-bit address space. However, since the lower half of this range is allocated to peripherals, only up to 2GB is available for DRAM.

To overcome this limitation, the system can extend the address space to 40-bit mode. This allows more than 2GB of DRAM to be mapped and provides additional address space for other devices, including the PCIe endpoint as shown in the diagram.

External DRAM

This is the basic range where DRAM is mapped. It serves as the main memory used by the kernel, where tasks like loading the kernel image during boot, memory management like the page allocation.

Peripherals

This range is where most peripherals are mapped to specific areas of the SoC, allowing access to their controllers.

RAM

It’s integrated into SoC chips because key components like PCIe, CPU, and GPU need ultra-high-speed communication. Its size is quite limited compared to DRAM, typically ranging from KB to MB, due to the high cost of larger capacities. This type of memory is commonly used for cache and CPU registers, where ultra-high speed is essential.

QSPI Flash Memory

A QSPI-interfaced flash memory is used to store resources such as pre/boot loaders, kernel images, and additional binaries. This area is used by the M7 cores to store their firmware.

However, the actual accessible address size on the board is limited to 0x03FF_FFFF (64MB), even though the total address space extends up to 0x1FFF_FFFF (512MB), because the NOR flash3 is designed as a 64MB storage.


Conclusion

We have been exploring the memory map of the chip. This can be challenging for BSP newcomers, but it’s essential knowledge. For instance, U-Boot, a bootloader uses environment variables such as loadaddr and fdtaddr to load binaries into DRAM. In such cases, understanding the accessible memory range is crucial.

I hope you found this post helpful and insightful!

memory Article's
30 articles in total
Favicon
Memory Management in Operating Systems
Favicon
What is GCHandle in C#? (Part 1)
Favicon
How Memory Shapes Data Structures: Arrays and Allocation
Favicon
Mastering Pointers in Go: Enhancing Safety, Performance, and Code Maintainability
Favicon
Methods for finding memory leaks in Visual Studio
Favicon
Laravel 11: Allowed memory size of 134217728 bytes exhausted (tried to allocate 23085056 bytes)
Favicon
Setting up memory for Flink - Configuration
Favicon
CS50 - Week 4
Favicon
How to Create Dynamic Memory Card Game Using HTML CSS and JavaScript
Favicon
Profiling no Java: Guia prático para analisar o desempenho de aplicações Java
Favicon
Potential Drawbacks of Using DMA Instead of Interrupts for Data Transfer in Embedded Systems
Favicon
x64 Virtual Address Translation
Favicon
Why Is Stack Memory Faster Than Heap Memory? Here’s What You Need to Know!
Favicon
Java tool to accurately measure object sizes and their hierarchies.
Favicon
Physical and Logical Memory: Addressing and Allocation in Operating Systems
Favicon
Mastering memory management in Go: Avoiding slice-related leaks
Favicon
How to estimate Java object size
Favicon
The difference between pointers and values on methods
Favicon
Data Flow in LLM Applications: Building Reliable Context Management Systems
Favicon
JavaScript Shared Memory
Favicon
Understanding Memory<T> in C#
Favicon
The Power of Memory Map
Favicon
Node.js Memory Leaks: A Guide to Detection and Resolution
Favicon
Kubectl Top command:-Secrets behind scenes
Favicon
Subsistema de memória
Favicon
How to Increase Free Tier Memory on AWS EC2
Favicon
Understanding Memory Leaks in Java: Common Causes and How to Detect Them
Favicon
"What Every Programmer Should Know About Memory" by Ulrich Drepper.
Favicon
Understanding Garbage Collection in Java: Essential for Interview Preparation
Favicon
Navigating JVM Memory: Key Concepts for Your Java Interview

Featured ones: