linux - make uses "cc" instead of "arm-none-eabi-as" -
i have problem when building program makefile. there problem when make tries compile assembly file named "startup.s". looks make uses compiler "cc" if specify "arm-none-eabi-as" in makefile (take @ variable as).
here makefile:
shell := /bin/bash root := $(shell pwd) inc := $(root)/inc src := $(root)/src str := $(root)/str exe := exe := 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) : $(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 $@ $< %.o : %.c %h @echo prevajanje c izvornih datotek... $(gcc) -o $@ $< .phony : clean clean : @echo brisanje objektov rm *.o @echo brisanje izvrsljivega programa rm $(exe) here error when typing comand make in terminal. tells "cc" doesnt understand assembly language, , error expected.
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 .' if try compile manualy using "arm-none-eabi-as startup.s" compiles fine...
my question be, why make uses cc instead arm-none-eabi-as? missing here?
after of proposal managed make makefile, looks , working:
shell := /bin/bash root := $(shell pwd) inc := $(root)/inc src := $(root)/src str := $(root)/str exe := exe := 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) : $(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 $@ $< %.o : %.h %.o : %.c @echo prevajanje c izvornih datotek... $(cc) -o $@ $< %.o : %.h .phony : clean clean : @echo brisanje objektov rm *.so rm *.o @echo brisanje izvrsljivega programa rm $(exe) when tried use same makefile in other project (project makefile has been built beginning) has same tree structure errors:
make 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 `ea3131_init' timer_example.o: in function `timer0_user_interrupt': timer_example.c:(.text+0x15c): undefined reference `timer_ioctl' timer_example.o: in function `uart_string_write': timer_example.c:(.text+0x1dc): undefined reference `strlen' timer_example.c:(.text+0x208): undefined reference `uart_write' timer_example.o: in function `c_entry': timer_example.c:(.text+0x258): undefined reference `ea3131_board_init' timer_example.c:(.text+0x260): undefined reference `cp15_set_vmmu_addr' timer_example.c:(.text+0x268): undefined reference `int_initialize' timer_example.c:(.text+0x274): undefined reference `int_install_irq_handler' timer_example.c:(.text+0x280): undefined reference `timer_open' timer_example.c:(.text+0x2a4): undefined reference `timer_ioctl' timer_example.c:(.text+0x2bc): undefined reference `timer_ioctl' timer_example.c:(.text+0x2d4): undefined reference `timer_ioctl' timer_example.c:(.text+0x2e0): undefined reference `uart_open' timer_example.c:(.text+0x2f8): undefined reference `memcpy' timer_example.c:(.text+0x32c): undefined reference `timer_ioctl' timer_example.c:(.text+0x334): undefined reference `int_enable' timer_example.c:(.text+0x38c): undefined reference `sprintf' make: *** [exe] error 1 it looks me makefile doing ok now, there unresolved references within project have nothing makefile. still need conformation makefile doing ok. thank all.
regards.
try using cc instead of gcc (which variable used in default make rules), in case, uncovered issue: rules ignored.
what's "%h" supposed do?
also note "echo" command isn't executed - hint rules aren't considered make
Comments
Post a Comment