Skip to content

Commit b9e9e70

Browse files
authored
Merge pull request adafruit#49 from adafruit/upstream-merge-2019-04
Merge from microsoft/uf2-samdx1; fuse repair
2 parents 5193a1a + a2fa250 commit b9e9e70

29 files changed

+1283
-36
lines changed

Makefile

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ endif
4242

4343
LDFLAGS= $(COMMON_FLAGS) \
4444
-Wall -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common \
45-
-Wl,--warn-section-align -Wl,--warn-unresolved-symbols \
45+
-Wl,--warn-section-align \
4646
-save-temps -nostartfiles \
4747
--specs=nano.specs --specs=nosys.specs
4848
BUILD_PATH=build/$(BOARD)
@@ -64,6 +64,8 @@ COMMON_SRC = \
6464
src/init_$(CHIP_FAMILY).c \
6565
src/startup_$(CHIP_FAMILY).c \
6666
src/usart_sam_ba.c \
67+
src/screen.c \
68+
src/images.c \
6769
src/utils.c
6870

6971
SOURCES = $(COMMON_SRC) \
@@ -100,6 +102,27 @@ burn: all
100102

101103
run: burn wait logs
102104

105+
# This currently only works on macOS with a BMP debugger attached.
106+
# It's meant to flash the bootloader in a loop.
107+
BMP = $(shell ls -1 /dev/cu.usbmodem* | head -1)
108+
BMP_ARGS = --nx -ex "set mem inaccessible-by-default off" -ex "set confirm off" -ex "target extended-remote $(BMP)" -ex "mon swdp_scan" -ex "attach 1"
109+
GDB = arm-none-eabi-gdb
110+
111+
bmp-flash: $(BUILD_PATH)/$(NAME).bin
112+
@test "X$(BMP)" != "X"
113+
$(GDB) $(BMP_ARGS) -ex "load" -ex "quit" $(BUILD_PATH)/$(NAME).elf | tee build/flash.log
114+
@grep -q "Transfer rate" build/flash.log
115+
116+
bmp-flashone:
117+
while : ; do $(MAKE) bmp-flash && exit 0 ; sleep 1 ; done
118+
afplay /System/Library/PrivateFrameworks/ScreenReader.framework/Versions/A/Resources/Sounds/Error.aiff
119+
120+
bmp-loop:
121+
while : ; do $(MAKE) bmp-flashone ; sleep 5 ; done
122+
123+
bmp-gdb: $(BUILD_PATH)/$(NAME).bin
124+
$(GDB) $(BMP_ARGS) $(BUILD_PATH)/$(NAME).elf
125+
103126
wait:
104127
sleep 5
105128

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ to temporarily turn off the protection. In gdb the command is:
117117

118118
* `make` and an Unix environment
119119
* `node`.js in path (optional)
120-
* `arm-none-eabi-gcc` in the path (the one coming with Yotta will do just fine)
120+
* `arm-none-eabi-gcc` in the path (the one coming with Yotta will do just fine). You can get the latest version from ARM: https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads
121121
* `openocd` - you can use the one coming with Arduino (after your install the M0 board support)
122122

123123
Atmel Studio is not supported.

boards/CC03/board.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CHIP_FAMILY = samd21
2+
CHIP_VARIANT = SAMD21G18A

boards/CC03/board_config.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#ifndef BOARD_CONFIG_H
2+
#define BOARD_CONFIG_H
3+
4+
#define VENDOR_NAME "XinaBox Limited"
5+
#define PRODUCT_NAME "CC03"
6+
#define VOLUME_LABEL "CC03"
7+
#define INDEX_URL "https://xinabox.cc/products/cc03"
8+
9+
#define BOARD_ID "SAMD21G18A-CC03-v0"
10+
11+
//#define USB_VID 0x2341
12+
//#define USB_PID 0x024D
13+
14+
#define LED_PIN PIN_PA07
15+
16+
#endif

boards/CS11/board.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CHIP_FAMILY = samd21
2+
CHIP_VARIANT = SAMD21G18A

boards/CS11/board_config.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#ifndef BOARD_CONFIG_H
2+
#define BOARD_CONFIG_H
3+
4+
#define VENDOR_NAME "XinaBox Limited"
5+
#define PRODUCT_NAME "CS11"
6+
#define VOLUME_LABEL "CS11"
7+
#define INDEX_URL "https://xinabox.cc/products/cc11"
8+
9+
#define BOARD_ID "SAMD21G18A-CS11-v0"
10+
11+
//#define USB_VID 0x2341
12+
//#define USB_PID 0x024D
13+
14+
#define LED_PIN PIN_PA08
15+
16+
#endif

boards/arcade_badge/board.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CHIP_FAMILY = samd51
2+
CHIP_VARIANT = SAMD51J19A

boards/arcade_badge/board_config.h

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
#ifndef BOARD_CONFIG_H
2+
#define BOARD_CONFIG_H
3+
4+
#define VENDOR_NAME "Adafruit Industries"
5+
#define PRODUCT_NAME "Arcade D51"
6+
#define VOLUME_LABEL "ARCADE-D5"
7+
#define INDEX_URL "http://adafru.it/"
8+
#define BOARD_ID "SAMD51J19A-Arcade-D51"
9+
10+
#define USB_VID 0x239A
11+
#define USB_PID 0x002B
12+
13+
#define LED_PIN PIN_PA23
14+
15+
#define BOARD_NEOPIXEL_PIN PIN_PA15
16+
#define BOARD_NEOPIXEL_COUNT 5
17+
18+
#define BOARD_SCREEN 1
19+
20+
#define BOOT_USART_MODULE SERCOM3
21+
#define BOOT_USART_MASK APBAMASK
22+
#define BOOT_USART_BUS_CLOCK_INDEX MCLK_APBBMASK_SERCOM3
23+
#define BOOT_USART_PAD_SETTINGS UART_RX_PAD1_TX_PAD0
24+
#define BOOT_USART_PAD3 PINMUX_UNUSED
25+
#define BOOT_USART_PAD2 PINMUX_UNUSED
26+
#define BOOT_USART_PAD1 PINMUX_PA22C_SERCOM3_PAD0
27+
#define BOOT_USART_PAD0 PINMUX_PA23C_SERCOM3_PAD1
28+
#define BOOT_GCLK_ID_CORE SERCOM3_GCLK_ID_CORE
29+
#define BOOT_GCLK_ID_SLOW SERCOM3_GCLK_ID_SLOW
30+
31+
32+
#define HAS_CONFIG_DATA 1
33+
34+
// This configuration data should be edited at https://microsoft.github.io/uf2/patcher/
35+
// Just drop this file there.
36+
// Alternatively, it can be also binary edited there after the bootloader is compiled.
37+
38+
#ifdef DEFINE_CONFIG_DATA
39+
const uint32_t config_data[] = {
40+
/* CF2 START */
41+
513675505, 539130489, // magic
42+
60, 100, // used entries, total entries
43+
1, 0x2e, // PIN_ACCELEROMETER_INT = PB14
44+
2, 0xd, // PIN_ACCELEROMETER_SCL = PIN_SCL
45+
3, 0xc, // PIN_ACCELEROMETER_SDA = PIN_SDA
46+
4, 0x3ef, // PIN_BTN_A = P_1007
47+
5, 0x3ee, // PIN_BTN_B = P_1006
48+
13, 0x17, // PIN_LED = PIN_D13
49+
18, 0x36, // PIN_MISO = PB22
50+
19, 0x37, // PIN_MOSI = PB23
51+
20, 0xf, // PIN_NEOPIXEL = PA15
52+
21, 0x11, // PIN_RX = PA17
53+
23, 0x11, // PIN_SCK = PA17
54+
24, 0xd, // PIN_SCL = PA13
55+
25, 0xc, // PIN_SDA = PA12
56+
28, 0x10, // PIN_TX = PA16
57+
32, 0x2d, // PIN_DISPLAY_SCK = PB13
58+
34, 0x2c, // PIN_DISPLAY_MOSI = PB12
59+
35, 0x27, // PIN_DISPLAY_CS = PB07
60+
36, 0x25, // PIN_DISPLAY_DC = PB05
61+
37, 0xa0, // DISPLAY_WIDTH = 160
62+
38, 0x80, // DISPLAY_HEIGHT = 128
63+
39, 0x80, // DISPLAY_CFG0 = 0x80
64+
40, 0x12c2d, // DISPLAY_CFG1 = 0x12c2d
65+
41, 0x18, // DISPLAY_CFG2 = 0x18
66+
43, 0x1, // PIN_DISPLAY_RST = PA01
67+
44, 0x0, // PIN_DISPLAY_BL = PA00
68+
47, 0x3e8, // PIN_BTN_LEFT = P_1000
69+
48, 0x3eb, // PIN_BTN_RIGHT = P_1003
70+
49, 0x3e9, // PIN_BTN_UP = P_1001
71+
50, 0x3ea, // PIN_BTN_DOWN = P_1002
72+
51, 0x3ec, // PIN_BTN_MENU = P_1004
73+
59, 0x200, // SPEAKER_VOLUME = 512
74+
60, 0x10, // PIN_JACK_TX = PIN_D5
75+
65, 0x2, // PIN_JACK_SND = PIN_A0
76+
69, 0x3ed, // PIN_BTN_SOFT_RESET = P_1005
77+
70, 0x32, // ACCELEROMETER_TYPE = LIS3DH
78+
71, 0x20, // PIN_BTNMX_LATCH = PB00
79+
72, 0x3f, // PIN_BTNMX_CLOCK = PB31
80+
73, 0x3e, // PIN_BTNMX_DATA = PB30
81+
100, 0x2, // PIN_A0 = PA02
82+
101, 0x5, // PIN_A1 = PA05
83+
102, 0x28, // PIN_A2 = PB08
84+
103, 0x29, // PIN_A3 = PB09
85+
104, 0x4, // PIN_A4 = PA04
86+
105, 0x6, // PIN_A5 = PA06
87+
152, 0x23, // PIN_D2 = PB03
88+
153, 0x22, // PIN_D3 = PB02
89+
154, 0xe, // PIN_D4 = PA14
90+
155, 0x10, // PIN_D5 = PA16
91+
156, 0x12, // PIN_D6 = PA18
92+
159, 0x13, // PIN_D9 = PA19
93+
160, 0x14, // PIN_D10 = PA20
94+
161, 0x15, // PIN_D11 = PA21
95+
162, 0x16, // PIN_D12 = PA22
96+
163, 0x17, // PIN_D13 = PA23
97+
200, 0x5, // NUM_NEOPIXELS = 5
98+
204, 0x80000, // FLASH_BYTES = 0x80000
99+
205, 0x30000, // RAM_BYTES = 0x30000
100+
208, 0x18591ab9, // BOOTLOADER_BOARD_ID = 0x18591ab9
101+
209, 0x55114460, // UF2_FAMILY = ATSAMD51
102+
210, 0x20, // PINS_PORT_SIZE = PA_32
103+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
104+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
105+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
106+
/* CF2 END */
107+
};
108+
#endif
109+
110+
#endif

boards/arcade_feather_m4/board.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CHIP_FAMILY = samd51
2+
CHIP_VARIANT = SAMD51J19A
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
#ifndef BOARD_CONFIG_H
2+
#define BOARD_CONFIG_H
3+
4+
#define VENDOR_NAME "Adafruit Industries"
5+
#define PRODUCT_NAME "Feather Arcade D51"
6+
#define VOLUME_LABEL "ARCADE-D5"
7+
#define INDEX_URL "https://arcade.makecode.com/"
8+
#define BOARD_ID "SAMD51J19A-Feather-Arcade-D51"
9+
10+
11+
#define USB_VID 0x239A
12+
#define USB_PID 0x0022
13+
14+
#define LED_PIN PIN_PA23
15+
16+
#define BOARD_NEOPIXEL_PIN PIN_PB03
17+
#define BOARD_NEOPIXEL_COUNT 1
18+
19+
#define BOOT_USART_MODULE SERCOM0
20+
#define BOOT_USART_MASK APBAMASK
21+
#define BOOT_USART_BUS_CLOCK_INDEX MCLK_APBAMASK_SERCOM0
22+
#define BOOT_USART_PAD_SETTINGS UART_RX_PAD3_TX_PAD0
23+
#define BOOT_USART_PAD3 PINMUX_PA07D_SERCOM0_PAD3
24+
#define BOOT_USART_PAD2 PINMUX_UNUSED
25+
#define BOOT_USART_PAD1 PINMUX_UNUSED
26+
#define BOOT_USART_PAD0 PINMUX_PA04D_SERCOM0_PAD0
27+
#define BOOT_GCLK_ID_CORE SERCOM0_GCLK_ID_CORE
28+
#define BOOT_GCLK_ID_SLOW SERCOM0_GCLK_ID_SLOW
29+
30+
#define HAS_CONFIG_DATA 1
31+
#define BOARD_SCREEN 1
32+
33+
34+
// This configuration data should be edited at https://microsoft.github.io/uf2/patcher/
35+
// Just drop this file there.
36+
// Alternatively, it can be also binary edited there after the bootloader is compiled.
37+
38+
#ifdef DEFINE_CONFIG_DATA
39+
const uint32_t config_data[] = {
40+
/* CF2 START */
41+
513675505, 539130489, // magic
42+
53, 100, // used entries, total entries
43+
4, 0xd, // PIN_BTN_A = PIN_SCL
44+
5, 0x12, // PIN_BTN_B = PIN_D6
45+
13, 0x17, // PIN_LED = PIN_D13
46+
18, 0x36, // PIN_MISO = PB22
47+
19, 0x37, // PIN_MOSI = PB23
48+
20, 0x23, // PIN_NEOPIXEL = PB03
49+
21, 0x31, // PIN_RX = PB17
50+
23, 0x11, // PIN_SCK = PA17
51+
24, 0xd, // PIN_SCL = PA13
52+
25, 0xc, // PIN_SDA = PA12
53+
26, 0xe, // PIN_SPEAKER_AMP = PIN_D4
54+
28, 0x30, // PIN_TX = PB16
55+
32, 0x11, // PIN_DISPLAY_SCK = PIN_SCK
56+
33, 0x36, // PIN_DISPLAY_MISO = PIN_MISO
57+
34, 0x37, // PIN_DISPLAY_MOSI = PIN_MOSI
58+
35, 0x28, // PIN_DISPLAY_CS = PIN_A2
59+
36, 0x29, // PIN_DISPLAY_DC = PIN_A3
60+
37, 0xa0, // DISPLAY_WIDTH = 160
61+
38, 0x80, // DISPLAY_HEIGHT = 128
62+
39, 0x90, // DISPLAY_CFG0 = 0x90
63+
40, 0xe14ff, // DISPLAY_CFG1 = 0xe14ff
64+
41, 0x18, // DISPLAY_CFG2 = 0x18
65+
43, 0x4, // PIN_DISPLAY_RST = PIN_A4
66+
44, 0x6, // PIN_DISPLAY_BL = PIN_A5
67+
47, 0x15, // PIN_BTN_LEFT = PIN_D11
68+
48, 0x13, // PIN_BTN_RIGHT = PIN_D9
69+
49, 0x14, // PIN_BTN_UP = PIN_D10
70+
50, 0x16, // PIN_BTN_DOWN = PIN_D12
71+
51, 0xc, // PIN_BTN_MENU = PIN_SDA
72+
59, 0x200, // SPEAKER_VOLUME = 512
73+
60, 0x30, // PIN_JACK_TX = PIN_D1
74+
100, 0x2, // PIN_A0 = PA02
75+
101, 0x5, // PIN_A1 = PA05
76+
102, 0x28, // PIN_A2 = PB08
77+
103, 0x29, // PIN_A3 = PB09
78+
104, 0x4, // PIN_A4 = PA04
79+
105, 0x6, // PIN_A5 = PA06
80+
150, 0x31, // PIN_D0 = PB17
81+
151, 0x30, // PIN_D1 = PB16
82+
154, 0xe, // PIN_D4 = PA14
83+
155, 0x10, // PIN_D5 = PA16
84+
156, 0x12, // PIN_D6 = PA18
85+
159, 0x13, // PIN_D9 = PA19
86+
160, 0x14, // PIN_D10 = PA20
87+
161, 0x15, // PIN_D11 = PA21
88+
162, 0x16, // PIN_D12 = PA22
89+
163, 0x17, // PIN_D13 = PA23
90+
200, 0x1, // NUM_NEOPIXELS = 1
91+
204, 0x80000, // FLASH_BYTES = 0x80000
92+
205, 0x30000, // RAM_BYTES = 0x30000
93+
208, 0x2b9e3d05, // BOOTLOADER_BOARD_ID = 0x2b9e3d05
94+
209, 0x55114460, // UF2_FAMILY = ATSAMD51
95+
210, 0x20, // PINS_PORT_SIZE = PA_32
96+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
97+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
98+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
99+
/* CF2 END */
100+
};
101+
#endif
102+
103+
#endif
104+
105+
106+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
PIN_BTN_A = PIN_D10
2+
PIN_BTN_B = PIN_D11
3+
PIN_BTN_LEFT = PIN_SDA
4+
PIN_BTN_UP = PIN_D7
5+
PIN_BTN_RIGHT = PIN_SCL
6+
PIN_BTN_DOWN = PIN_D9
7+
PIN_BTN_MENU = PIN_D12
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
DISPLAY_CFG0 = 0x01000080
2+
DISPLAY_CFG1 = 0x00000603

boards/arcade_itsybitsy_m4/board.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CHIP_FAMILY = samd51
2+
CHIP_VARIANT = SAMD51G19A

0 commit comments

Comments
 (0)