can platformio generate a .map file ?
Ty
Dthat is dependant on the compiler you are wanting to use with it. For the gcc variants, just pass the appropriate arguments in the build_flags section.
Thank you itās work !!
Glad to be of some help.
Advice please. What is the right arguments to generate map file? Iāve made many attemps but without succes.
As I wrote. Iād like to generate map file as linking result. So I tried to pass the arguments in the build_flags section, like ābuild_flags = -Wl,-mapā, but without succes. I cannot find the right argument and syntax.
See here,
You also have to specify the name of the map file in the build flags arguments.
Running it with -Wl,-Map,output.map
gave me the output map file for avr-gcc and arm-elf-gcc.
Maybe thats what you were missing.
Hope this helps!!
The exact text is
build_flags = -Wl,-Map,output.map
Thank you, it works!
I tried to generate a MAP file, but in my case, unfortunately, it does not work.
I use exactly the same build flags as pointed above, but I cannot trace any MAP file in ā.pioenvs[my_env]ā folder.
The ELF file is there, but no MAP file.
Also, no MAP file generation lines within the build messages.
What am I doing wrong? Where to look for this file?
A little more information please. The above method only works for GCC. Can you post your platformio.INI file please
Hi Krishna,
my INI file has following information:
platform = ststm32
board = genericSTM32F407VE
framework = arduino
I use GCC.
I can see in the build window of ATOM the verbose messages.
The compiling messages are there, but not the linker verbose message:
Archiving .pioenvs\genericSTM32F407VE\libFrameworkArduino.a Linking .pioenvs\genericSTM32F407VE\firmware.elf Calculating size .pioenvs\genericSTM32F407VE\firmware.elf Building .pioenvs\genericSTM32F407VE\firmware.bin text data bss dec hex filename 16712 6392 6064 29168 71f0 .pioenvs\genericSTM32F407VE\firmware.elf [SUCCESS] Took 9.62 seconds
As you can see, just a short line about invoking the linker, but no detailed linker verbose message, so that I cannot see the linker parametersā¦
And no trace of a MAP fileā¦
After trying to add the needed arguments to the INI files without success, I finally added the MAP generation parameter to the .platformio\platforms\ststm32\builder\main.py
LINKFLAGS=[
"-Os",
"-Wl,--gc-sections,--relax",
"-Wl,-Map,output.map"
"-mthumb",
"-nostartfiles",
"-nostdlib"
],
but still no success.
You should add the flags for map generation to your platformio.ini file under the build_flags section. Please see the above post for more information.
I did try it, but it did not work, see my previous post, where I mentioned this already:
Any thoughts?
There is something wrong!
I tried it again after cleaning the project, and the .map file generated just fine.
I added this to the platformio.ini file.
build_flags = -Wl,-Map,output.map
Where is the MAP file going to be placed?
In the root of the project folder. Atleast thats where my map file was generated.
All right, that was it. I was looking for it in the wrong folder, where the ELF file was placed.
But I can now confirm: it works!
Thanks a lot!
You are welcome!
Glad to be some help!!!
Btw, just for info, it also works when included into
line 57. In the posted version I had an error, a comma was missing from the line end.
Maybe Ivan would consider to include it to the official version.