From 160fa18adbee5d596373ad49fc8e6854089f6d92 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Fri, 13 Jan 2012 19:09:07 +0100 Subject: [PATCH] Fixed platforms.txt and corrected some paths for multiplatform IDE --- hardware/arduino/sam/boards.txt | 15 +---- hardware/arduino/sam/cores/sam/Arduino.h | 4 +- hardware/arduino/sam/libraries/Wire/Wire.cpp | 1 - hardware/arduino/sam/libraries/Wire/Wire.h | 4 +- hardware/arduino/sam/platform.txt | 65 +++++++------------ .../sam/system/libsam/build_gcc/Makefile | 7 ++ 6 files changed, 38 insertions(+), 58 deletions(-) diff --git a/hardware/arduino/sam/boards.txt b/hardware/arduino/sam/boards.txt index 3eab06a30..a35391dd8 100644 --- a/hardware/arduino/sam/boards.txt +++ b/hardware/arduino/sam/boards.txt @@ -30,22 +30,9 @@ arduino_due.name=Arduino Due arduino_due.uploader=bossac arduino_due.upload.maximum_size=49152 arduino_due.upload.speed=115200 -#arduino_due.bootloader.path=sam3u_boot -#arduino_due.bootloader.file=sam3u_boot.bin arduino_due.build.mcu=cortex-m3 arduino_due.build.f_cpu=96000000L arduino_due.build.core=sam -arduino_due.build.pins=arduino_due arduino_due.build.extra_flags=-D__SAM3U4E__ -arduino_due.build.extra_include_dirs=system/libsam|system/libsam/include|system/CMSIS/Include|system/libsam/cmsis/sam3u/source/templates|system/libsam/cmsis/sam3u/include -arduino_due.core.extra_source_dirs=sam -arduino_due.system.extra_source_dirs=libsam/source|libsam/cmsis/sam3u/source/templates|libsam/cmsis/sam3u/source/templates/gcc -arduino_due.variants.extra_source_dirs=arduino_due|common -#hardware/sam/system/libsam/source/ -#hardware/sam/system/libsam/cmsis/sam3u/source/ -#hardware/sam/variants/arduino_due -#hardware/sam/variants/common -#hardware/sam/cores/sam arduino_due.build.ldscript=linker_scripts/gcc/flash.ld - - +arduino_due.build.variant=arduino_due diff --git a/hardware/arduino/sam/cores/sam/Arduino.h b/hardware/arduino/sam/cores/sam/Arduino.h index e0b11199e..820116fa4 100644 --- a/hardware/arduino/sam/cores/sam/Arduino.h +++ b/hardware/arduino/sam/cores/sam/Arduino.h @@ -30,7 +30,9 @@ extern "C"{ #endif // __cplusplus -#include "libsam/chip.h" +// Includes Atmel CMSIS +#include + #include "wiring_constants.h" #define clockCyclesPerMicrosecond() ( SystemCoreClock / 1000000L ) diff --git a/hardware/arduino/sam/libraries/Wire/Wire.cpp b/hardware/arduino/sam/libraries/Wire/Wire.cpp index 67383ac3f..2c7b7ab0d 100644 --- a/hardware/arduino/sam/libraries/Wire/Wire.cpp +++ b/hardware/arduino/sam/libraries/Wire/Wire.cpp @@ -20,7 +20,6 @@ extern "C" { #include -#include "twi.h" } #include "Wire.h" diff --git a/hardware/arduino/sam/libraries/Wire/Wire.h b/hardware/arduino/sam/libraries/Wire/Wire.h index b5edc2425..1bbc1b741 100644 --- a/hardware/arduino/sam/libraries/Wire/Wire.h +++ b/hardware/arduino/sam/libraries/Wire/Wire.h @@ -21,8 +21,10 @@ #ifndef TwoWire_h #define TwoWire_h +// Include Atmel CMSIS driver +#include + #include "Stream.h" -#include "twi.h" #include "variant.h" #define BUFFER_LENGTH 32 diff --git a/hardware/arduino/sam/platform.txt b/hardware/arduino/sam/platform.txt index 9176938ad..6472e0e09 100644 --- a/hardware/arduino/sam/platform.txt +++ b/hardware/arduino/sam/platform.txt @@ -1,12 +1,14 @@ +# SAM3 compile variables +# --------------------- -name=Atmel SAM +name=Atmel SAM3 #compiler.path Official default is correct, only need to change this if you want to overide the initial default -compiler.path={0}/hardware/tools/CodeSourcery_arm/bin/ +compiler.path={0}/hardware/tools/g++_arm_none_eabi/bin/ compiler.c.cmd=arm-none-eabi-gcc compiler.c.flags=-c -g -Os -w -mthumb -mlong-calls -ffunction-sections -nostdlib --param max-inline-insns-single=500 -Dprintf=iprintf -compiler.c.elf.flags=-Os -Wl,--gc-sections compiler.c.elf.cmd=arm-none-eabi-gcc +compiler.c.elf.flags=-Os -Wl,--gc-sections compiler.S.flags=-c -g -assembler-with-cpp compiler.cpp.cmd=arm-none-eabi-g++ compiler.cpp.flags=-c -g -Os -w -mthumb -mlong-calls -ffunction-sections -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -Dprintf=iprintf @@ -17,56 +19,37 @@ compiler.objcopy.eep.flags=-O ihex -j .eeprom --set-section-flags=.eeprom=alloc, compiler.elf2hex.flags=-O binary compiler.elf2hex.cmd=arm-none-eabi-objcopy compiler.ldflags= -compiler.cpudef=-mcpu= compiler.size.cmd=arm-none-eabi-size compiler.upload.cmd= compiler.upload.flags= compiler.define=-DARDUINO= -library.path=./hardware/sam/cores/sam -library.core.path=./libraries;./hardware/sam/libraries +compiler.libsam.c.flags=-I{core_path}/../../system/libsam -I{core_path}/../../system/CMSIS/Include/ +#library.path=hardware/sam/cores/sam +#library.core.path=libraries;hardware/sam/libraries -#########Compiler Recipe################################# +# SAM3 compile patterns +# --------------------- -##compile c object files -##Default.recipe, overide if overide exists, these defauls should remain the same, if you need to change them do it as an overide. +## Compile c files +recipe.c.o.pattern={toolchain_path}{compiler.c.cmd} {compiler.c.flags} -mcpu={build.mcu} -DF_CPU={build.f_cpu} -D{software}={ide_version} {build.extra_flags} {compiler.libsam.c.flags} {includes} {source_file} -o {object_file} -#default.recipe.c.o.pattern={0}{1} {2} {3}{4} -DF_CPU={5} -D{6}={7} {8} {9} -o {10} -#default.recipe.cpp.o.pattern={0}{1} {2} {3}{4} -DF_CPU={5} -D{6}={7} {8} {9} -o {10} -#default.recipe.ar.pattern={0}{1} {2} {3}{4} {5} -#default.recipe.c.combine.pattern={0}{1} {2} {3}{4} -o {5}{6}.elf {7} {8} -L{9} -lm -#default.recipe.objcopy.eep.pattern={0}{1} {2} {3}.elf {4}.eep -#default.recipe.objcopy.hex.pattern={0}{1} {2} {3}.elf {4}.hex +## Compile c++ files +recipe.cpp.o.pattern={toolchain_path}{compiler.cpp.cmd} {compiler.cpp.flags} -mcpu={build.mcu} -DF_CPU={build.f_cpu} -D{software}={ide_version} {build.extra_flags} {compiler.libsam.c.flags} {includes} {source_file} -o {object_file} -########sam compile pattern ########## -#recipe.c.o.pattern={0=compiler.path}{1=compiler.c.cmd}{2=compiler.c.flags}{3=compiler.cpudef}{4=build.mcu}-DF_CPU={5=build.f_cpu}-D{7=ARDUINO}={6=Base.REVISION}{7=-I/INCLUDE_PATHS} {8=SOURCE_NAME} -o{9=OBJECT_NAME} -#object name seems to have build path in it. -recipe.c.o.pattern={0}{1} {2} {3}{4} -DF_CPU={5} -D{6}={7} {11} {8} {9} -o {10} +## Create archives +recipe.ar.pattern={toolchain_path}{compiler.ar.cmd} {compiler.ar.flags} {build_path}{archive_file} {object_file} +## Combine gc-sections, archives, and objects +recipe.c.combine.pattern={toolchain_path}{compiler.c.elf.cmd} {compiler.c.elf.flags} -mcpu={build.mcu} -T{variant_path}{build.ldscript} -Wl,-Map,{build_path}{project_name}.map -o {build_path}{project_name}.elf -L{build_path} -lm -lgcc -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols -Wl,--start-group {object_files} {variant_path}libsam_sam3u4e_gcc_rel.a {build_path}{archive_file} -Wl,--end-group -##compile cc object files -#recipe.cc.o.pattern={0=compiler.path}{1=compiler.cc.cmd}{2=compiler.c.flags}{3=compiler.cpudef}{4=build.mcu}-DF_CPU={5=build.f_cpu}-DARDUINO={6=Base.REVISION}{-7=I/INCLUDE_PATHS} {8=SOURCE_NAME} -o{9=BUILD_PATH}{10=OBJECT_NAME} -recipe.cpp.o.pattern={0}{1} {2} {3}{4} -DF_CPU={5} -D{6}={7} {11} {8} {9} -o {10} -##create archives -#recipe.ar.pattern={0=compiler.path}{1=compiler.ar.cmd}{2=compiler.ar.flags}{3=BUILD_PATH}{4=CORE_NAME=core.a}{5=BUILD_PATH}{6=OBJECT_NAME} -recipe.ar.pattern={0}{1} {2} {3}{4} {5} - -##combine gc-sections archives, and objects -#recipe.c.combine.pattern={0=compiler.path}{1=compiler.c.cmd}{2=compiler.combine.flags}{3=compiler.cpudef}{4=build.mcu} -o {5=BUILD_PATH}{6=SOURCE_NAME}.elf {7=BUILD_PATH}{8=SOURCE_NAME}.o {9=BUILD_PATH}{10=CORE_NAME=core.a} -L{11=BUILD_PATH} -lm -#recipe.c.combine.pattern={0}{1} {2} {3}{4} -o {5}{6}.elf {7}{8} {9} -L{10} -lm -recipe.c.combine.pattern={0}{1} {2} {3}{4} -T{11} -Wl,-Map,{5}{6}.map -o {5}{6}.elf -L{9} -lm -lgcc -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols -Wl,--start-group {7} {8} -Wl,--end-group - -##create eeprom -#recipe.objcopy.eep.pattern={0=compiler.path}{1=compiler.objcopy.cmd}{2=compiler.objcopy.eep.flags} {3=BUILD_PATH}{4=SOURCE_NAME}.elf {5=BUILD_PATH}{6=SOURCE_NAME}.eep -#recipe.objcopy.eep.pattern={0}{1} {2} {3}.elf {4}.eep +## Create eeprom recipe.objcopy.eep.pattern= -##create hex -#recipe.objcopy.hex.pattern={0=compiler.path}{1=compiler.objcopy.cmd}{2=compiler.objcopy.elf.flags} {3=BUILD_PATH}{4=SOURCE_NAME}.elf {5=BUILD_PATH}{6=SOURCE_NAME}.hex -recipe.objcopy.hex.pattern={0}{1} {2} {3}.elf {4}.bin - - -##compute size -recipe.size.pattern={0}{1} {2}.elf +## Create hex +recipe.objcopy.hex.pattern={toolchain_path}{compiler.elf2hex.cmd} {compiler.elf2hex.flags} {build_path}{project_name}.elf {build_path}{project_name}.bin + +## Compute Size +#recipe.size.pattern={toolchain_path}{1} {2}.elf diff --git a/hardware/arduino/sam/system/libsam/build_gcc/Makefile b/hardware/arduino/sam/system/libsam/build_gcc/Makefile index 6beb5821d..2ed7da22b 100644 --- a/hardware/arduino/sam/system/libsam/build_gcc/Makefile +++ b/hardware/arduino/sam/system/libsam/build_gcc/Makefile @@ -27,6 +27,13 @@ SUBMAKE_OPTIONS=--no-builtin-rules --no-builtin-variables # libsam_sam3s4c_gcc_rel.a libsam_sam3u4e_gcc_rel.a all: libsam_sam3s4c_gcc_dbg.a libsam_sam3u4e_gcc_dbg.a +arduino_due: + @echo --- + @echo --- + @echo --- Making $@ + @echo --- + @$(MAKE) CHIP=__SAM3U4E__ $(SUBMAKE_OPTIONS) OUTPUT_BIN=../../../variants/arduino_due -f sam3.mk + .PHONY: libsam_sam3s4c_gcc_dbg.a libsam_sam3s4c_gcc_dbg.a: @echo ---