diff --git a/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMD21J18A/PeripheralNames.h b/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/PeripheralNames.h
similarity index 100%
rename from libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMD21J18A/PeripheralNames.h
rename to libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/PeripheralNames.h
diff --git a/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMD21J18A/PeripheralPins.h b/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/PeripheralPins.h
similarity index 100%
rename from libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMD21J18A/PeripheralPins.h
rename to libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/PeripheralPins.h
diff --git a/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMD21J18A/PinNames.h b/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/PinNames.h
similarity index 100%
rename from libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMD21J18A/PinNames.h
rename to libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/PinNames.h
diff --git a/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMD21J18A/PortNames.h b/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/PortNames.h
similarity index 100%
rename from libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMD21J18A/PortNames.h
rename to libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/PortNames.h
diff --git a/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMD21J18A/SAMD21_XPLAINED_PRO/mbed_overrides.c b/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMD21J18A/SAMD21_XPLAINED_PRO/mbed_overrides.c
index 000a33dd28..074e99efea 100644
--- a/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMD21J18A/SAMD21_XPLAINED_PRO/mbed_overrides.c
+++ b/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMD21J18A/SAMD21_XPLAINED_PRO/mbed_overrides.c
@@ -13,33 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-//#include "system.h"
#include "mbed_assert.h"
#include "compiler.h"
-//#include "core_cm0plus.h"
-//#include "comp_sysctrl.h"
-
-void system_clock_init(void)
-{
- // struct Sysctrl* syscontrol = 0x40000800UL;
- // syscontrol->INTFLAG.reg = SYSCTRL_INTFLAG_BOD33RDY | SYSCTRL_INTFLAG_BOD33DET |
- // SYSCTRL_INTFLAG_DFLLRDY;
-
-}
-
-void system_board_init(void)
-{
-
-}
-
//called before main - implement here if board needs it ortherwise, let
// the application override this if necessary
+ //TODO: To be implemented by adding system init and board init
void mbed_sdk_init()
{
- system_clock_init();
- system_board_init();
- // _system_events_init();
- // _system_extint_init();
+
}
/***************************************************************/
diff --git a/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMD21J18A/gpio_api.c b/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMD21J18A/gpio_api.c
deleted file mode 100644
index a19188c997..0000000000
--- a/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMD21J18A/gpio_api.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "mbed_assert.h"
-#include "pinmap.h"
-#include "PinNames.h"
-#include "gpio_object.h"
-#include "gpio_api.h"
-#include "compiler.h"
-
-uint32_t gpio_set(PinName pin) {
-
-}
-
-void gpio_init(gpio_t *obj, PinName pin) {
-
-}
-
-void gpio_mode(gpio_t *obj, PinMode mode) {
-
-}
-
-void gpio_dir(gpio_t *obj, PinDirection direction) {
-
-}
-
-
diff --git a/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMD21J18A/status_codes.h b/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMD21J18A/status_codes.h
deleted file mode 100644
index cd0f087332..0000000000
--- a/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMD21J18A/status_codes.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/**
- * \file
- *
- * \brief Status code definitions.
- *
- * This file defines various status codes returned by functions,
- * indicating success or failure as well as what kind of failure.
- *
- * Copyright (C) 2012-2014 Atmel Corporation. All rights reserved.
- *
- * \asf_license_start
- *
- * \page License
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * 3. The name of Atmel may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * 4. This software may only be redistributed and used in connection with an
- * Atmel microcontroller product.
- *
- * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
- * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * \asf_license_stop
- *
- */
- /**
- * Support and FAQ: visit Atmel Support
- */
-
-#ifndef STATUS_CODES_H_INCLUDED
-#define STATUS_CODES_H_INCLUDED
-
-#include
-
-/**
- * \defgroup group_sam0_utils_status_codes Status Codes
- *
- * \ingroup group_sam0_utils
- *
- * @{
- */
-
-/** Mask to retrieve the error category of a status code. */
-#define STATUS_CATEGORY_MASK 0xF0
-
-/** Mask to retrieve the error code within the category of a status code. */
-#define STATUS_ERROR_MASK 0x0F
-
-/** Status code error categories. */
-enum status_categories {
- STATUS_CATEGORY_OK = 0x00,
- STATUS_CATEGORY_COMMON = 0x10,
- STATUS_CATEGORY_ANALOG = 0x30,
- STATUS_CATEGORY_COM = 0x40,
- STATUS_CATEGORY_IO = 0x50,
-};
-
-/**
- * Status code that may be returned by shell commands and protocol
- * implementations.
- *
- * \note Any change to these status codes and the corresponding
- * message strings is strictly forbidden. New codes can be added,
- * however, but make sure that any message string tables are updated
- * at the same time.
- */
-enum status_code {
- STATUS_OK = STATUS_CATEGORY_OK | 0x00,
- STATUS_VALID_DATA = STATUS_CATEGORY_OK | 0x01,
- STATUS_NO_CHANGE = STATUS_CATEGORY_OK | 0x02,
- STATUS_ABORTED = STATUS_CATEGORY_OK | 0x04,
- STATUS_BUSY = STATUS_CATEGORY_OK | 0x05,
- STATUS_SUSPEND = STATUS_CATEGORY_OK | 0x06,
-
- STATUS_ERR_IO = STATUS_CATEGORY_COMMON | 0x00,
- STATUS_ERR_REQ_FLUSHED = STATUS_CATEGORY_COMMON | 0x01,
- STATUS_ERR_TIMEOUT = STATUS_CATEGORY_COMMON | 0x02,
- STATUS_ERR_BAD_DATA = STATUS_CATEGORY_COMMON | 0x03,
- STATUS_ERR_NOT_FOUND = STATUS_CATEGORY_COMMON | 0x04,
- STATUS_ERR_UNSUPPORTED_DEV = STATUS_CATEGORY_COMMON | 0x05,
- STATUS_ERR_NO_MEMORY = STATUS_CATEGORY_COMMON | 0x06,
- STATUS_ERR_INVALID_ARG = STATUS_CATEGORY_COMMON | 0x07,
- STATUS_ERR_BAD_ADDRESS = STATUS_CATEGORY_COMMON | 0x08,
- STATUS_ERR_BAD_FORMAT = STATUS_CATEGORY_COMMON | 0x0A,
- STATUS_ERR_BAD_FRQ = STATUS_CATEGORY_COMMON | 0x0B,
- STATUS_ERR_DENIED = STATUS_CATEGORY_COMMON | 0x0c,
- STATUS_ERR_ALREADY_INITIALIZED = STATUS_CATEGORY_COMMON | 0x0d,
- STATUS_ERR_OVERFLOW = STATUS_CATEGORY_COMMON | 0x0e,
- STATUS_ERR_NOT_INITIALIZED = STATUS_CATEGORY_COMMON | 0x0f,
-
- STATUS_ERR_SAMPLERATE_UNAVAILABLE = STATUS_CATEGORY_ANALOG | 0x00,
- STATUS_ERR_RESOLUTION_UNAVAILABLE = STATUS_CATEGORY_ANALOG | 0x01,
-
- STATUS_ERR_BAUDRATE_UNAVAILABLE = STATUS_CATEGORY_COM | 0x00,
- STATUS_ERR_PACKET_COLLISION = STATUS_CATEGORY_COM | 0x01,
- STATUS_ERR_PROTOCOL = STATUS_CATEGORY_COM | 0x02,
-
- STATUS_ERR_PIN_MUX_INVALID = STATUS_CATEGORY_IO | 0x00,
-};
-typedef enum status_code status_code_genare_t;
-
-/**
- Status codes used by MAC stack.
- */
-enum status_code_wireless {
- //STATUS_OK = 0, //!< Success
- ERR_IO_ERROR = -1, //!< I/O error
- ERR_FLUSHED = -2, //!< Request flushed from queue
- ERR_TIMEOUT = -3, //!< Operation timed out
- ERR_BAD_DATA = -4, //!< Data integrity check failed
- ERR_PROTOCOL = -5, //!< Protocol error
- ERR_UNSUPPORTED_DEV = -6, //!< Unsupported device
- ERR_NO_MEMORY = -7, //!< Insufficient memory
- ERR_INVALID_ARG = -8, //!< Invalid argument
- ERR_BAD_ADDRESS = -9, //!< Bad address
- ERR_BUSY = -10, //!< Resource is busy
- ERR_BAD_FORMAT = -11, //!< Data format not recognized
- ERR_NO_TIMER = -12, //!< No timer available
- ERR_TIMER_ALREADY_RUNNING = -13, //!< Timer already running
- ERR_TIMER_NOT_RUNNING = -14, //!< Timer not running
-
- /**
- * \brief Operation in progress
- *
- * This status code is for driver-internal use when an operation
- * is currently being performed.
- *
- * \note Drivers should never return this status code to any
- * callers. It is strictly for internal use.
- */
- OPERATION_IN_PROGRESS = -128,
-};
-
-typedef enum status_code_wireless status_code_t;
-
-/** @} */
-
-#endif /* STATUS_CODES_H_INCLUDED */
diff --git a/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMR21G18A/PeripheralNames.h b/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMR21G18A/PeripheralNames.h
deleted file mode 100644
index 5fd3537312..0000000000
--- a/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMR21G18A/PeripheralNames.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_PERIPHERALNAMES_H
-#define MBED_PERIPHERALNAMES_H
-
-#include "cmsis.h"
-#include "PinNames.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-/*
-typedef enum {
- UART_0 = (int)LPC_UART0_BASE,
- UART_1 = (int)LPC_UART1_BASE,
- UART_2 = (int)LPC_UART2_BASE,
- UART_3 = (int)LPC_UART3_BASE
-} UARTName;
-
-typedef enum {
- ADC0_0 = 0,
- ADC0_1,
- ADC0_2,
- ADC0_3,
- ADC0_4,
- ADC0_5,
- ADC0_6,
- ADC0_7
-} ADCName;
-
-typedef enum {
- DAC_0 = 0
-} DACName;
-
-typedef enum {
- SPI_0 = (int)LPC_SSP0_BASE,
- SPI_1 = (int)LPC_SSP1_BASE
-} SPIName;
-
-typedef enum {
- I2C_0 = (int)LPC_I2C0_BASE,
- I2C_1 = (int)LPC_I2C1_BASE,
- I2C_2 = (int)LPC_I2C2_BASE
-} I2CName;
-
-typedef enum {
- PWM_1 = 1,
- PWM_2,
- PWM_3,
- PWM_4,
- PWM_5,
- PWM_6
-} PWMName;
-
-typedef enum {
- CAN_1 = (int)LPC_CAN1_BASE,
- CAN_2 = (int)LPC_CAN2_BASE
-} CANName;*/
-
-#define STDIO_UART_TX USBTX
-#define STDIO_UART_RX USBRX
-#define STDIO_UART UART_0
-
-// Default peripherals
-#define MBED_SPI0 p5, p6, p7, p8
-#define MBED_SPI1 p11, p12, p13, p14
-
-#define MBED_UART0 p9, p10
-#define MBED_UART1 p13, p14
-#define MBED_UART2 p28, p27
-#define MBED_UARTUSB USBTX, USBRX
-
-#define MBED_I2C0 p28, p27
-#define MBED_I2C1 p9, p10
-
-#define MBED_CAN0 p30, p29
-
-#define MBED_ANALOGOUT0 p18
-
-#define MBED_ANALOGIN0 p15
-#define MBED_ANALOGIN1 p16
-#define MBED_ANALOGIN2 p17
-#define MBED_ANALOGIN3 p18
-#define MBED_ANALOGIN4 p19
-#define MBED_ANALOGIN5 p20
-
-#define MBED_PWMOUT0 p26
-#define MBED_PWMOUT1 p25
-#define MBED_PWMOUT2 p24
-#define MBED_PWMOUT3 p23
-#define MBED_PWMOUT4 p22
-#define MBED_PWMOUT5 p21
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMR21G18A/PeripheralPins.h b/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMR21G18A/PeripheralPins.h
deleted file mode 100644
index 00119af27b..0000000000
--- a/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMR21G18A/PeripheralPins.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef MBED_PERIPHERALPINS_H
-#define MBED_PERIPHERALPINS_H
-
-#include "pinmap.h"
-#include "PeripheralNames.h"
-
-/************RTC***************/
-//extern const PinMap PinMap_RTC[];
-
-/************ADC***************/
-//extern const PinMap PinMap_ADC[];
-
-/************DAC***************/
-//extern const PinMap PinMap_DAC[];
-
-/************I2C***************/
-//extern const PinMap PinMap_I2C_SDA[];
-//extern const PinMap PinMap_I2C_SCL[];
-
-/************UART***************/
-//extern const PinMap PinMap_UART_TX[];
-//extern const PinMap PinMap_UART_RX[];
-
-/************SPI***************/
-//extern const PinMap PinMap_SPI_SCLK[];
-//extern const PinMap PinMap_SPI_MOSI[];
-//extern const PinMap PinMap_SPI_MISO[];
-//extern const PinMap PinMap_SPI_SSEL[];
-
-/************PWM***************/
-//extern const PinMap PinMap_PWM[];
-
-#endif
diff --git a/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMR21G18A/PinNames.h b/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMR21G18A/PinNames.h
deleted file mode 100644
index 50952b32e4..0000000000
--- a/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMR21G18A/PinNames.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2013 Nordic Semiconductor
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_PINNAMES_H
-#define MBED_PINNAMES_H
-
-#include "cmsis.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
- PIN_INPUT,
- PIN_OUTPUT,
- PIN_INPUT_OUTPUT //pin state can be set and read back
-} PinDirection;
-
-typedef enum {
- PA00 = 0,
- PA01 = 1,
- PA02 = 2,
- PA03 = 3,
- PA04 = 4,
- PA05 = 5,
- PA06 = 6,
- PA07 = 7,
- PA08 = 8,
- PA09 = 9,
- PA10 = 10,
- PA11 = 11,
- PA12 = 12,
- PA13 = 13,
- PA14 = 14,
- PA15 = 15,
- PA16 = 16,
- PA17 = 17,
- PA18 = 18,
- PA19 = 19,
- PA20 = 20,
- PA21 = 21,
- PA22 = 22,
- PA23 = 23,
- PA24 = 24,
- PA25 = 25,
- PA26 = 26,
- PA27 = 27,
- PA28 = 28,
- PA29 = 29,
- PA30 = 30,
- PA31 = 31,
-
- PB00 = 32,
- PB01 = 33,
- PB02 = 34,
- PB03 = 35,
- PB04 = 36,
- PB05 = 37,
- PB06 = 38,
- PB07 = 39,
- PB08 = 40,
- PB09 = 41,
- PB10 = 42,
- PB11 = 43,
- PB12 = 44,
- PB13 = 45,
- PB14 = 46,
- PB15 = 47,
- PB16 = 48,
- PB17 = 49,
- PB18 = 50,
- PB19 = 51,
- PB20 = 52,
- PB21 = 53,
- PB22 = 54,
- PB23 = 55,
- PB24 = 56,
- PB25 = 57,
- PB26 = 58,
- PB27 = 59,
- PB28 = 60,
- PB29 = 61,
- PB30 = 62,
- PB31 = 63,
-
- // Not connected
- NC = (int)0xFFFFFFFF
-} PinName;
-
-typedef enum {
- PullNone = 0,
- PullUp = 1,
- PullDown = 2,
- PullDefault = PullUp
-} PinMode;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMR21G18A/PortNames.h b/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMR21G18A/PortNames.h
deleted file mode 100644
index 887ba88482..0000000000
--- a/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMR21G18A/PortNames.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_PORTNAMES_H
-#define MBED_PORTNAMES_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
- PortA = 0,
- PortB = 1
-} PortName;
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMR21G18A/SAMR21_XPLAINED_PRO/mbed_overrides.c b/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMR21G18A/SAMR21_XPLAINED_PRO/mbed_overrides.c
index 000a33dd28..074e99efea 100644
--- a/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMR21G18A/SAMR21_XPLAINED_PRO/mbed_overrides.c
+++ b/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMR21G18A/SAMR21_XPLAINED_PRO/mbed_overrides.c
@@ -13,33 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-//#include "system.h"
#include "mbed_assert.h"
#include "compiler.h"
-//#include "core_cm0plus.h"
-//#include "comp_sysctrl.h"
-
-void system_clock_init(void)
-{
- // struct Sysctrl* syscontrol = 0x40000800UL;
- // syscontrol->INTFLAG.reg = SYSCTRL_INTFLAG_BOD33RDY | SYSCTRL_INTFLAG_BOD33DET |
- // SYSCTRL_INTFLAG_DFLLRDY;
-
-}
-
-void system_board_init(void)
-{
-
-}
-
//called before main - implement here if board needs it ortherwise, let
// the application override this if necessary
+ //TODO: To be implemented by adding system init and board init
void mbed_sdk_init()
{
- system_clock_init();
- system_board_init();
- // _system_events_init();
- // _system_extint_init();
+
}
/***************************************************************/
diff --git a/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMR21G18A/gpio_api.c b/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMR21G18A/gpio_api.c
deleted file mode 100644
index a19188c997..0000000000
--- a/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMR21G18A/gpio_api.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "mbed_assert.h"
-#include "pinmap.h"
-#include "PinNames.h"
-#include "gpio_object.h"
-#include "gpio_api.h"
-#include "compiler.h"
-
-uint32_t gpio_set(PinName pin) {
-
-}
-
-void gpio_init(gpio_t *obj, PinName pin) {
-
-}
-
-void gpio_mode(gpio_t *obj, PinMode mode) {
-
-}
-
-void gpio_dir(gpio_t *obj, PinDirection direction) {
-
-}
-
-
diff --git a/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMR21G18A/gpio_object.h b/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMR21G18A/gpio_object.h
deleted file mode 100644
index 1a0fb50315..0000000000
--- a/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMR21G18A/gpio_object.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_GPIO_OBJECT_H
-#define MBED_GPIO_OBJECT_H
-
-#include "mbed_assert.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct {
- PinName pin;
- uint32_t mask;
- uint8_t powersave;
-
- __IO uint32_t *OUTCLR;
- __IO uint32_t *OUTSET;
- __I uint32_t *IN;
-} gpio_t;
-
-static inline void gpio_write(gpio_t *obj, int value) {
- MBED_ASSERT(obj->pin != (PinName)NC);
- if (value)
- *obj->OUTSET = obj->mask;
- else
- *obj->OUTCLR = obj->mask;
-}
-
-static inline int gpio_read(gpio_t *obj) {
- MBED_ASSERT(obj->pin != (PinName)NC);
- return ((*obj->IN & obj->mask) ? 1 : 0);
-}
-
-static inline int gpio_is_connected(const gpio_t *obj) {
- return obj->pin != (PinName)NC;
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMR21G18A/objects.h b/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMR21G18A/objects.h
deleted file mode 100644
index 60daf4fce2..0000000000
--- a/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMR21G18A/objects.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_OBJECTS_H
-#define MBED_OBJECTS_H
-
-#include "cmsis.h"
-#include "PortNames.h"
-#include "PeripheralNames.h"
-#include "gpio_object.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct gpio_irq_s {
- uint32_t port;
- uint32_t pin;
- uint32_t ch;
-};
-
-struct port_s {
- __IO uint32_t *OUTCLR;
- __IO uint32_t *OUTSET;
- __I uint32_t *IN;
-
- PortName port;
- uint32_t mask;
-};
-/*
-struct pwmout_s {
- __IO uint32_t *MR;
- PWMName pwm;
-};
-
-struct serial_s {
- LPC_UART_TypeDef *uart;
- int index;
-};
-
-struct analogin_s {
- ADCName adc;
-};
-
-struct dac_s {
- DACName dac;
-};
-
-struct can_s {
- LPC_CAN_TypeDef *dev;
- int index;
-};
-
-struct i2c_s {
- LPC_I2C_TypeDef *i2c;
-};
-
-struct spi_s {
- LPC_SSP_TypeDef *spi;
-};
-*/
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMR21G18A/status_codes.h b/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMR21G18A/status_codes.h
deleted file mode 100644
index cd0f087332..0000000000
--- a/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMR21G18A/status_codes.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/**
- * \file
- *
- * \brief Status code definitions.
- *
- * This file defines various status codes returned by functions,
- * indicating success or failure as well as what kind of failure.
- *
- * Copyright (C) 2012-2014 Atmel Corporation. All rights reserved.
- *
- * \asf_license_start
- *
- * \page License
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * 3. The name of Atmel may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * 4. This software may only be redistributed and used in connection with an
- * Atmel microcontroller product.
- *
- * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
- * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * \asf_license_stop
- *
- */
- /**
- * Support and FAQ: visit Atmel Support
- */
-
-#ifndef STATUS_CODES_H_INCLUDED
-#define STATUS_CODES_H_INCLUDED
-
-#include
-
-/**
- * \defgroup group_sam0_utils_status_codes Status Codes
- *
- * \ingroup group_sam0_utils
- *
- * @{
- */
-
-/** Mask to retrieve the error category of a status code. */
-#define STATUS_CATEGORY_MASK 0xF0
-
-/** Mask to retrieve the error code within the category of a status code. */
-#define STATUS_ERROR_MASK 0x0F
-
-/** Status code error categories. */
-enum status_categories {
- STATUS_CATEGORY_OK = 0x00,
- STATUS_CATEGORY_COMMON = 0x10,
- STATUS_CATEGORY_ANALOG = 0x30,
- STATUS_CATEGORY_COM = 0x40,
- STATUS_CATEGORY_IO = 0x50,
-};
-
-/**
- * Status code that may be returned by shell commands and protocol
- * implementations.
- *
- * \note Any change to these status codes and the corresponding
- * message strings is strictly forbidden. New codes can be added,
- * however, but make sure that any message string tables are updated
- * at the same time.
- */
-enum status_code {
- STATUS_OK = STATUS_CATEGORY_OK | 0x00,
- STATUS_VALID_DATA = STATUS_CATEGORY_OK | 0x01,
- STATUS_NO_CHANGE = STATUS_CATEGORY_OK | 0x02,
- STATUS_ABORTED = STATUS_CATEGORY_OK | 0x04,
- STATUS_BUSY = STATUS_CATEGORY_OK | 0x05,
- STATUS_SUSPEND = STATUS_CATEGORY_OK | 0x06,
-
- STATUS_ERR_IO = STATUS_CATEGORY_COMMON | 0x00,
- STATUS_ERR_REQ_FLUSHED = STATUS_CATEGORY_COMMON | 0x01,
- STATUS_ERR_TIMEOUT = STATUS_CATEGORY_COMMON | 0x02,
- STATUS_ERR_BAD_DATA = STATUS_CATEGORY_COMMON | 0x03,
- STATUS_ERR_NOT_FOUND = STATUS_CATEGORY_COMMON | 0x04,
- STATUS_ERR_UNSUPPORTED_DEV = STATUS_CATEGORY_COMMON | 0x05,
- STATUS_ERR_NO_MEMORY = STATUS_CATEGORY_COMMON | 0x06,
- STATUS_ERR_INVALID_ARG = STATUS_CATEGORY_COMMON | 0x07,
- STATUS_ERR_BAD_ADDRESS = STATUS_CATEGORY_COMMON | 0x08,
- STATUS_ERR_BAD_FORMAT = STATUS_CATEGORY_COMMON | 0x0A,
- STATUS_ERR_BAD_FRQ = STATUS_CATEGORY_COMMON | 0x0B,
- STATUS_ERR_DENIED = STATUS_CATEGORY_COMMON | 0x0c,
- STATUS_ERR_ALREADY_INITIALIZED = STATUS_CATEGORY_COMMON | 0x0d,
- STATUS_ERR_OVERFLOW = STATUS_CATEGORY_COMMON | 0x0e,
- STATUS_ERR_NOT_INITIALIZED = STATUS_CATEGORY_COMMON | 0x0f,
-
- STATUS_ERR_SAMPLERATE_UNAVAILABLE = STATUS_CATEGORY_ANALOG | 0x00,
- STATUS_ERR_RESOLUTION_UNAVAILABLE = STATUS_CATEGORY_ANALOG | 0x01,
-
- STATUS_ERR_BAUDRATE_UNAVAILABLE = STATUS_CATEGORY_COM | 0x00,
- STATUS_ERR_PACKET_COLLISION = STATUS_CATEGORY_COM | 0x01,
- STATUS_ERR_PROTOCOL = STATUS_CATEGORY_COM | 0x02,
-
- STATUS_ERR_PIN_MUX_INVALID = STATUS_CATEGORY_IO | 0x00,
-};
-typedef enum status_code status_code_genare_t;
-
-/**
- Status codes used by MAC stack.
- */
-enum status_code_wireless {
- //STATUS_OK = 0, //!< Success
- ERR_IO_ERROR = -1, //!< I/O error
- ERR_FLUSHED = -2, //!< Request flushed from queue
- ERR_TIMEOUT = -3, //!< Operation timed out
- ERR_BAD_DATA = -4, //!< Data integrity check failed
- ERR_PROTOCOL = -5, //!< Protocol error
- ERR_UNSUPPORTED_DEV = -6, //!< Unsupported device
- ERR_NO_MEMORY = -7, //!< Insufficient memory
- ERR_INVALID_ARG = -8, //!< Invalid argument
- ERR_BAD_ADDRESS = -9, //!< Bad address
- ERR_BUSY = -10, //!< Resource is busy
- ERR_BAD_FORMAT = -11, //!< Data format not recognized
- ERR_NO_TIMER = -12, //!< No timer available
- ERR_TIMER_ALREADY_RUNNING = -13, //!< Timer already running
- ERR_TIMER_NOT_RUNNING = -14, //!< Timer not running
-
- /**
- * \brief Operation in progress
- *
- * This status code is for driver-internal use when an operation
- * is currently being performed.
- *
- * \note Drivers should never return this status code to any
- * callers. It is strictly for internal use.
- */
- OPERATION_IN_PROGRESS = -128,
-};
-
-typedef enum status_code_wireless status_code_t;
-
-/** @} */
-
-#endif /* STATUS_CODES_H_INCLUDED */
diff --git a/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMR21G18A/us_ticker.c b/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMR21G18A/us_ticker.c
deleted file mode 100644
index 9189381b01..0000000000
--- a/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMR21G18A/us_ticker.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include
-#include "us_ticker_api.h"
-#include "cmsis.h"
-#include "mbed_assert.h"
-#include "ins_gclk.h"
-#include "compiler.h"
-
-void us_ticker_irq_handler_internal(void)
-{
-
-}
-
-void us_ticker_init(void)
-{
-
-}
-
-uint32_t us_ticker_read()
-{
-
-}
-
-void us_ticker_set_interrupt(timestamp_t timestamp)
-{
-
-}
-
-void us_ticker_clear_interrupt(void)
-{
-
-}
-/***************************************************************/
diff --git a/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/gpio_api.c b/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/gpio_api.c
new file mode 100644
index 0000000000..92f68bb8f2
--- /dev/null
+++ b/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/gpio_api.c
@@ -0,0 +1,72 @@
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "mbed_assert.h"
+#include "PinNames.h"
+#include "gpio_object.h"
+#include "gpio_api.h"
+#include "compiler.h"
+#include "port.h"
+
+void pin_mode(PinName pin, PinMode mode) { // Kept as dummy function. configuration settings already taken care in gpio_dir function
+ MBED_ASSERT(pin != (PinName)NC);
+}
+
+uint32_t gpio_set(PinName pin) {
+ MBED_ASSERT(pin != (PinName)NC);
+ return (1UL << (pin % 32));
+}
+
+void gpio_init(gpio_t *obj, PinName pin) {
+ MBED_ASSERT(pin != (PinName)NC);
+ struct port_config pin_conf;
+ PortGroup *const port_base = (PortGroup*)port_get_group_from_gpio_pin(pin);
+
+ obj->pin = pin;
+ if (pin == (PinName)NC)
+ return;
+
+ obj->mask = gpio_set(pin);
+ port_get_config_defaults(&pin_conf);
+ obj->powersave = pin_conf.powersave;
+ port_pin_set_config(pin, &pin_conf);
+
+ obj->OUTCLR = &port_base->OUTCLR.reg;
+ obj->OUTSET = &port_base->OUTSET.reg;
+ obj->IN = &port_base->IN.reg;
+}
+
+void gpio_mode(gpio_t *obj, PinMode mode) {
+ pin_mode(obj->pin, mode);
+}
+
+void gpio_dir(gpio_t *obj, PinDirection direction) {
+ MBED_ASSERT(obj->pin != (PinName)NC);
+ struct port_config pin_conf;
+ port_get_config_defaults(&pin_conf);
+ switch (direction) {
+ case PIN_INPUT :
+ pin_conf.direction = PORT_PIN_DIR_INPUT;
+ pin_conf.input_pull = PORT_PIN_PULL_UP;
+ break;
+ case PIN_OUTPUT:
+ pin_conf.direction = PORT_PIN_DIR_OUTPUT;
+ break;
+ case PIN_INPUT_OUTPUT:
+ pin_conf.direction = PORT_PIN_DIR_OUTPUT;
+ break;
+ }
+ port_pin_set_config(obj->pin, &pin_conf);
+}
diff --git a/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMD21J18A/gpio_object.h b/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/gpio_object.h
similarity index 100%
rename from libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMD21J18A/gpio_object.h
rename to libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/gpio_object.h
diff --git a/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMD21J18A/objects.h b/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/objects.h
similarity index 100%
rename from libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMD21J18A/objects.h
rename to libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/objects.h
diff --git a/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMD21J18A/us_ticker.c b/libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/us_ticker.c
similarity index 100%
rename from libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/TARGET_SAMD21J18A/us_ticker.c
rename to libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM21/us_ticker.c