STM32 Makefile add -Wa -adhlns… to create assembler listing.

Sysprogs forums Forums VisualGDB STM32 Makefile add -Wa -adhlns… to create assembler listing.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #6674
    itisnt
    Participant

    I’ve created a Stand-alone Embedded Project after your tutorial for my STM32F407 project. Everything runs fine so far, but:

    In my old Makefile (Commandline project), i have the following entry:

    ……

    CFLAGS += -Wredundant-decls -Wshadow -Wcast-qual -Wcast-align
    CFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<))))
    # Compiler flags to generate dependency files:
    #CFLAGS += -MD -MP -MF $(OUTDIR)/dep/$(@F).d
    …….

    With -Wa -adhlns=… you can create (with -ggdb) a combined listing with assembler and C-Code for each .c file and for the hole target.

    How can i add that to a VisualGDB controlled Makefile ?

    All my tries ended in a misery 🙂

    Regards Daniel

    #6675
    support
    Keymaster

    Hi,

    Please try adding the flags directly to the targets and target templates, e.g.:

    $(BINARYDIR)/%.o : %.cpp $(all_make_files) |$(BINARYDIR)
        $(CXX) $(CXXFLAGS) -c $< -o $@ -MD -MF $(@:.o=.dep) <add your flags here>

     

    #6676
    itisnt
    Participant

    First of all thanks for the quick answer, but please, could you go a little more into the deep 🙂

    I’v added the following in the “Makefile”:

    $(BINARYDIR)/%.o : %.c $(all_make_files) |$(BINARYDIR)
    $(CC) $(CFLAGS) -c $< -o $@ -MD -MF $(@:.o=.dep) -Wa -adhlns=$(@:.o=.lst)

    and got the following back:

    1>  C:\Users\a239368\Privat\Mikrokontroller\VisualStudio\GCC_4_9_2015q2/bin/arm-none-eabi-gcc.exe -ggdb -ffunction-sections -O0 -mcpu=cortex-m4 -mthumb -ffunction-sections -mapcs-frame -ffunction-sections -fdata-sections -Wextra -Wcast-align -Wpointer-arith -Wredundant-decls -Wshadow -Wcast-qual -Wcast-align -std=gnu99   -mfloat-abi=soft -I. -IC:/Users/a239368/Privat/Mikrokontroller/Rekolas/VisualGDB_workspace/RLS-15/RLS-15/Daenus_STM32F4xx_StdPeriph_151/cmis -IC:/Users/a239368/Privat/Mikrokontroller/Rekolas/VisualGDB_workspace/RLS-15/RLS-15/Daenus_STM32F4xx_StdPeriph_151/cmsis_boot -IC:/Users/a239368/Privat/Mikrokontroller/Rekolas/VisualGDB_workspace/RLS-15/RLS-15/Daenus_STM32F4xx_StdPeriph_151/cmsis_lib/inc -IC:/Users/a239368/Privat/Mikrokontroller/Rekolas/VisualGDB_workspace/RLS-15/RLS-15/src -IC:/Users/a239368/Privat/Mikrokontroller/Rekolas/VisualGDB_workspace/RLS-15/RLS-15/ub_lib -IC:/Users/a239368/Privat/Mikrokontroller/Rekolas/VisualGDB_workspace/RLS-15/RLS-15/stdio -DDEBUG -DARM_MATH_CM4 -Dstm32_flash_layout -DSTM32F407ZG -DSTM32F40_41xxx -DUSE_STDPERIPH_DRIVER -DUSE_FULL_ASSERT -DUSE_OLIMEX_H407 -DMOD_MTHOMAS_STMLIB  -c main.c -o Debug/main.o -MD -MF Debug/main.dep -Wa -adhlns=Debug/main.lst
    1>arm-none-eabi-gcc.exe : error : unrecognized command line option ‘-Wa’
    1>arm-none-eabi-gcc.exe : error : unrecognized command line option ‘-adhlns=Debug/main.lst’
    1>  make: *** [Debug/main.o] Error 1

    Sorry, but i’m not a Makefile crack 🙁

     

     

    #6683
    support
    Keymaster

    Please use comma instead of space after the -Wa option, i.e.:

    1. Modify the .c file rule this way:​
      ​$(BINARYDIR)/%.o : %.c $(all_make_files) |$(BINARYDIR)
          $(CC) $(CFLAGS) -c $< -o $@ -MD -MF $(@:.o=.dep) -Wa,-adhlns=$(@:.o=.lst)
    2. Change the contents of the SOURCEFILES statement (e.g. remove one file) so that VisualGDB regenerates the rules your Makefile.
    3. Build your project.​
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.