diff options
| author | Scott Shawcroft <scott@tannewt.org> | 2017-09-22 18:05:51 -0700 |
|---|---|---|
| committer | Dan Halbert <halbert@halwitz.org> | 2017-09-22 21:05:51 -0400 |
| commit | 6839fff31303463d5c7942387fa498895edf1abf (patch) | |
| tree | f4c5b94c6534c8d5c65ea6b7209cd2d681508f5f /atmel-samd/boards | |
| parent | 3ad01ddb04b160b74b4baee9fce043da17dbcef5 (diff) | |
Move to ASF4 and introduce SAMD51 support. (#258)3.0.0-alpha.0
* atmel-samd: Remove ASF3. This will break builds.
* atmel-samd: Add ASF4 for the SAMD21 and SAMD51.
* Introduce the supervisor concept to facilitate porting.
The supervisor is the code which runs individual MicroPython VMs. By
splitting it out we make it more consistent and easier to find.
This also adds very basic SAMD21 and SAMD51 support using the
supervisor. Only the REPL currently works.
This begins the work for #178.
Diffstat (limited to 'atmel-samd/boards')
60 files changed, 507 insertions, 2896 deletions
diff --git a/atmel-samd/boards/arduino_zero/board.c b/atmel-samd/boards/arduino_zero/board.c index b5d7b328b..2dc1683ea 100644 --- a/atmel-samd/boards/arduino_zero/board.c +++ b/atmel-samd/boards/arduino_zero/board.c @@ -25,20 +25,18 @@ */ #include "boards/board.h" -#include "asf/sam0/drivers/port/port.h" #include "mpconfigboard.h" +#include "hal/include/hal_gpio.h" void board_init(void) { - struct port_config pin_conf; - port_get_config_defaults(&pin_conf); + gpio_set_pin_function(MICROPY_HW_LED_TX, GPIO_PIN_FUNCTION_OFF); + gpio_set_pin_direction(MICROPY_HW_LED_TX, GPIO_DIRECTION_OUT); + gpio_set_pin_level(MICROPY_HW_LED_TX, true); - pin_conf.direction = PORT_PIN_DIR_OUTPUT; - port_pin_set_config(MICROPY_HW_LED_TX, &pin_conf); - port_pin_set_output_level(MICROPY_HW_LED_TX, true); - - port_pin_set_config(MICROPY_HW_LED_RX, &pin_conf); - port_pin_set_output_level(MICROPY_HW_LED_RX, true); + gpio_set_pin_function(MICROPY_HW_LED_RX, GPIO_PIN_FUNCTION_OFF); + gpio_set_pin_direction(MICROPY_HW_LED_RX, GPIO_DIRECTION_OUT); + gpio_set_pin_level(MICROPY_HW_LED_RX, true); } bool board_requests_safe_mode(void) { diff --git a/atmel-samd/boards/arduino_zero/conf_access.h b/atmel-samd/boards/arduino_zero/conf_access.h deleted file mode 100644 index 25109b75c..000000000 --- a/atmel-samd/boards/arduino_zero/conf_access.h +++ /dev/null @@ -1,115 +0,0 @@ -/** - * \file - * - * \brief Memory access control configuration file. - * - * Copyright (c) 2014-2015 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 <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#ifndef _CONF_ACCESS_H_ -#define _CONF_ACCESS_H_ - -#include "compiler.h" -#include "board.h" - - -/*! \name Activation of Logical Unit Numbers - */ -//! @{ -#define LUN_0 ENABLE //!< On-Chip Virtual Memory. -#define LUN_1 DISABLE //!< AT45DBX Data Flash. -#define LUN_2 DISABLE //!< SD/MMC Card over SPI. -#define LUN_3 DISABLE //!< SD/MMC Card over MCI Slot 0. -#define LUN_4 DISABLE -#define LUN_5 DISABLE -#define LUN_6 DISABLE -#define LUN_7 DISABLE -#define LUN_USB DISABLE //!< Host Mass-Storage Memory. -//! @} - -/*! \name LUN 0 Definitions - */ -//! @{ -#define LUN_0_INCLUDE "access_vfs.h" -#define Lun_0_test_unit_ready vfs_test_unit_ready -#define Lun_0_read_capacity vfs_read_capacity -#define Lun_0_unload NULL -#define Lun_0_wr_protect vfs_wr_protect -#define Lun_0_removal vfs_removal -#define Lun_0_usb_read_10 vfs_usb_read_10 -#define Lun_0_usb_write_10 vfs_usb_write_10 -#define LUN_0_NAME "\"MicroPython VFS[0]\"" -//! @} - -#define MEM_USB LUN_USB - -/*! \name Actions Associated with Memory Accesses - * - * Write here the action to associate with each memory access. - * - * \warning Be careful not to waste time in order not to disturb the functions. - */ -//! @{ -#define memory_start_read_action(nb_sectors) -#define memory_stop_read_action() -#define memory_start_write_action(nb_sectors) -#define memory_stop_write_action() -//! @} - -/*! \name Activation of Interface Features - */ -//! @{ -#define ACCESS_USB true //!< MEM <-> USB interface. -#define ACCESS_MEM_TO_RAM false //!< MEM <-> RAM interface. -#define ACCESS_STREAM false //!< Streaming MEM <-> MEM interface. -#define ACCESS_STREAM_RECORD false //!< Streaming MEM <-> MEM interface in record mode. -#define ACCESS_MEM_TO_MEM false //!< MEM <-> MEM interface. -#define ACCESS_CODEC false //!< Codec interface. -//! @} - -/*! \name Specific Options for Access Control - */ -//! @{ -#define GLOBAL_WR_PROTECT false //!< Management of a global write protection. -//! @} - - -#endif // _CONF_ACCESS_H_ diff --git a/atmel-samd/boards/arduino_zero/conf_board.h b/atmel-samd/boards/arduino_zero/conf_board.h deleted file mode 100644 index 7b88c97fc..000000000 --- a/atmel-samd/boards/arduino_zero/conf_board.h +++ /dev/null @@ -1,14 +0,0 @@ -/** - * \file - * - * \brief User board configuration template - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#ifndef CONF_BOARD_H -#define CONF_BOARD_H - -#endif // CONF_BOARD_H diff --git a/atmel-samd/boards/arduino_zero/conf_clocks.h b/atmel-samd/boards/arduino_zero/conf_clocks.h deleted file mode 100644 index d3f3e6496..000000000 --- a/atmel-samd/boards/arduino_zero/conf_clocks.h +++ /dev/null @@ -1 +0,0 @@ -#include "conf_clocks_external_32k.h" diff --git a/atmel-samd/boards/arduino_zero/conf_usb.h b/atmel-samd/boards/arduino_zero/conf_usb.h deleted file mode 100644 index 98c9abe89..000000000 --- a/atmel-samd/boards/arduino_zero/conf_usb.h +++ /dev/null @@ -1,220 +0,0 @@ - -#include <stdbool.h> -#include <stdint.h> - -#include "asf/common/services/usb/class/cdc/usb_protocol_cdc.h" - -#ifndef CONF_USB_H_INCLUDED -#define CONF_USB_H_INCLUDED - -#define USB_DEVICE_MAJOR_VERSION 1 -#define USB_DEVICE_MINOR_VERSION 0 -#define USB_DEVICE_POWER 100 // Consumption on Vbus line (mA) -#define USB_DEVICE_ATTR \ - (USB_CONFIG_ATTR_BUS_POWERED) -// (USB_CONFIG_ATTR_REMOTE_WAKEUP|USB_CONFIG_ATTR_SELF_POWERED) -// (USB_CONFIG_ATTR_REMOTE_WAKEUP|USB_CONFIG_ATTR_BUS_POWERED) - -//! USB Device string definitions (Optional) -#ifndef USB_DEVICE_MANUFACTURE_NAME -# define USB_DEVICE_MANUFACTURE_NAME "Arduino LLC" -#endif - -#ifndef USB_DEVICE_PRODUCT_NAME -# define USB_DEVICE_PRODUCT_NAME "Arduino Zero" -#endif -// #define USB_DEVICE_SERIAL_NAME "12...EF" -#define USB_DEVICE_GET_SERIAL_NAME_POINTER serial_number -#define USB_DEVICE_GET_SERIAL_NAME_LENGTH 32 -extern char serial_number[USB_DEVICE_GET_SERIAL_NAME_LENGTH]; - -//! Control endpoint size -#define USB_DEVICE_EP_CTRL_SIZE 64 - -//! Interfaces for this device (CDC COM + CDC DATA + MSC + HID mouse + HID kbd) -#define USB_DEVICE_NB_INTERFACE 5 - -// (3 | USB_EP_DIR_IN) // CDC Notify endpoint -// (4 | USB_EP_DIR_IN) // CDC TX -// (5 | USB_EP_DIR_OUT) // CDC RX -// (1 | USB_EP_DIR_IN) // MSC IN -// (2 | USB_EP_DIR_OUT) // MSC OUT -// (6 | USB_EP_DIR_IN) // HID mouse report -// (7 | USB_EP_DIR_IN) // HID keyboard report -#define USB_DEVICE_MAX_EP 7 - -#define UDI_CDC_PORT_NB 1 -#define UDI_CDC_ENABLE_EXT(port) mp_cdc_enable(port) -extern bool mp_cdc_enable(uint8_t port); -#define UDI_CDC_DISABLE_EXT(port) mp_cdc_disable(port) -extern void mp_cdc_disable(uint8_t port); -#define UDI_CDC_LOW_RATE - -#define UDI_CDC_DEFAULT_RATE 115200 -#define UDI_CDC_DEFAULT_STOPBITS CDC_STOP_BITS_1 -#define UDI_CDC_DEFAULT_PARITY CDC_PAR_NONE -#define UDI_CDC_DEFAULT_DATABITS 8 - -#define UDI_CDC_RX_NOTIFY(port) usb_rx_notify() -void usb_rx_notify(void); -#define UDI_CDC_SET_CODING_EXT(port,cfg) usb_coding_notify(port, cfg) -void usb_coding_notify(uint8_t port, usb_cdc_line_coding_t* coding); -#define UDI_CDC_SET_DTR_EXT(port,set) usb_dtr_notify(port, set) -void usb_dtr_notify(uint8_t port, bool set); -#define UDI_CDC_SET_RTS_EXT(port,set) usb_rts_notify(port, set) -void usb_rts_notify(uint8_t port, bool set); - -/** - * USB CDC low level configuration - * In standalone these configurations are defined by the CDC module. - * For composite device, these configuration must be defined here - * @{ - */ -//! Endpoint numbers definition - -#define UDI_CDC_COMM_EP_0 (3 | USB_EP_DIR_IN) // Notify endpoint -#define UDI_CDC_DATA_EP_IN_0 (4 | USB_EP_DIR_IN) // TX -#define UDI_CDC_DATA_EP_OUT_0 (5 | USB_EP_DIR_OUT) // RX - -//! Interface numbers -#define UDI_CDC_COMM_IFACE_NUMBER_0 0 -#define UDI_CDC_DATA_IFACE_NUMBER_0 1 - -/** - * Configuration of MSC interface - * @{ - */ -//! Vendor name and Product version of MSC interface -#define UDI_MSC_GLOBAL_VENDOR_ID \ - 'A', 'T', 'M', 'E', 'L', ' ', ' ', ' ' -#define UDI_MSC_GLOBAL_PRODUCT_VERSION \ - '1', '.', '0', '0' - -//! Interface callback definition -#define UDI_MSC_ENABLE_EXT() mp_msc_enable() -extern bool mp_msc_enable(void); -#define UDI_MSC_DISABLE_EXT() mp_msc_disable() -extern void mp_msc_disable(void); - -//! Enable id string of interface to add an extra USB string -#define UDI_MSC_STRING_ID 5 - -/** - * USB MSC low level configuration - * In standalone these configurations are defined by the MSC module. - * For composite device, these configuration must be defined here - * @{ - */ -//! Endpoint numbers definition -#define UDI_MSC_EP_IN (1 | USB_EP_DIR_IN) -#define UDI_MSC_EP_OUT (2 | USB_EP_DIR_OUT) - -//! Interface number -#define UDI_MSC_IFACE_NUMBER 2 -/** - * Configuration of HID Mouse interface - * @{ - */ -//! Interface callback definition -#define UDI_HID_MOUSE_ENABLE_EXT() mp_mouse_enable() -extern bool mp_mouse_enable(void); -#define UDI_HID_MOUSE_DISABLE_EXT() mp_mouse_disable() -extern void mp_mouse_disable(void); - -//! Enable id string of interface to add an extra USB string -#define UDI_HID_MOUSE_STRING_ID 6 - -/** - * USB HID Mouse low level configuration - * In standalone these configurations are defined by the HID Mouse module. - * For composite device, these configuration must be defined here - * @{ - */ -//! Endpoint numbers definition -#define UDI_HID_MOUSE_EP_IN (6 | USB_EP_DIR_IN) - -//! Interface number -#define UDI_HID_MOUSE_IFACE_NUMBER 3 -//@} -//@} - -/** - * Configuration of HID Keyboard interface - * @{ - */ -//! Interface callback definition -#define UDI_HID_KBD_ENABLE_EXT() mp_keyboard_enable() -extern bool mp_keyboard_enable(void); -#define UDI_HID_KBD_DISABLE_EXT() mp_keyboard_disable() -extern void mp_keyboard_disable(void); -#define UDI_HID_KBD_CHANGE_LED(value) mp_keyboard_led(value) -extern void mp_keyboard_led(uint8_t); - -//! Enable id string of interface to add an extra USB string -#define UDI_HID_KBD_STRING_ID 7 - -/** - * USB HID Keyboard low level configuration - * In standalone these configurations are defined by the HID Keyboard module. - * For composite device, these configuration must be defined here - * @{ - */ -//! Endpoint numbers definition -#define UDI_HID_KBD_EP_IN (7 | USB_EP_DIR_IN) - -//! Interface number -#define UDI_HID_KBD_IFACE_NUMBER 4 - -/** - * Description of Composite Device - * @{ - */ -//! USB Interfaces descriptor structure -#define UDI_COMPOSITE_DESC_T \ - usb_iad_desc_t udi_cdc_iad; \ - udi_cdc_comm_desc_t udi_cdc_comm; \ - udi_cdc_data_desc_t udi_cdc_data; \ - udi_msc_desc_t udi_msc; \ - udi_hid_mouse_desc_t udi_hid_mouse; \ - udi_hid_kbd_desc_t udi_hid_kbd - -//! USB Interfaces descriptor value for Full Speed -#define UDI_COMPOSITE_DESC_FS \ - .udi_cdc_iad = UDI_CDC_IAD_DESC_0, \ - .udi_cdc_comm = UDI_CDC_COMM_DESC_0, \ - .udi_cdc_data = UDI_CDC_DATA_DESC_0_FS, \ - .udi_msc = UDI_MSC_DESC_FS, \ - .udi_hid_mouse = UDI_HID_MOUSE_DESC, \ - .udi_hid_kbd = UDI_HID_KBD_DESC - -//! USB Interfaces descriptor value for High Speed -#define UDI_COMPOSITE_DESC_HS \ - .udi_cdc_iad = UDI_CDC_IAD_DESC_0, \ - .udi_cdc_comm = UDI_CDC_COMM_DESC_0, \ - .udi_cdc_data = UDI_CDC_DATA_DESC_0_HS, \ - .udi_msc = UDI_MSC_DESC_HS, \ - .udi_hid_mouse = UDI_HID_MOUSE_DESC, \ - .udi_hid_kbd = UDI_HID_KBD_DESC - -//! USB Interface APIs -#define UDI_COMPOSITE_API \ - &udi_api_cdc_comm, \ - &udi_api_cdc_data, \ - &udi_api_msc, \ - &udi_api_hid_mouse, \ - &udi_api_hid_kbd -//@} - -/** - * USB Device Driver Configuration - * @{ - */ -//@} - -//! The includes of classes and other headers must be done at the end of this file to avoid compile error -#include "udi_cdc.h" -#include "udi_msc.h" -#include "udi_hid_mouse.h" -#include "udi_hid_kbd.h" - -#endif diff --git a/atmel-samd/boards/arduino_zero/mpconfigboard.h b/atmel-samd/boards/arduino_zero/mpconfigboard.h index 149963840..e17d599f4 100644 --- a/atmel-samd/boards/arduino_zero/mpconfigboard.h +++ b/atmel-samd/boards/arduino_zero/mpconfigboard.h @@ -9,6 +9,7 @@ #define MICROPY_PORT_A (PORT_PA24 | PORT_PA25 | PORT_PA27) #define MICROPY_PORT_B (PORT_PB03) +#define MICROPY_PORT_C (0) #include "internal_flash.h" diff --git a/atmel-samd/boards/arduino_zero/mpconfigboard.mk b/atmel-samd/boards/arduino_zero/mpconfigboard.mk index 9ea93525d..d6621cada 100644 --- a/atmel-samd/boards/arduino_zero/mpconfigboard.mk +++ b/atmel-samd/boards/arduino_zero/mpconfigboard.mk @@ -5,3 +5,4 @@ USB_PID = 0x824D FLASH_IMPL = internal_flash.c CHIP_VARIANT = SAMD21G18A +CHIP_FAMILY = samd21 diff --git a/atmel-samd/boards/circuitplayground_express/board.c b/atmel-samd/boards/circuitplayground_express/board.c index 58cc55a16..4467180c7 100644 --- a/atmel-samd/boards/circuitplayground_express/board.c +++ b/atmel-samd/boards/circuitplayground_express/board.c @@ -27,8 +27,8 @@ #include <string.h> #include "boards/board.h" -#include "asf/sam0/drivers/port/port.h" #include "common-hal/microcontroller/Pin.h" +#include "hal/include/hal_gpio.h" #include "shared-bindings/digitalio/DigitalInOut.h" #include "shared-bindings/neopixel_write/__init__.h" #include "samd21_pins.h" @@ -40,14 +40,15 @@ void board_init(void) // Check the status of the two buttons on CircuitPlayground Express. If both are // pressed, then boot into user safe mode. bool board_requests_safe_mode(void) { - struct port_config pin_conf; - port_get_config_defaults(&pin_conf); - pin_conf.direction = PORT_PIN_DIR_INPUT; - pin_conf.input_pull = PORT_PIN_PULL_DOWN; - port_pin_set_config(PIN_PA14, &pin_conf); - port_pin_set_config(PIN_PA28, &pin_conf); - bool safe_mode = port_pin_get_input_level(PIN_PA14) && - port_pin_get_input_level(PIN_PA28); + gpio_set_pin_function(PIN_PA14, GPIO_PIN_FUNCTION_OFF); + gpio_set_pin_direction(PIN_PA14, GPIO_DIRECTION_IN); + gpio_set_pin_pull_mode(PIN_PA14, GPIO_PULL_DOWN); + + gpio_set_pin_function(PIN_PA28, GPIO_PIN_FUNCTION_OFF); + gpio_set_pin_direction(PIN_PA28, GPIO_DIRECTION_IN); + gpio_set_pin_pull_mode(PIN_PA28, GPIO_PULL_DOWN); + bool safe_mode = gpio_get_pin_level(PIN_PA14) && + gpio_get_pin_level(PIN_PA28); reset_pin(PIN_PA14); reset_pin(PIN_PA28); return safe_mode; @@ -60,6 +61,6 @@ void reset_board(void) { common_hal_digitalio_digitalinout_construct(&neopixel_pin, &pin_PB23); common_hal_digitalio_digitalinout_switch_to_output(&neopixel_pin, false, DRIVE_MODE_PUSH_PULL); - common_hal_neopixel_write(&neopixel_pin, empty, 30); + // common_hal_neopixel_write(&neopixel_pin, empty, 30); common_hal_digitalio_digitalinout_deinit(&neopixel_pin); } diff --git a/atmel-samd/boards/circuitplayground_express/conf_access.h b/atmel-samd/boards/circuitplayground_express/conf_access.h deleted file mode 100644 index 25109b75c..000000000 --- a/atmel-samd/boards/circuitplayground_express/conf_access.h +++ /dev/null @@ -1,115 +0,0 @@ -/** - * \file - * - * \brief Memory access control configuration file. - * - * Copyright (c) 2014-2015 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 <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#ifndef _CONF_ACCESS_H_ -#define _CONF_ACCESS_H_ - -#include "compiler.h" -#include "board.h" - - -/*! \name Activation of Logical Unit Numbers - */ -//! @{ -#define LUN_0 ENABLE //!< On-Chip Virtual Memory. -#define LUN_1 DISABLE //!< AT45DBX Data Flash. -#define LUN_2 DISABLE //!< SD/MMC Card over SPI. -#define LUN_3 DISABLE //!< SD/MMC Card over MCI Slot 0. -#define LUN_4 DISABLE -#define LUN_5 DISABLE -#define LUN_6 DISABLE -#define LUN_7 DISABLE -#define LUN_USB DISABLE //!< Host Mass-Storage Memory. -//! @} - -/*! \name LUN 0 Definitions - */ -//! @{ -#define LUN_0_INCLUDE "access_vfs.h" -#define Lun_0_test_unit_ready vfs_test_unit_ready -#define Lun_0_read_capacity vfs_read_capacity -#define Lun_0_unload NULL -#define Lun_0_wr_protect vfs_wr_protect -#define Lun_0_removal vfs_removal -#define Lun_0_usb_read_10 vfs_usb_read_10 -#define Lun_0_usb_write_10 vfs_usb_write_10 -#define LUN_0_NAME "\"MicroPython VFS[0]\"" -//! @} - -#define MEM_USB LUN_USB - -/*! \name Actions Associated with Memory Accesses - * - * Write here the action to associate with each memory access. - * - * \warning Be careful not to waste time in order not to disturb the functions. - */ -//! @{ -#define memory_start_read_action(nb_sectors) -#define memory_stop_read_action() -#define memory_start_write_action(nb_sectors) -#define memory_stop_write_action() -//! @} - -/*! \name Activation of Interface Features - */ -//! @{ -#define ACCESS_USB true //!< MEM <-> USB interface. -#define ACCESS_MEM_TO_RAM false //!< MEM <-> RAM interface. -#define ACCESS_STREAM false //!< Streaming MEM <-> MEM interface. -#define ACCESS_STREAM_RECORD false //!< Streaming MEM <-> MEM interface in record mode. -#define ACCESS_MEM_TO_MEM false //!< MEM <-> MEM interface. -#define ACCESS_CODEC false //!< Codec interface. -//! @} - -/*! \name Specific Options for Access Control - */ -//! @{ -#define GLOBAL_WR_PROTECT false //!< Management of a global write protection. -//! @} - - -#endif // _CONF_ACCESS_H_ diff --git a/atmel-samd/boards/circuitplayground_express/conf_board.h b/atmel-samd/boards/circuitplayground_express/conf_board.h deleted file mode 100644 index 7b88c97fc..000000000 --- a/atmel-samd/boards/circuitplayground_express/conf_board.h +++ /dev/null @@ -1,14 +0,0 @@ -/** - * \file - * - * \brief User board configuration template - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#ifndef CONF_BOARD_H -#define CONF_BOARD_H - -#endif // CONF_BOARD_H diff --git a/atmel-samd/boards/circuitplayground_express/conf_clocks.h b/atmel-samd/boards/circuitplayground_express/conf_clocks.h deleted file mode 100644 index 9e4f7876b..000000000 --- a/atmel-samd/boards/circuitplayground_express/conf_clocks.h +++ /dev/null @@ -1 +0,0 @@ -#include "conf_clocks_crystalless.h" diff --git a/atmel-samd/boards/circuitplayground_express/conf_dma.h b/atmel-samd/boards/circuitplayground_express/conf_dma.h deleted file mode 100644 index ffb71f634..000000000 --- a/atmel-samd/boards/circuitplayground_express/conf_dma.h +++ /dev/null @@ -1,51 +0,0 @@ -/** - * \file - * - * \brief SAM D21 Direct Memory Access Driver Configuration Header - * - * Copyright (C) 2014-2015 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 <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#ifndef CONF_DMA_H_INCLUDED -#define CONF_DMA_H_INCLUDED - -# define CONF_MAX_USED_CHANNEL_NUM 1 - -#endif diff --git a/atmel-samd/boards/circuitplayground_express/conf_usb.h b/atmel-samd/boards/circuitplayground_express/conf_usb.h deleted file mode 100644 index 971bee331..000000000 --- a/atmel-samd/boards/circuitplayground_express/conf_usb.h +++ /dev/null @@ -1,220 +0,0 @@ - -#include <stdbool.h> -#include <stdint.h> - -#include "asf/common/services/usb/class/cdc/usb_protocol_cdc.h" - -#ifndef CONF_USB_H_INCLUDED -#define CONF_USB_H_INCLUDED - -#define USB_DEVICE_MAJOR_VERSION 1 -#define USB_DEVICE_MINOR_VERSION 0 -#define USB_DEVICE_POWER 100 // Consumption on Vbus line (mA) -#define USB_DEVICE_ATTR \ - (USB_CONFIG_ATTR_BUS_POWERED) -// (USB_CONFIG_ATTR_REMOTE_WAKEUP|USB_CONFIG_ATTR_SELF_POWERED) -// (USB_CONFIG_ATTR_REMOTE_WAKEUP|USB_CONFIG_ATTR_BUS_POWERED) - -//! USB Device string definitions (Optional) -#ifndef USB_DEVICE_MANUFACTURE_NAME -# define USB_DEVICE_MANUFACTURE_NAME "Adafruit Industries" -#endif - -#ifndef USB_DEVICE_PRODUCT_NAME -# define USB_DEVICE_PRODUCT_NAME "CircuitPlayground Express" -#endif -// #define USB_DEVICE_SERIAL_NAME "12...EF" -#define USB_DEVICE_GET_SERIAL_NAME_POINTER serial_number -#define USB_DEVICE_GET_SERIAL_NAME_LENGTH 32 -extern char serial_number[USB_DEVICE_GET_SERIAL_NAME_LENGTH]; - -//! Control endpoint size -#define USB_DEVICE_EP_CTRL_SIZE 64 - -//! Interfaces for this device (CDC COM + CDC DATA + MSC + HID mouse + HID kbd) -#define USB_DEVICE_NB_INTERFACE 5 - -// (3 | USB_EP_DIR_IN) // CDC Notify endpoint -// (4 | USB_EP_DIR_IN) // CDC TX -// (5 | USB_EP_DIR_OUT) // CDC RX -// (1 | USB_EP_DIR_IN) // MSC IN -// (2 | USB_EP_DIR_OUT) // MSC OUT -// (6 | USB_EP_DIR_IN) // HID mouse report -// (7 | USB_EP_DIR_IN) // HID keyboard report -#define USB_DEVICE_MAX_EP 7 - -#define UDI_CDC_PORT_NB 1 -#define UDI_CDC_ENABLE_EXT(port) mp_cdc_enable(port) -extern bool mp_cdc_enable(uint8_t port); -#define UDI_CDC_DISABLE_EXT(port) mp_cdc_disable(port) -extern void mp_cdc_disable(uint8_t port); -#define UDI_CDC_LOW_RATE - -#define UDI_CDC_DEFAULT_RATE 115200 -#define UDI_CDC_DEFAULT_STOPBITS CDC_STOP_BITS_1 -#define UDI_CDC_DEFAULT_PARITY CDC_PAR_NONE -#define UDI_CDC_DEFAULT_DATABITS 8 - -#define UDI_CDC_RX_NOTIFY(port) usb_rx_notify() -void usb_rx_notify(void); -#define UDI_CDC_SET_CODING_EXT(port,cfg) usb_coding_notify(port, cfg) -void usb_coding_notify(uint8_t port, usb_cdc_line_coding_t* coding); -#define UDI_CDC_SET_DTR_EXT(port,set) usb_dtr_notify(port, set) -void usb_dtr_notify(uint8_t port, bool set); -#define UDI_CDC_SET_RTS_EXT(port,set) usb_rts_notify(port, set) -void usb_rts_notify(uint8_t port, bool set); - -/** - * USB CDC low level configuration - * In standalone these configurations are defined by the CDC module. - * For composite device, these configuration must be defined here - * @{ - */ -//! Endpoint numbers definition - -#define UDI_CDC_COMM_EP_0 (3 | USB_EP_DIR_IN) // Notify endpoint -#define UDI_CDC_DATA_EP_IN_0 (4 | USB_EP_DIR_IN) // TX -#define UDI_CDC_DATA_EP_OUT_0 (5 | USB_EP_DIR_OUT) // RX - -//! Interface numbers -#define UDI_CDC_COMM_IFACE_NUMBER_0 0 -#define UDI_CDC_DATA_IFACE_NUMBER_0 1 - -/** - * Configuration of MSC interface - * @{ - */ -//! Vendor name and Product version of MSC interface -#define UDI_MSC_GLOBAL_VENDOR_ID \ - 'A', 'T', 'M', 'E', 'L', ' ', ' ', ' ' -#define UDI_MSC_GLOBAL_PRODUCT_VERSION \ - '1', '.', '0', '0' - -//! Interface callback definition -#define UDI_MSC_ENABLE_EXT() mp_msc_enable() -extern bool mp_msc_enable(void); -#define UDI_MSC_DISABLE_EXT() mp_msc_disable() -extern void mp_msc_disable(void); - -//! Enable id string of interface to add an extra USB string -#define UDI_MSC_STRING_ID 5 - -/** - * USB MSC low level configuration - * In standalone these configurations are defined by the MSC module. - * For composite device, these configuration must be defined here - * @{ - */ -//! Endpoint numbers definition -#define UDI_MSC_EP_IN (1 | USB_EP_DIR_IN) -#define UDI_MSC_EP_OUT (2 | USB_EP_DIR_OUT) - -//! Interface number -#define UDI_MSC_IFACE_NUMBER 2 -/** - * Configuration of HID Mouse interface - * @{ - */ -//! Interface callback definition -#define UDI_HID_MOUSE_ENABLE_EXT() mp_mouse_enable() -extern bool mp_mouse_enable(void); -#define UDI_HID_MOUSE_DISABLE_EXT() mp_mouse_disable() -extern void mp_mouse_disable(void); - -//! Enable id string of interface to add an extra USB string -#define UDI_HID_MOUSE_STRING_ID 6 - -/** - * USB HID Mouse low level configuration - * In standalone these configurations are defined by the HID Mouse module. - * For composite device, these configuration must be defined here - * @{ - */ -//! Endpoint numbers definition -#define UDI_HID_MOUSE_EP_IN (6 | USB_EP_DIR_IN) - -//! Interface number -#define UDI_HID_MOUSE_IFACE_NUMBER 3 -//@} -//@} - -/** - * Configuration of HID Keyboard interface - * @{ - */ -//! Interface callback definition -#define UDI_HID_KBD_ENABLE_EXT() mp_keyboard_enable() -extern bool mp_keyboard_enable(void); -#define UDI_HID_KBD_DISABLE_EXT() mp_keyboard_disable() -extern void mp_keyboard_disable(void); -#define UDI_HID_KBD_CHANGE_LED(value) mp_keyboard_led(value) -extern void mp_keyboard_led(uint8_t); - -//! Enable id string of interface to add an extra USB string -#define UDI_HID_KBD_STRING_ID 7 - -/** - * USB HID Keyboard low level configuration - * In standalone these configurations are defined by the HID Keyboard module. - * For composite device, these configuration must be defined here - * @{ - */ -//! Endpoint numbers definition -#define UDI_HID_KBD_EP_IN (7 | USB_EP_DIR_IN) - -//! Interface number -#define UDI_HID_KBD_IFACE_NUMBER 4 - -/** - * Description of Composite Device - * @{ - */ -//! USB Interfaces descriptor structure -#define UDI_COMPOSITE_DESC_T \ - usb_iad_desc_t udi_cdc_iad; \ - udi_cdc_comm_desc_t udi_cdc_comm; \ - udi_cdc_data_desc_t udi_cdc_data; \ - udi_msc_desc_t udi_msc; \ - udi_hid_mouse_desc_t udi_hid_mouse; \ - udi_hid_kbd_desc_t udi_hid_kbd - -//! USB Interfaces descriptor value for Full Speed -#define UDI_COMPOSITE_DESC_FS \ - .udi_cdc_iad = UDI_CDC_IAD_DESC_0, \ - .udi_cdc_comm = UDI_CDC_COMM_DESC_0, \ - .udi_cdc_data = UDI_CDC_DATA_DESC_0_FS, \ - .udi_msc = UDI_MSC_DESC_FS, \ - .udi_hid_mouse = UDI_HID_MOUSE_DESC, \ - .udi_hid_kbd = UDI_HID_KBD_DESC - -//! USB Interfaces descriptor value for High Speed -#define UDI_COMPOSITE_DESC_HS \ - .udi_cdc_iad = UDI_CDC_IAD_DESC_0, \ - .udi_cdc_comm = UDI_CDC_COMM_DESC_0, \ - .udi_cdc_data = UDI_CDC_DATA_DESC_0_HS, \ - .udi_msc = UDI_MSC_DESC_HS, \ - .udi_hid_mouse = UDI_HID_MOUSE_DESC, \ - .udi_hid_kbd = UDI_HID_KBD_DESC - -//! USB Interface APIs -#define UDI_COMPOSITE_API \ - &udi_api_cdc_comm, \ - &udi_api_cdc_data, \ - &udi_api_msc, \ - &udi_api_hid_mouse, \ - &udi_api_hid_kbd -//@} - -/** - * USB Device Driver Configuration - * @{ - */ -//@} - -//! The includes of classes and other headers must be done at the end of this file to avoid compile error -#include "udi_cdc.h" -#include "udi_msc.h" -#include "udi_hid_mouse.h" -#include "udi_hid_kbd.h" - -#endif diff --git a/atmel-samd/boards/circuitplayground_express/mpconfigboard.h b/atmel-samd/boards/circuitplayground_express/mpconfigboard.h index f9ff05084..a12ac51a0 100644 --- a/atmel-samd/boards/circuitplayground_express/mpconfigboard.h +++ b/atmel-samd/boards/circuitplayground_express/mpconfigboard.h @@ -20,6 +20,7 @@ // PA24 and PA25 are USB. #define MICROPY_PORT_A (PORT_PA16 | PORT_PA20 | PORT_PA21 | PORT_PA24 | PORT_PA25) #define MICROPY_PORT_B (PORT_PB22) +#define MICROPY_PORT_C (0) #define SPEAKER_ENABLE_PIN (&pin_PA30) @@ -27,7 +28,8 @@ // If you change this, then make sure to update the linker scripts as well to // make sure you don't overwrite code. -#define CIRCUITPY_INTERNAL_NVM_SIZE 256 +// #define CIRCUITPY_INTERNAL_NVM_SIZE 256 +#define CIRCUITPY_INTERNAL_NVM_SIZE 0 #define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - CIRCUITPY_INTERNAL_NVM_SIZE) @@ -37,4 +39,4 @@ #define CALIBRATE_CRYSTALLESS 1 // Explanation of how a user got into safe mode. -#define BOARD_USER_SAFE_MODE "pressing both buttons at start up" +#define BOARD_USER_SAFE_MODE_ACTION "pressing both buttons at start up" diff --git a/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk b/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk index d773f2f60..0a93ccddc 100644 --- a/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk +++ b/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk @@ -5,6 +5,7 @@ USB_PID = 0x8019 FLASH_IMPL = spi_flash.c CHIP_VARIANT = SAMD21G18A +CHIP_FAMILY = samd21 # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel diff --git a/atmel-samd/boards/feather_m0_adalogger/conf_access.h b/atmel-samd/boards/feather_m0_adalogger/conf_access.h deleted file mode 100644 index 25109b75c..000000000 --- a/atmel-samd/boards/feather_m0_adalogger/conf_access.h +++ /dev/null @@ -1,115 +0,0 @@ -/** - * \file - * - * \brief Memory access control configuration file. - * - * Copyright (c) 2014-2015 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 <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#ifndef _CONF_ACCESS_H_ -#define _CONF_ACCESS_H_ - -#include "compiler.h" -#include "board.h" - - -/*! \name Activation of Logical Unit Numbers - */ -//! @{ -#define LUN_0 ENABLE //!< On-Chip Virtual Memory. -#define LUN_1 DISABLE //!< AT45DBX Data Flash. -#define LUN_2 DISABLE //!< SD/MMC Card over SPI. -#define LUN_3 DISABLE //!< SD/MMC Card over MCI Slot 0. -#define LUN_4 DISABLE -#define LUN_5 DISABLE -#define LUN_6 DISABLE -#define LUN_7 DISABLE -#define LUN_USB DISABLE //!< Host Mass-Storage Memory. -//! @} - -/*! \name LUN 0 Definitions - */ -//! @{ -#define LUN_0_INCLUDE "access_vfs.h" -#define Lun_0_test_unit_ready vfs_test_unit_ready -#define Lun_0_read_capacity vfs_read_capacity -#define Lun_0_unload NULL -#define Lun_0_wr_protect vfs_wr_protect -#define Lun_0_removal vfs_removal -#define Lun_0_usb_read_10 vfs_usb_read_10 -#define Lun_0_usb_write_10 vfs_usb_write_10 -#define LUN_0_NAME "\"MicroPython VFS[0]\"" -//! @} - -#define MEM_USB LUN_USB - -/*! \name Actions Associated with Memory Accesses - * - * Write here the action to associate with each memory access. - * - * \warning Be careful not to waste time in order not to disturb the functions. - */ -//! @{ -#define memory_start_read_action(nb_sectors) -#define memory_stop_read_action() -#define memory_start_write_action(nb_sectors) -#define memory_stop_write_action() -//! @} - -/*! \name Activation of Interface Features - */ -//! @{ -#define ACCESS_USB true //!< MEM <-> USB interface. -#define ACCESS_MEM_TO_RAM false //!< MEM <-> RAM interface. -#define ACCESS_STREAM false //!< Streaming MEM <-> MEM interface. -#define ACCESS_STREAM_RECORD false //!< Streaming MEM <-> MEM interface in record mode. -#define ACCESS_MEM_TO_MEM false //!< MEM <-> MEM interface. -#define ACCESS_CODEC false //!< Codec interface. -//! @} - -/*! \name Specific Options for Access Control - */ -//! @{ -#define GLOBAL_WR_PROTECT false //!< Management of a global write protection. -//! @} - - -#endif // _CONF_ACCESS_H_ diff --git a/atmel-samd/boards/feather_m0_adalogger/conf_board.h b/atmel-samd/boards/feather_m0_adalogger/conf_board.h deleted file mode 100644 index 7b88c97fc..000000000 --- a/atmel-samd/boards/feather_m0_adalogger/conf_board.h +++ /dev/null @@ -1,14 +0,0 @@ -/** - * \file - * - * \brief User board configuration template - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#ifndef CONF_BOARD_H -#define CONF_BOARD_H - -#endif // CONF_BOARD_H diff --git a/atmel-samd/boards/feather_m0_adalogger/conf_clocks.h b/atmel-samd/boards/feather_m0_adalogger/conf_clocks.h deleted file mode 100644 index d3f3e6496..000000000 --- a/atmel-samd/boards/feather_m0_adalogger/conf_clocks.h +++ /dev/null @@ -1 +0,0 @@ -#include "conf_clocks_external_32k.h" diff --git a/atmel-samd/boards/feather_m0_adalogger/conf_usb.h b/atmel-samd/boards/feather_m0_adalogger/conf_usb.h deleted file mode 100644 index 8ec6f99dc..000000000 --- a/atmel-samd/boards/feather_m0_adalogger/conf_usb.h +++ /dev/null @@ -1,220 +0,0 @@ - -#include <stdbool.h> -#include <stdint.h> - -#include "asf/common/services/usb/class/cdc/usb_protocol_cdc.h" - -#ifndef CONF_USB_H_INCLUDED -#define CONF_USB_H_INCLUDED - -#define USB_DEVICE_MAJOR_VERSION 1 -#define USB_DEVICE_MINOR_VERSION 0 -#define USB_DEVICE_POWER 100 // Consumption on Vbus line (mA) -#define USB_DEVICE_ATTR \ - (USB_CONFIG_ATTR_BUS_POWERED) -// (USB_CONFIG_ATTR_REMOTE_WAKEUP|USB_CONFIG_ATTR_SELF_POWERED) -// (USB_CONFIG_ATTR_REMOTE_WAKEUP|USB_CONFIG_ATTR_BUS_POWERED) - -//! USB Device string definitions (Optional) -#ifndef USB_DEVICE_MANUFACTURE_NAME -# define USB_DEVICE_MANUFACTURE_NAME "Adafruit Industries" -#endif - -#ifndef USB_DEVICE_PRODUCT_NAME -# define USB_DEVICE_PRODUCT_NAME "Feather M0 Adalogger" -#endif - -#define USB_DEVICE_GET_SERIAL_NAME_POINTER serial_number -#define USB_DEVICE_GET_SERIAL_NAME_LENGTH 32 -extern char serial_number[USB_DEVICE_GET_SERIAL_NAME_LENGTH]; - -//! Control endpoint size -#define USB_DEVICE_EP_CTRL_SIZE 64 - -//! Interfaces for this device (CDC COM + CDC DATA + MSC + HID mouse + HID kbd) -#define USB_DEVICE_NB_INTERFACE 5 - -// (3 | USB_EP_DIR_IN) // CDC Notify endpoint -// (4 | USB_EP_DIR_IN) // CDC TX -// (5 | USB_EP_DIR_OUT) // CDC RX -// (1 | USB_EP_DIR_IN) // MSC IN -// (2 | USB_EP_DIR_OUT) // MSC OUT -// (6 | USB_EP_DIR_IN) // HID mouse report -// (7 | USB_EP_DIR_IN) // HID keyboard report -#define USB_DEVICE_MAX_EP 7 - -#define UDI_CDC_PORT_NB 1 -#define UDI_CDC_ENABLE_EXT(port) mp_cdc_enable(port) -extern bool mp_cdc_enable(uint8_t port); -#define UDI_CDC_DISABLE_EXT(port) mp_cdc_disable(port) -extern void mp_cdc_disable(uint8_t port); -#define UDI_CDC_LOW_RATE - -#define UDI_CDC_DEFAULT_RATE 115200 -#define UDI_CDC_DEFAULT_STOPBITS CDC_STOP_BITS_1 -#define UDI_CDC_DEFAULT_PARITY CDC_PAR_NONE -#define UDI_CDC_DEFAULT_DATABITS 8 - -#define UDI_CDC_RX_NOTIFY(port) usb_rx_notify() -void usb_rx_notify(void); -#define UDI_CDC_SET_CODING_EXT(port,cfg) usb_coding_notify(port, cfg) -void usb_coding_notify(uint8_t port, usb_cdc_line_coding_t* coding); -#define UDI_CDC_SET_DTR_EXT(port,set) usb_dtr_notify(port, set) -void usb_dtr_notify(uint8_t port, bool set); -#define UDI_CDC_SET_RTS_EXT(port,set) usb_rts_notify(port, set) -void usb_rts_notify(uint8_t port, bool set); - -/** - * USB CDC low level configuration - * In standalone these configurations are defined by the CDC module. - * For composite device, these configuration must be defined here - * @{ - */ -//! Endpoint numbers definition - -#define UDI_CDC_COMM_EP_0 (3 | USB_EP_DIR_IN) // Notify endpoint -#define UDI_CDC_DATA_EP_IN_0 (4 | USB_EP_DIR_IN) // TX -#define UDI_CDC_DATA_EP_OUT_0 (5 | USB_EP_DIR_OUT) // RX - -//! Interface numbers -#define UDI_CDC_COMM_IFACE_NUMBER_0 0 -#define UDI_CDC_DATA_IFACE_NUMBER_0 1 - -/** - * Configuration of MSC interface - * @{ - */ -//! Vendor name and Product version of MSC interface -#define UDI_MSC_GLOBAL_VENDOR_ID \ - 'A', 'T', 'M', 'E', 'L', ' ', ' ', ' ' -#define UDI_MSC_GLOBAL_PRODUCT_VERSION \ - '1', '.', '0', '0' - -//! Interface callback definition -#define UDI_MSC_ENABLE_EXT() mp_msc_enable() -extern bool mp_msc_enable(void); -#define UDI_MSC_DISABLE_EXT() mp_msc_disable() -extern void mp_msc_disable(void); - -//! Enable id string of interface to add an extra USB string -#define UDI_MSC_STRING_ID 5 - -/** - * USB MSC low level configuration - * In standalone these configurations are defined by the MSC module. - * For composite device, these configuration must be defined here - * @{ - */ -//! Endpoint numbers definition -#define UDI_MSC_EP_IN (1 | USB_EP_DIR_IN) -#define UDI_MSC_EP_OUT (2 | USB_EP_DIR_OUT) - -//! Interface number -#define UDI_MSC_IFACE_NUMBER 2 -/** - * Configuration of HID Mouse interface - * @{ - */ -//! Interface callback definition -#define UDI_HID_MOUSE_ENABLE_EXT() mp_mouse_enable() -extern bool mp_mouse_enable(void); -#define UDI_HID_MOUSE_DISABLE_EXT() mp_mouse_disable() -extern void mp_mouse_disable(void); - -//! Enable id string of interface to add an extra USB string -#define UDI_HID_MOUSE_STRING_ID 6 - -/** - * USB HID Mouse low level configuration - * In standalone these configurations are defined by the HID Mouse module. - * For composite device, these configuration must be defined here - * @{ - */ -//! Endpoint numbers definition -#define UDI_HID_MOUSE_EP_IN (6 | USB_EP_DIR_IN) - -//! Interface number -#define UDI_HID_MOUSE_IFACE_NUMBER 3 -//@} -//@} - -/** - * Configuration of HID Keyboard interface - * @{ - */ -//! Interface callback definition -#define UDI_HID_KBD_ENABLE_EXT() mp_keyboard_enable() -extern bool mp_keyboard_enable(void); -#define UDI_HID_KBD_DISABLE_EXT() mp_keyboard_disable() -extern void mp_keyboard_disable(void); -#define UDI_HID_KBD_CHANGE_LED(value) mp_keyboard_led(value) -extern void mp_keyboard_led(uint8_t); - -//! Enable id string of interface to add an extra USB string -#define UDI_HID_KBD_STRING_ID 7 - -/** - * USB HID Keyboard low level configuration - * In standalone these configurations are defined by the HID Keyboard module. - * For composite device, these configuration must be defined here - * @{ - */ -//! Endpoint numbers definition -#define UDI_HID_KBD_EP_IN (7 | USB_EP_DIR_IN) - -//! Interface number -#define UDI_HID_KBD_IFACE_NUMBER 4 - -/** - * Description of Composite Device - * @{ - */ -//! USB Interfaces descriptor structure -#define UDI_COMPOSITE_DESC_T \ - usb_iad_desc_t udi_cdc_iad; \ - udi_cdc_comm_desc_t udi_cdc_comm; \ - udi_cdc_data_desc_t udi_cdc_data; \ - udi_msc_desc_t udi_msc; \ - udi_hid_mouse_desc_t udi_hid_mouse; \ - udi_hid_kbd_desc_t udi_hid_kbd - -//! USB Interfaces descriptor value for Full Speed -#define UDI_COMPOSITE_DESC_FS \ - .udi_cdc_iad = UDI_CDC_IAD_DESC_0, \ - .udi_cdc_comm = UDI_CDC_COMM_DESC_0, \ - .udi_cdc_data = UDI_CDC_DATA_DESC_0_FS, \ - .udi_msc = UDI_MSC_DESC_FS, \ - .udi_hid_mouse = UDI_HID_MOUSE_DESC, \ - .udi_hid_kbd = UDI_HID_KBD_DESC - -//! USB Interfaces descriptor value for High Speed -#define UDI_COMPOSITE_DESC_HS \ - .udi_cdc_iad = UDI_CDC_IAD_DESC_0, \ - .udi_cdc_comm = UDI_CDC_COMM_DESC_0, \ - .udi_cdc_data = UDI_CDC_DATA_DESC_0_HS, \ - .udi_msc = UDI_MSC_DESC_HS, \ - .udi_hid_mouse = UDI_HID_MOUSE_DESC, \ - .udi_hid_kbd = UDI_HID_KBD_DESC - -//! USB Interface APIs -#define UDI_COMPOSITE_API \ - &udi_api_cdc_comm, \ - &udi_api_cdc_data, \ - &udi_api_msc, \ - &udi_api_hid_mouse, \ - &udi_api_hid_kbd -//@} - -/** - * USB Device Driver Configuration - * @{ - */ -//@} - -//! The includes of classes and other headers must be done at the end of this file to avoid compile error -#include "udi_cdc.h" -#include "udi_msc.h" -#include "udi_hid_mouse.h" -#include "udi_hid_kbd.h" - -#endif diff --git a/atmel-samd/boards/feather_m0_adalogger/mpconfigboard.h b/atmel-samd/boards/feather_m0_adalogger/mpconfigboard.h index 2a2d21dd3..d81f980c9 100644 --- a/atmel-samd/boards/feather_m0_adalogger/mpconfigboard.h +++ b/atmel-samd/boards/feather_m0_adalogger/mpconfigboard.h @@ -8,6 +8,7 @@ #define MICROPY_PORT_A (PORT_PA24 | PORT_PA25) #define MICROPY_PORT_B (0) +#define MICROPY_PORT_C (0) #include "internal_flash.h" diff --git a/atmel-samd/boards/feather_m0_adalogger/mpconfigboard.mk b/atmel-samd/boards/feather_m0_adalogger/mpconfigboard.mk index 755157cb7..900b9f52e 100644 --- a/atmel-samd/boards/feather_m0_adalogger/mpconfigboard.mk +++ b/atmel-samd/boards/feather_m0_adalogger/mpconfigboard.mk @@ -5,3 +5,4 @@ USB_PID = 0x8015 FLASH_IMPL = internal_flash.c CHIP_VARIANT = SAMD21G18A +CHIP_FAMILY = samd21 diff --git a/atmel-samd/boards/feather_m0_basic/conf_access.h b/atmel-samd/boards/feather_m0_basic/conf_access.h deleted file mode 100644 index 25109b75c..000000000 --- a/atmel-samd/boards/feather_m0_basic/conf_access.h +++ /dev/null @@ -1,115 +0,0 @@ -/** - * \file - * - * \brief Memory access control configuration file. - * - * Copyright (c) 2014-2015 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 <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#ifndef _CONF_ACCESS_H_ -#define _CONF_ACCESS_H_ - -#include "compiler.h" -#include "board.h" - - -/*! \name Activation of Logical Unit Numbers - */ -//! @{ -#define LUN_0 ENABLE //!< On-Chip Virtual Memory. -#define LUN_1 DISABLE //!< AT45DBX Data Flash. -#define LUN_2 DISABLE //!< SD/MMC Card over SPI. -#define LUN_3 DISABLE //!< SD/MMC Card over MCI Slot 0. -#define LUN_4 DISABLE -#define LUN_5 DISABLE -#define LUN_6 DISABLE -#define LUN_7 DISABLE -#define LUN_USB DISABLE //!< Host Mass-Storage Memory. -//! @} - -/*! \name LUN 0 Definitions - */ -//! @{ -#define LUN_0_INCLUDE "access_vfs.h" -#define Lun_0_test_unit_ready vfs_test_unit_ready -#define Lun_0_read_capacity vfs_read_capacity -#define Lun_0_unload NULL -#define Lun_0_wr_protect vfs_wr_protect -#define Lun_0_removal vfs_removal -#define Lun_0_usb_read_10 vfs_usb_read_10 -#define Lun_0_usb_write_10 vfs_usb_write_10 -#define LUN_0_NAME "\"MicroPython VFS[0]\"" -//! @} - -#define MEM_USB LUN_USB - -/*! \name Actions Associated with Memory Accesses - * - * Write here the action to associate with each memory access. - * - * \warning Be careful not to waste time in order not to disturb the functions. - */ -//! @{ -#define memory_start_read_action(nb_sectors) -#define memory_stop_read_action() -#define memory_start_write_action(nb_sectors) -#define memory_stop_write_action() -//! @} - -/*! \name Activation of Interface Features - */ -//! @{ -#define ACCESS_USB true //!< MEM <-> USB interface. -#define ACCESS_MEM_TO_RAM false //!< MEM <-> RAM interface. -#define ACCESS_STREAM false //!< Streaming MEM <-> MEM interface. -#define ACCESS_STREAM_RECORD false //!< Streaming MEM <-> MEM interface in record mode. -#define ACCESS_MEM_TO_MEM false //!< MEM <-> MEM interface. -#define ACCESS_CODEC false //!< Codec interface. -//! @} - -/*! \name Specific Options for Access Control - */ -//! @{ -#define GLOBAL_WR_PROTECT false //!< Management of a global write protection. -//! @} - - -#endif // _CONF_ACCESS_H_ diff --git a/atmel-samd/boards/feather_m0_basic/conf_board.h b/atmel-samd/boards/feather_m0_basic/conf_board.h deleted file mode 100644 index 7b88c97fc..000000000 --- a/atmel-samd/boards/feather_m0_basic/conf_board.h +++ /dev/null @@ -1,14 +0,0 @@ -/** - * \file - * - * \brief User board configuration template - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#ifndef CONF_BOARD_H -#define CONF_BOARD_H - -#endif // CONF_BOARD_H diff --git a/atmel-samd/boards/feather_m0_basic/conf_clocks.h b/atmel-samd/boards/feather_m0_basic/conf_clocks.h deleted file mode 100644 index d3f3e6496..000000000 --- a/atmel-samd/boards/feather_m0_basic/conf_clocks.h +++ /dev/null @@ -1 +0,0 @@ -#include "conf_clocks_external_32k.h" diff --git a/atmel-samd/boards/feather_m0_basic/conf_usb.h b/atmel-samd/boards/feather_m0_basic/conf_usb.h deleted file mode 100644 index 940fc26bd..000000000 --- a/atmel-samd/boards/feather_m0_basic/conf_usb.h +++ /dev/null @@ -1,221 +0,0 @@ - -#include <stdbool.h> -#include <stdint.h> - -#include "asf/common/services/usb/class/cdc/usb_protocol_cdc.h" - -#ifndef CONF_USB_H_INCLUDED -#define CONF_USB_H_INCLUDED - -#define USB_DEVICE_MAJOR_VERSION 1 -#define USB_DEVICE_MINOR_VERSION 0 -#define USB_DEVICE_POWER 100 // Consumption on Vbus line (mA) -#define USB_DEVICE_ATTR \ - (USB_CONFIG_ATTR_BUS_POWERED) -// (USB_CONFIG_ATTR_REMOTE_WAKEUP|USB_CONFIG_ATTR_SELF_POWERED) -// (USB_CONFIG_ATTR_REMOTE_WAKEUP|USB_CONFIG_ATTR_BUS_POWERED) - -//! USB Device string definitions (Optional) -#ifndef USB_DEVICE_MANUFACTURE_NAME -# define USB_DEVICE_MANUFACTURE_NAME "Adafruit Industries" -#endif - -#ifndef USB_DEVICE_PRODUCT_NAME -# define USB_DEVICE_PRODUCT_NAME "Feather M0 Basic" -#endif - -#define USB_DEVICE_GET_SERIAL_NAME_POINTER serial_number -#define USB_DEVICE_GET_SERIAL_NAME_LENGTH 32 -extern char serial_number[USB_DEVICE_GET_SERIAL_NAME_LENGTH]; - -//! Control endpoint size -#define USB_DEVICE_EP_CTRL_SIZE 64 - -//! Two interfaces for this device (CDC COM + CDC DATA + MSC + HID mouse + HID kbd) -#define USB_DEVICE_NB_INTERFACE 5 - -// (3 | USB_EP_DIR_IN) // CDC Notify endpoint -// (4 | USB_EP_DIR_IN) // CDC TX -// (5 | USB_EP_DIR_OUT) // CDC RX -// (1 | USB_EP_DIR_IN) // MSC IN -// (2 | USB_EP_DIR_OUT) // MSC OUT -// (6 | USB_EP_DIR_IN) // HID mouse report -// (7 | USB_EP_DIR_IN) // HID keyboard report -#define USB_DEVICE_MAX_EP 7 - -#define UDI_CDC_PORT_NB 1 -#define UDI_CDC_ENABLE_EXT(port) mp_cdc_enable(port) -extern bool mp_cdc_enable(uint8_t port); -#define UDI_CDC_DISABLE_EXT(port) mp_cdc_disable(port) -extern void mp_cdc_disable(uint8_t port); -#define UDI_CDC_LOW_RATE - -#define UDI_CDC_DEFAULT_RATE 115200 -#define UDI_CDC_DEFAULT_STOPBITS CDC_STOP_BITS_1 -#define UDI_CDC_DEFAULT_PARITY CDC_PAR_NONE -#define UDI_CDC_DEFAULT_DATABITS 8 - -#define UDI_CDC_RX_NOTIFY(port) usb_rx_notify() -void usb_rx_notify(void); -#define UDI_CDC_SET_CODING_EXT(port,cfg) usb_coding_notify(port, cfg) -void usb_coding_notify(uint8_t port, usb_cdc_line_coding_t* coding); -#define UDI_CDC_SET_DTR_EXT(port,set) usb_dtr_notify(port, set) -void usb_dtr_notify(uint8_t port, bool set); -#define UDI_CDC_SET_RTS_EXT(port,set) usb_rts_notify(port, set) -void usb_rts_notify(uint8_t port, bool set); - -/** - * USB CDC low level configuration - * In standalone these configurations are defined by the CDC module. - * For composite device, these configuration must be defined here - * @{ - */ -//! Endpoint numbers definition - -#define UDI_CDC_COMM_EP_0 (3 | USB_EP_DIR_IN) // Notify endpoint -#define UDI_CDC_DATA_EP_IN_0 (4 | USB_EP_DIR_IN) // TX -#define UDI_CDC_DATA_EP_OUT_0 (5 | USB_EP_DIR_OUT) // RX - -//! Interface numbers -#define UDI_CDC_COMM_IFACE_NUMBER_0 0 -#define UDI_CDC_DATA_IFACE_NUMBER_0 1 - -/** - * Configuration of MSC interface - * @{ - */ -//! Vendor name and Product version of MSC interface -#define UDI_MSC_GLOBAL_VENDOR_ID \ - 'A', 'T', 'M', 'E', 'L', ' ', ' ', ' ' -#define UDI_MSC_GLOBAL_PRODUCT_VERSION \ - '1', '.', '0', '0' - -//! Interface callback definition -#define UDI_MSC_ENABLE_EXT() mp_msc_enable() -extern bool mp_msc_enable(void); -#define UDI_MSC_DISABLE_EXT() mp_msc_disable() -extern void mp_msc_disable(void); - -//! Enable id string of interface to add an extra USB string -#define UDI_MSC_STRING_ID 5 - -/** - * USB MSC low level configuration - * In standalone these configurations are defined by the MSC module. - * For composite device, these configuration must be defined here - * @{ - */ -//! Endpoint numbers definition -#define UDI_MSC_EP_IN (1 | USB_EP_DIR_IN) -#define UDI_MSC_EP_OUT (2 | USB_EP_DIR_OUT) - -//! Interface number -#define UDI_MSC_IFACE_NUMBER 2 - -/** - * Configuration of HID Mouse interface - * @{ - */ -//! Interface callback definition -#define UDI_HID_MOUSE_ENABLE_EXT() mp_mouse_enable() -extern bool mp_mouse_enable(void); -#define UDI_HID_MOUSE_DISABLE_EXT() mp_mouse_disable() -extern void mp_mouse_disable(void); - -//! Enable id string of interface to add an extra USB string -#define UDI_HID_MOUSE_STRING_ID 6 - -/** - * USB HID Mouse low level configuration - * In standalone these configurations are defined by the HID Mouse module. - * For composite device, these configuration must be defined here - * @{ - */ -//! Endpoint numbers definition -#define UDI_HID_MOUSE_EP_IN (6 | USB_EP_DIR_IN) - -//! Interface number -#define UDI_HID_MOUSE_IFACE_NUMBER 3 -//@} -//@} - -/** - * Configuration of HID Keyboard interface - * @{ - */ -//! Interface callback definition -#define UDI_HID_KBD_ENABLE_EXT() mp_keyboard_enable() -extern bool mp_keyboard_enable(void); -#define UDI_HID_KBD_DISABLE_EXT() mp_keyboard_disable() -extern void mp_keyboard_disable(void); -#define UDI_HID_KBD_CHANGE_LED(value) mp_keyboard_led(value) -extern void mp_keyboard_led(uint8_t); - -//! Enable id string of interface to add an extra USB string -#define UDI_HID_KBD_STRING_ID 7 - -/** - * USB HID Keyboard low level configuration - * In standalone these configurations are defined by the HID Keyboard module. - * For composite device, these configuration must be defined here - * @{ - */ -//! Endpoint numbers definition -#define UDI_HID_KBD_EP_IN (7 | USB_EP_DIR_IN) - -//! Interface number -#define UDI_HID_KBD_IFACE_NUMBER 4 - -/** - * Description of Composite Device - * @{ - */ -//! USB Interfaces descriptor structure -#define UDI_COMPOSITE_DESC_T \ - usb_iad_desc_t udi_cdc_iad; \ - udi_cdc_comm_desc_t udi_cdc_comm; \ - udi_cdc_data_desc_t udi_cdc_data; \ - udi_msc_desc_t udi_msc; \ - udi_hid_mouse_desc_t udi_hid_mouse; \ - udi_hid_kbd_desc_t udi_hid_kbd - -//! USB Interfaces descriptor value for Full Speed -#define UDI_COMPOSITE_DESC_FS \ - .udi_cdc_iad = UDI_CDC_IAD_DESC_0, \ - .udi_cdc_comm = UDI_CDC_COMM_DESC_0, \ - .udi_cdc_data = UDI_CDC_DATA_DESC_0_FS, \ - .udi_msc = UDI_MSC_DESC_FS, \ - .udi_hid_mouse = UDI_HID_MOUSE_DESC, \ - .udi_hid_kbd = UDI_HID_KBD_DESC - -//! USB Interfaces descriptor value for High Speed -#define UDI_COMPOSITE_DESC_HS \ - .udi_cdc_iad = UDI_CDC_IAD_DESC_0, \ - .udi_cdc_comm = UDI_CDC_COMM_DESC_0, \ - .udi_cdc_data = UDI_CDC_DATA_DESC_0_HS, \ - .udi_msc = UDI_MSC_DESC_HS, \ - .udi_hid_mouse = UDI_HID_MOUSE_DESC, \ - .udi_hid_kbd = UDI_HID_KBD_DESC - -//! USB Interface APIs -#define UDI_COMPOSITE_API \ - &udi_api_cdc_comm, \ - &udi_api_cdc_data, \ - &udi_api_msc, \ - &udi_api_hid_mouse, \ - &udi_api_hid_kbd -//@} - -/** - * USB Device Driver Configuration - * @{ - */ -//@} - -//! The includes of classes and other headers must be done at the end of this file to avoid compile error -#include "udi_cdc.h" -#include "udi_msc.h" -#include "udi_hid_mouse.h" -#include "udi_hid_kbd.h" - -#endif diff --git a/atmel-samd/boards/feather_m0_basic/mpconfigboard.h b/atmel-samd/boards/feather_m0_basic/mpconfigboard.h index a8a8247fa..829692ed3 100644 --- a/atmel-samd/boards/feather_m0_basic/mpconfigboard.h +++ b/atmel-samd/boards/feather_m0_basic/mpconfigboard.h @@ -8,6 +8,7 @@ #define MICROPY_PORT_A (PORT_PA24 | PORT_PA25) #define MICROPY_PORT_B (0) +#define MICROPY_PORT_C (0) #include "internal_flash.h" diff --git a/atmel-samd/boards/feather_m0_basic/mpconfigboard.mk b/atmel-samd/boards/feather_m0_basic/mpconfigboard.mk index 755157cb7..900b9f52e 100644 --- a/atmel-samd/boards/feather_m0_basic/mpconfigboard.mk +++ b/atmel-samd/boards/feather_m0_basic/mpconfigboard.mk @@ -5,3 +5,4 @@ USB_PID = 0x8015 FLASH_IMPL = internal_flash.c CHIP_VARIANT = SAMD21G18A +CHIP_FAMILY = samd21 diff --git a/atmel-samd/boards/feather_m0_express/conf_access.h b/atmel-samd/boards/feather_m0_express/conf_access.h deleted file mode 100644 index 2326bfcdf..000000000 --- a/atmel-samd/boards/feather_m0_express/conf_access.h +++ /dev/null @@ -1,115 +0,0 @@ -/** - * \file - * - * \brief Memory access control configuration file. - * - * Copyright (c) 2014-2015 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 <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#ifndef _CONF_ACCESS_H_ -#define _CONF_ACCESS_H_ - -#include "compiler.h" -#include "board.h" - - -/*! \name Activation of Logical Unit Numbers - */ -//! @{ -#define LUN_0 ENABLE //!< On-Chip Virtual Memory. -#define LUN_1 DISABLE //!< AT45DBX Data Flash. -#define LUN_2 DISABLE //!< SD/MMC Card over SPI. -#define LUN_3 DISABLE //!< SD/MMC Card over MCI Slot 0. -#define LUN_4 DISABLE -#define LUN_5 DISABLE -#define LUN_6 DISABLE -#define LUN_7 DISABLE -#define LUN_USB DISABLE //!< Host Mass-Storage Memory. -//! @} - -/*! \name LUN 0 Definitions - */ -//! @{ -#define LUN_0_INCLUDE "access_vfs.h" -#define Lun_0_test_unit_ready vfs_test_unit_ready -#define Lun_0_read_capacity vfs_read_capacity -#define Lun_0_unload NULL -#define Lun_0_wr_protect vfs_wr_protect -#define Lun_0_removal vfs_removal -#define Lun_0_usb_read_10 vfs_usb_read_10 -#define Lun_0_usb_write_10 vfs_usb_write_10 -#define LUN_0_NAME "\"CircuitPython VFS[0]\"" -//! @} - -#define MEM_USB LUN_USB - -/*! \name Actions Associated with Memory Accesses - * - * Write here the action to associate with each memory access. - * - * \warning Be careful not to waste time in order not to disturb the functions. - */ -//! @{ -#define memory_start_read_action(nb_sectors) -#define memory_stop_read_action() -#define memory_start_write_action(nb_sectors) -#define memory_stop_write_action() -//! @} - -/*! \name Activation of Interface Features - */ -//! @{ -#define ACCESS_USB true //!< MEM <-> USB interface. -#define ACCESS_MEM_TO_RAM false //!< MEM <-> RAM interface. -#define ACCESS_STREAM false //!< Streaming MEM <-> MEM interface. -#define ACCESS_STREAM_RECORD false //!< Streaming MEM <-> MEM interface in record mode. -#define ACCESS_MEM_TO_MEM false //!< MEM <-> MEM interface. -#define ACCESS_CODEC false //!< Codec interface. -//! @} - -/*! \name Specific Options for Access Control - */ -//! @{ -#define GLOBAL_WR_PROTECT false //!< Management of a global write protection. -//! @} - - -#endif // _CONF_ACCESS_H_ diff --git a/atmel-samd/boards/feather_m0_express/conf_board.h b/atmel-samd/boards/feather_m0_express/conf_board.h deleted file mode 100644 index 7b88c97fc..000000000 --- a/atmel-samd/boards/feather_m0_express/conf_board.h +++ /dev/null @@ -1,14 +0,0 @@ -/** - * \file - * - * \brief User board configuration template - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#ifndef CONF_BOARD_H -#define CONF_BOARD_H - -#endif // CONF_BOARD_H diff --git a/atmel-samd/boards/feather_m0_express/conf_clocks.h b/atmel-samd/boards/feather_m0_express/conf_clocks.h deleted file mode 100644 index d3f3e6496..000000000 --- a/atmel-samd/boards/feather_m0_express/conf_clocks.h +++ /dev/null @@ -1 +0,0 @@ -#include "conf_clocks_external_32k.h" diff --git a/atmel-samd/boards/feather_m0_express/conf_usb.h b/atmel-samd/boards/feather_m0_express/conf_usb.h deleted file mode 100644 index 54313030c..000000000 --- a/atmel-samd/boards/feather_m0_express/conf_usb.h +++ /dev/null @@ -1,220 +0,0 @@ - -#include <stdbool.h> -#include <stdint.h> - -#include "asf/common/services/usb/class/cdc/usb_protocol_cdc.h" - -#ifndef CONF_USB_H_INCLUDED -#define CONF_USB_H_INCLUDED - -#define USB_DEVICE_MAJOR_VERSION 1 -#define USB_DEVICE_MINOR_VERSION 0 -#define USB_DEVICE_POWER 100 // Consumption on Vbus line (mA) -#define USB_DEVICE_ATTR \ - (USB_CONFIG_ATTR_BUS_POWERED) -// (USB_CONFIG_ATTR_REMOTE_WAKEUP|USB_CONFIG_ATTR_SELF_POWERED) -// (USB_CONFIG_ATTR_REMOTE_WAKEUP|USB_CONFIG_ATTR_BUS_POWERED) - -//! USB Device string definitions (Optional) -#ifndef USB_DEVICE_MANUFACTURE_NAME -# define USB_DEVICE_MANUFACTURE_NAME "Adafruit Industries" -#endif - -#ifndef USB_DEVICE_PRODUCT_NAME -# define USB_DEVICE_PRODUCT_NAME "Feather M0 Express" -#endif - -#define USB_DEVICE_GET_SERIAL_NAME_POINTER serial_number -#define USB_DEVICE_GET_SERIAL_NAME_LENGTH 32 -extern char serial_number[USB_DEVICE_GET_SERIAL_NAME_LENGTH]; - -//! Control endpoint size -#define USB_DEVICE_EP_CTRL_SIZE 64 - -//! Interfaces for this device (CDC COM + CDC DATA + MSC + HID mouse + HID kbd) -#define USB_DEVICE_NB_INTERFACE 5 - -// (3 | USB_EP_DIR_IN) // CDC Notify endpoint -// (4 | USB_EP_DIR_IN) // CDC TX -// (5 | USB_EP_DIR_OUT) // CDC RX -// (1 | USB_EP_DIR_IN) // MSC IN -// (2 | USB_EP_DIR_OUT) // MSC OUT -// (6 | USB_EP_DIR_IN) // HID mouse report -// (7 | USB_EP_DIR_IN) // HID keyboard report -#define USB_DEVICE_MAX_EP 7 - -#define UDI_CDC_PORT_NB 1 -#define UDI_CDC_ENABLE_EXT(port) mp_cdc_enable(port) -extern bool mp_cdc_enable(uint8_t port); -#define UDI_CDC_DISABLE_EXT(port) mp_cdc_disable(port) -extern void mp_cdc_disable(uint8_t port); -#define UDI_CDC_LOW_RATE - -#define UDI_CDC_DEFAULT_RATE 115200 -#define UDI_CDC_DEFAULT_STOPBITS CDC_STOP_BITS_1 -#define UDI_CDC_DEFAULT_PARITY CDC_PAR_NONE -#define UDI_CDC_DEFAULT_DATABITS 8 - -#define UDI_CDC_RX_NOTIFY(port) usb_rx_notify() -void usb_rx_notify(void); -#define UDI_CDC_SET_CODING_EXT(port,cfg) usb_coding_notify(port, cfg) -void usb_coding_notify(uint8_t port, usb_cdc_line_coding_t* coding); -#define UDI_CDC_SET_DTR_EXT(port,set) usb_dtr_notify(port, set) -void usb_dtr_notify(uint8_t port, bool set); -#define UDI_CDC_SET_RTS_EXT(port,set) usb_rts_notify(port, set) -void usb_rts_notify(uint8_t port, bool set); - -/** - * USB CDC low level configuration - * In standalone these configurations are defined by the CDC module. - * For composite device, these configuration must be defined here - * @{ - */ -//! Endpoint numbers definition - -#define UDI_CDC_COMM_EP_0 (3 | USB_EP_DIR_IN) // Notify endpoint -#define UDI_CDC_DATA_EP_IN_0 (4 | USB_EP_DIR_IN) // TX -#define UDI_CDC_DATA_EP_OUT_0 (5 | USB_EP_DIR_OUT) // RX - -//! Interface numbers -#define UDI_CDC_COMM_IFACE_NUMBER_0 0 -#define UDI_CDC_DATA_IFACE_NUMBER_0 1 - -/** - * Configuration of MSC interface - * @{ - */ -//! Vendor name and Product version of MSC interface -#define UDI_MSC_GLOBAL_VENDOR_ID \ - 'A', 'T', 'M', 'E', 'L', ' ', ' ', ' ' -#define UDI_MSC_GLOBAL_PRODUCT_VERSION \ - '1', '.', '0', '0' - -//! Interface callback definition -#define UDI_MSC_ENABLE_EXT() mp_msc_enable() -extern bool mp_msc_enable(void); -#define UDI_MSC_DISABLE_EXT() mp_msc_disable() -extern void mp_msc_disable(void); - -//! Enable id string of interface to add an extra USB string -#define UDI_MSC_STRING_ID 5 - -/** - * USB MSC low level configuration - * In standalone these configurations are defined by the MSC module. - * For composite device, these configuration must be defined here - * @{ - */ -//! Endpoint numbers definition -#define UDI_MSC_EP_IN (1 | USB_EP_DIR_IN) -#define UDI_MSC_EP_OUT (2 | USB_EP_DIR_OUT) - -//! Interface number -#define UDI_MSC_IFACE_NUMBER 2 -/** - * Configuration of HID Mouse interface - * @{ - */ -//! Interface callback definition -#define UDI_HID_MOUSE_ENABLE_EXT() mp_mouse_enable() -extern bool mp_mouse_enable(void); -#define UDI_HID_MOUSE_DISABLE_EXT() mp_mouse_disable() -extern void mp_mouse_disable(void); - -//! Enable id string of interface to add an extra USB string -#define UDI_HID_MOUSE_STRING_ID 6 - -/** - * USB HID Mouse low level configuration - * In standalone these configurations are defined by the HID Mouse module. - * For composite device, these configuration must be defined here - * @{ - */ -//! Endpoint numbers definition -#define UDI_HID_MOUSE_EP_IN (6 | USB_EP_DIR_IN) - -//! Interface number -#define UDI_HID_MOUSE_IFACE_NUMBER 3 -//@} -//@} - -/** - * Configuration of HID Keyboard interface - * @{ - */ -//! Interface callback definition -#define UDI_HID_KBD_ENABLE_EXT() mp_keyboard_enable() -extern bool mp_keyboard_enable(void); -#define UDI_HID_KBD_DISABLE_EXT() mp_keyboard_disable() -extern void mp_keyboard_disable(void); -#define UDI_HID_KBD_CHANGE_LED(value) mp_keyboard_led(value) -extern void mp_keyboard_led(uint8_t); - -//! Enable id string of interface to add an extra USB string -#define UDI_HID_KBD_STRING_ID 7 - -/** - * USB HID Keyboard low level configuration - * In standalone these configurations are defined by the HID Keyboard module. - * For composite device, these configuration must be defined here - * @{ - */ -//! Endpoint numbers definition -#define UDI_HID_KBD_EP_IN (7 | USB_EP_DIR_IN) - -//! Interface number -#define UDI_HID_KBD_IFACE_NUMBER 4 - -/** - * Description of Composite Device - * @{ - */ -//! USB Interfaces descriptor structure -#define UDI_COMPOSITE_DESC_T \ - usb_iad_desc_t udi_cdc_iad; \ - udi_cdc_comm_desc_t udi_cdc_comm; \ - udi_cdc_data_desc_t udi_cdc_data; \ - udi_msc_desc_t udi_msc; \ - udi_hid_mouse_desc_t udi_hid_mouse; \ - udi_hid_kbd_desc_t udi_hid_kbd - -//! USB Interfaces descriptor value for Full Speed -#define UDI_COMPOSITE_DESC_FS \ - .udi_cdc_iad = UDI_CDC_IAD_DESC_0, \ - .udi_cdc_comm = UDI_CDC_COMM_DESC_0, \ - .udi_cdc_data = UDI_CDC_DATA_DESC_0_FS, \ - .udi_msc = UDI_MSC_DESC_FS, \ - .udi_hid_mouse = UDI_HID_MOUSE_DESC, \ - .udi_hid_kbd = UDI_HID_KBD_DESC - -//! USB Interfaces descriptor value for High Speed -#define UDI_COMPOSITE_DESC_HS \ - .udi_cdc_iad = UDI_CDC_IAD_DESC_0, \ - .udi_cdc_comm = UDI_CDC_COMM_DESC_0, \ - .udi_cdc_data = UDI_CDC_DATA_DESC_0_HS, \ - .udi_msc = UDI_MSC_DESC_HS, \ - .udi_hid_mouse = UDI_HID_MOUSE_DESC, \ - .udi_hid_kbd = UDI_HID_KBD_DESC - -//! USB Interface APIs -#define UDI_COMPOSITE_API \ - &udi_api_cdc_comm, \ - &udi_api_cdc_data, \ - &udi_api_msc, \ - &udi_api_hid_mouse, \ - &udi_api_hid_kbd -//@} - -/** - * USB Device Driver Configuration - * @{ - */ -//@} - -//! The includes of classes and other headers must be done at the end of this file to avoid compile error -#include "udi_cdc.h" -#include "udi_msc.h" -#include "udi_hid_mouse.h" -#include "udi_hid_kbd.h" - -#endif diff --git a/atmel-samd/boards/feather_m0_express/mpconfigboard.h b/atmel-samd/boards/feather_m0_express/mpconfigboard.h index 896a04dd8..9f9c25a7d 100644 --- a/atmel-samd/boards/feather_m0_express/mpconfigboard.h +++ b/atmel-samd/boards/feather_m0_express/mpconfigboard.h @@ -1,9 +1,7 @@ -#define USB_REPL - #define MICROPY_HW_BOARD_NAME "Adafruit Feather M0 Express" #define MICROPY_HW_MCU_NAME "samd21g18" -#define MICROPY_HW_NEOPIXEL (&pin_PA06) +// #define MICROPY_HW_NEOPIXEL (&pin_PA06) // Salae reads 12mhz which is the limit even though we set it to the safer 8mhz. #define SPI_FLASH_BAUDRATE (8000000) @@ -20,12 +18,14 @@ #define MICROPY_PORT_A (PORT_PA06 | PORT_PA08 | PORT_PA09 | PORT_PA14 | PORT_PA13 | PORT_PA14 | PORT_PA24 | PORT_PA25) #define MICROPY_PORT_B ( 0 ) +#define MICROPY_PORT_C ( 0 ) #include "spi_flash.h" // If you change this, then make sure to update the linker scripts as well to // make sure you don't overwrite code. -#define CIRCUITPY_INTERNAL_NVM_SIZE 256 +// #define CIRCUITPY_INTERNAL_NVM_SIZE 256 +#define CIRCUITPY_INTERNAL_NVM_SIZE 0 #define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - CIRCUITPY_INTERNAL_NVM_SIZE) diff --git a/atmel-samd/boards/feather_m0_express/mpconfigboard.mk b/atmel-samd/boards/feather_m0_express/mpconfigboard.mk index bf8bd54f2..5840a5cf9 100644 --- a/atmel-samd/boards/feather_m0_express/mpconfigboard.mk +++ b/atmel-samd/boards/feather_m0_express/mpconfigboard.mk @@ -5,3 +5,4 @@ USB_PID = 0x801b FLASH_IMPL = spi_flash.c CHIP_VARIANT = SAMD21G18A +CHIP_FAMILY = samd21 diff --git a/atmel-samd/boards/gemma_m0/conf_access.h b/atmel-samd/boards/gemma_m0/conf_access.h deleted file mode 100644 index 25109b75c..000000000 --- a/atmel-samd/boards/gemma_m0/conf_access.h +++ /dev/null @@ -1,115 +0,0 @@ -/** - * \file - * - * \brief Memory access control configuration file. - * - * Copyright (c) 2014-2015 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 <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#ifndef _CONF_ACCESS_H_ -#define _CONF_ACCESS_H_ - -#include "compiler.h" -#include "board.h" - - -/*! \name Activation of Logical Unit Numbers - */ -//! @{ -#define LUN_0 ENABLE //!< On-Chip Virtual Memory. -#define LUN_1 DISABLE //!< AT45DBX Data Flash. -#define LUN_2 DISABLE //!< SD/MMC Card over SPI. -#define LUN_3 DISABLE //!< SD/MMC Card over MCI Slot 0. -#define LUN_4 DISABLE -#define LUN_5 DISABLE -#define LUN_6 DISABLE -#define LUN_7 DISABLE -#define LUN_USB DISABLE //!< Host Mass-Storage Memory. -//! @} - -/*! \name LUN 0 Definitions - */ -//! @{ -#define LUN_0_INCLUDE "access_vfs.h" -#define Lun_0_test_unit_ready vfs_test_unit_ready -#define Lun_0_read_capacity vfs_read_capacity -#define Lun_0_unload NULL -#define Lun_0_wr_protect vfs_wr_protect -#define Lun_0_removal vfs_removal -#define Lun_0_usb_read_10 vfs_usb_read_10 -#define Lun_0_usb_write_10 vfs_usb_write_10 -#define LUN_0_NAME "\"MicroPython VFS[0]\"" -//! @} - -#define MEM_USB LUN_USB - -/*! \name Actions Associated with Memory Accesses - * - * Write here the action to associate with each memory access. - * - * \warning Be careful not to waste time in order not to disturb the functions. - */ -//! @{ -#define memory_start_read_action(nb_sectors) -#define memory_stop_read_action() -#define memory_start_write_action(nb_sectors) -#define memory_stop_write_action() -//! @} - -/*! \name Activation of Interface Features - */ -//! @{ -#define ACCESS_USB true //!< MEM <-> USB interface. -#define ACCESS_MEM_TO_RAM false //!< MEM <-> RAM interface. -#define ACCESS_STREAM false //!< Streaming MEM <-> MEM interface. -#define ACCESS_STREAM_RECORD false //!< Streaming MEM <-> MEM interface in record mode. -#define ACCESS_MEM_TO_MEM false //!< MEM <-> MEM interface. -#define ACCESS_CODEC false //!< Codec interface. -//! @} - -/*! \name Specific Options for Access Control - */ -//! @{ -#define GLOBAL_WR_PROTECT false //!< Management of a global write protection. -//! @} - - -#endif // _CONF_ACCESS_H_ diff --git a/atmel-samd/boards/gemma_m0/conf_board.h b/atmel-samd/boards/gemma_m0/conf_board.h deleted file mode 100644 index 7b88c97fc..000000000 --- a/atmel-samd/boards/gemma_m0/conf_board.h +++ /dev/null @@ -1,14 +0,0 @@ -/** - * \file - * - * \brief User board configuration template - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#ifndef CONF_BOARD_H -#define CONF_BOARD_H - -#endif // CONF_BOARD_H diff --git a/atmel-samd/boards/gemma_m0/conf_clocks.h b/atmel-samd/boards/gemma_m0/conf_clocks.h deleted file mode 100644 index 9e4f7876b..000000000 --- a/atmel-samd/boards/gemma_m0/conf_clocks.h +++ /dev/null @@ -1 +0,0 @@ -#include "conf_clocks_crystalless.h" diff --git a/atmel-samd/boards/gemma_m0/conf_usb.h b/atmel-samd/boards/gemma_m0/conf_usb.h deleted file mode 100644 index dd5316b8f..000000000 --- a/atmel-samd/boards/gemma_m0/conf_usb.h +++ /dev/null @@ -1,220 +0,0 @@ - -#include <stdbool.h> -#include <stdint.h> - -#include "asf/common/services/usb/class/cdc/usb_protocol_cdc.h" - -#ifndef CONF_USB_H_INCLUDED -#define CONF_USB_H_INCLUDED - -#define USB_DEVICE_MAJOR_VERSION 1 -#define USB_DEVICE_MINOR_VERSION 0 -#define USB_DEVICE_POWER 100 // Consumption on Vbus line (mA) -#define USB_DEVICE_ATTR \ - (USB_CONFIG_ATTR_BUS_POWERED) -// (USB_CONFIG_ATTR_REMOTE_WAKEUP|USB_CONFIG_ATTR_SELF_POWERED) -// (USB_CONFIG_ATTR_REMOTE_WAKEUP|USB_CONFIG_ATTR_BUS_POWERED) - -//! USB Device string definitions (Optional) -#ifndef USB_DEVICE_MANUFACTURE_NAME -# define USB_DEVICE_MANUFACTURE_NAME "Adafruit Industries" -#endif - -#ifndef USB_DEVICE_PRODUCT_NAME -# define USB_DEVICE_PRODUCT_NAME "Gemma M0" -#endif - -#define USB_DEVICE_GET_SERIAL_NAME_POINTER serial_number -#define USB_DEVICE_GET_SERIAL_NAME_LENGTH 32 -extern char serial_number[USB_DEVICE_GET_SERIAL_NAME_LENGTH]; - -//! Control endpoint size -#define USB_DEVICE_EP_CTRL_SIZE 64 - -//! Interfaces for this device (CDC COM + CDC DATA + MSC + HID mouse + HID kbd) -#define USB_DEVICE_NB_INTERFACE 5 - -// (3 | USB_EP_DIR_IN) // CDC Notify endpoint -// (4 | USB_EP_DIR_IN) // CDC TX -// (5 | USB_EP_DIR_OUT) // CDC RX -// (1 | USB_EP_DIR_IN) // MSC IN -// (2 | USB_EP_DIR_OUT) // MSC OUT -// (6 | USB_EP_DIR_IN) // HID mouse report -// (7 | USB_EP_DIR_IN) // HID keyboard report -#define USB_DEVICE_MAX_EP 7 - -#define UDI_CDC_PORT_NB 1 -#define UDI_CDC_ENABLE_EXT(port) mp_cdc_enable(port) -extern bool mp_cdc_enable(uint8_t port); -#define UDI_CDC_DISABLE_EXT(port) mp_cdc_disable(port) -extern void mp_cdc_disable(uint8_t port); -#define UDI_CDC_LOW_RATE - -#define UDI_CDC_DEFAULT_RATE 115200 -#define UDI_CDC_DEFAULT_STOPBITS CDC_STOP_BITS_1 -#define UDI_CDC_DEFAULT_PARITY CDC_PAR_NONE -#define UDI_CDC_DEFAULT_DATABITS 8 - -#define UDI_CDC_RX_NOTIFY(port) usb_rx_notify() -void usb_rx_notify(void); -#define UDI_CDC_SET_CODING_EXT(port,cfg) usb_coding_notify(port, cfg) -void usb_coding_notify(uint8_t port, usb_cdc_line_coding_t* coding); -#define UDI_CDC_SET_DTR_EXT(port,set) usb_dtr_notify(port, set) -void usb_dtr_notify(uint8_t port, bool set); -#define UDI_CDC_SET_RTS_EXT(port,set) usb_rts_notify(port, set) -void usb_rts_notify(uint8_t port, bool set); - -/** - * USB CDC low level configuration - * In standalone these configurations are defined by the CDC module. - * For composite device, these configuration must be defined here - * @{ - */ -//! Endpoint numbers definition - -#define UDI_CDC_COMM_EP_0 (3 | USB_EP_DIR_IN) // Notify endpoint -#define UDI_CDC_DATA_EP_IN_0 (4 | USB_EP_DIR_IN) // TX -#define UDI_CDC_DATA_EP_OUT_0 (5 | USB_EP_DIR_OUT) // RX - -//! Interface numbers -#define UDI_CDC_COMM_IFACE_NUMBER_0 0 -#define UDI_CDC_DATA_IFACE_NUMBER_0 1 - -/** - * Configuration of MSC interface - * @{ - */ -//! Vendor name and Product version of MSC interface -#define UDI_MSC_GLOBAL_VENDOR_ID \ - 'A', 'T', 'M', 'E', 'L', ' ', ' ', ' ' -#define UDI_MSC_GLOBAL_PRODUCT_VERSION \ - '1', '.', '0', '0' - -//! Interface callback definition -#define UDI_MSC_ENABLE_EXT() mp_msc_enable() -extern bool mp_msc_enable(void); -#define UDI_MSC_DISABLE_EXT() mp_msc_disable() -extern void mp_msc_disable(void); - -//! Enable id string of interface to add an extra USB string -#define UDI_MSC_STRING_ID 5 - -/** - * USB MSC low level configuration - * In standalone these configurations are defined by the MSC module. - * For composite device, these configuration must be defined here - * @{ - */ -//! Endpoint numbers definition -#define UDI_MSC_EP_IN (1 | USB_EP_DIR_IN) -#define UDI_MSC_EP_OUT (2 | USB_EP_DIR_OUT) - -//! Interface number -#define UDI_MSC_IFACE_NUMBER 2 -/** - * Configuration of HID Mouse interface - * @{ - */ -//! Interface callback definition -#define UDI_HID_MOUSE_ENABLE_EXT() mp_mouse_enable() -extern bool mp_mouse_enable(void); -#define UDI_HID_MOUSE_DISABLE_EXT() mp_mouse_disable() -extern void mp_mouse_disable(void); - -//! Enable id string of interface to add an extra USB string -#define UDI_HID_MOUSE_STRING_ID 6 - -/** - * USB HID Mouse low level configuration - * In standalone these configurations are defined by the HID Mouse module. - * For composite device, these configuration must be defined here - * @{ - */ -//! Endpoint numbers definition -#define UDI_HID_MOUSE_EP_IN (6 | USB_EP_DIR_IN) - -//! Interface number -#define UDI_HID_MOUSE_IFACE_NUMBER 3 -//@} -//@} - -/** - * Configuration of HID Keyboard interface - * @{ - */ -//! Interface callback definition -#define UDI_HID_KBD_ENABLE_EXT() mp_keyboard_enable() -extern bool mp_keyboard_enable(void); -#define UDI_HID_KBD_DISABLE_EXT() mp_keyboard_disable() -extern void mp_keyboard_disable(void); -#define UDI_HID_KBD_CHANGE_LED(value) mp_keyboard_led(value) -extern void mp_keyboard_led(uint8_t); - -//! Enable id string of interface to add an extra USB string -#define UDI_HID_KBD_STRING_ID 7 - -/** - * USB HID Keyboard low level configuration - * In standalone these configurations are defined by the HID Keyboard module. - * For composite device, these configuration must be defined here - * @{ - */ -//! Endpoint numbers definition -#define UDI_HID_KBD_EP_IN (7 | USB_EP_DIR_IN) - -//! Interface number -#define UDI_HID_KBD_IFACE_NUMBER 4 - -/** - * Description of Composite Device - * @{ - */ -//! USB Interfaces descriptor structure -#define UDI_COMPOSITE_DESC_T \ - usb_iad_desc_t udi_cdc_iad; \ - udi_cdc_comm_desc_t udi_cdc_comm; \ - udi_cdc_data_desc_t udi_cdc_data; \ - udi_msc_desc_t udi_msc; \ - udi_hid_mouse_desc_t udi_hid_mouse; \ - udi_hid_kbd_desc_t udi_hid_kbd - -//! USB Interfaces descriptor value for Full Speed -#define UDI_COMPOSITE_DESC_FS \ - .udi_cdc_iad = UDI_CDC_IAD_DESC_0, \ - .udi_cdc_comm = UDI_CDC_COMM_DESC_0, \ - .udi_cdc_data = UDI_CDC_DATA_DESC_0_FS, \ - .udi_msc = UDI_MSC_DESC_FS, \ - .udi_hid_mouse = UDI_HID_MOUSE_DESC, \ - .udi_hid_kbd = UDI_HID_KBD_DESC - -//! USB Interfaces descriptor value for High Speed -#define UDI_COMPOSITE_DESC_HS \ - .udi_cdc_iad = UDI_CDC_IAD_DESC_0, \ - .udi_cdc_comm = UDI_CDC_COMM_DESC_0, \ - .udi_cdc_data = UDI_CDC_DATA_DESC_0_HS, \ - .udi_msc = UDI_MSC_DESC_HS, \ - .udi_hid_mouse = UDI_HID_MOUSE_DESC, \ - .udi_hid_kbd = UDI_HID_KBD_DESC - -//! USB Interface APIs -#define UDI_COMPOSITE_API \ - &udi_api_cdc_comm, \ - &udi_api_cdc_data, \ - &udi_api_msc, \ - &udi_api_hid_mouse, \ - &udi_api_hid_kbd -//@} - -/** - * USB Device Driver Configuration - * @{ - */ -//@} - -//! The includes of classes and other headers must be done at the end of this file to avoid compile error -#include "udi_cdc.h" -#include "udi_msc.h" -#include "udi_hid_mouse.h" -#include "udi_hid_kbd.h" - -#endif diff --git a/atmel-samd/boards/gemma_m0/mpconfigboard.h b/atmel-samd/boards/gemma_m0/mpconfigboard.h index 8988c9a63..baa0b3395 100644 --- a/atmel-samd/boards/gemma_m0/mpconfigboard.h +++ b/atmel-samd/boards/gemma_m0/mpconfigboard.h @@ -3,13 +3,14 @@ #define MICROPY_HW_BOARD_NAME "Adafruit Gemma M0" #define MICROPY_HW_MCU_NAME "samd21e18" -#define MICROPY_HW_APA102_MOSI (&pin_PA00) -#define MICROPY_HW_APA102_SCK (&pin_PA01) +// #define MICROPY_HW_APA102_MOSI (&pin_PA00) +// #define MICROPY_HW_APA102_SCK (&pin_PA01) // #define CIRCUITPY_BITBANG_APA102 #define MICROPY_PORT_A (PORT_PA00 | PORT_PA01 | PORT_PA24 | PORT_PA25) #define MICROPY_PORT_B (0) +#define MICROPY_PORT_C (0) #define CIRCUITPY_INTERNAL_NVM_SIZE 0 diff --git a/atmel-samd/boards/gemma_m0/mpconfigboard.mk b/atmel-samd/boards/gemma_m0/mpconfigboard.mk index 87a5e93c1..0666da9a2 100644 --- a/atmel-samd/boards/gemma_m0/mpconfigboard.mk +++ b/atmel-samd/boards/gemma_m0/mpconfigboard.mk @@ -5,3 +5,4 @@ USB_PID = 0x801D FLASH_IMPL = internal_flash.c CHIP_VARIANT = SAMD21E18A +CHIP_FAMILY = samd21 diff --git a/atmel-samd/boards/metro_m0_express/board.c b/atmel-samd/boards/metro_m0_express/board.c index b5d7b328b..bd63baa6f 100644 --- a/atmel-samd/boards/metro_m0_express/board.c +++ b/atmel-samd/boards/metro_m0_express/board.c @@ -25,20 +25,19 @@ */ #include "boards/board.h" -#include "asf/sam0/drivers/port/port.h" #include "mpconfigboard.h" void board_init(void) { - struct port_config pin_conf; - port_get_config_defaults(&pin_conf); - - pin_conf.direction = PORT_PIN_DIR_OUTPUT; - port_pin_set_config(MICROPY_HW_LED_TX, &pin_conf); - port_pin_set_output_level(MICROPY_HW_LED_TX, true); - - port_pin_set_config(MICROPY_HW_LED_RX, &pin_conf); - port_pin_set_output_level(MICROPY_HW_LED_RX, true); + // struct port_config pin_conf; + // port_get_config_defaults(&pin_conf); + // + // pin_conf.direction = PORT_PIN_DIR_OUTPUT; + // port_pin_set_config(MICROPY_HW_LED_TX, &pin_conf); + // port_pin_set_output_level(MICROPY_HW_LED_TX, true); + // + // port_pin_set_config(MICROPY_HW_LED_RX, &pin_conf); + // port_pin_set_output_level(MICROPY_HW_LED_RX, true); } bool board_requests_safe_mode(void) { diff --git a/atmel-samd/boards/metro_m0_express/conf_access.h b/atmel-samd/boards/metro_m0_express/conf_access.h deleted file mode 100644 index 25109b75c..000000000 --- a/atmel-samd/boards/metro_m0_express/conf_access.h +++ /dev/null @@ -1,115 +0,0 @@ -/** - * \file - * - * \brief Memory access control configuration file. - * - * Copyright (c) 2014-2015 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 <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#ifndef _CONF_ACCESS_H_ -#define _CONF_ACCESS_H_ - -#include "compiler.h" -#include "board.h" - - -/*! \name Activation of Logical Unit Numbers - */ -//! @{ -#define LUN_0 ENABLE //!< On-Chip Virtual Memory. -#define LUN_1 DISABLE //!< AT45DBX Data Flash. -#define LUN_2 DISABLE //!< SD/MMC Card over SPI. -#define LUN_3 DISABLE //!< SD/MMC Card over MCI Slot 0. -#define LUN_4 DISABLE -#define LUN_5 DISABLE -#define LUN_6 DISABLE -#define LUN_7 DISABLE -#define LUN_USB DISABLE //!< Host Mass-Storage Memory. -//! @} - -/*! \name LUN 0 Definitions - */ -//! @{ -#define LUN_0_INCLUDE "access_vfs.h" -#define Lun_0_test_unit_ready vfs_test_unit_ready -#define Lun_0_read_capacity vfs_read_capacity -#define Lun_0_unload NULL -#define Lun_0_wr_protect vfs_wr_protect -#define Lun_0_removal vfs_removal -#define Lun_0_usb_read_10 vfs_usb_read_10 -#define Lun_0_usb_write_10 vfs_usb_write_10 -#define LUN_0_NAME "\"MicroPython VFS[0]\"" -//! @} - -#define MEM_USB LUN_USB - -/*! \name Actions Associated with Memory Accesses - * - * Write here the action to associate with each memory access. - * - * \warning Be careful not to waste time in order not to disturb the functions. - */ -//! @{ -#define memory_start_read_action(nb_sectors) -#define memory_stop_read_action() -#define memory_start_write_action(nb_sectors) -#define memory_stop_write_action() -//! @} - -/*! \name Activation of Interface Features - */ -//! @{ -#define ACCESS_USB true //!< MEM <-> USB interface. -#define ACCESS_MEM_TO_RAM false //!< MEM <-> RAM interface. -#define ACCESS_STREAM false //!< Streaming MEM <-> MEM interface. -#define ACCESS_STREAM_RECORD false //!< Streaming MEM <-> MEM interface in record mode. -#define ACCESS_MEM_TO_MEM false //!< MEM <-> MEM interface. -#define ACCESS_CODEC false //!< Codec interface. -//! @} - -/*! \name Specific Options for Access Control - */ -//! @{ -#define GLOBAL_WR_PROTECT false //!< Management of a global write protection. -//! @} - - -#endif // _CONF_ACCESS_H_ diff --git a/atmel-samd/boards/metro_m0_express/conf_board.h b/atmel-samd/boards/metro_m0_express/conf_board.h deleted file mode 100644 index 7b88c97fc..000000000 --- a/atmel-samd/boards/metro_m0_express/conf_board.h +++ /dev/null @@ -1,14 +0,0 @@ -/** - * \file - * - * \brief User board configuration template - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#ifndef CONF_BOARD_H -#define CONF_BOARD_H - -#endif // CONF_BOARD_H diff --git a/atmel-samd/boards/metro_m0_express/conf_clocks.h b/atmel-samd/boards/metro_m0_express/conf_clocks.h deleted file mode 100644 index d3f3e6496..000000000 --- a/atmel-samd/boards/metro_m0_express/conf_clocks.h +++ /dev/null @@ -1 +0,0 @@ -#include "conf_clocks_external_32k.h" diff --git a/atmel-samd/boards/metro_m0_express/conf_usb.h b/atmel-samd/boards/metro_m0_express/conf_usb.h deleted file mode 100644 index 0a623fa06..000000000 --- a/atmel-samd/boards/metro_m0_express/conf_usb.h +++ /dev/null @@ -1,221 +0,0 @@ - -#include <stdbool.h> -#include <stdint.h> - -#include "asf/common/services/usb/class/cdc/usb_protocol_cdc.h" - -#ifndef CONF_USB_H_INCLUDED -#define CONF_USB_H_INCLUDED - -#define USB_DEVICE_MAJOR_VERSION 1 -#define USB_DEVICE_MINOR_VERSION 0 -#define USB_DEVICE_POWER 100 // Consumption on Vbus line (mA) -#define USB_DEVICE_ATTR \ - (USB_CONFIG_ATTR_BUS_POWERED) -// (USB_CONFIG_ATTR_REMOTE_WAKEUP|USB_CONFIG_ATTR_SELF_POWERED) -// (USB_CONFIG_ATTR_REMOTE_WAKEUP|USB_CONFIG_ATTR_BUS_POWERED) - -//! USB Device string definitions (Optional) -#ifndef USB_DEVICE_MANUFACTURE_NAME -# define USB_DEVICE_MANUFACTURE_NAME "Adafruit Industries" -#endif - -#ifndef USB_DEVICE_PRODUCT_NAME -# define USB_DEVICE_PRODUCT_NAME "Metro M0 Express" -#endif -// #define USB_DEVICE_SERIAL_NAME "12...EF" -#define USB_DEVICE_GET_SERIAL_NAME_POINTER serial_number -#define USB_DEVICE_GET_SERIAL_NAME_LENGTH 32 -extern char serial_number[USB_DEVICE_GET_SERIAL_NAME_LENGTH]; - -//! Control endpoint size -#define USB_DEVICE_EP_CTRL_SIZE 64 - -//! Interfaces for this device (CDC COM + CDC DATA + MSC + HID mouse + HID kbd) -#define USB_DEVICE_NB_INTERFACE 5 - -// (3 | USB_EP_DIR_IN) // CDC Notify endpoint -// (4 | USB_EP_DIR_IN) // CDC TX -// (5 | USB_EP_DIR_OUT) // CDC RX -// (1 | USB_EP_DIR_IN) // MSC IN -// (2 | USB_EP_DIR_OUT) // MSC OUT -// (6 | USB_EP_DIR_IN) // HID mouse report -// (7 | USB_EP_DIR_IN) // HID keyboard report -#define USB_DEVICE_MAX_EP 7 - -#define UDI_CDC_PORT_NB 1 -#define UDI_CDC_ENABLE_EXT(port) mp_cdc_enable(port) -extern bool mp_cdc_enable(uint8_t port); -#define UDI_CDC_DISABLE_EXT(port) mp_cdc_disable(port) -extern void mp_cdc_disable(uint8_t port); -#define UDI_CDC_LOW_RATE - -#define UDI_CDC_DEFAULT_RATE 115200 -#define UDI_CDC_DEFAULT_STOPBITS CDC_STOP_BITS_1 -#define UDI_CDC_DEFAULT_PARITY CDC_PAR_NONE -#define UDI_CDC_DEFAULT_DATABITS 8 - -#define UDI_CDC_RX_NOTIFY(port) usb_rx_notify() -void usb_rx_notify(void); -#define UDI_CDC_SET_CODING_EXT(port,cfg) usb_coding_notify(port, cfg) -void usb_coding_notify(uint8_t port, usb_cdc_line_coding_t* coding); -#define UDI_CDC_SET_DTR_EXT(port,set) usb_dtr_notify(port, set) -void usb_dtr_notify(uint8_t port, bool set); -#define UDI_CDC_SET_RTS_EXT(port,set) usb_rts_notify(port, set) -void usb_rts_notify(uint8_t port, bool set); - -/** - * USB CDC low level configuration - * In standalone these configurations are defined by the CDC module. - * For composite device, these configuration must be defined here - * @{ - */ -//! Endpoint numbers definition - -#define UDI_CDC_COMM_EP_0 (3 | USB_EP_DIR_IN) // Notify endpoint -#define UDI_CDC_DATA_EP_IN_0 (4 | USB_EP_DIR_IN) // TX -#define UDI_CDC_DATA_EP_OUT_0 (5 | USB_EP_DIR_OUT) // RX - -//! Interface numbers -#define UDI_CDC_COMM_IFACE_NUMBER_0 0 -#define UDI_CDC_DATA_IFACE_NUMBER_0 1 - -/** - * Configuration of MSC interface - * @{ - */ -//! Vendor name and Product version of MSC interface -#define UDI_MSC_GLOBAL_VENDOR_ID \ - 'A', 'T', 'M', 'E', 'L', ' ', ' ', ' ' -#define UDI_MSC_GLOBAL_PRODUCT_VERSION \ - '1', '.', '0', '0' - -//! Interface callback definition -#define UDI_MSC_ENABLE_EXT() mp_msc_enable() -extern bool mp_msc_enable(void); -#define UDI_MSC_DISABLE_EXT() mp_msc_disable() -extern void mp_msc_disable(void); - -//! Enable id string of interface to add an extra USB string -#define UDI_MSC_STRING_ID 5 - -/** - * USB MSC low level configuration - * In standalone these configurations are defined by the MSC module. - * For composite device, these configuration must be defined here - * @{ - */ -//! Endpoint numbers definition -#define UDI_MSC_EP_IN (1 | USB_EP_DIR_IN) -#define UDI_MSC_EP_OUT (2 | USB_EP_DIR_OUT) - -//! Interface number -#define UDI_MSC_IFACE_NUMBER 2 - -/** - * Configuration of HID Mouse interface - * @{ - */ -//! Interface callback definition -#define UDI_HID_MOUSE_ENABLE_EXT() mp_mouse_enable() -extern bool mp_mouse_enable(void); -#define UDI_HID_MOUSE_DISABLE_EXT() mp_mouse_disable() -extern void mp_mouse_disable(void); - -//! Enable id string of interface to add an extra USB string -#define UDI_HID_MOUSE_STRING_ID 6 - -/** - * USB HID Mouse low level configuration - * In standalone these configurations are defined by the HID Mouse module. - * For composite device, these configuration must be defined here - * @{ - */ -//! Endpoint numbers definition -#define UDI_HID_MOUSE_EP_IN (6 | USB_EP_DIR_IN) - -//! Interface number -#define UDI_HID_MOUSE_IFACE_NUMBER 3 -//@} -//@} - -/** - * Configuration of HID Keyboard interface - * @{ - */ -//! Interface callback definition -#define UDI_HID_KBD_ENABLE_EXT() mp_keyboard_enable() -extern bool mp_keyboard_enable(void); -#define UDI_HID_KBD_DISABLE_EXT() mp_keyboard_disable() -extern void mp_keyboard_disable(void); -#define UDI_HID_KBD_CHANGE_LED(value) mp_keyboard_led(value) -extern void mp_keyboard_led(uint8_t); - -//! Enable id string of interface to add an extra USB string -#define UDI_HID_KBD_STRING_ID 7 - -/** - * USB HID Keyboard low level configuration - * In standalone these configurations are defined by the HID Keyboard module. - * For composite device, these configuration must be defined here - * @{ - */ -//! Endpoint numbers definition -#define UDI_HID_KBD_EP_IN (7 | USB_EP_DIR_IN) - -//! Interface number -#define UDI_HID_KBD_IFACE_NUMBER 4 - -/** - * Description of Composite Device - * @{ - */ -//! USB Interfaces descriptor structure -#define UDI_COMPOSITE_DESC_T \ - usb_iad_desc_t udi_cdc_iad; \ - udi_cdc_comm_desc_t udi_cdc_comm; \ - udi_cdc_data_desc_t udi_cdc_data; \ - udi_msc_desc_t udi_msc; \ - udi_hid_mouse_desc_t udi_hid_mouse; \ - udi_hid_kbd_desc_t udi_hid_kbd - -//! USB Interfaces descriptor value for Full Speed -#define UDI_COMPOSITE_DESC_FS \ - .udi_cdc_iad = UDI_CDC_IAD_DESC_0, \ - .udi_cdc_comm = UDI_CDC_COMM_DESC_0, \ - .udi_cdc_data = UDI_CDC_DATA_DESC_0_FS, \ - .udi_msc = UDI_MSC_DESC_FS, \ - .udi_hid_mouse = UDI_HID_MOUSE_DESC, \ - .udi_hid_kbd = UDI_HID_KBD_DESC - -//! USB Interfaces descriptor value for High Speed -#define UDI_COMPOSITE_DESC_HS \ - .udi_cdc_iad = UDI_CDC_IAD_DESC_0, \ - .udi_cdc_comm = UDI_CDC_COMM_DESC_0, \ - .udi_cdc_data = UDI_CDC_DATA_DESC_0_HS, \ - .udi_msc = UDI_MSC_DESC_HS, \ - .udi_hid_mouse = UDI_HID_MOUSE_DESC, \ - .udi_hid_kbd = UDI_HID_KBD_DESC - -//! USB Interface APIs -#define UDI_COMPOSITE_API \ - &udi_api_cdc_comm, \ - &udi_api_cdc_data, \ - &udi_api_msc, \ - &udi_api_hid_mouse, \ - &udi_api_hid_kbd -//@} - -/** - * USB Device Driver Configuration - * @{ - */ -//@} - -//! The includes of classes and other headers must be done at the end of this file to avoid compile error -#include "udi_cdc.h" -#include "udi_msc.h" -#include "udi_hid_mouse.h" -#include "udi_hid_kbd.h" - -#endif diff --git a/atmel-samd/boards/metro_m0_express/mpconfigboard.h b/atmel-samd/boards/metro_m0_express/mpconfigboard.h index cbc28dc78..291967c88 100644 --- a/atmel-samd/boards/metro_m0_express/mpconfigboard.h +++ b/atmel-samd/boards/metro_m0_express/mpconfigboard.h @@ -4,9 +4,9 @@ #define MICROPY_HW_MCU_NAME "samd21g18" #define MICROPY_HW_LED_TX PIN_PA27 -#define MICROPY_HW_LED_RX PIN_PA31 +//#define MICROPY_HW_LED_RX PIN_PA31 -#define MICROPY_HW_NEOPIXEL (&pin_PA30) +//#define MICROPY_HW_NEOPIXEL (&pin_PA30) // Salae reads 12mhz which is the limit even though we set it to the safer 8mhz. #define SPI_FLASH_BAUDRATE (8000000) @@ -22,12 +22,14 @@ #define MICROPY_PORT_A (PORT_PA13 |PORT_PA24 | PORT_PA25 | PORT_PA27 | PORT_PA30 | PORT_PA31) #define MICROPY_PORT_B (PORT_PB03 | PORT_PB22 | PORT_PB23) +#define MICROPY_PORT_C (0) #include "spi_flash.h" // If you change this, then make sure to update the linker scripts as well to // make sure you don't overwrite code. -#define CIRCUITPY_INTERNAL_NVM_SIZE 256 +// #define CIRCUITPY_INTERNAL_NVM_SIZE 256 +#define CIRCUITPY_INTERNAL_NVM_SIZE 0 #define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - CIRCUITPY_INTERNAL_NVM_SIZE) diff --git a/atmel-samd/boards/metro_m0_express/mpconfigboard.mk b/atmel-samd/boards/metro_m0_express/mpconfigboard.mk index 436e56a60..763738748 100644 --- a/atmel-samd/boards/metro_m0_express/mpconfigboard.mk +++ b/atmel-samd/boards/metro_m0_express/mpconfigboard.mk @@ -5,3 +5,4 @@ USB_PID = 0x8014 FLASH_IMPL = spi_flash.c CHIP_VARIANT = SAMD21G18A +CHIP_FAMILY = samd21 diff --git a/atmel-samd/boards/metro_m4_express/board.c b/atmel-samd/boards/metro_m4_express/board.c new file mode 100644 index 000000000..8096b9b8e --- /dev/null +++ b/atmel-samd/boards/metro_m4_express/board.c @@ -0,0 +1,38 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "boards/board.h" +#include "mpconfigboard.h" + +void board_init(void) { +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { +} diff --git a/atmel-samd/boards/metro_m4_express/mpconfigboard.h b/atmel-samd/boards/metro_m4_express/mpconfigboard.h new file mode 100644 index 000000000..4ce6fe9e4 --- /dev/null +++ b/atmel-samd/boards/metro_m4_express/mpconfigboard.h @@ -0,0 +1,38 @@ +#define MICROPY_HW_BOARD_NAME "Metro M4 Express" +#define MICROPY_HW_MCU_NAME "samd51j20" + +#define CIRCUITPY_MCU_FAMILY samd51 + +#define MICROPY_HW_LED_TX PIN_PA27 +#define MICROPY_HW_LED_RX PIN_PB06 + +// #define MICROPY_HW_NEOPIXEL (&pin_PB17) + +#define SPI_FLASH_BAUDRATE (1000000) + +// Rev F +#define SPI_FLASH_MUX_SETTING SPI_SIGNAL_MUX_SETTING_F +#define SPI_FLASH_PAD0_PINMUX PINMUX_PB08 // MOSI +// Use default pinmux for the chip select since we manage it ourselves. +#define SPI_FLASH_PAD1_PINMUX PINMUX_PB09 // SCK +#define SPI_FLASH_PAD2_PINMUX PINMUX_DEFAULT // CS +#define SPI_FLASH_PAD3_PINMUX PINMUX_PB11 // MISO +#define SPI_FLASH_CS PIN_PB10 +#define SPI_FLASH_SERCOM SERCOM5 + +#define MICROPY_PORT_A (PORT_PA27) +#define MICROPY_PORT_B (PORT_PB06 | PORT_PB08 | PORT_PB09 | PORT_PB11 | PORT_PB17) +#define MICROPY_PORT_C (0) +#define MICROPY_PORT_D (0) + +#define CONF_USB_COMPOSITE_CDC_ACM_EN 1 + +#define AUTORESET_DELAY_MS 500 + +#include "internal_flash.h" + +// If you change this, then make sure to update the linker scripts as well to +// make sure you don't overwrite code. +#define CIRCUITPY_INTERNAL_NVM_SIZE 0 + +#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000) diff --git a/atmel-samd/boards/metro_m4_express/mpconfigboard.mk b/atmel-samd/boards/metro_m4_express/mpconfigboard.mk new file mode 100644 index 000000000..24557e3e0 --- /dev/null +++ b/atmel-samd/boards/metro_m4_express/mpconfigboard.mk @@ -0,0 +1,8 @@ +LD_FILE = boards/samd51x20-external-flash.ld +USB_VID = 0x239A +USB_PID = 0x8015 + +FLASH_IMPL = spi_flash.c + +CHIP_VARIANT = SAMD51J20A +CHIP_FAMILY = samd51 diff --git a/atmel-samd/boards/metro_m4_express/pins.c b/atmel-samd/boards/metro_m4_express/pins.c new file mode 100644 index 000000000..ea6bab9c1 --- /dev/null +++ b/atmel-samd/boards/metro_m4_express/pins.c @@ -0,0 +1,42 @@ +#include "samd51_pins.h" + +// This mapping only includes functional names because pins broken +// out on connectors are labeled with their MCU name available from +// microcontroller.pin. +STATIC const mp_map_elem_t board_global_dict_table[] = { + { MP_OBJ_NEW_QSTR(MP_QSTR_A0), (mp_obj_t)&pin_PA02 }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A1), (mp_obj_t)&pin_PA05 }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A2), (mp_obj_t)&pin_PA06 }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A3), (mp_obj_t)&pin_PA07 }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A4), (mp_obj_t)&pin_PA11 }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A5), (mp_obj_t)&pin_PA04 }, + + + { MP_OBJ_NEW_QSTR(MP_QSTR_D0), (mp_obj_t)&pin_PA23 }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D1), (mp_obj_t)&pin_PA22 }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D2), (mp_obj_t)&pin_PA08 }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D3), (mp_obj_t)&pin_PA10 }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D4), (mp_obj_t)&pin_PB12 }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D5), (mp_obj_t)&pin_PB14 }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D6), (mp_obj_t)&pin_PB15 }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D7), (mp_obj_t)&pin_PA14 }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D8), (mp_obj_t)&pin_PA16 }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D9), (mp_obj_t)&pin_PA17 }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D10), (mp_obj_t)&pin_PA18 }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D11), (mp_obj_t)&pin_PA19 }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D12), (mp_obj_t)&pin_PA20 }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D13), (mp_obj_t)&pin_PA21 }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_SDA), (mp_obj_t)&pin_PB02 }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SCL), (mp_obj_t)&pin_PB03 }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_NEOPIXEL), (mp_obj_t)&pin_PB17 }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_SCK), (mp_obj_t)&pin_PA12 }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MOSI), (mp_obj_t)&pin_PA13 }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MISO), (mp_obj_t)&pin_PA15 }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_LED_RX), (mp_obj_t)&pin_PB06 }, + { MP_OBJ_NEW_QSTR(MP_QSTR_LED_TX), (mp_obj_t)&pin_PA27 }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); diff --git a/atmel-samd/boards/samd51x18-bootloader-external-flash.ld b/atmel-samd/boards/samd51x18-bootloader-external-flash.ld new file mode 100644 index 000000000..b009de640 --- /dev/null +++ b/atmel-samd/boards/samd51x18-bootloader-external-flash.ld @@ -0,0 +1,81 @@ +/* + GNU linker script for SAMD21 +*/ + +/* Specify the memory areas */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000 + 0x4000, LENGTH = 0x00040000 - 0x4000 /* Leave 16KiB for the bootloader. */ + RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 0x00020000 /* 128 KiB */ +} + +/* top end of the stack */ +_estack = ORIGIN(RAM) + LENGTH(RAM); + +/* define output sections */ +SECTIONS +{ + /* The program code and other data goes into FLASH */ + .text : + { + . = ALIGN(4); + _sfixed = .; + KEEP(*(.vectors)) /* isr vector table */ + *(.text) /* .text sections (code) */ + *(.text*) /* .text* sections (code) */ + *(.rodata) /* .rodata sections (constants, strings, etc.) */ + *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ + + . = ALIGN(4); + _etext = .; /* define a global symbol at end of code */ + } >FLASH + + .ARM.exidx : + { + *(.ARM.exidx*) + *(.gnu.linkonce.armexidx.*) + _sidata = .; /* This is used by the startup in order to initialize the .data section */ + } > FLASH + + /* This is the initialized data section + The program executes knowing that the data is in the RAM + but the loader puts the initial values in the FLASH (inidata). + It is one task of the startup to copy the initial values from FLASH to RAM. */ + .data : AT ( _sidata ) + { + . = ALIGN(4); + _srelocate = .; /* create a global symbol at data start; used by startup code in order to initialise the .data section in RAM */ + *(.ramfunc) + *(.ramfunc*) + *(.data) /* .data sections */ + *(.data*) /* .data* sections */ + + . = ALIGN(4); + _erelocate = .; /* define a global symbol at data end; used by startup code in order to initialise the .data section in RAM */ + } >RAM + + /* Uninitialized data section */ + .bss : + { + . = ALIGN(4); + _sbss = .; + _szero = .; /* define a global symbol at bss start; used by startup code */ + *(.bss) + *(.bss*) + *(COMMON) + + . = ALIGN(4); + _ezero = .; /* define a global symbol at bss end; used by startup code */ + _ebss = .; + } >RAM + + /* this just checks there is enough RAM for a minimal stack */ + .stack : + { + . = ALIGN(4); + . = . + 0x800; /* Reserve a minimum of 2K for the stack. */ + . = ALIGN(4); + } >RAM + + .ARM.attributes 0 : { *(.ARM.attributes) } +} diff --git a/atmel-samd/boards/samd51x19-bootloader-external-flash.ld b/atmel-samd/boards/samd51x19-bootloader-external-flash.ld new file mode 100644 index 000000000..bea575797 --- /dev/null +++ b/atmel-samd/boards/samd51x19-bootloader-external-flash.ld @@ -0,0 +1,81 @@ +/* + GNU linker script for SAMD21 +*/ + +/* Specify the memory areas */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000 + 0x4000, LENGTH = 0x00080000 - 0x4000 /* Leave 16KiB for the bootloader. */ + RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 0x00030000 /* 192 KiB */ +} + +/* top end of the stack */ +_estack = ORIGIN(RAM) + LENGTH(RAM); + +/* define output sections */ +SECTIONS +{ + /* The program code and other data goes into FLASH */ + .text : + { + . = ALIGN(4); + _sfixed = .; + KEEP(*(.vectors)) /* isr vector table */ + *(.text) /* .text sections (code) */ + *(.text*) /* .text* sections (code) */ + *(.rodata) /* .rodata sections (constants, strings, etc.) */ + *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ + + . = ALIGN(4); + _etext = .; /* define a global symbol at end of code */ + } >FLASH + + .ARM.exidx : + { + *(.ARM.exidx*) + *(.gnu.linkonce.armexidx.*) + _sidata = .; /* This is used by the startup in order to initialize the .data section */ + } > FLASH + + /* This is the initialized data section + The program executes knowing that the data is in the RAM + but the loader puts the initial values in the FLASH (inidata). + It is one task of the startup to copy the initial values from FLASH to RAM. */ + .data : AT ( _sidata ) + { + . = ALIGN(4); + _srelocate = .; /* create a global symbol at data start; used by startup code in order to initialise the .data section in RAM */ + *(.ramfunc) + *(.ramfunc*) + *(.data) /* .data sections */ + *(.data*) /* .data* sections */ + + . = ALIGN(4); + _erelocate = .; /* define a global symbol at data end; used by startup code in order to initialise the .data section in RAM */ + } >RAM + + /* Uninitialized data section */ + .bss : + { + . = ALIGN(4); + _sbss = .; + _szero = .; /* define a global symbol at bss start; used by startup code */ + *(.bss) + *(.bss*) + *(COMMON) + + . = ALIGN(4); + _ezero = .; /* define a global symbol at bss end; used by startup code */ + _ebss = .; + } >RAM + + /* this just checks there is enough RAM for a minimal stack */ + .stack : + { + . = ALIGN(4); + . = . + 0x800; /* Reserve a minimum of 2K for the stack. */ + . = ALIGN(4); + } >RAM + + .ARM.attributes 0 : { *(.ARM.attributes) } +} diff --git a/atmel-samd/boards/samd51x20-bootloader-external-flash.ld b/atmel-samd/boards/samd51x20-bootloader-external-flash.ld new file mode 100644 index 000000000..e9c67de97 --- /dev/null +++ b/atmel-samd/boards/samd51x20-bootloader-external-flash.ld @@ -0,0 +1,81 @@ +/* + GNU linker script for SAMD21 +*/ + +/* Specify the memory areas */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000 + 0x4000, LENGTH = 0x00100000 - 0x4000 /* Leave 16KiB for the bootloader. */ + RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 0x00040000 /* 256 KiB */ +} + +/* top end of the stack */ +_estack = ORIGIN(RAM) + LENGTH(RAM); + +/* define output sections */ +SECTIONS +{ + /* The program code and other data goes into FLASH */ + .text : + { + . = ALIGN(4); + _sfixed = .; + KEEP(*(.vectors)) /* isr vector table */ + *(.text) /* .text sections (code) */ + *(.text*) /* .text* sections (code) */ + *(.rodata) /* .rodata sections (constants, strings, etc.) */ + *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ + + . = ALIGN(4); + _etext = .; /* define a global symbol at end of code */ + } >FLASH + + .ARM.exidx : + { + *(.ARM.exidx*) + *(.gnu.linkonce.armexidx.*) + _sidata = .; /* This is used by the startup in order to initialize the .data section */ + } > FLASH + + /* This is the initialized data section + The program executes knowing that the data is in the RAM + but the loader puts the initial values in the FLASH (inidata). + It is one task of the startup to copy the initial values from FLASH to RAM. */ + .data : AT ( _sidata ) + { + . = ALIGN(4); + _srelocate = .; /* create a global symbol at data start; used by startup code in order to initialise the .data section in RAM */ + *(.ramfunc) + *(.ramfunc*) + *(.data) /* .data sections */ + *(.data*) /* .data* sections */ + + . = ALIGN(4); + _erelocate = .; /* define a global symbol at data end; used by startup code in order to initialise the .data section in RAM */ + } >RAM + + /* Uninitialized data section */ + .bss : + { + . = ALIGN(4); + _sbss = .; + _szero = .; /* define a global symbol at bss start; used by startup code */ + *(.bss) + *(.bss*) + *(COMMON) + + . = ALIGN(4); + _ezero = .; /* define a global symbol at bss end; used by startup code */ + _ebss = .; + } >RAM + + /* this just checks there is enough RAM for a minimal stack */ + .stack : + { + . = ALIGN(4); + . = . + 0x800; /* Reserve a minimum of 2K for the stack. */ + . = ALIGN(4); + } >RAM + + .ARM.attributes 0 : { *(.ARM.attributes) } +} diff --git a/atmel-samd/boards/samd51x20-external-flash.ld b/atmel-samd/boards/samd51x20-external-flash.ld new file mode 100644 index 000000000..701e24762 --- /dev/null +++ b/atmel-samd/boards/samd51x20-external-flash.ld @@ -0,0 +1,81 @@ +/* + GNU linker script for SAMD21 +*/ + +/* Specify the memory areas */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00100000 + RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 0x00040000 /* 256 KiB */ +} + +/* top end of the stack */ +_estack = ORIGIN(RAM) + LENGTH(RAM); + +/* define output sections */ +SECTIONS +{ + /* The program code and other data goes into FLASH */ + .text : + { + . = ALIGN(4); + _sfixed = .; + KEEP(*(.vectors)) /* isr vector table */ + *(.text) /* .text sections (code) */ + *(.text*) /* .text* sections (code) */ + *(.rodata) /* .rodata sections (constants, strings, etc.) */ + *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ + + . = ALIGN(4); + _etext = .; /* define a global symbol at end of code */ + } >FLASH + + .ARM.exidx : + { + *(.ARM.exidx*) + *(.gnu.linkonce.armexidx.*) + _sidata = .; /* This is used by the startup in order to initialize the .data section */ + } > FLASH + + /* This is the initialized data section + The program executes knowing that the data is in the RAM + but the loader puts the initial values in the FLASH (inidata). + It is one task of the startup to copy the initial values from FLASH to RAM. */ + .data : AT ( _sidata ) + { + . = ALIGN(4); + _srelocate = .; /* create a global symbol at data start; used by startup code in order to initialise the .data section in RAM */ + *(.ramfunc) + *(.ramfunc*) + *(.data) /* .data sections */ + *(.data*) /* .data* sections */ + + . = ALIGN(4); + _erelocate = .; /* define a global symbol at data end; used by startup code in order to initialise the .data section in RAM */ + } >RAM + + /* Uninitialized data section */ + .bss : + { + . = ALIGN(4); + _sbss = .; + _szero = .; /* define a global symbol at bss start; used by startup code */ + *(.bss) + *(.bss*) + *(COMMON) + + . = ALIGN(4); + _ezero = .; /* define a global symbol at bss end; used by startup code */ + _ebss = .; + } >RAM + + /* this just checks there is enough RAM for a minimal stack */ + .stack : + { + . = ALIGN(4); + . = . + 0x800; /* Reserve a minimum of 2K for the stack. */ + . = ALIGN(4); + } >RAM + + .ARM.attributes 0 : { *(.ARM.attributes) } +} diff --git a/atmel-samd/boards/trinket_m0/conf_access.h b/atmel-samd/boards/trinket_m0/conf_access.h deleted file mode 100644 index 25109b75c..000000000 --- a/atmel-samd/boards/trinket_m0/conf_access.h +++ /dev/null @@ -1,115 +0,0 @@ -/** - * \file - * - * \brief Memory access control configuration file. - * - * Copyright (c) 2014-2015 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 <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#ifndef _CONF_ACCESS_H_ -#define _CONF_ACCESS_H_ - -#include "compiler.h" -#include "board.h" - - -/*! \name Activation of Logical Unit Numbers - */ -//! @{ -#define LUN_0 ENABLE //!< On-Chip Virtual Memory. -#define LUN_1 DISABLE //!< AT45DBX Data Flash. -#define LUN_2 DISABLE //!< SD/MMC Card over SPI. -#define LUN_3 DISABLE //!< SD/MMC Card over MCI Slot 0. -#define LUN_4 DISABLE -#define LUN_5 DISABLE -#define LUN_6 DISABLE -#define LUN_7 DISABLE -#define LUN_USB DISABLE //!< Host Mass-Storage Memory. -//! @} - -/*! \name LUN 0 Definitions - */ -//! @{ -#define LUN_0_INCLUDE "access_vfs.h" -#define Lun_0_test_unit_ready vfs_test_unit_ready -#define Lun_0_read_capacity vfs_read_capacity -#define Lun_0_unload NULL -#define Lun_0_wr_protect vfs_wr_protect -#define Lun_0_removal vfs_removal -#define Lun_0_usb_read_10 vfs_usb_read_10 -#define Lun_0_usb_write_10 vfs_usb_write_10 -#define LUN_0_NAME "\"MicroPython VFS[0]\"" -//! @} - -#define MEM_USB LUN_USB - -/*! \name Actions Associated with Memory Accesses - * - * Write here the action to associate with each memory access. - * - * \warning Be careful not to waste time in order not to disturb the functions. - */ -//! @{ -#define memory_start_read_action(nb_sectors) -#define memory_stop_read_action() -#define memory_start_write_action(nb_sectors) -#define memory_stop_write_action() -//! @} - -/*! \name Activation of Interface Features - */ -//! @{ -#define ACCESS_USB true //!< MEM <-> USB interface. -#define ACCESS_MEM_TO_RAM false //!< MEM <-> RAM interface. -#define ACCESS_STREAM false //!< Streaming MEM <-> MEM interface. -#define ACCESS_STREAM_RECORD false //!< Streaming MEM <-> MEM interface in record mode. -#define ACCESS_MEM_TO_MEM false //!< MEM <-> MEM interface. -#define ACCESS_CODEC false //!< Codec interface. -//! @} - -/*! \name Specific Options for Access Control - */ -//! @{ -#define GLOBAL_WR_PROTECT false //!< Management of a global write protection. -//! @} - - -#endif // _CONF_ACCESS_H_ diff --git a/atmel-samd/boards/trinket_m0/conf_board.h b/atmel-samd/boards/trinket_m0/conf_board.h deleted file mode 100644 index 7b88c97fc..000000000 --- a/atmel-samd/boards/trinket_m0/conf_board.h +++ /dev/null @@ -1,14 +0,0 @@ -/** - * \file - * - * \brief User board configuration template - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#ifndef CONF_BOARD_H -#define CONF_BOARD_H - -#endif // CONF_BOARD_H diff --git a/atmel-samd/boards/trinket_m0/conf_clocks.h b/atmel-samd/boards/trinket_m0/conf_clocks.h deleted file mode 100644 index 9e4f7876b..000000000 --- a/atmel-samd/boards/trinket_m0/conf_clocks.h +++ /dev/null @@ -1 +0,0 @@ -#include "conf_clocks_crystalless.h" diff --git a/atmel-samd/boards/trinket_m0/conf_usb.h b/atmel-samd/boards/trinket_m0/conf_usb.h deleted file mode 100644 index 2e6cee1bc..000000000 --- a/atmel-samd/boards/trinket_m0/conf_usb.h +++ /dev/null @@ -1,221 +0,0 @@ - -#include <stdbool.h> -#include <stdint.h> - -#include "asf/common/services/usb/class/cdc/usb_protocol_cdc.h" - -#ifndef CONF_USB_H_INCLUDED -#define CONF_USB_H_INCLUDED - -#define USB_DEVICE_MAJOR_VERSION 1 -#define USB_DEVICE_MINOR_VERSION 0 -#define USB_DEVICE_POWER 100 // Consumption on Vbus line (mA) -#define USB_DEVICE_ATTR \ - (USB_CONFIG_ATTR_BUS_POWERED) -// (USB_CONFIG_ATTR_REMOTE_WAKEUP|USB_CONFIG_ATTR_SELF_POWERED) -// (USB_CONFIG_ATTR_REMOTE_WAKEUP|USB_CONFIG_ATTR_BUS_POWERED) - -//! USB Device string definitions (Optional) -#ifndef USB_DEVICE_MANUFACTURE_NAME -# define USB_DEVICE_MANUFACTURE_NAME "Adafruit Industries" -#endif - -#ifndef USB_DEVICE_PRODUCT_NAME -# define USB_DEVICE_PRODUCT_NAME "Trinket M0" -#endif -// #define USB_DEVICE_SERIAL_NAME "12...EF" -#define USB_DEVICE_GET_SERIAL_NAME_POINTER serial_number -#define USB_DEVICE_GET_SERIAL_NAME_LENGTH 32 -extern char serial_number[USB_DEVICE_GET_SERIAL_NAME_LENGTH]; - -//! Control endpoint size -#define USB_DEVICE_EP_CTRL_SIZE 64 - -//! Interfaces for this device (CDC COM + CDC DATA + MSC + HID mouse + HID kbd) -#define USB_DEVICE_NB_INTERFACE 5 - -// (3 | USB_EP_DIR_IN) // CDC Notify endpoint -// (4 | USB_EP_DIR_IN) // CDC TX -// (5 | USB_EP_DIR_OUT) // CDC RX -// (1 | USB_EP_DIR_IN) // MSC IN -// (2 | USB_EP_DIR_OUT) // MSC OUT -// (6 | USB_EP_DIR_IN) // HID mouse report -// (7 | USB_EP_DIR_IN) // HID keyboard report -#define USB_DEVICE_MAX_EP 7 - -#define UDI_CDC_PORT_NB 1 -#define UDI_CDC_ENABLE_EXT(port) mp_cdc_enable(port) -extern bool mp_cdc_enable(uint8_t port); -#define UDI_CDC_DISABLE_EXT(port) mp_cdc_disable(port) -extern void mp_cdc_disable(uint8_t port); -#define UDI_CDC_LOW_RATE - -#define UDI_CDC_DEFAULT_RATE 115200 -#define UDI_CDC_DEFAULT_STOPBITS CDC_STOP_BITS_1 -#define UDI_CDC_DEFAULT_PARITY CDC_PAR_NONE -#define UDI_CDC_DEFAULT_DATABITS 8 - -#define UDI_CDC_RX_NOTIFY(port) usb_rx_notify() -void usb_rx_notify(void); - -#define UDI_CDC_SET_CODING_EXT(port,cfg) usb_coding_notify(port, cfg) -void usb_coding_notify(uint8_t port, usb_cdc_line_coding_t* coding); -#define UDI_CDC_SET_DTR_EXT(port,set) usb_dtr_notify(port, set) -void usb_dtr_notify(uint8_t port, bool set); -#define UDI_CDC_SET_RTS_EXT(port,set) usb_rts_notify(port, set) -void usb_rts_notify(uint8_t port, bool set); - -/** - * USB CDC low level configuration - * In standalone these configurations are defined by the CDC module. - * For composite device, these configuration must be defined here - * @{ - */ -//! Endpoint numbers definition - -#define UDI_CDC_COMM_EP_0 (3 | USB_EP_DIR_IN) // Notify endpoint -#define UDI_CDC_DATA_EP_IN_0 (4 | USB_EP_DIR_IN) // TX -#define UDI_CDC_DATA_EP_OUT_0 (5 | USB_EP_DIR_OUT) // RX - -//! Interface numbers -#define UDI_CDC_COMM_IFACE_NUMBER_0 0 -#define UDI_CDC_DATA_IFACE_NUMBER_0 1 - -/** - * Configuration of MSC interface - * @{ - */ -//! Vendor name and Product version of MSC interface -#define UDI_MSC_GLOBAL_VENDOR_ID \ - 'A', 'T', 'M', 'E', 'L', ' ', ' ', ' ' -#define UDI_MSC_GLOBAL_PRODUCT_VERSION \ - '1', '.', '0', '0' - -//! Interface callback definition -#define UDI_MSC_ENABLE_EXT() mp_msc_enable() -extern bool mp_msc_enable(void); -#define UDI_MSC_DISABLE_EXT() mp_msc_disable() -extern void mp_msc_disable(void); - -//! Enable id string of interface to add an extra USB string -#define UDI_MSC_STRING_ID 5 - -/** - * USB MSC low level configuration - * In standalone these configurations are defined by the MSC module. - * For composite device, these configuration must be defined here - * @{ - */ -//! Endpoint numbers definition -#define UDI_MSC_EP_IN (1 | USB_EP_DIR_IN) -#define UDI_MSC_EP_OUT (2 | USB_EP_DIR_OUT) - -//! Interface number -#define UDI_MSC_IFACE_NUMBER 2 -/** - * Configuration of HID Mouse interface - * @{ - */ -//! Interface callback definition -#define UDI_HID_MOUSE_ENABLE_EXT() mp_mouse_enable() -extern bool mp_mouse_enable(void); -#define UDI_HID_MOUSE_DISABLE_EXT() mp_mouse_disable() -extern void mp_mouse_disable(void); - -//! Enable id string of interface to add an extra USB string -#define UDI_HID_MOUSE_STRING_ID 6 - -/** - * USB HID Mouse low level configuration - * In standalone these configurations are defined by the HID Mouse module. - * For composite device, these configuration must be defined here - * @{ - */ -//! Endpoint numbers definition -#define UDI_HID_MOUSE_EP_IN (6 | USB_EP_DIR_IN) - -//! Interface number -#define UDI_HID_MOUSE_IFACE_NUMBER 3 -//@} -//@} - -/** - * Configuration of HID Keyboard interface - * @{ - */ -//! Interface callback definition -#define UDI_HID_KBD_ENABLE_EXT() mp_keyboard_enable() -extern bool mp_keyboard_enable(void); -#define UDI_HID_KBD_DISABLE_EXT() mp_keyboard_disable() -extern void mp_keyboard_disable(void); -#define UDI_HID_KBD_CHANGE_LED(value) mp_keyboard_led(value) -extern void mp_keyboard_led(uint8_t); - -//! Enable id string of interface to add an extra USB string -#define UDI_HID_KBD_STRING_ID 7 - -/** - * USB HID Keyboard low level configuration - * In standalone these configurations are defined by the HID Keyboard module. - * For composite device, these configuration must be defined here - * @{ - */ -//! Endpoint numbers definition -#define UDI_HID_KBD_EP_IN (7 | USB_EP_DIR_IN) - -//! Interface number -#define UDI_HID_KBD_IFACE_NUMBER 4 - -/** - * Description of Composite Device - * @{ - */ -//! USB Interfaces descriptor structure -#define UDI_COMPOSITE_DESC_T \ - usb_iad_desc_t udi_cdc_iad; \ - udi_cdc_comm_desc_t udi_cdc_comm; \ - udi_cdc_data_desc_t udi_cdc_data; \ - udi_msc_desc_t udi_msc; \ - udi_hid_mouse_desc_t udi_hid_mouse; \ - udi_hid_kbd_desc_t udi_hid_kbd - -//! USB Interfaces descriptor value for Full Speed -#define UDI_COMPOSITE_DESC_FS \ - .udi_cdc_iad = UDI_CDC_IAD_DESC_0, \ - .udi_cdc_comm = UDI_CDC_COMM_DESC_0, \ - .udi_cdc_data = UDI_CDC_DATA_DESC_0_FS, \ - .udi_msc = UDI_MSC_DESC_FS, \ - .udi_hid_mouse = UDI_HID_MOUSE_DESC, \ - .udi_hid_kbd = UDI_HID_KBD_DESC - -//! USB Interfaces descriptor value for High Speed -#define UDI_COMPOSITE_DESC_HS \ - .udi_cdc_iad = UDI_CDC_IAD_DESC_0, \ - .udi_cdc_comm = UDI_CDC_COMM_DESC_0, \ - .udi_cdc_data = UDI_CDC_DATA_DESC_0_HS, \ - .udi_msc = UDI_MSC_DESC_HS, \ - .udi_hid_mouse = UDI_HID_MOUSE_DESC, \ - .udi_hid_kbd = UDI_HID_KBD_DESC - -//! USB Interface APIs -#define UDI_COMPOSITE_API \ - &udi_api_cdc_comm, \ - &udi_api_cdc_data, \ - &udi_api_msc, \ - &udi_api_hid_mouse, \ - &udi_api_hid_kbd -//@} - -/** - * USB Device Driver Configuration - * @{ - */ -//@} - -//! The includes of classes and other headers must be done at the end of this file to avoid compile error -#include "udi_cdc.h" -#include "udi_msc.h" -#include "udi_hid_mouse.h" -#include "udi_hid_kbd.h" - -#endif diff --git a/atmel-samd/boards/trinket_m0/mpconfigboard.h b/atmel-samd/boards/trinket_m0/mpconfigboard.h index 8fc70f22d..6d46d0414 100644 --- a/atmel-samd/boards/trinket_m0/mpconfigboard.h +++ b/atmel-samd/boards/trinket_m0/mpconfigboard.h @@ -4,11 +4,12 @@ #define MICROPY_HW_MCU_NAME "samd21e18" // Rev B - Black -#define MICROPY_HW_APA102_MOSI (&pin_PA00) -#define MICROPY_HW_APA102_SCK (&pin_PA01) +// #define MICROPY_HW_APA102_MOSI (&pin_PA00) +// #define MICROPY_HW_APA102_SCK (&pin_PA01) #define MICROPY_PORT_A (PORT_PA00 | PORT_PA01 | PORT_PA24 | PORT_PA25) #define MICROPY_PORT_B (0) +#define MICROPY_PORT_C (0) #include "internal_flash.h" diff --git a/atmel-samd/boards/trinket_m0/mpconfigboard.mk b/atmel-samd/boards/trinket_m0/mpconfigboard.mk index 4d2268c13..16b75baa0 100644 --- a/atmel-samd/boards/trinket_m0/mpconfigboard.mk +++ b/atmel-samd/boards/trinket_m0/mpconfigboard.mk @@ -5,3 +5,4 @@ USB_PID = 0x801F FLASH_IMPL = internal_flash.c CHIP_VARIANT = SAMD21E18A +CHIP_FAMILY = samd21 |
