Other Parts Discussed in Thread: HALCOGEN
Tool/software: TI C/C++ Compiler
I use HALCOGEN to generate code with GCC Tools,and use arm-none-eabi-gcc to compile the code on linux,the makefile reported compile error:
arm-none-eabi-ld -n -o boot.elf ./bin/*.o ./bin/*.a -L/usr/bin/gcc-arm-none-eabi-9-2019-q4-major/arm-none-eabi/lib
arm-none-eabi-ld: warning: cannot find entry symbol _start; defaulting to 0000000000008000
arm-none-eabi-ld: ./bin/startup.o: in function `_c_int00':
/root/ls3137/3137_boot/ls3137_miniboot/init/startup.c:649: undefined reference to `_sidata'
arm-none-eabi-ld: /root/ls3137/3137_boot/ls3137_miniboot/init/startup.c:649: undefined reference to `_sidata'
arm-none-eabi-ld: /root/ls3137/3137_boot/ls3137_miniboot/init/startup.c:650: undefined reference to `_sdata'
arm-none-eabi-ld: /root/ls3137/3137_boot/ls3137_miniboot/init/startup.c:650: undefined reference to `_sdata'
arm-none-eabi-ld: /root/ls3137/3137_boot/ls3137_miniboot/init/startup.c:668: undefined reference to `exit'
arm-none-eabi-ld: ./bin/libgcc.a(_dvmd_lnx.o): in function `__div0':
/opt/FriendlyARM/mini2440/build-toolschain/working/src/gcc-4.4.3/libgcc/../gcc/config/arm/lib1funcs.asm:1093: undefined reference to `raise'
make: *** [boot] Error 1
Here is my makefile:
############################ Tool chain ################################### #GCC_BIN = $(GCC_HOME)bin/ GCC_BIN = #CROSS_COMPILE = $(GCC_BIN)arm-linux- CROSS_COMPILE = arm-none-eabi- CC = $(CROSS_COMPILE)gcc AR = $(CROSS_COMPILE)ar LD = $(CROSS_COMPILE)ld OBJCOPY = $(CROSS_COMPILE)objcopy OBJDUMP = $(CROSS_COMPILE)objdump CP = cp RM = -rm -rf MAKE = make ############################### FLAGS ##################################### # compile flags: CFLAGS for *.c, SFLAGS for *.S CFLAGS += -g CFLAGS += -O0 CFLAGS += -Wall CFLAGS += -mcpu=cortex-r4f #CFLAGS += -std=c99 #CFLAGS += -mthumb CFLAGS += -marm CFLAGS += -nostdlib CFLAGS += -mlittle-endian #CFLAGS += -mbig-endian CFLAGS += -march=armv7-r CFLAGS += -mfpu=vfpv3-d16 ######################### dirs & srcs #################################### LDFLAGS= -L/usr/bin/gcc-arm-none-eabi-9-2019-q4-major/arm-none-eabi/lib # find all of the sub directions in current direction. dirs := $(shell find . -maxdepth 1 -type d) dirs := $(basename $(patsubst ./%, %, $(dirs))) dirs := $(filter-out $(exclude_dirs), $(dirs)) SUBDIRS := $(dirs) # srcs, objs and depends SRCS = $(wildcard *.c) ASMSRCS = $(wildcard *.S) OBJS = $(SRCS:%.c=%.o) ASMOBJS = $(ASMSRCS:%.S=%.o) #DEPENDS = $(SRCS:%.c=%.d) LIB=lib ############################ rules ###################################### # # Entry of Makefie # all:subdirs $(LIB) $(TARGET) # # LIB target # $(LIB):$(OBJS) $(ASMOBJS) # $(AR) rcs $(TOPDIR)/lib/$@ $^ # $(RM) *.o *.d* *.a # walk through all of the subdirs, execute 'make' in these directions. subdirs:$(SUBDIRS) # echo $(SUBDIRS) @for dir in $(SUBDIRS);\ do \ echo ;\ echo "----------- $$dir --------------";\ $(MAKE) -C $$dir all || exit 1;\ echo "-------- exit $$dir ------------";\ echo ;\ done ######################################### # # Final binary targets # ######################################### $(TARGET):$(OBJS) $(ASMOBJS) # $(LD) -n -o $@ $^ $(LDFLAGS) -mv $(TOPDIR)/bin/ls3137_intvecs.o $(TOPDIR)/ # $(LD) -n -o $@.elf crt0.o $(TOPDIR)/bin/*.o $(LDFLAGS) $(LD) -n -o $@.elf $(TOPDIR)/bin/*.o $(TOPDIR)/bin/*.a $(LDFLAGS) # $(LD) -n -o $@.elf $(TOPDIR)/bin/*.o $(LDFLAGS) #$(LD) -n -o $@.elf $(TOPDIR)/bin/*.o $(LDFLAGS) # -rm $(TOPDIR)/crt0.o $(OBJCOPY) -O binary --strip-all --verbose $@.elf $@.bin $(OBJDUMP) -D $@.elf > dump_$@.txt # # Rules for source code # $(OBJS):%.o:%.c $(CC) -c $< -o $(TOPDIR)/bin/$@ $(CFLAGS) $(ASMOBJS):%.o:%.S $(CC) -c $< -o $(TOPDIR)/bin/$@ $(CFLAGS) #-include $(DEPENDS) # # Header file depends. If header file was changed, compiling will execute. # 1. set -e: if any command exit error, then stop # 2. rm -f $@: delete the depend file already existed # 3. -MM: write the depend relationship to the .d file # 4. $$: pid # 5. sed: replace 'xxx.o:xxx.c depend.h' to 'xxx.o xxx.d:xxx.c depend.h', # then write it to xxx.d. # 6. rm -f $@: delete the temporary. # #$(DEPENDS):%.d:%.c # @set -e; rm -f $@; \ # $(CC) -MM $(CFLAGS) $< >$@.$$$$; \ # sed 's,\($*\)\.o[:]*,\1.o $@:,g' < $@.$$$$ > $@; \ # rm $@* clean: @for dir in $(SUBDIRS); \ do $(MAKE) -C $$dir clean||exit 1; \ done # $(RM) $(TARGET) $(LIB) $(OBJS) $(DEPENDS) # $(RM) $(DEPENDS) $(RM) $(TOPDIR)/bin/*.o $(RM) $(TOPDIR)/boot.bin $(RM) $(TOPDIR)/boot.hex