Create MAP file when Compiling for Teensy in Teensyduino

I needed to generate a compiler .MAP file for a project to examine my global variables. Sifting thru various somewhat vague explanations for generating a MAP file in the arduino IDE, I got it figured out.

In your Arduino/Teensyduino directory go to the directory:

hardware\teensy\avr\

and edit the file platform.txt

Find the lines :

## Link
recipe.c.combine.pattern=...

and between the parts

{build.flags.cpu}

and

-o "{build.path}/{build.project_name}.elf"

add

"-Wl,-Map,{build.path}/{build.project_name}.map"

for me the entire line looks like:

recipe.c.combine.pattern="{compiler.path}{build.toolchain}{build.command.gcc}" {build.flags.optimize} {build.flags.ld} {build.flags.ldspecs} {build.flags.cpu} "-Wl,-Map,{build.path}/{build.project_name}.map" -o "{build.path}/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" "-L{build.path}" {build.flags.libs}

Now when you compile, along with elf, hex files you will get map file:

Advertisements
This entry was posted in c-teensy and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.