Skip to content

Commit e08241d

Browse files
dastelstannewt
authored andcommitted
Supersized Feather M0 Express for 2.x (replace the 2Mbyte SPI flash with an 8Mbyte chip) (micropython#355)
Add supersized (8Mbyte SPI flash) FeatherM0Express support
1 parent 9bcc105 commit e08241d

File tree

9 files changed

+513
-0
lines changed

9 files changed

+513
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* This file is part of the MicroPython project, http://micropython.org/
3+
*
4+
* The MIT License (MIT)
5+
*
6+
* Copyright (c) 2017 Scott Shawcroft for Adafruit Industries
7+
*
8+
* Permission is hereby granted, free of charge, to any person obtaining a copy
9+
* of this software and associated documentation files (the "Software"), to deal
10+
* in the Software without restriction, including without limitation the rights
11+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
* copies of the Software, and to permit persons to whom the Software is
13+
* furnished to do so, subject to the following conditions:
14+
*
15+
* The above copyright notice and this permission notice shall be included in
16+
* all copies or substantial portions of the Software.
17+
*
18+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24+
* THE SOFTWARE.
25+
*/
26+
27+
#include "boards/board.h"
28+
29+
void board_init(void)
30+
{
31+
}
32+
33+
bool board_requests_safe_mode(void) {
34+
return false;
35+
}
36+
37+
void reset_board(void) {
38+
}
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
/**
2+
* \file
3+
*
4+
* \brief Memory access control configuration file.
5+
*
6+
* Copyright (c) 2014-2015 Atmel Corporation. All rights reserved.
7+
*
8+
* \asf_license_start
9+
*
10+
* \page License
11+
*
12+
* Redistribution and use in source and binary forms, with or without
13+
* modification, are permitted provided that the following conditions are met:
14+
*
15+
* 1. Redistributions of source code must retain the above copyright notice,
16+
* this list of conditions and the following disclaimer.
17+
*
18+
* 2. Redistributions in binary form must reproduce the above copyright notice,
19+
* this list of conditions and the following disclaimer in the documentation
20+
* and/or other materials provided with the distribution.
21+
*
22+
* 3. The name of Atmel may not be used to endorse or promote products derived
23+
* from this software without specific prior written permission.
24+
*
25+
* 4. This software may only be redistributed and used in connection with an
26+
* Atmel microcontroller product.
27+
*
28+
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
29+
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
30+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
31+
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
32+
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34+
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
36+
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
37+
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38+
* POSSIBILITY OF SUCH DAMAGE.
39+
*
40+
* \asf_license_stop
41+
*
42+
*/
43+
/*
44+
* Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
45+
*/
46+
47+
#ifndef _CONF_ACCESS_H_
48+
#define _CONF_ACCESS_H_
49+
50+
#include "compiler.h"
51+
#include "board.h"
52+
53+
54+
/*! \name Activation of Logical Unit Numbers
55+
*/
56+
//! @{
57+
#define LUN_0 ENABLE //!< On-Chip Virtual Memory.
58+
#define LUN_1 DISABLE //!< AT45DBX Data Flash.
59+
#define LUN_2 DISABLE //!< SD/MMC Card over SPI.
60+
#define LUN_3 DISABLE //!< SD/MMC Card over MCI Slot 0.
61+
#define LUN_4 DISABLE
62+
#define LUN_5 DISABLE
63+
#define LUN_6 DISABLE
64+
#define LUN_7 DISABLE
65+
#define LUN_USB DISABLE //!< Host Mass-Storage Memory.
66+
//! @}
67+
68+
/*! \name LUN 0 Definitions
69+
*/
70+
//! @{
71+
#define LUN_0_INCLUDE "access_vfs.h"
72+
#define Lun_0_test_unit_ready vfs_test_unit_ready
73+
#define Lun_0_read_capacity vfs_read_capacity
74+
#define Lun_0_unload NULL
75+
#define Lun_0_wr_protect vfs_wr_protect
76+
#define Lun_0_removal vfs_removal
77+
#define Lun_0_usb_read_10 vfs_usb_read_10
78+
#define Lun_0_usb_write_10 vfs_usb_write_10
79+
#define LUN_0_NAME "\"CircuitPython VFS[0]\""
80+
//! @}
81+
82+
#define MEM_USB LUN_USB
83+
84+
/*! \name Actions Associated with Memory Accesses
85+
*
86+
* Write here the action to associate with each memory access.
87+
*
88+
* \warning Be careful not to waste time in order not to disturb the functions.
89+
*/
90+
//! @{
91+
#define memory_start_read_action(nb_sectors)
92+
#define memory_stop_read_action()
93+
#define memory_start_write_action(nb_sectors)
94+
#define memory_stop_write_action()
95+
//! @}
96+
97+
/*! \name Activation of Interface Features
98+
*/
99+
//! @{
100+
#define ACCESS_USB true //!< MEM <-> USB interface.
101+
#define ACCESS_MEM_TO_RAM false //!< MEM <-> RAM interface.
102+
#define ACCESS_STREAM false //!< Streaming MEM <-> MEM interface.
103+
#define ACCESS_STREAM_RECORD false //!< Streaming MEM <-> MEM interface in record mode.
104+
#define ACCESS_MEM_TO_MEM false //!< MEM <-> MEM interface.
105+
#define ACCESS_CODEC false //!< Codec interface.
106+
//! @}
107+
108+
/*! \name Specific Options for Access Control
109+
*/
110+
//! @{
111+
#define GLOBAL_WR_PROTECT false //!< Management of a global write protection.
112+
//! @}
113+
114+
115+
#endif // _CONF_ACCESS_H_
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* \file
3+
*
4+
* \brief User board configuration template
5+
*
6+
*/
7+
/*
8+
* Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
9+
*/
10+
11+
#ifndef CONF_BOARD_H
12+
#define CONF_BOARD_H
13+
14+
#endif // CONF_BOARD_H
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include "conf_clocks_external_32k.h"
Lines changed: 220 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,220 @@
1+
2+
#include <stdbool.h>
3+
#include <stdint.h>
4+
5+
#include "asf/common/services/usb/class/cdc/usb_protocol_cdc.h"
6+
7+
#ifndef CONF_USB_H_INCLUDED
8+
#define CONF_USB_H_INCLUDED
9+
10+
#define USB_DEVICE_MAJOR_VERSION 1
11+
#define USB_DEVICE_MINOR_VERSION 0
12+
#define USB_DEVICE_POWER 100 // Consumption on Vbus line (mA)
13+
#define USB_DEVICE_ATTR \
14+
(USB_CONFIG_ATTR_BUS_POWERED)
15+
// (USB_CONFIG_ATTR_REMOTE_WAKEUP|USB_CONFIG_ATTR_SELF_POWERED)
16+
// (USB_CONFIG_ATTR_REMOTE_WAKEUP|USB_CONFIG_ATTR_BUS_POWERED)
17+
18+
//! USB Device string definitions (Optional)
19+
#ifndef USB_DEVICE_MANUFACTURE_NAME
20+
# define USB_DEVICE_MANUFACTURE_NAME "Dave Astels"
21+
#endif
22+
23+
#ifndef USB_DEVICE_PRODUCT_NAME
24+
# define USB_DEVICE_PRODUCT_NAME "Hacked Feather M0 Express with 8Mbyte SPI flash"
25+
#endif
26+
27+
#define USB_DEVICE_GET_SERIAL_NAME_POINTER serial_number
28+
#define USB_DEVICE_GET_SERIAL_NAME_LENGTH 32
29+
extern char serial_number[USB_DEVICE_GET_SERIAL_NAME_LENGTH];
30+
31+
//! Control endpoint size
32+
#define USB_DEVICE_EP_CTRL_SIZE 64
33+
34+
//! Interfaces for this device (CDC COM + CDC DATA + MSC + HID mouse + HID kbd)
35+
#define USB_DEVICE_NB_INTERFACE 5
36+
37+
// (3 | USB_EP_DIR_IN) // CDC Notify endpoint
38+
// (4 | USB_EP_DIR_IN) // CDC TX
39+
// (5 | USB_EP_DIR_OUT) // CDC RX
40+
// (1 | USB_EP_DIR_IN) // MSC IN
41+
// (2 | USB_EP_DIR_OUT) // MSC OUT
42+
// (6 | USB_EP_DIR_IN) // HID mouse report
43+
// (7 | USB_EP_DIR_IN) // HID keyboard report
44+
#define USB_DEVICE_MAX_EP 7
45+
46+
#define UDI_CDC_PORT_NB 1
47+
#define UDI_CDC_ENABLE_EXT(port) mp_cdc_enable(port)
48+
extern bool mp_cdc_enable(uint8_t port);
49+
#define UDI_CDC_DISABLE_EXT(port) mp_cdc_disable(port)
50+
extern void mp_cdc_disable(uint8_t port);
51+
#define UDI_CDC_LOW_RATE
52+
53+
#define UDI_CDC_DEFAULT_RATE 115200
54+
#define UDI_CDC_DEFAULT_STOPBITS CDC_STOP_BITS_1
55+
#define UDI_CDC_DEFAULT_PARITY CDC_PAR_NONE
56+
#define UDI_CDC_DEFAULT_DATABITS 8
57+
58+
#define UDI_CDC_RX_NOTIFY(port) usb_rx_notify()
59+
void usb_rx_notify(void);
60+
#define UDI_CDC_SET_CODING_EXT(port,cfg) usb_coding_notify(port, cfg)
61+
void usb_coding_notify(uint8_t port, usb_cdc_line_coding_t* coding);
62+
#define UDI_CDC_SET_DTR_EXT(port,set) usb_dtr_notify(port, set)
63+
void usb_dtr_notify(uint8_t port, bool set);
64+
#define UDI_CDC_SET_RTS_EXT(port,set) usb_rts_notify(port, set)
65+
void usb_rts_notify(uint8_t port, bool set);
66+
67+
/**
68+
* USB CDC low level configuration
69+
* In standalone these configurations are defined by the CDC module.
70+
* For composite device, these configuration must be defined here
71+
* @{
72+
*/
73+
//! Endpoint numbers definition
74+
75+
#define UDI_CDC_COMM_EP_0 (3 | USB_EP_DIR_IN) // Notify endpoint
76+
#define UDI_CDC_DATA_EP_IN_0 (4 | USB_EP_DIR_IN) // TX
77+
#define UDI_CDC_DATA_EP_OUT_0 (5 | USB_EP_DIR_OUT) // RX
78+
79+
//! Interface numbers
80+
#define UDI_CDC_COMM_IFACE_NUMBER_0 0
81+
#define UDI_CDC_DATA_IFACE_NUMBER_0 1
82+
83+
/**
84+
* Configuration of MSC interface
85+
* @{
86+
*/
87+
//! Vendor name and Product version of MSC interface
88+
#define UDI_MSC_GLOBAL_VENDOR_ID \
89+
'A', 'T', 'M', 'E', 'L', ' ', ' ', ' '
90+
#define UDI_MSC_GLOBAL_PRODUCT_VERSION \
91+
'1', '.', '0', '0'
92+
93+
//! Interface callback definition
94+
#define UDI_MSC_ENABLE_EXT() mp_msc_enable()
95+
extern bool mp_msc_enable(void);
96+
#define UDI_MSC_DISABLE_EXT() mp_msc_disable()
97+
extern void mp_msc_disable(void);
98+
99+
//! Enable id string of interface to add an extra USB string
100+
#define UDI_MSC_STRING_ID 5
101+
102+
/**
103+
* USB MSC low level configuration
104+
* In standalone these configurations are defined by the MSC module.
105+
* For composite device, these configuration must be defined here
106+
* @{
107+
*/
108+
//! Endpoint numbers definition
109+
#define UDI_MSC_EP_IN (1 | USB_EP_DIR_IN)
110+
#define UDI_MSC_EP_OUT (2 | USB_EP_DIR_OUT)
111+
112+
//! Interface number
113+
#define UDI_MSC_IFACE_NUMBER 2
114+
/**
115+
* Configuration of HID Mouse interface
116+
* @{
117+
*/
118+
//! Interface callback definition
119+
#define UDI_HID_MOUSE_ENABLE_EXT() mp_mouse_enable()
120+
extern bool mp_mouse_enable(void);
121+
#define UDI_HID_MOUSE_DISABLE_EXT() mp_mouse_disable()
122+
extern void mp_mouse_disable(void);
123+
124+
//! Enable id string of interface to add an extra USB string
125+
#define UDI_HID_MOUSE_STRING_ID 6
126+
127+
/**
128+
* USB HID Mouse low level configuration
129+
* In standalone these configurations are defined by the HID Mouse module.
130+
* For composite device, these configuration must be defined here
131+
* @{
132+
*/
133+
//! Endpoint numbers definition
134+
#define UDI_HID_MOUSE_EP_IN (6 | USB_EP_DIR_IN)
135+
136+
//! Interface number
137+
#define UDI_HID_MOUSE_IFACE_NUMBER 3
138+
//@}
139+
//@}
140+
141+
/**
142+
* Configuration of HID Keyboard interface
143+
* @{
144+
*/
145+
//! Interface callback definition
146+
#define UDI_HID_KBD_ENABLE_EXT() mp_keyboard_enable()
147+
extern bool mp_keyboard_enable(void);
148+
#define UDI_HID_KBD_DISABLE_EXT() mp_keyboard_disable()
149+
extern void mp_keyboard_disable(void);
150+
#define UDI_HID_KBD_CHANGE_LED(value) mp_keyboard_led(value)
151+
extern void mp_keyboard_led(uint8_t);
152+
153+
//! Enable id string of interface to add an extra USB string
154+
#define UDI_HID_KBD_STRING_ID 7
155+
156+
/**
157+
* USB HID Keyboard low level configuration
158+
* In standalone these configurations are defined by the HID Keyboard module.
159+
* For composite device, these configuration must be defined here
160+
* @{
161+
*/
162+
//! Endpoint numbers definition
163+
#define UDI_HID_KBD_EP_IN (7 | USB_EP_DIR_IN)
164+
165+
//! Interface number
166+
#define UDI_HID_KBD_IFACE_NUMBER 4
167+
168+
/**
169+
* Description of Composite Device
170+
* @{
171+
*/
172+
//! USB Interfaces descriptor structure
173+
#define UDI_COMPOSITE_DESC_T \
174+
usb_iad_desc_t udi_cdc_iad; \
175+
udi_cdc_comm_desc_t udi_cdc_comm; \
176+
udi_cdc_data_desc_t udi_cdc_data; \
177+
udi_msc_desc_t udi_msc; \
178+
udi_hid_mouse_desc_t udi_hid_mouse; \
179+
udi_hid_kbd_desc_t udi_hid_kbd
180+
181+
//! USB Interfaces descriptor value for Full Speed
182+
#define UDI_COMPOSITE_DESC_FS \
183+
.udi_cdc_iad = UDI_CDC_IAD_DESC_0, \
184+
.udi_cdc_comm = UDI_CDC_COMM_DESC_0, \
185+
.udi_cdc_data = UDI_CDC_DATA_DESC_0_FS, \
186+
.udi_msc = UDI_MSC_DESC_FS, \
187+
.udi_hid_mouse = UDI_HID_MOUSE_DESC, \
188+
.udi_hid_kbd = UDI_HID_KBD_DESC
189+
190+
//! USB Interfaces descriptor value for High Speed
191+
#define UDI_COMPOSITE_DESC_HS \
192+
.udi_cdc_iad = UDI_CDC_IAD_DESC_0, \
193+
.udi_cdc_comm = UDI_CDC_COMM_DESC_0, \
194+
.udi_cdc_data = UDI_CDC_DATA_DESC_0_HS, \
195+
.udi_msc = UDI_MSC_DESC_HS, \
196+
.udi_hid_mouse = UDI_HID_MOUSE_DESC, \
197+
.udi_hid_kbd = UDI_HID_KBD_DESC
198+
199+
//! USB Interface APIs
200+
#define UDI_COMPOSITE_API \
201+
&udi_api_cdc_comm, \
202+
&udi_api_cdc_data, \
203+
&udi_api_msc, \
204+
&udi_api_hid_mouse, \
205+
&udi_api_hid_kbd
206+
//@}
207+
208+
/**
209+
* USB Device Driver Configuration
210+
* @{
211+
*/
212+
//@}
213+
214+
//! The includes of classes and other headers must be done at the end of this file to avoid compile error
215+
#include "udi_cdc.h"
216+
#include "udi_msc.h"
217+
#include "udi_hid_mouse.h"
218+
#include "udi_hid_kbd.h"
219+
220+
#endif

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy