This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Map file generation using arm-none-eabi

Hi all,

We generally get executable and linkable file(ELF) to program Microcontrollers. I wanted to generate MAP file using this elf file to observe various sections of memory. How is it possible using toolchain arm-none-eabi toolchain?

So far I have done something like:

arm-none-eabi-gcc.exe -Xlinker -Map=out.map program.elf

to get some linker script  and memory map

but it is not an exact map file

any suggestions?

best,

Fahad

  • Hi Fahad,

    Can you be more specific about what is inexact in that map file?

    Best regards.

  • Hi,

    I needed the memory regions occupied by my code. I got it by giving -map=out.map to the compiler in my make file

    thanks

  • Can you help me to make a map file in makefile?

    I've got some error as the below,

    arm-none-eabi-gcc -g -O3 -mthumb -mcpu=cortex-m3 ../../../../software/cmsis/Device/ARM/CMSDK_CM3/Source/GCC/startup_CMSDK_CM3.s \
                    hello.c \
                    ../../../../software/common/retarget/retarget.c \
                    ../../../../software/common/retarget/uart_stdout.c \
                    ../../../../software/cmsis/Device/ARM/CMSDK_CM3/Source/system_CMSDK_CM3.c \
                    -I ../../../../software/cmsis/Device/ARM/CMSDK_CM3/Include -I ../../../../software/cmsis/CMSIS/Include \
                    -I ../../../../software/common/retarget \
                    -L ../../../../software/common/scripts \
                    -D__STACK_SIZE=0x200 \
                    -D__HEAP_SIZE=0x1000 \
                    -DCORTEX_M3 -T ../../../../software/common/scripts/cmsdk_cm3.ld -o hello.o
    # Generate disassembly code
    arm-none-eabi-objdump -S hello.o > hello.lst
    # Generate binary file
    arm-none-eabi-objcopy -S hello.o -O binary hello.bin
    # Generate hex file
    arm-none-eabi-objcopy -S hello.o -O verilog hello.hex
    # Generate map file
    #arm-none-eabi-gcc -Xlinker -Map=out.map program.elf
    arm-none-eabi-gcc -Xlinker -Map=out.map
    /opt/gcc-arm-none-eabi-4_9-2015q3/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/libc.a(lib_a-exit.o): In function `exit':
    exit.c:(.text.exit+0x2c): undefined reference to `_exit'
    /opt/gcc-arm-none-eabi-4_9-2015q3/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/crt0.o: In function `_start':
    (.text+0xec): undefined reference to `main'
    collect2: error: ld returned 1 exit status
    make: *** [all_gcc] Error 1
    

    Could you help me and let me know what am I supposed to do to resolve this problem?

  • Why are you giving hello.o after -o? The compiler flag -o should be followed by output executable name. Just remove .o and it should work. You can try giving hello instead. Hope it resolves your problem

  • Hi,

    I hope you have already figured out your problem, but still try to give -Map=out.map to the arm-none-eabi-gcc as an argument.