Note that there are some explanatory texts on larger screens.

plurals
  1. POmake uses "cc" instead of "arm-none-eabi-as"
    text
    copied!<p>I have a problem when building a program with makefile. There is only a problem when make tries to compile assembly file named "startup.S". It looks like make uses compiler "cc" even if i specify "arm-none-eabi-as" in a makefile (take a look at variable AS). </p> <p>Here is my makefile:</p> <pre><code>SHELL := /bin/bash ROOT := $(shell pwd) INC := $(ROOT)/inc SRC := $(ROOT)/src STR := $(ROOT)/str EXE := exe AS := arm-none-eabi-as -mcpu=arm926ej-s -c -Wall -I $(INC) -I$(SRC) -I $(STR) GCC := arm-none-eabi-gcc -mcpu=arm926ej-s -c -Wall -I $(INC) -I$(SRC) -I $(STR) LDSCRIPT := test.ld LD := arm-none-eabi-ld -T $(LDSCRIPT) HEADERS := $(notdir $(wildcard $(INC)/*.h)) SOURCES_GCC := $(notdir $(wildcard $(SRC)/*.c)) SOURCES_AS := $(notdir $(wildcard $(STR)/*.S)) OBJECTS_GCC := $(SOURCES_GCC:.c=.o) OBJECTS_AS := $(SOURCES_AS:.S=.o) VPATH := $(STR):$(SRC):$(INC) all : $(EXE) @echo konec postopka: izvrsljiv program po imenu $(EXE) se nahaja v mapi $(ROOT) $(EXE) : $(OBJECTS_AS) $(OBJECTS_GCC) @echo objekti so: $(OBJECTS_AS) $(OBJECTS_GCC) @echo headerji so: $(HEADERS) @echo linkanje objektov v izvrsljiv program... $(LD) -o $@ $^ %.o : %.S %h @echo prevajanje ASSEMBLY izvornih datotek... $(AS) -o $@ $&lt; %.o : %.c %h @echo prevajanje C izvornih datotek... $(GCC) -o $@ $&lt; .PHONY : clean clean : @echo brisanje objektov rm *.o @echo brisanje izvrsljivega programa rm $(EXE) </code></pre> <p>Here is the error i get when typing comand make in a terminal. It clearly tells that "cc" doesnt understand assembly language, and this error is somewhat expected.</p> <pre><code>cc -c -o startup.o /home/ziga/Dropbox/diploma/86x_linux/IDE_eclipse/eclipse_projects/makefile_8/str/startup.S /home/ziga/Dropbox/diploma/86x_linux/IDE_eclipse/eclipse_projects/makefile_8/str/startup.S: Assembler messages: /home/ziga/Dropbox/diploma/86x_linux/IDE_eclipse/eclipse_projects/makefile_8/str/startup.S:4: Error: no such instruction: `b Reset_Handler' /home/ziga/Dropbox/diploma/86x_linux/IDE_eclipse/eclipse_projects/makefile_8/str/startup.S:5: Error: no such instruction: `b .' /home/ziga/Dropbox/diploma/86x_linux/IDE_eclipse/eclipse_projects/makefile_8/str/startup.S:6: Error: no such instruction: `b .' /home/ziga/Dropbox/diploma/86x_linux/IDE_eclipse/eclipse_projects/makefile_8/str/startup.S:7: Error: no such instruction: `b .' /home/ziga/Dropbox/diploma/86x_linux/IDE_eclipse/eclipse_projects/makefile_8/str/startup.S:8: Error: no such instruction: `b .' /home/ziga/Dropbox/diploma/86x_linux/IDE_eclipse/eclipse_projects/makefile_8/str/startup.S:9: Error: no such instruction: `b .' /home/ziga/Dropbox/diploma/86x_linux/IDE_eclipse/eclipse_projects/makefile_8/str/startup.S:10: Error: no such instruction: `b .' /home/ziga/Dropbox/diploma/86x_linux/IDE_eclipse/eclipse_projects/makefile_8/str/startup.S:11: Error: no such instruction: `b .' /home/ziga/Dropbox/diploma/86x_linux/IDE_eclipse/eclipse_projects/makefile_8/str/startup.S:14: Error: no such instruction: `ldr sp,=stack_top' /home/ziga/Dropbox/diploma/86x_linux/IDE_eclipse/eclipse_projects/makefile_8/str/startup.S:15: Error: no such instruction: `bl c_entry' /home/ziga/Dropbox/diploma/86x_linux/IDE_eclipse/eclipse_projects/makefile_8/str/startup.S:16: Error: no such instruction: `b .' </code></pre> <p>If i try to compile it manualy using "arm-none-eabi-as startup.S" it compiles fine... </p> <p><strong>My question would be, why does make uses cc instead arm-none-eabi-as? What am i missing here?</strong></p> <p>After all of your proposal i managed to make a makefile, that looks like this and it is working:</p> <pre><code>SHELL := /bin/bash ROOT := $(shell pwd) INC := $(ROOT)/inc SRC := $(ROOT)/src STR := $(ROOT)/str EXE := exe AS := arm-none-eabi-as -mcpu=arm926ej-s -c -Wall -I $(INC) -I$(SRC) -I $(STR) CC := arm-none-eabi-gcc -mcpu=arm926ej-s -c -Wall -I $(INC) -I$(SRC) -I $(STR) LDSCRIPT := ldscript_iram_gnu.ld LD := arm-none-eabi-ld -T $(LDSCRIPT) HEADERS := $(notdir $(wildcard $(INC)/*.h)) SOURCES_CC := $(notdir $(wildcard $(SRC)/*.c)) SOURCES_AS := $(notdir $(wildcard $(STR)/*.S)) OBJECTS_CC := $(SOURCES_CC:.c=.o) OBJECTS_AS := $(SOURCES_AS:.S=.o) VPATH := $(STR):$(SRC):$(INC) all : $(EXE) @echo konec postopka: izvrsljiv program po imenu $(EXE) se nahaja v mapi $(ROOT) $(EXE) : $(OBJECTS_AS) $(OBJECTS_CC) @echo objekti so: $(OBJECTS_AS) $(OBJECTS_CC) @echo headerji so: $(HEADERS) @echo linkanje objektov v izvrsljiv program... $(LD) -o $@ $^ %.o : %.S @echo prevajanje ASSEMBLY izvornih datotek... $(AS) -o $@ $&lt; %.o : %.h %.o : %.c @echo prevajanje C izvornih datotek... $(CC) -o $@ $&lt; %.o : %.h .PHONY : clean clean : @echo brisanje objektov rm *.So rm *.o @echo brisanje izvrsljivega programa rm $(EXE) </code></pre> <p>When i tried to use same makefile in other project (project for which my makefile has been built from the beginning) which also has same tree structure i get some errors: </p> <pre><code>make all objekti so: timer_example.o headerji so: ea3131_board.h ffconf.h ff.h integer.h lpc313x_cgu_driver.h lpc313x_cgu.h lpc313x_cgu_switchbox.h lpc313x_chip.h lpc313x_crc_driver.h lpc313x_dmac.h lpc313x_dma_driver.h lpc313x_evt_driver.h lpc313x_evt_router.h lpc313x_i2c_driver.h lpc313x_i2c.h lpc313x_intc_driver.h lpc313x_intc.h lpc313x_ioconf_driver.h lpc313x_ioconf.h lpc313x_mci_driver.h lpc313x_mci.h lpc313x_nandc.h lpc313x_nand_driver.h lpc313x_spi_driver.h lpc313x_spi.h lpc313x_sysreg.h lpc313x_timer_driver.h lpc313x_timer.h lpc313x_uart_driver.h lpc313x_uart.h lpc313x_wdt_driver.h lpc313x_wdt.h lpc31xx_vmem_driver.h lpc_api.h lpc_arm922t_arch.h lpc_arm922t_cp15_driver.h lpc_arm_arch.h lpc_bmp.h lpc_colors.h lpc_fat16.h lpc_fat16_private.h lpc_fonts.h lpc_heap.h lpc_helvr10.h lpc_irq_fiq.h lpc_lbecc.h lpc_lcd_params.h lpc_line_parser.h lpc_nandflash_params.h lpc_params.h lpc_rom8x16.h lpc_rom8x8.h lpc_sdmmc.h lpc_string.h lpc_swim_font.h lpc_swim.h lpc_swim_image.h lpc_types.h lpc_winfreesystem14x16.h lpc_x5x7.h lpc_x6x13.h linkanje objektov v izvrsljiv program... arm-none-eabi-ld -T ldscript_iram_gnu.ld -o exe timer_example.o ea3131_startup_entry.o: In function `clearzi_exit': (.text+0x170): undefined reference to `ea3131_init' timer_example.o: In function `timer0_user_interrupt': timer_example.c:(.text+0x15c): undefined reference to `timer_ioctl' timer_example.o: In function `uart_string_write': timer_example.c:(.text+0x1dc): undefined reference to `strlen' timer_example.c:(.text+0x208): undefined reference to `uart_write' timer_example.o: In function `c_entry': timer_example.c:(.text+0x258): undefined reference to `ea3131_board_init' timer_example.c:(.text+0x260): undefined reference to `cp15_set_vmmu_addr' timer_example.c:(.text+0x268): undefined reference to `int_initialize' timer_example.c:(.text+0x274): undefined reference to `int_install_irq_handler' timer_example.c:(.text+0x280): undefined reference to `timer_open' timer_example.c:(.text+0x2a4): undefined reference to `timer_ioctl' timer_example.c:(.text+0x2bc): undefined reference to `timer_ioctl' timer_example.c:(.text+0x2d4): undefined reference to `timer_ioctl' timer_example.c:(.text+0x2e0): undefined reference to `uart_open' timer_example.c:(.text+0x2f8): undefined reference to `memcpy' timer_example.c:(.text+0x32c): undefined reference to `timer_ioctl' timer_example.c:(.text+0x334): undefined reference to `int_enable' timer_example.c:(.text+0x38c): undefined reference to `sprintf' make: *** [exe] Error 1 </code></pre> <p>It looks to me that my makefile is doing OK now, but there are some unresolved references within my project which have nothing to do with my makefile. <strong>Still i need your conformation that my makefile is doing OK.</strong> Thank you all.</p> <p>Regards.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload