I'm using gcc 4.71 toolchain to compile my c program for STM32F4 (ARM Cortex-M4) microcontroller. After my program is compiled and linked (I have .elf file) I would like to extract address of first instruction for each source code line. Currently I'm trying to do this by parsing the disassembly file - for example below I get adr 0x8000c44 for line 41 in main.c.
Is there some other more convenient way how to get this information using some of gcc tools?
sample disassembly file:
c:\a_test2/main.c:41
8000c44: b580 push {r7, lr}
command line I use to compile and link:
c:\Yagarto471\bin\arm-none-eabi-gcc.exe -c -mcpu=cortex-m4 -mthumb -ffunction-sections -fdata-sections -Wall -Wextra -Wno-unused-parameter -Wno-unknown-pragmas -Wno-unused-variable -Wno-unused-but-set-variable -std=gnu89 -g -ggdb3 -fverbose-asm -Wa,-ahlms=app.lst -DUSE_STDPERIPH_DRIVER -DSTM32F4XX -DUSE_STM32F4_DISCOVERY -DUSE_USB_OTG_FS -DHSE_VALUE=8000000 -MD -MP -MF app.d -I. -Iinc -save-temps -c main.c -o main.o
c:\Yagarto471\bin\arm-none-eabi-g++ -mcpu=cortex-m4 -mthumb -Tstm32f4xx.ld -g -Wl,-Map=Map.map,--cref,--no-warn-mismatch -Wl,--gc-sections -nostartfiles startup\startup_stm32f4xx.o startup\stm32f4_discovery.o startup\system_stm32f4xx.o startup\stm32f4xx_rcc.o startup\stm32f4xx_gpio.o startup\stm32f4xx_tim.o startup\misc.o startup\stm32f4xx_usart.o startup\syscalls.o main.o sys.o intr.o vars.o debug.o lib.o -o stm32f4_temp.elf