打印

Linking with newlib for NE10 library

[复制链接]
219|0
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
哈金|  楼主 | 2018-9-8 20:42 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
I am using arm-none-eabi-* (7 2018-q2-update) to link with newlib-nano to use the NE10 library in a bare metal envirolment.
It looks like i am unable to be successful in compiling the code with newlib nano as i get many undefined references. I have messed up the makefile (which may look shabby) code from what it used to be for which i have been trying to link withour success.
I do not know what am I missing. It looks like calls to : malloc memmove free should be included in newlib. I am also unable to link the math functions for which i try to include libm libgcc...
My link process just fails(fails when arm-none-eabi-ld is called!) a copy of the makefile is below
An extract of errors or output log while making :
arm-none-eabi-ld   -T src/linker32.ld  -Map output.map -o build/kernel7.elf  -static build/gpio_test_c.o build/serial_c.o build/cstart_c.o build/NE10_sample_real_fft_c.o build/interrupts_c.o build/Ne10Test_c.o build/mailbox_c.o build/start32_s.o   -L. -LC:/Users/Sheroy/Desktop/RpiBareMetal/Codes -lNE10
C:/Users/Sheroy/Desktop/RpiBareMetal/CodeslibNE10.a(NE10_abs.c.obj): In function `ne10_abs_float_c\':
NE10_abs.c:(.text+0x14): undefined reference to `fabs\'
C:/Users/Sheroy/Desktop/RpiBareMetal/CodeslibNE10.a(NE10_abs.c.obj): In function `ne10_abs_vec2f_c\':
NE10_abs.c:(.text+0x44): undefined reference to `fabs\'
NE10_abs.c:(.text+0x58): undefined reference to `fabs\'
C:/Users/Sheroy/Desktop/RpiBareMetal/CodeslibNE10.a(NE10_abs.c.obj): In function `ne10_abs_vec3f_c\':
NE10_abs.c:(.text+0x8a): undefined reference to `fabs\'
NE10_abs.c:(.text+0x9e): undefined reference to `fabs\'
NE10_fft.c:(.text+0x70): undefined reference to `cos\'
NE10_fft.c:(.text+0x80): undefined reference to `sin\'
C:/Users/Sheroy/Desktop/RpiBareMetal/CodeslibNE10.a(NE10_fft.c.obj): In function `ne10_fft_generate_twiddles_line_transposed_float32\':
NE10_fft.c:(.text+0x128): undefined reference to `cos\'
NE10_fft.c:(.text+0x138): undefined reference to `sin\'
C:/Users/Sheroy/Desktop/RpiBareMetal/CodeslibNE10.a(NE10_fft.c.obj): In function `ne10_fft_generate_twiddles_line_int32\':
NE10_fft.c:(.text+0x1e0): undefined reference to `cos\'
NE10_fft.c:(.text+0x1f0): undefined reference to `floor\'
NE10_fft.c:(.text+0x200): undefined reference to `sin\'
NE10_fft.c:(.text+0x210): undefined reference to `floor\'
C:/Users/Sheroy/Desktop/RpiBareMetal/CodeslibNE10.a(NE10_fft.c.obj): In function `ne10_factor.part.0\':
NE10_fft.c:(.text+0x2a0): undefined reference to `__aeabi_idiv\'
NE10_fft.c:(.text+0x31e): undefined reference to `__aeabi_idiv\'
C:/Users/Sheroy/Desktop/RpiBareMetal/CodeslibNE10.a(NE10_fft.c.obj): In function `ne10_fft_generate_twiddles_int32\':
NE10_fft.c:(.text+0x3a4): undefined reference to `__aeabi_idiv\'
C:/Users/Sheroy/Desktop/RpiBareMetal/CodeslibNE10.a(NE10_fft.c.obj): In function `ne10_fft_generate_twiddles_impl_float32\':
NE10_fft.c:(.text+0x454): undefined reference to `__aeabi_idiv\'
C:/Users/Sheroy/Desktop/RpiBareMetal/CodeslibNE10.a(NE10_fft.c.obj): In function `ne10_fft_alloc_c2c_float32_neon\':
NE10_fft.c:(.text+0x4b8): undefined reference to `malloc\'
NE10_fft.c:(.text+0x542): undefined reference to `memmove\'
NE10_fft.c:(.text+0x572): undefined reference to `free\'
C:/Users/Sheroy/Desktop/RpiBareMetal/CodeslibNE10.a(NE10_fft.c.obj): In function `ne10_fft_alloc_c2c_int32_neon\':
NE10_fft.c:(.text+0x5bc): undefined reference to `malloc\'
NE10_fft.c:(.text+0x63a): undefined reference to `memmove\'
NE10_fft.c:(.text+0x660): undefined reference to `free\'
C:/Users/Sheroy/Desktop/RpiBareMetal/CodeslibNE10.a(NE10_fft.c.obj): In function `ne10_fft_destroy_c2c_float32\':
NE10_fft.c:(.text+0x6b0): undefined reference to `free\'
C:/Users/Sheroy/Desktop/RpiBareMetal/CodeslibNE10.a(NE10_fft.c.obj): In function `ne10_fft_destroy_c2c_int32\':
NE10_fft.c:(.text+0x6b4): undefined reference to `free\'
and a lot more undefined references...
The makefile is below:
ARMGNU ?= arm-none-eabi-
-IC:UsersSheroyDesktopRpiBareMetalCodesNe10-masterNe10-masterincINCPATH =  -Iinclude  \\
   -IC:/Users/Sheroy/Desktop/RpiBareMetal/Codes/Ne10-master/Ne10-master/inc
-LC:UsersSheroyDesktopRpiBareMetalCodes\\SHLIB =  -L. -LC:/Users/Sheroy/Desktop/RpiBareMetal/Codes -lNE10
libs =    -lm  -lc -lgcc -lnosys
Link for code sizeGC=-Wl,--gc-sections  
CPUOPS =   -O2 -mfloat-abi=hard -mthumb -mcpu=cortex-a53 -mfpu=neon-vfpv4
--specs=nano.specs --specs=nosys.specs -nostdlibCOPS =  --specs=nano.specs --specs=nosys.specs $(libs) \\
   $(CPUOPS) -Wall  -nostartfiles -ffreestanding  $(INCPATH) $(GC)
ASMOPS = $(INCPATH)  $(CPUOPS) $(libs)
-u floor -u sin -u cos -u fabs -u malloc -u memcpy -u free -u __aeabi_idiv -u sqrtLDOPS = -static $(OBJ_FILES)   $(SHLIB)
BUILD_DIR = build
SRC_DIR = src
all :kernel7.img
clean:
del  $(BUILD_DIR)*.o
del  $(BUILD_DIR)*.d
del  $(BUILD_DIR)*.elf$(BUILD_DIR)/%_c.o: $(SRC_DIR)/%.c
mkdir -p $(@D)$(ARMGNU)gcc  $(COPS)  -MD -H -c $< -o $@
$(BUILD_DIR)/%_s.o: $(SRC_DIR)/%.S
$(ARMGNU)gcc $(ASMOPS)  -MD -c $< -o $@
C_FILES = $(wildcard src/*.c)
ASM_FILES = $(wildcard src/*.S)
OBJ_FILES = $(wildcard $(BUILD_DIR)/*.o)OBJ_FILES = $(C_FILES:$(SRC_DIR)/%.c=$(BUILD_DIR)/%_c.o)
OBJ_FILES += $(ASM_FILES:$(SRC_DIR)/%.S=$(BUILD_DIR)/%_s.o)
DEP_FILES = $(OBJ_FILES:%.o=%.d)
-include $(DEP_FILES)
include the previously built object filesOBJ_FILES += $(wildcard $(BUILD_DIR)/*.o)kernel7.img: $(SRC_DIR)/linker32.ld $(OBJ_FILES)
$(ARMGNU)ld $(SHLIB)   -Map output.map   -o $(BUILD_DIR)/kernel7.elf   $(OBJ_FILES) $(SHLIB)$(ARMGNU)ld   -T src/linker32.ld  -Map output.map -o $(BUILD_DIR)/kernel7.elf  $(LDOPS)
$(ARMGNU)objcopy $(BUILD_DIR)/kernel7.elf -O binary kernel7.img
$(ARMGNU)nm -n  $(BUILD_DIR)/kernel7.elf >  $(BUILD_DIR)/output.symbol
$(ARMGNU)objdump -D $(BUILD_DIR)/kernel7.elf > $(BUILD_DIR)/output.list
readelf.exe -x .rodata $(BUILD_DIR)/kernel7.elf > $(BUILD_DIR)/rodata.list

使用特权

评论回复

相关帖子

发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

432

主题

433

帖子

1

粉丝