This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Building a GCC-based project from the command line

I'm compiling my project successfully in Eclipse, but trying to build it from the command line (cygwin) fails near the end with this error (make, make all, make nrf51422_xxac_s110 all result in this):

make: *** No rule to make target '_build/gcc_startup_nrf51.o', needed by 'nrf51422_xxac_s110'. Stop.

Which makes sense since gcc_startup_nrf51.s is never compiled when makefile is called from the command line. I don't completely understand the mechanism for starting the compilation of the assembly file so I don't know where to start with fixing this.

I've got makefile template from this tutorial, my full makefile is here.

Parents
  • makefile looks right to me. The rule is

    # Assemble files
    $(OBJECT_DIRECTORY)/%.o: %.s
        @echo Compiling file: $(notdir $<)
        $(NO_ECHO)$(CC) $(ASMFLAGS) $(INC_PATHS) -c -o $@ $<
    

    which tells make how to compile a .o from a .s file. You have the .s file listed in the ASM_SOURCE_FILES and clearly that's being properly turned into a dependent object file because the link fails and the .o appears in the list. ASM_PATHS looks right, the vpath is right.

    you could try writing a target which just echos all those variables, ASM_OBJECTS, ASM_PATHS, all that stuff, see if you can see anything wrong. The ASM_OBJECTS should just be the one startup file, the ASM_PATHS should be the prefix to it. Failing that you compile what you can and then run make in the most verbose mode possible to see if you can figure out what rules it's trying.

    also check file exists and is .s not .S

Reply
  • makefile looks right to me. The rule is

    # Assemble files
    $(OBJECT_DIRECTORY)/%.o: %.s
        @echo Compiling file: $(notdir $<)
        $(NO_ECHO)$(CC) $(ASMFLAGS) $(INC_PATHS) -c -o $@ $<
    

    which tells make how to compile a .o from a .s file. You have the .s file listed in the ASM_SOURCE_FILES and clearly that's being properly turned into a dependent object file because the link fails and the .o appears in the list. ASM_PATHS looks right, the vpath is right.

    you could try writing a target which just echos all those variables, ASM_OBJECTS, ASM_PATHS, all that stuff, see if you can see anything wrong. The ASM_OBJECTS should just be the one startup file, the ASM_PATHS should be the prefix to it. Failing that you compile what you can and then run make in the most verbose mode possible to see if you can figure out what rules it's trying.

    also check file exists and is .s not .S

Children
Related