Generate memory map file for embedded compilation

Hi!

I can not find a straightforward answer to this question so I thought, why not ask here, it might help other people.

When compiling embedded software in C/C++, I find it really useful to generate a map file. This file contains specific information on where certain segments and data structures are placed. This can be really useful when I want to place certain data structures in other memory segments for example and I want to inspect the actual memory layout.

When using CMake, I have a directive like this to generate the map file:

if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
  target_link_options(${TARGET_NAME} PRIVATE "-Wl,-Map=${OUTPUT_NAME_VAR}.map")
endif()

How would I do this in Rust?

Kind Regards
Robin

After some more research, I found this blogpost:

I guess I was not looking diligently enough :slight_smile:

With

rustflags = ["-Clink-args=-Map=app.map"]

inside my .cargo/cargo.toml I am now able to see that some of my buffers I annotated to be placed into different sections are indeed placed there.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.