diff --git a/cores/arduino/Arduino.h b/cores/arduino/Arduino.h
index b3e6a53c8f2ba19ed4d86bb601c39e743ebd437f..1e24bf4fce75b86fe2556547054343a6e13b2744 100644
--- a/cores/arduino/Arduino.h
+++ b/cores/arduino/Arduino.h
@@ -25,11 +25,11 @@
 #include <string.h>
 #include <math.h>
 
-// some libraries and sketches depend on this
-// AVR stuff, assuming Arduino.h or WProgram.h
-// automatically includes it...
-#include <avr/pgmspace.h>
-#include <avr/interrupt.h>
+// some libraries and sketches depend on this AVR stuff,
+// assuming Arduino.h or WProgram.h automatically includes it...
+//
+#include "avr/pgmspace.h"
+#include "avr/interrupt.h"
 
 #include "binary.h"
 #include "itoa.h"
@@ -47,7 +47,7 @@ extern "C"{
 #define clockCyclesToMicroseconds(a) ( ((a) * 1000L) / (SystemCoreClock / 1000L) )
 #define microsecondsToClockCycles(a) ( (a) * (SystemCoreClock / 1000000L) )
 
-void yield(void);
+void yield( void ) ;
 
 /* sketch */
 extern void setup( void ) ;
@@ -173,7 +173,7 @@ typedef struct _PinDescription
 {
   void* pPort ;
   uint32_t ulPin ;
-  uint32_t ulPeripheralId ;
+//  uint32_t ulPeripheralId ;
   EPioType ulPinType ;
   uint32_t ulPinConfiguration ;
   uint32_t ulPinAttribute ;
diff --git a/cores/arduino/delay.c b/cores/arduino/delay.c
index 7ed2c5087b26988c5c97883198fb6f4ad29849ae..bf39ba9319351ccae5a17e2c4a637d06369bb69e 100644
--- a/cores/arduino/delay.c
+++ b/cores/arduino/delay.c
@@ -1,4 +1,5 @@
 #include "delay.h"
+#include "Arduino.h"
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/cores/arduino/delay.h b/cores/arduino/delay.h
index d06d1004dd3ac5f296db9b04dae9fbdcbfee30e0..e26ba81b56a541cce8982cc829d213b96d6af6f7 100644
--- a/cores/arduino/delay.h
+++ b/cores/arduino/delay.h
@@ -23,6 +23,8 @@
 extern "C" {
 #endif
 
+#include <stdint.h>
+
 /**
  * \brief Returns the number of milliseconds since the Arduino board began running the current program.
  *
diff --git a/cores/arduino/validation/build_gcc/test.mk b/cores/arduino/validation/build_gcc/test.mk
index eb7ce87287500c37ad89e3e92e1a2e1c39991f4c..de60a51433c8158b5536fd07a314b1a06ffbecc4 100644
--- a/cores/arduino/validation/build_gcc/test.mk
+++ b/cores/arduino/validation/build_gcc/test.mk
@@ -39,7 +39,7 @@ endif
 #-------------------------------------------------------------------------------
 # Path
 #-------------------------------------------------------------------------------
-HARDWARE_PATH=../../../../../../
+HARDWARE_PATH=../../../../../..
 ARCH_PATH=$(HARDWARE_PATH)/arduino/samd
 ARDUINO_CORE_PATH=$(ARCH_PATH)/cores/arduino
 ARDUINO_USB_PATH=$(ARDUINO_CORE_PATH)/USB
@@ -63,13 +63,13 @@ OUTPUT_PATH = debug_$(VARIANT)
 #-------------------------------------------------------------------------------
 
 vpath %.cpp $(PROJECT_BASE_PATH)
+vpath %.c $(ARDUINO_CORE_PATH) $(VARIANT_PATH)
 
 #VPATH+=$(PROJECT_BASE_PATH)
 
 INCLUDES = -I$(ARDUINO_CORE_PATH)
-INCLUDES += -I$(ARDUINO_CORE_PATH)/USB
+INCLUDES += -I$(ARDUINO_USB_PATH)
 INCLUDES += -I$(VARIANT_PATH)
-INCLUDES += -I$(SYSTEM_PATH)/libsam
 INCLUDES += -I$(CMSIS_ARM_PATH)
 INCLUDES += -I$(CMSIS_ATMEL_PATH)
 INCLUDES += -I$(CMSIS_DEVICE_PATH)
@@ -106,10 +106,26 @@ LIB_PATH =-L$(PROJECT_BASE_PATH)/..
 LIB_PATH+=-L=/lib/thumb2
 #LIB_PATH+=-L=/../lib/gcc/arm-none-eabi/4.5.2/thumb2
 
+#-------------------------------------------------------------------------------
+# C source files and objects
+#-------------------------------------------------------------------------------
+C_SRC=$(wildcard $(PROJECT_BASE_PATH)/*.c)
+C_SRC+=$(wildcard $(ARDUINO_CORE_PATH)/*.c)
+C_SRC+=$(wildcard $(VARIANT_PATH)/*.c)
+
+C_OBJ_TEMP = $(patsubst %.c, %.o, $(notdir $(C_SRC)))
+
+# during development, remove some files
+C_OBJ_FILTER=
+
+C_OBJ=$(filter-out $(C_OBJ_FILTER), $(C_OBJ_TEMP))
+
 #-------------------------------------------------------------------------------
 # CPP source files and objects
 #-------------------------------------------------------------------------------
 CPP_SRC=$(wildcard $(PROJECT_BASE_PATH)/*.cpp)
+CPP_SRC+=$(wildcard $(ARDUINO_CORE_PATH)/*.cpp)
+CPP_SRC+=$(wildcard $(VARIANT_PATH)/*.cpp)
 
 CPP_OBJ_TEMP = $(patsubst %.cpp, %.o, $(notdir $(CPP_SRC)))
 
@@ -130,27 +146,46 @@ test: create_output $(OUTPUT_BIN)
 create_output:
 	@echo ------------------------------------------------------------------------------------
 	@echo --- Preparing $(VARIANT) files in $(OUTPUT_PATH) $(OUTPUT_BIN)
-#	@echo -------------------------
-#	@echo *$(INCLUDES)
-#	@echo -------------------------
-#	@echo *$(C_SRC)
-#	@echo -------------------------
-#	@echo *$(C_OBJ)
-#	@echo -------------------------
-#	@echo *$(addprefix $(OUTPUT_PATH)/, $(C_OBJ))
-#	@echo -------------------------
-#	@echo *$(CPP_SRC)
-#	@echo -------------------------
-#	@echo *$(CPP_OBJ)
-#	@echo -------------------------
-#	@echo *$(addprefix $(OUTPUT_PATH)/, $(CPP_OBJ))
-#	@echo -------------------------
+	@echo -
+	@echo -
+	@echo INCLUDES -------------------------
+	@echo *$(INCLUDES)
+	@echo -
+	@echo -
+	@echo C_SRC -------------------------
+	@echo *$(C_SRC)
+	@echo -
+	@echo -
+	@echo C_OBJ -------------------------
+	@echo *$(C_OBJ)
+	@echo -
+	@echo -
+	@echo C_OBJ prefix -------------------------
+	@echo *$(addprefix $(OUTPUT_PATH)/, $(C_OBJ))
+	@echo -
+	@echo -
+	@echo CPP_SRC -------------------------
+	@echo *$(CPP_SRC)
+	@echo -
+	@echo -
+	@echo CPP_OBJ -------------------------
+	@echo *$(CPP_OBJ)
+	@echo -
+	@echo -
+	@echo CPP_OBJ prefix -------------------------
+	@echo *$(addprefix $(OUTPUT_PATH)/, $(CPP_OBJ))
+#	@echo A_SRC -------------------------
 #	@echo *$(A_SRC)
-#	@echo -------------------------
+	@echo -------------------------
 
 	-@mkdir $(OUTPUT_PATH) 1>NUL 2>&1
 	@echo ------------------------------------------------------------------------------------
 
+$(addprefix $(OUTPUT_PATH)/,$(C_OBJ)): $(OUTPUT_PATH)/%.o: %.c
+	@echo *** Current folder is $(shell cd)
+#	@"$(CC)" -c $(CFLAGS) $< -o $@
+	"$(CC)" -v -c $(CFLAGS) $< -o $@
+
 $(addprefix $(OUTPUT_PATH)/,$(CPP_OBJ)): $(OUTPUT_PATH)/%.o: %.cpp
 	@echo *** Current folder is $(shell cd)
 #	@"$(CXX)" -c $(CPPFLAGS) $< -o $@
diff --git a/cores/arduino/wiring.c b/cores/arduino/wiring.c
index 0f7d19f27a069e2548c9c45d31f510ae148e1af6..1bb8e2ab3e94c1cb9df0c257c61f98318ab8c5cd 100644
--- a/cores/arduino/wiring.c
+++ b/cores/arduino/wiring.c
@@ -34,27 +34,24 @@ void __libc_init_array(void);
  * Arduino Zero board initialization
  *
  * Good to know:
+ *   - At reset, ResetHandler did the system clock configuration. Core is running at 48MHz.
  *   - Watchdog is disabled by default, unless someone plays with NVM User page
- *   -
+ *   - During reset, all PORT lines are configured as inputs with input buffers, output buffers and pull disabled.
  */
 void init( void )
 {
-  // Set Systick to 1ms interval, common to all SAM3 variants
-  if (SysTick_Config(SystemCoreClock / 1000))
+  // Set Systick to 1ms interval, common to all Cortex-M variants
+  if ( SysTick_Config( SystemCoreClock / 1000 ) )
   {
     // Capture error
     while (true);
   }
 
-
   // Initialize C library
 //  __libc_init_array();
 
-  // Disable pull-up on every pin
-  for ( int i = 0 ; i < PINS_COUNT ; i++ )
-	{
-	  digitalWrite( i, LOW ) ;
-	}
+  // Setup PORT for Digital I/O
+	PM->APBBMASK.bit.PORT=1 ;
 
   // Initialize Serial port U(S)ART pins
 	// Todo