Hi I am trying to compile EFSL library from Winarm Projects page with AT91SAM7X256 (Olimex SAM7-EX256). My make file is as follows: # Hey Emacs, this is a -*- makefile -*- # # WinARM template makefile # by Martin Thomas, Kaiserslautern, Germany # <eversmith@heizung-thomas.de> # # based on the WinAVR makefile written by Eric B. Weddington, Jörg Wunsch, et al. # Released to the Public Domain # Please read the make user manual! # # # On command line: # # make all = Make software. # # make clean = Clean out built project files. # # make program = Download the hex file to the device # # (TODO: make filename.s = Just compile filename.c into the assembler code only) # # To rebuild project do "make clean" then "make all". # # - Thomas Schelagowski ## EFSL # 0 - standalone: compiler with efsl sources # 1 - use libefsl.a EFSL_AS_LIB = 1 SHELL = cmd #FLASH_TOOL = UVISION FLASH_TOOL = OPENOCD # MCU name and submodel MCU = arm7tdmi SUBMDL = AT91SAM7X256 #USE_THUMB_MODE = YES #USE_THUMB_MODE = NO ## Create ROM-Image (final) RUN_MODE=ROM_RUN ## Create RAM-Image (debugging) ##( not used: example does not fit in AT91SAM7S64 RAM ) #RUN_MODE=RAM_RUN ## Exception-Vector placement only supported for "ROM_RUN" ## (placement settings ignored when using "RAM_RUN") ## - Exception vectors in ROM: #VECTOR_LOCATION=VECTORS_IN_ROM ## - Exception vectors in RAM: VECTOR_LOCATION=VECTORS_IN_RAM # Target file name (without extension). TARGET = main # List C source files here. (C dependencies are automatically generated.) # use file-extension c for "c-only"-files SRC = $(TARGET).c SRC += dbgu.c SRC += syscalls.c #SRC += swi_handler_user.c SRC += systime.c SRC += ./common/lowlevelinit.c ## EFSL ifeq ($(EFSL_AS_LIB),0) SRC += ./src/efs.c ./src/plibc.c ./src/disc.c ./src/partition.c SRC += ./src/time.c ./src/fs.c ./src/fat.c ./src/file.c ./src/dir.c ./src/ls.c SRC += ./src/mkfs.c ./src/debug.c ./src/ioman.c ./src/ui.c ./src/extract.c SRC += ./src/interfaces/sd.c SRC += ./src/interfaces/efsl_dbg_printf_arm.c SRC += ./src/interfaces/at91_spi.c endif # List C source files here which must be compiled in ARM-Mode. # use file-extension c for "c-only"-files #SRCARM = ./common/Cstartup_SAM7.c #SRCARM = ./common/lowlevelinit.c # List Assembler source files here. # Make them always end in a capital .S. Files ending in a lowercase .s # will not be considered source files but generated files (assembler # output from the compiler), and will be deleted upon "make clean"! # Even though the DOS/Win* filesystem matches both .s and .S the same, # it will preserve the spelling of the filenames, and gcc itself does # care about how the name is spelled on its command-line. ASRC = # List Assembler source files here which must be assembled in ARM-Mode. ASRCARM = ./common/Cstartup.S #ASRCARM += ./common/swi_handler.S ## Output format. (can be ihex or binary) ## (binary i.e. for openocd and SAM-BA, hex i.e. for lpc21isp and uVision) #FORMAT = ihex FORMAT = binary # Optimization level, can be [0, 1, 2, 3, s]. # 0 = turn off optimization. s = optimize for size. # (Note: 3 is not always the best optimization level. See avr-libc FAQ.) #OPT = s OPT = 0 # Debugging format. # Native formats for AVR-GCC's -g are stabs [default], or dwarf-2. # AVR (extended) COFF requires stabs, plus an avr-objcopy run. #DEBUG = stabs DEBUG = dwarf-2 # List any extra directories to look for include files here. # Each directory must be seperated by a space. EXTRAINCDIRS = ./common ## EFSL EXTRAINCDIRS += ./inc ./conf # List any extra directories to look for library files here. # Each directory must be seperated by a space. #EXTRA_LIBDIRS = ../arm7_efsl_0_2_4 #EXTRA_LIBDIRS = ./common EXTRA_LIBDIRS = ## Using the Atmel AT91_lib produces warning with ## the default warning-levels. ## yes - disable these warnings; no - keep default settings AT91LIBNOWARN = yes #AT91LIBNOWARN = no # Compiler flag to set the C Standard level. # c89 - "ANSI" C # gnu89 - c89 plus GCC extensions # c99 - ISO C99 standard (not yet fully implemented) # gnu99 - c99 plus GCC extensions CSTANDARD = -std=gnu99 # Place -D or -U options for C here CDEFS = -D$(RUN_MODE) # Place -I options here CINCS = # Place -D or -U options for ASM here ADEFS = -D$(RUN_MODE) ifdef VECTOR_LOCATION CDEFS += -D$(VECTOR_LOCATION) ADEFS += -D$(VECTOR_LOCATION) endif #CDEFS += -D__WinARM__ -D__WINARMSUBMDL_$(SUBMDL)__ #ADEFS += -D__WinARM__ -D__WINARMSUBMDL_$(SUBMDL)__ CDEFS += -D__WinARM__ ADEFS += -D__WinARM__ # Compiler flags. ifeq ($(USE_THUMB_MODE),YES) THUMB = -mthumb THUMB_IW = -mthumb-interwork else THUMB = THUMB_IW = endif # -g*: generate debugging information # -O*: optimization level # -f...: tuning, see GCC manual and avr-libc documentation # -Wall...: warning level # -Wa,...: tell GCC to pass this to the assembler. # -adhlns...: create assembler listing # # Flags for C and C++ (arm-elf-gcc/arm-elf-g++) CFLAGS = -g$(DEBUG) CFLAGS += $(CDEFS) $(CINCS) CFLAGS += -O$(OPT) CFLAGS += -ffunction-sections -fdata-sections CFLAGS += -Wall -Wcast-align -Wimplicit CFLAGS += -Wpointer-arith -Wswitch CFLAGS += -Wredundant-decls -Wreturn-type -Wshadow -Wunused CFLAGS += -Wa,-adhlns=$(subst $(suffix $<),.lst,$<) CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) # flags only for C CONLYFLAGS += -Wnested-externs CONLYFLAGS += $(CSTANDARD) ifneq ($(AT91LIBNOWARN),yes) #AT91-lib warnings with: CFLAGS += -Wcast-qual CONLYFLAGS += -Wmissing-prototypes CONLYFLAGS += -Wstrict-prototypes CONLYFLAGS += -Wmissing-declarations endif # Assembler flags. # -Wa,...: tell GCC to pass this to the assembler. # -ahlns: create listing # -g$(DEBUG): have the assembler create line number information ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:.S=.lst),--g$(DEBUG) #Additional libraries. # Extra libraries # Each library-name must be seperated by a space. # To add libxyz.a, libabc.a and libefsl.a: # EXTRA_LIBS = xyz abc efsl #EXTRA_LIBS = efsl EXTRA_LIBS = #Support for newlibc-lpc (file: libnewlibc-lpc.a) #NEWLIBLPC = -lnewlib-lpc MATH_LIB = -lm # CPLUSPLUS_LIB = -lstdc++ ## EFSL ifeq ($(EFSL_AS_LIB),1) EXTRA_LIBDIRS += ./ # extra libraries ( to add libxyz.a and libabc.a: -lxyz -labc ) EXTRA_LIBS += efsl endif # Linker flags. # -Wl,...: tell GCC to pass this to linker. # -Map: create map file # --cref: add cross reference to map file LDFLAGS = -nostartfiles -Wl,-Map=$(TARGET).map,--cref,--gc-sections LDFLAGS += -lc LDFLAGS += $(NEWLIBLPC) $(MATH_LIB) LDFLAGS += -lc -lgcc LDFLAGS += $(patsubst %,-L%,$(EXTRA_LIBDIRS)) LDFLAGS += $(patsubst %,-l%,$(EXTRA_LIBS)) # Set Linker-Script Depending On Selected Memory and Controller ifeq ($(RUN_MODE),RAM_RUN) LDFLAGS +=-T./common/$(SUBMDL)-RAM.ld else LDFLAGS +=-T./common/$(SUBMDL)-ROM.ld endif ## ------------------------------------------------------------------------ --- ## Flash-Programming support using lpc21isp by Martin Maurer ## only for Philips LPC and Analog ADuC ARMs ## ## Settings and variables: ##LPC21ISP = lpc21isp #LPC21ISP = lpc21isp #LPC21ISP_PORT = com1 #LPC21ISP_BAUD = 38400 #LPC21ISP_XTAL = 12000 #LPC21ISP_FLASHFILE = $(TARGET).hex ## verbose output: ##LPC21ISP_DEBUG = -debug ## enter bootloader via RS232 DTR/RTS (only if hardware supports this ## feature - see Philips AppNote): #LPC21ISP_CONTROL = -control ## ------------------------------------------------------------------------ --- # Define directories, if needed. ## DIRARM = c:/WinARM/ ## DIRARMBIN = $(DIRAVR)/bin/ ## DIRAVRUTILS = $(DIRAVR)/utils/bin/ # Define programs and commands. CC = arm-elf-gcc #CPP = arm-elf-g++ OBJCOPY = arm-elf-objcopy OBJDUMP = arm-elf-objdump SIZE = arm-elf-size NM = arm-elf-nm REMOVE = rm -f COPY = cp # Define Messages # English MSG_ERRORS_NONE = Errors: none MSG_BEGIN = "-------- begin (mode: $(RUN_MODE)) --------" MSG_END = -------- end -------- MSG_SIZE_BEFORE = Size before: MSG_SIZE_AFTER = Size after: MSG_FLASH = Creating load file for Flash: MSG_EXTENDED_LISTING = Creating Extended Listing: MSG_SYMBOL_TABLE = Creating Symbol Table: MSG_LINKING = Linking: MSG_COMPILING = Compiling C: MSG_COMPILING_ARM = "Compiling C (ARM-only):" MSG_COMPILINGCPP = Compiling C++: MSG_COMPILINGCPP_ARM = "Compiling C++ (ARM-only):" MSG_ASSEMBLING = Assembling: MSG_ASSEMBLING_ARM = "Assembling (ARM-only):" MSG_CLEANING = Cleaning project: MSG_FORMATERROR = Can not handle output-format MSG_LPC21_RESETREMINDER = You may have to bring the target in bootloader-mode now. # Define all object files. COBJ = $(SRC:.c=.o) AOBJ = $(ASRC:.S=.o) COBJARM = $(SRCARM:.c=.o) AOBJARM = $(ASRCARM:.S=.o) # Define all listing files. LST = $(ASRC:.S=.lst) $(ASRCARM:.S=.lst) $(SRC:.c=.lst) $(SRCARM:.c=.lst) #LST += $(CPPSRC:.cpp=.lst) $(CPPSRCARM:.cpp=.lst) # Compiler flags to generate dependency files. ### GENDEPFLAGS = -Wp,-M,-MP,-MT,$(*F).o,-MF,.dep/$(@F).d GENDEPFLAGS = -MD -MP -MF ./dep/$(@F).d # Combine all necessary flags and optional flags. # Add target processor to flags. ALL_CFLAGS = -mcpu=$(MCU) $(THUMB_IW) -I. $(CFLAGS) $(GENDEPFLAGS) ALL_ASFLAGS = -mcpu=$(MCU) $(THUMB_IW) -I. -x assembler-with-cpp $(ASFLAGS) # Default target. all: begin gccversion sizebefore build sizeafter finished end ifeq ($(FORMAT),ihex) build: elf hex lss sym hex: $(TARGET).hex IMGEXT=hex else ifeq ($(FORMAT),binary) build: elf bin lss sym bin: $(TARGET).bin IMGEXT=bin else $(error "$(MSG_FORMATERROR) $(FORMAT)") endif endif elf: $(TARGET).elf lss: $(TARGET).lss sym: $(TARGET).sym # Eye candy. begin: @echo @echo $(MSG_BEGIN) finished: @echo $(MSG_ERRORS_NONE) end: @echo $(MSG_END) @echo # Display size of file. HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex ELFSIZE = $(SIZE) -A $(TARGET).elf sizebefore: # @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi sizeafter: # @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi # Display compiler version information. gccversion : @$(CC) --version ifeq ($(FLASH_TOOL),OPENOCD) # Program the device with Dominic Rath's OPENOCD in "batch-mode", needs cfg and "reset-script". program: $(TARGET).$(IMGEXT) @echo @echo "Programming with OPENOCD" # 'C:\Program Files\openocd-2006re115\bin\'openocd-ftd2xx.exe -f 'C:\Program Files\openocd-2006re115\bin\'at91sam7x256-armusbocd-flash-program.cfg 'C:\Program Files\openocd-2006re115\bin\'openocd-ftd2xx.exe -f 'C:\Program Files\openocd-2006re115\bin\'at91sam7x256-armusbocd-debugger-program.cfg endif # Create final output file (.hex) from ELF output file. %.hex: %.elf @echo @echo $(MSG_FLASH) $@ $(OBJCOPY) -O $(FORMAT) $< $@ # Create final output file (.bin) from ELF output file. %.bin: %.elf @echo @echo $(MSG_FLASH) $@ $(OBJCOPY) -O $(FORMAT) $< $@ # Create extended listing file from ELF output file. # testing: option -C %.lss: %.elf @echo @echo $(MSG_EXTENDED_LISTING) $@ $(OBJDUMP) -h -S -C $< > $@ # Create a symbol table from ELF output file. %.sym: %.elf @echo @echo $(MSG_SYMBOL_TABLE) $@ $(NM) -n $< > $@ # Link: create ELF output file from object files. .SECONDARY : $(TARGET).elf .PRECIOUS : $(AOBJARM) $(AOBJ) $(COBJARM) $(COBJ) $(CPPOBJ) $(CPPOBJARM) %.elf: $(AOBJARM) $(AOBJ) $(COBJARM) $(COBJ) $(CPPOBJ) $(CPPOBJARM) @echo @echo $(MSG_LINKING) $@ $(CC) $(THUMB) $(ALL_CFLAGS) $(AOBJARM) $(AOBJ) $(COBJARM) $(COBJ) $(CPPOBJ) $(CPPOBJARM) --output $@ $(LDFLAGS) # $(CPP) $(THUMB) $(ALL_CFLAGS) $(AOBJARM) $(AOBJ) $(COBJARM) $(COBJ) $(CPPOBJ) $(CPPOBJARM) --output $@ $(LDFLAGS) # Compile: create object files from C source files. ARM/Thumb $(COBJ) : %.o : %.c @echo @echo $(MSG_COMPILING) $< $(CC) -c $(THUMB) $(ALL_CFLAGS) $(CONLYFLAGS) $< -o $@ # Compile: create object files from C source files. ARM-only $(COBJARM) : %.o : %.c @echo @echo $(MSG_COMPILING_ARM) $< $(CC) -c $(ALL_CFLAGS) $(CONLYFLAGS) $< -o $@ ## Compile: create object files from C++ source files. ARM/Thumb #$(CPPOBJ) : %.o : %.cpp # @echo # @echo $(MSG_COMPILINGCPP) $< # $(CPP) -c $(THUMB) $(ALL_CFLAGS) $(CPPFLAGS) $< -o $@ # ## Compile: create object files from C++ source files. ARM-only #$(CPPOBJARM) : %.o : %.cpp # @echo # @echo $(MSG_COMPILINGCPP_ARM) $< # $(CPP) -c $(ALL_CFLAGS) $(CPPFLAGS) $< -o $@ # Compile: create assembler files from C source files. ARM/Thumb ## does not work - TODO - hints welcome ##$(COBJ) : %.s : %.c ## $(CC) $(THUMB) -S $(ALL_CFLAGS) $< -o $@ # Assemble: create object files from assembler source files. ARM/Thumb $(AOBJ) : %.o : %.S @echo @echo $(MSG_ASSEMBLING) $< $(CC) -c $(THUMB) $(ALL_ASFLAGS) $< -o $@ # Assemble: create object files from assembler source files. ARM-only $(AOBJARM) : %.o : %.S @echo @echo $(MSG_ASSEMBLING_ARM) $< $(CC) -c $(ALL_ASFLAGS) $< -o $@ # Target: clean project. clean: begin clean_list finished end clean_list : @echo @echo $(MSG_CLEANING) $(REMOVE) $(TARGET).hex $(REMOVE) $(TARGET).bin $(REMOVE) $(TARGET).obj $(REMOVE) $(TARGET).elf $(REMOVE) $(TARGET).map $(REMOVE) $(TARGET).obj $(REMOVE) $(TARGET).a90 $(REMOVE) $(TARGET).sym $(REMOVE) $(TARGET).lnk $(REMOVE) $(TARGET).lss $(REMOVE) $(COBJ) $(REMOVE) $(CPPOBJ) $(REMOVE) $(AOBJ) $(REMOVE) $(COBJARM) $(REMOVE) $(CPPOBJARM) $(REMOVE) $(AOBJARM) $(REMOVE) $(LST) $(REMOVE) $(SRC:.c=.s) $(REMOVE) $(SRC:.c=.d) $(REMOVE) $(SRCARM:.c=.s) $(REMOVE) $(SRCARM:.c=.d) $(REMOVE) $(CPPSRC:.cpp=.s) $(REMOVE) $(CPPSRC:.cpp=.d) $(REMOVE) $(CPPSRCARM:.cpp=.s) $(REMOVE) $(CPPSRCARM:.cpp=.d) $(REMOVE) .dep/* # Include the dependency files. -include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) # Listing of phony targets. .PHONY : all begin finish end sizebefore sizeafter gccversion \ build elf hex bin lss sym clean clean_list program When i buid my code it gives the following errors: ld: c:/program files/yagarto/bin/../lib/gcc/arm-elf/4.1.1/../../../../arm-elf/lib\libc. a(memcpy.o)(memcpy): warning: interworking not enabled. EFSL_090507 line 0 1179130695742 2398 ld: C:/Program Files/yagarto/lib/gcc/arm-elf/4.1.1\libgcc.a(_divsi3.o)(__divsi3): warning: interworking not enabled. EFSL_090507 line 0 1179130695742 2384 ld: Warning: C:/Program Files/yagarto/lib/gcc/arm-elf/4.1.1\libgcc.a(_divsi3.o) does not support interworking, whereas main.elf does EFSL_090507 line 0 1179130695742 2382 Anyone of you have any idea how to fix this error? Regards Flying
Rajitha Dandu wrote: > Hi > > I am trying to compile EFSL library from Winarm Projects page with > AT91SAM7X256 (Olimex SAM7-EX256). > > My make file is as follows: > [...] There are various modifications in your makefile comparted to the one that I provide with the example. So I can not comment too much on this. Try to create a diff-file or use the Windows "FC". I have also not tested the code with the GNU arm-elf toolchain in Yagarto but it should work with it too. Just some remarks: - Why are both commented out? #USE_THUMB_MODE = YES #USE_THUMB_MODE = NO Sine it seems that you want "ARM-only" set USE_THUMB_MODE=NO - Is the library build with thumb and thumb-interwork enabled as demonstrated in the makefiles which come with the 0.2.9 RCx package? This will not work if you disable thumb-interwork in your application which uses the lib. This happens if you set USE_THUMB_MODE=NO since I "bundle" -mthumb and -mthumb-interwork. The option to compile some parts in ARM-only mode is still available thru the SRCARM list. If you don't enable thumb-interwork for the application you should also build the libefsl.a without -mthumb -mthumb-interwork. Martin Thomas
Martin Thomas wrote: > Rajitha Dandu wrote: >> Hi >> >> I am trying to compile EFSL library from Winarm Projects page with >> AT91SAM7X256 (Olimex SAM7-EX256). >> >> My make file is as follows: >> [...] > > There are various modifications in your makefile comparted to the one > that I provide with the example. So I can not comment too much on this. > Try to create a diff-file or use the Windows "FC". I have also not > tested the code with the GNU arm-elf toolchain in Yagarto but it should > work with it too. Just some remarks: > > - Why are both commented out? > #USE_THUMB_MODE = YES > #USE_THUMB_MODE = NO > Sine it seems that you want "ARM-only" set USE_THUMB_MODE=NO When to use Thumb Mode and when to use ARM mode where can i find information on this? > - Is the library build with thumb and thumb-interwork enabled as > demonstrated in the makefiles which come with the 0.2.9 RCx package? I downloaded the source files from the page: http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects/efsl_arm/index.html But here the version mentioned was efsl Ver. 0.2.8 Where can i find 0.2.9 version. > This will not work if you disable thumb-interwork in your application > which uses the lib. This happens if you set USE_THUMB_MODE=NO since I > "bundle" -mthumb and -mthumb-interwork. The option to compile some parts > in ARM-only mode is still available thru the SRCARM list. If you don't > enable thumb-interwork for the application you should also build the > libefsl.a without -mthumb -mthumb-interwork. I enabled Thum mode I mean in make file I changed to USE_THUMB_MODE = YES No when i buid project it doesn't give any error. But when i say clean project it gives me following warnings: warning: #warning "inofficial CSD-read patch active sd_Resp8b->if_spiSend" EFSL_090507/src/interfaces sd.c line 321 1179138037896 3527 In all .c files where there is a warning declaration like this. Also warning: implicit declaration of function 'AT91F_US_GetChar' EFSL_090507 syscalls.c line 35 1179138037896 3509 Regards Flying
Rajitha Dandu wrote: > Martin Thomas wrote: > When to use Thumb Mode and when to use ARM mode where can i find > information on this? Visit arm.com and read some of the available documents. > >> - Is the library build with thumb and thumb-interwork enabled as >> demonstrated in the makefiles which come with the 0.2.9 RCx package? > > I downloaded the source files from the page: > http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects/efsl_arm/index.html > > But here the version mentioned was efsl Ver. 0.2.8 > > Where can i find 0.2.9 version. On the same page a few lines down. >> This will not work if you disable thumb-interwork in your application >> which uses the lib. This happens if you set USE_THUMB_MODE=NO since I >> "bundle" -mthumb and -mthumb-interwork. The option to compile some parts >> in ARM-only mode is still available thru the SRCARM list. If you don't >> enable thumb-interwork for the application you should also build the >> libefsl.a without -mthumb -mthumb-interwork. > > > I enabled Thum mode I mean in make file I changed to > > USE_THUMB_MODE = YES > > No when i buid project it doesn't give any error. > > But when i say clean project it gives me following warnings: > > warning: #warning "inofficial CSD-read patch active > sd_Resp8b->if_spiSend" EFSL_090507/src/interfaces sd.c line 321 > 1179138037896 3527 Just an information. > In all .c files where there is a warning declaration like this. > > Also > > warning: implicit declaration of function 'AT91F_US_GetChar' > EFSL_090507 syscalls.c line 35 1179138037896 3509 This function is used to pass characters sent from stdio-functions thru the syscalls-interface to the DBGU. Martin
Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
Log in with Google account
No account? Register here.