|
Hi everybody!
I am developing a port of Contiki RTOS for Olimex SAM7-EX256 development board. I am using the previous definition for AT91SAM7Sxx mcu's but modifying the io registers. I have some doubts about this. When I compile with my Makefile: ----------------------------------------------------------------------- # Default to AT91SAM7S64 SUBTARGET =
### Code common for all ARM CPUs
CONTIKI_CPU_ARM=$(CONTIKI)/cpu/at91sam7x CONTIKI_CPU_ARM_COMMON=$(CONTIKI)/cpu/arm/common
### Defin the CPU directory CONTIKI_CPU=$(CONTIKI)/cpu/at91sam7x
### Define the source files we have in the AT91SAM7S port
CONTIKI_CPU_DIRS = . ../common/dbg-io ../common/usb loader
AT91SAM7 = clock.c debug-uart.c interrupt-utils.c sys-interrupt.c rtimer-arch.c rtimer-arch-interrupt.c #uip-log.c spi.c cc2420_spi.c newlib-syscalls.c
APPDIRS += $(CONTIKI)/cpu/at91sam7x
ELFLOADER = elfloader-otf.c elfloader-arm.c #symtab.c cfs-ram.c
#include $(CONTIKI_CPU_ARM_COMMON)/usb/Makefile.usb
#USB += usb-interrupt.c
#include $(CONTIKI_CPU_ARM_COMMON)/SD-card/Makefile.sdcard
#TARGETLIBS = random.c dbg-printf.c dbg-puts.c dbg-putchar.c dbg-sprintf.c dbg-snprintf.c strformat.c
CONTIKI_TARGET_SOURCEFILES += $(AT91SAM7) $(ELFLOADER) #$(TARGETLIBS) \ #$(UIPDRIVERS) $(USB) $(SYSAPPS)
CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES)
THREADS =
### Compiler definitions CC = arm-none-eabi-gcc LD = arm-none-eabi-ld AS = arm-none-eabi-as AR = arm-none-eabi-ar NM = arm-none-eabi-nm OBJCOPY = arm-none-eabi-objcopy STRIP = arm-none-eabi-strip
XSLTPROC=xsltproc
PROJECT_OBJECTFILES += ${addprefix $(OBJECTDIR)/,$(CONTIKI_TARGET_MAIN:.c=.o)}
LINKERSCRIPT = $(CONTIKI_CPU)/atmel-rom.ld
STARTUP=${addprefix $(OBJECTDIR)/,Cstartup_SAM7.o}
# JTAG program upload OPENOCD = openocd OPENOCD_DIR = $(CONTIKI_CPU)/openocd/ OPENOCD_CFG = arm7_wig.cfg
OPENOCD_FLASH_CFG = arm7_wig_flash.cfg
# USB program upload SAMIAM=Sam_I_Am SAMIAM_TTY=/dev/ttyACM0
ARCH_FLAGS= -mcpu=arm7tdmi -mthumb-interwork THUMB_FLAGS=-mthumb ARM_FLAGS=
CFLAGSNO = -I. -I$(CONTIKI)/core -I$(CONTIKI_CPU) \ -I$(CONTIKI_CPU)/dbg-io \ -I$(CONTIKI)/platform/$(TARGET) \ ${addprefix -I,$(APPDIRS)} \ -DWITH_UIP -DWITH_ASCII -DMCK=$(MCK) \ -Wall $(ARCH_FLAGS) -g -D SUBTARGET=$(SUBTARGET)
CFLAGS += $(CFLAGSNO) -O -DRUN_AS_SYSTEM -DROM_RUN LDFLAGS += -L $(CONTIKI_CPU) -T $(LINKERSCRIPT) -nostartfiles
CDEPFLAGS = $(CFLAGS) -D __MAKING_DEPS__
### Setup directory search path for source files
CUSTOM_RULE_C_TO_OBJECTDIR_O=yes CUSTOM_RULE_C_TO_O=yes
%-interrupt.o: %-interrupt.c $(CC) $(CFLAGS) $(ARM_FLAGS) $< -c
$(OBJECTDIR)/%-interrupt.o: %-interrupt.c $(CC) $(CFLAGS) $(ARM_FLAGS) -c $< -o $@
%-arm.o: %-arm.c $(CC) $(CFLAGS) $(ARM_FLAGS) $< -c
$(OBJECTDIR)/%-arm.o: %-arm.c $(CC) $(CFLAGS) $(ARM_FLAGS) -c $< -o $@
$(OBJECTDIR)/interrupt-utils.o: interrupt-utils.c $(CC) $(CFLAGS) $(ARM_FLAGS) $< -c -o $@
%.o: %.c $(CC) $(CFLAGS) $(THUMB_FLAGS) $< -c
$(OBJECTDIR)/%.o: %.c $(CC) $(CFLAGS) $(THUMB_FLAGS) -c $< -o $@
CUSTOM_RULE_S_TO_OBJECTDIR_O = yes %.o: %.S $(CC) $(CFLAGS) $(ARM_FLAGS) $< -c
$(OBJECTDIR)/%.o: %.S $(CC) $(CFLAGS) $(ARM_FLAGS) $< -c -o $@
CUSTOM_RULE_C_TO_CO=yes
%.co: %.c $(CC) $(CFLAGS) $(THUMB_FLAGS) $< -c -o $@
CUSTOM_RULE_C_TO_CE=yes
%.ce: %.o $(LD) $(LDFLAGS) --relocatable -T $(CONTIKI_CPU)/merge-rodata.ld $< -o $@ $(STRIP) -K _init -K _fini --strip-unneeded -g -x $@
CUSTOM_RULE_LINK=yes
%-stripped.o: %.c $(CC) $(CFLAGS) -c $< -o $@ $(STRIP) --strip-unneeded -g -x $@
%-stripped.o: %.o $(STRIP) --strip-unneeded -g -x -o $@ $<
%.o: ${CONTIKI_TARGET}/%.S $(AS) -o $(notdir $(<:.S=.o)) $<
%-nosyms.$(TARGET): %.co $(PROJECT_OBJECTFILES) contiki-$(TARGET).a $(STARTUP) $(OBJECTDIR)/empty-symbols.o $(CC) $(LDFLAGS) $(CFLAGS) -nostartfiles -o $@ $(filter-out %.a,$^) $(filter %.a,$^) -lc $(filter %.a,$^)
%.ihex: %.$(TARGET) $(OBJCOPY) $^ -O ihex $@
%.bin: %.$(TARGET) $(OBJCOPY) -O binary $< $@ .PHONY: symbols.c ifdef CORE %.$(TARGET): %.co $(PROJECT_OBJECTFILES) contiki-$(TARGET).a $(STARTUP) $(OBJECTDIR)/symbols.o $(CC) $(LDFLAGS) $(CFLAGS) -nostartfiles -o $@ $(filter-out %.a,$^) $(filter %.a,$^) -lc $(filter %.a,$^)
symbols.c: $(CORE) $(NM) $< | awk -f $(CONTIKI_CPU)/builtins.awk -f ../../tools/mknmlist > symbols.c
else %.$(TARGET): %-nosyms.$(TARGET) ln -sf $< $@ endif
empty-symbols.c: @${CONTIKI}/tools/make-empty-symbols
upload_ocd_%: %.bin # Clear lock bits $(OPENOCD) -s $(OPENOCD_DIR) -f $(OPENOCD_CFG) -c init -c "halt;mww 0xffffff64 0x5a000004;sleep 250;mww 0xffffff64 0x5a002004; sleep 250;flash probe 0;flash write_bank 0 $< 0x0;reset run;sleep 500;exit"
upload_%: %.ihex # Clear lock bits $(SAMIAM) "open $(SAMIAM_TTY) , writew 0xffffff64 5a000004" $(SAMIAM) "open $(SAMIAM_TTY) , writew 0xffffff64 5a002004" $(SAMIAM) "open $(SAMIAM_TTY) , flash $< , go"
ocd_reset: cd $(CONTIKI_CPU)/openocd;$(OPENOCD) -f $(OPENOCD_CFG) -c init -c reset -c exit
# Don't use core/loader/elfloader.c, use elfloader-otf.c instead $(OBJECTDIR)/elfloader.o: echo -n >$@
clean: clean_cpu
.PHONY: clean_cpu
clean_cpu: -rm -rf $(BUILTSRCDIR)
.PRECIOUS: %-nosyms.$(TARGET) -----------------------------------------------------------------------
I obtain this output on my console: ----------------------------------------------------------------------- bj_sam7ex256/Cstartup_SAM7.o obj_sam7ex256/empty-symbols.o contiki-sam7ex256.a -lc contiki-sam7ex256.a /home/xxxx/CodeSourcery/Sourcery_G++_Lite/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/lib/libc.a(lib_a-sbrkr.o): In function `_sbrk_r': sbrkr.c:(.text+0x18): undefined reference to `_sbrk' /home/xxxx/CodeSourcery/Sourcery_G++_Lite/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/lib/libc.a(lib_a-writer.o): In function `_write_r': writer.c:(.text+0x20): undefined reference to `_write' /home/xxxx/CodeSourcery/Sourcery_G++_Lite/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/lib/libc.a(lib_a-closer.o): In function `_close_r': closer.c:(.text+0x18): undefined reference to `_close' /home/xxxx/CodeSourcery/Sourcery_G++_Lite/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/lib/libc.a(lib_a-fstatr.o): In function `_fstat_r': fstatr.c:(.text+0x1c): undefined reference to `_fstat' /home/xxxx/CodeSourcery/Sourcery_G++_Lite/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/lib/libc.a(lib_a-isattyr.o): In function `_isatty_r': isattyr.c:(.text+0x18): undefined reference to `_isatty' /home/xxxx/CodeSourcery/Sourcery_G++_Lite/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/lib/libc.a(lib_a-lseekr.o): In function `_lseek_r': lseekr.c:(.text+0x20): undefined reference to `_lseek' /home/xxxx/CodeSourcery/Sourcery_G++_Lite/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/lib/libc.a(lib_a-readr.o): In function `_read_r': readr.c:(.text+0x20): undefined reference to `_read' collect2: ld returned 1 exit status make: *** [hello-world-nosyms.sam7ex256] Error 1 rm hello-world.co obj_sam7ex256/Cstartup_SAM7.o obj_sam7ex256/empty-symbols.o -----------------------------------------------------------------------
I have compiled with another toolchain and i have the same error. Do you know what is the possible cause?
Thanks and if you want colaborate with this port I will be very thankful!
|