Skip to content
Snippets Groups Projects
Commit ece2b42f authored by Thibaut VIARD's avatar Thibaut VIARD Committed by Jonathan BAUDIN
Browse files

Fixed makefiles for validation

parent 0ab6e348
No related branches found
No related tags found
No related merge requests found
...@@ -38,8 +38,8 @@ ...@@ -38,8 +38,8 @@
extern "C"{ extern "C"{
#endif // __cplusplus #endif // __cplusplus
// Includes Atmel CMSIS // Include Atmel headers
#include <chip.h> #include "sam.h"
#include "wiring_constants.h" #include "wiring_constants.h"
...@@ -100,40 +100,65 @@ typedef enum _EAnalogChannel ...@@ -100,40 +100,65 @@ typedef enum _EAnalogChannel
typedef enum _EPWMChannel typedef enum _EPWMChannel
{ {
NOT_ON_PWM=-1, NOT_ON_PWM=-1,
PWM_CH0=0, // todo // PWM_CH0=0, // todo
PWM_CH1, // PWM_CH1,
PWM_CH2, // PWM_CH2,
PWM_CH3, // PWM_CH3,
PWM_CH4, // PWM_CH4,
PWM_CH5, // PWM_CH5,
PWM_CH6, // PWM_CH6,
PWM_CH7 // PWM_CH7
} EPWMChannel ; } EPWMChannel ;
// Definitions for TC channels // Definitions for TC channels
typedef enum _ETCChannel typedef enum _ETCChannel
{ {
NOT_ON_TIMER=-1, NOT_ON_TIMER=-1,
TC0_CHA0=0, // todo // TC0_CHA0=0, // todo
TC0_CHB0, // TC0_CHB0,
TC0_CHA1, // TC0_CHA1,
TC0_CHB1, // TC0_CHB1,
TC0_CHA2, // TC0_CHA2,
TC0_CHB2, // TC0_CHB2,
TC1_CHA3, // TC1_CHA3,
TC1_CHB3, // TC1_CHB3,
TC1_CHA4, // TC1_CHA4,
TC1_CHB4, // TC1_CHB4,
TC1_CHA5, // TC1_CHA5,
TC1_CHB5, // TC1_CHB5,
TC2_CHA6, // TC2_CHA6,
TC2_CHB6, // TC2_CHB6,
TC2_CHA7, // TC2_CHA7,
TC2_CHB7, // TC2_CHB7,
TC2_CHA8, // TC2_CHA8,
TC2_CHB8 // TC2_CHB8
} ETCChannel ; } ETCChannel ;
#define PORTA (0ul)
#define PORTB (1ul)
#define PORTC (2ul)
//A B C D E F G H
//EIC REF ADC AC PTC DAC SERCOM SERCOM_ALT TC/TCC TCC COM AC/GCLK
typedef enum _EPioType
{
PIO_NOT_A_PIN, /* Not under control of a peripheral. */
PIO_DIGITAL, /* The pin is controlled by PORT. */
PIO_EXTINT, /* The pin is controlled by the associated signal of peripheral A. */
PIO_ANALOG, /* The pin is controlled by the associated signal of peripheral B. */
PIO_SERCOM, /* The pin is controlled by the associated signal of peripheral C. */
PIO_SERCOM_ALT, /* The pin is controlled by the associated signal of peripheral D. */
PIO_TIMER, /* The pin is controlled by the associated signal of peripheral E. */
PIO_TIMER_ALT, /* The pin is controlled by the associated signal of peripheral F. */
PIO_COM, /* The pin is controlled by the associated signal of peripheral G. */
PIO_AC_CLK, /* The pin is controlled by the associated signal of peripheral H. */
PIO_INPUT, /* The pin is an input. */
PIO_OUTPUT_0, /* The pin is an output and has a default level of 0. */
PIO_OUTPUT_1 /* The pin is an output and has a default level of 1. */
} EPioType ;
/** /**
* Pin Attributes to be OR-ed * Pin Attributes to be OR-ed
*/ */
...@@ -143,10 +168,10 @@ typedef enum _ETCChannel ...@@ -143,10 +168,10 @@ typedef enum _ETCChannel
#define PIN_ATTR_PWM (1UL<<3) #define PIN_ATTR_PWM (1UL<<3)
#define PIN_ATTR_TIMER (1UL<<4) #define PIN_ATTR_TIMER (1UL<<4)
/* Types used for the tables below */ /* Types used for the table below */
typedef struct _PinDescription typedef struct _PinDescription
{ {
Pio* pPort ; void* pPort ;
uint32_t ulPin ; uint32_t ulPin ;
uint32_t ulPeripheralId ; uint32_t ulPeripheralId ;
EPioType ulPinType ; EPioType ulPinType ;
...@@ -174,7 +199,7 @@ extern const PinDescription g_APinDescription[] ; ...@@ -174,7 +199,7 @@ extern const PinDescription g_APinDescription[] ;
#endif // __cplusplus #endif // __cplusplus
// Include board variant // Include board variant
#include "variant.h" //#include "variant.h"
#include "wiring.h" #include "wiring.h"
#include "wiring_digital.h" #include "wiring_digital.h"
......
...@@ -24,50 +24,27 @@ SUBMAKE_OPTIONS=--no-builtin-rules --no-builtin-variables --no-print-directory ...@@ -24,50 +24,27 @@ SUBMAKE_OPTIONS=--no-builtin-rules --no-builtin-variables --no-print-directory
all: clean test all: clean test
test: test_arduino_zero test_samd21_xpro test: test_arduino_zero
clean: clean_arduino_zero clean_samd21_xpro clean: clean_arduino_zero
.PHONY: test_arduino_zero .PHONY: test_arduino_zero
test_arduino_zero: test_arduino_zero:
@echo ------------------------------------------------------------------------------------ @echo ------------------------------------------------------------------------------------
@echo --- Making test_arduino_zero @echo --- Making test_arduino_zero
@$(MAKE) DEBUG=1 VARIANT=arduino_zero $(SUBMAKE_OPTIONS) -f test.mk @$(MAKE) DEBUG=1 VARIANT=arduino_zero $(SUBMAKE_OPTIONS) -f test.mk test
@echo ------------------------------------------------------------------------------------ @echo ------------------------------------------------------------------------------------
.PHONY: clean_arduino_zero .PHONY: clean_arduino_zero
clean_arduino_zero: clean_arduino_zero:
@echo ------------------------------------------------------------------------------------ @echo ------------------------------------------------------------------------------------
@echo --- Cleaning test arduino_zero @echo --- Cleaning test arduino_zero
@$(MAKE) DEBUG=1 VARIANT=arduino_zero $(SUBMAKE_OPTIONS) -f test.mk $@ @$(MAKE) DEBUG=1 VARIANT=arduino_zero $(SUBMAKE_OPTIONS) -f test.mk clean
@echo ------------------------------------------------------------------------------------ @echo ------------------------------------------------------------------------------------
.PHONY: debug_arduino_zero .PHONY: debug_arduino_zero
debug_arduino_zero: debug_arduino_zero:
@echo ------------------------------------------------------------------------------------ @echo ------------------------------------------------------------------------------------
@echo --- Debugging test arduino_zero @echo --- Debugging test arduino_zero
@$(MAKE) DEBUG=1 VARIANT=arduino_zero $(SUBMAKE_OPTIONS) -f test.mk $@ @$(MAKE) DEBUG=1 VARIANT=arduino_zero $(SUBMAKE_OPTIONS) -f test.mk debug
@echo ------------------------------------------------------------------------------------
.PHONY: test_samd21_xpro
test_samd21_xpro:
@echo ------------------------------------------------------------------------------------
@echo --- Making test_samd21_xpro
@$(MAKE) DEBUG=1 VARIANT=samd21_xpro $(SUBMAKE_OPTIONS) -f test.mk
@echo ------------------------------------------------------------------------------------
.PHONY: clean_samd21_xpro
clean:
@echo ------------------------------------------------------------------------------------
@echo --- Cleaning test samd21_xpro
@$(MAKE) DEBUG=1 VARIANT=samd21_xpro $(SUBMAKE_OPTIONS) -f test.mk $@
@echo ------------------------------------------------------------------------------------
.PHONY: debug_samd21_xpro
debug_samd21_xpro:
@echo ------------------------------------------------------------------------------------
@echo --- Debugging test samd21_xpro
@$(MAKE) DEBUG=1 VARIANT=samd21_xpro $(SUBMAKE_OPTIONS) -f test.mk $@
@echo ------------------------------------------------------------------------------------ @echo ------------------------------------------------------------------------------------
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
# #
# This library is distributed in the hope that it will be useful, # This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Lesser General Public License for more details. # See the GNU Lesser General Public License for more details.
# #
# You should have received a copy of the GNU Lesser General Public # You should have received a copy of the GNU Lesser General Public
...@@ -16,24 +16,18 @@ ...@@ -16,24 +16,18 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# #
# Tool suffix when cross-compiling
CROSS_COMPILE = $(ARM_GCC_TOOLCHAIN)/arm-none-eabi-
# Compilation tools # Compilation tools
AR = $(CROSS_COMPILE)ar AR = $(ARM_GCC_TOOLCHAIN)/arm-none-eabi-ar
CC = $(CROSS_COMPILE)gcc CC = $(ARM_GCC_TOOLCHAIN)/arm-none-eabi-gcc
CXX = $(CROSS_COMPILE)g++ #CXX = $(ARM_GCC_TOOLCHAIN)/arm-none-eabi-g++
AS = $(CROSS_COMPILE)as CXX = $(ARM_GCC_TOOLCHAIN)/arm-none-eabi-gcc
GDB = $(CROSS_COMPILE)gdb AS = $(ARM_GCC_TOOLCHAIN)/arm-none-eabi-as
SIZE = $(CROSS_COMPILE)size GDB = $(ARM_GCC_TOOLCHAIN)/arm-none-eabi-gdb
NM = $(CROSS_COMPILE)nm SIZE = $(ARM_GCC_TOOLCHAIN)/arm-none-eabi-size
OBJCOPY = $(CROSS_COMPILE)objcopy NM = $(ARM_GCC_TOOLCHAIN)/arm-none-eabi-nm
OBJCOPY = $(ARM_GCC_TOOLCHAIN)/arm-none-eabi-objcopy
ifeq ($(OS),Windows_NT)
RM=cs-rm -Rf
else
RM=rm -Rf RM=rm -Rf
endif
SEP=\\ SEP=\\
...@@ -52,12 +46,14 @@ CFLAGS += -Wpacked -Wredundant-decls -Wnested-externs -Winline -Wlong-long ...@@ -52,12 +46,14 @@ CFLAGS += -Wpacked -Wredundant-decls -Wnested-externs -Winline -Wlong-long
CFLAGS += -Wunreachable-code CFLAGS += -Wunreachable-code
CFLAGS += -Wcast-align CFLAGS += -Wcast-align
CFLAGS += --param max-inline-insns-single=500 -mcpu=cortex-m3 -mthumb -mlong-calls -ffunction-sections -nostdlib -std=c99 CFLAGS += --param max-inline-insns-single=500 -mcpu=cortex-m0plus -mthumb -mlong-calls -ffunction-sections -nostdlib -std=c99
CFLAGS += $(OPTIMIZATION) $(INCLUDES) -D$(CHIP) -D$(VARIANT) CFLAGS += $(OPTIMIZATION) $(INCLUDES) -D$(CHIP) -D$(VARIANT)
# To reduce application size use only integer printf function. # To reduce application size use only integer printf function.
CFLAGS += -Dprintf=iprintf CFLAGS += -Dprintf=iprintf
# --------------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------
# CPP Flags # CPP Flags
...@@ -71,13 +67,23 @@ CPPFLAGS += -Wformat -Wmissing-format-attribute -Wno-deprecated-declarations ...@@ -71,13 +67,23 @@ CPPFLAGS += -Wformat -Wmissing-format-attribute -Wno-deprecated-declarations
CPPFLAGS += -Wpacked -Wredundant-decls -Winline -Wlong-long CPPFLAGS += -Wpacked -Wredundant-decls -Winline -Wlong-long
#-fno-rtti -fno-exceptions #-fno-rtti -fno-exceptions
CPPFLAGS += --param max-inline-insns-single=500 -mcpu=cortex-m0p -mthumb -mlong-calls -ffunction-sections -fdata-sections -std=c++98 CPPFLAGS += --param max-inline-insns-single=500 -mcpu=cortex-m0plus -mthumb -mlong-calls -ffunction-sections -fdata-sections -std=c++98
CPPFLAGS += $(OPTIMIZATION) $(INCLUDES) -D$(CHIP) CPPFLAGS += $(OPTIMIZATION) $(INCLUDES) -D$(CHIP)
# To reduce application size use only integer printf function. # To reduce application size use only integer printf function.
CPPFLAGS += -Dprintf=iprintf CPPFLAGS += -Dprintf=iprintf
# --------------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------
# ASM Flags # ASM Flags
ASFLAGS = -mcpu=cortex-m3 -mthumb -Wall -g $(OPTIMIZATION) $(INCLUDES) ASFLAGS = -mcpu=cortex-m0plus -mthumb -Wall -g $(OPTIMIZATION) $(INCLUDES)
# ---------------------------------------------------------------------------------------
# LD Flags
LDFLAGS= -mcpu=cortex-m0plus -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
...@@ -21,44 +21,39 @@ ...@@ -21,44 +21,39 @@
# putting default variant # putting default variant
ifeq ("$(VARIANT)", "") ifeq ("$(VARIANT)", "")
VARIANT=samd21_xpro VARIANT=arduino_zero
#VARIANT=arduino_zero
endif endif
ifeq ("$(VARIANT)", "samd21_xpro") ifeq ("$(VARIANT)", "arduino_zero")
DEVICE=__SAMD21J18__
VARIANT_PATH = ../../../../../../atmel/sam/variants/$(VARIANT)
else ifeq ("$(VARIANT)", "arduino_zero")
DEVICE=__SAMD21G18__ DEVICE=__SAMD21G18__
VARIANT_PATH = ../../../../../../atmel/sam/variants/$(VARIANT)
endif endif
TOOLCHAIN=gcc
#-------------------------------------------------------------------------------
# Path
#-------------------------------------------------------------------------------
# Libraries
PROJECT_BASE_PATH = ..
SYSTEM_PATH = ../../../../system
ifeq ($(DEVICE), __SAMD21G18__) ifeq ($(DEVICE), __SAMD21G18__)
DEVICE_NAME=samd21g18 DEVICE_NAME=samd21g18
DEVICE_SERIE=samd DEVICE_SERIE=samd21
else ifeq ($(DEVICE), __SAMD21J18__) else ifeq ($(DEVICE), __SAMD21J18__)
DEVICE_NAME=samd21j18 DEVICE_NAME=samd21j18
DEVICE_SERIE=samd DEVICE_SERIE=samd21
else
endif endif
CMSIS_ROOT_PATH = $(SYSTEM_PATH)/CMSIS #-------------------------------------------------------------------------------
# Path
#-------------------------------------------------------------------------------
HARDWARE_PATH=../../../../../../
ARCH_PATH=$(HARDWARE_PATH)/arduino/samd
ARDUINO_CORE_PATH=$(ARCH_PATH)/cores/arduino
ARDUINO_USB_PATH=$(ARDUINO_CORE_PATH)/USB
VARIANT_PATH = $(ARCH_PATH)/variants/$(VARIANT)
TOOLS_PATH = $(HARDWARE_PATH)/tools
CMSIS_ROOT_PATH=$(TOOLS_PATH)/CMSIS
CMSIS_ARM_PATH=$(CMSIS_ROOT_PATH)/CMSIS/Include CMSIS_ARM_PATH=$(CMSIS_ROOT_PATH)/CMSIS/Include
CMSIS_ATMEL_PATH=$(CMSIS_ROOT_PATH)/Device/ATMEL CMSIS_ATMEL_PATH=$(CMSIS_ROOT_PATH)/Device/ATMEL
CMSIS_DEVICE_PATH=$(CMSIS_ROOT_PATH)/Device/ATMEL/$(DEVICE_SERIE) #CMSIS_DEVICE_PATH=$(CMSIS_ROOT_PATH)/Device/ATMEL/$(DEVICE_SERIE)
PROJECT_BASE_PATH = ..
TOOLCHAIN=gcc
ARDUINO_CORE_PATH=../../../../cores/arduino
ARDUINO_USB_PATH=$(ARDUINO_CORE_PATH)/USB
# Output directories # Output directories
OUTPUT_PATH = debug_$(VARIANT) OUTPUT_PATH = debug_$(VARIANT)
...@@ -67,7 +62,6 @@ OUTPUT_PATH = debug_$(VARIANT) ...@@ -67,7 +62,6 @@ OUTPUT_PATH = debug_$(VARIANT)
# Files # Files
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
#vpath %.h $(PROJECT_BASE_PATH)/.. $(PROJECT_BASE_PATH)/../USB $(VARIANT_PATH) $(SYSTEM_PATH) $(CMSIS_ARM_PATH)
vpath %.cpp $(PROJECT_BASE_PATH) vpath %.cpp $(PROJECT_BASE_PATH)
#VPATH+=$(PROJECT_BASE_PATH) #VPATH+=$(PROJECT_BASE_PATH)
...@@ -112,8 +106,6 @@ LIB_PATH =-L$(PROJECT_BASE_PATH)/.. ...@@ -112,8 +106,6 @@ LIB_PATH =-L$(PROJECT_BASE_PATH)/..
LIB_PATH+=-L=/lib/thumb2 LIB_PATH+=-L=/lib/thumb2
#LIB_PATH+=-L=/../lib/gcc/arm-none-eabi/4.5.2/thumb2 #LIB_PATH+=-L=/../lib/gcc/arm-none-eabi/4.5.2/thumb2
LDFLAGS= -mcpu=cortex-m0p -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
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# CPP source files and objects # CPP source files and objects
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
...@@ -161,8 +153,8 @@ create_output: ...@@ -161,8 +153,8 @@ create_output:
$(addprefix $(OUTPUT_PATH)/,$(CPP_OBJ)): $(OUTPUT_PATH)/%.o: %.cpp $(addprefix $(OUTPUT_PATH)/,$(CPP_OBJ)): $(OUTPUT_PATH)/%.o: %.cpp
@echo *** Current folder is $(shell cd) @echo *** Current folder is $(shell cd)
@"$(CXX)" -c $(CPPFLAGS) $< -o $@ # @"$(CXX)" -c $(CPPFLAGS) $< -o $@
# "$(CXX)" -v -c $(CPPFLAGS) $< -o $@ "$(CXX)" -v -c $(CPPFLAGS) $< -o $@
$(OUTPUT_BIN): $(addprefix $(OUTPUT_PATH)/, $(C_OBJ)) $(addprefix $(OUTPUT_PATH)/, $(CPP_OBJ)) $(addprefix $(OUTPUT_PATH)/, $(A_OBJ)) $(OUTPUT_BIN): $(addprefix $(OUTPUT_PATH)/, $(C_OBJ)) $(addprefix $(OUTPUT_PATH)/, $(CPP_OBJ)) $(addprefix $(OUTPUT_PATH)/, $(A_OBJ))
@"$(CC)" $(LIB_PATH) $(LDFLAGS) -T"$(VARIANT_PATH)/linker_scripts/gcc/flash.ld" -Wl,-Map,$(OUTPUT_PATH)/$@.map -o $(OUTPUT_PATH)/$@.elf $^ $(LIBS) @"$(CC)" $(LIB_PATH) $(LDFLAGS) -T"$(VARIANT_PATH)/linker_scripts/gcc/flash.ld" -Wl,-Map,$(OUTPUT_PATH)/$@.map -o $(OUTPUT_PATH)/$@.elf $^ $(LIBS)
...@@ -176,14 +168,6 @@ clean: ...@@ -176,14 +168,6 @@ clean:
@echo --- Cleaning test files for $(VARIANT) @echo --- Cleaning test files for $(VARIANT)
-@$(RM) $(OUTPUT_PATH) 1>NUL 2>&1 -@$(RM) $(OUTPUT_PATH) 1>NUL 2>&1
@echo ------------------------------------------------------------------------------------ @echo ------------------------------------------------------------------------------------
@echo ------------------------------------------------------------------------------------
@echo Sub-making clean for Arduino core
$(MAKE) -C $(ARDUINO_CORE_PATH)/build_gcc -f Makefile clean
@echo ------------------------------------------------------------------------------------
@echo ------------------------------------------------------------------------------------
@echo Sub-making clean for variant $(VARIANT)
$(MAKE) -C $(VARIANT_PATH)/build_gcc -f Makefile clean
@echo ------------------------------------------------------------------------------------
# -$(RM) $(OUTPUT_PATH)/test.o # -$(RM) $(OUTPUT_PATH)/test.o
# -$(RM) $(OUTPUT_PATH)/$(OUTPUT_BIN).elf # -$(RM) $(OUTPUT_PATH)/$(OUTPUT_BIN).elf
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment