Skip to content

Commit 7ddab64

Browse files
committed
move bootloaderConfig into pinconfig.c
1 parent fe5cbd8 commit 7ddab64

File tree

3 files changed

+70
-68
lines changed

3 files changed

+70
-68
lines changed

src/boards/arcade_feather_nrf52840_express/board.h

Lines changed: 61 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
* THE SOFTWARE.
2323
*/
2424

25-
#ifndef _FEATHER_NRF52840_H
26-
#define _FEATHER_NRF52840_H
25+
#ifndef _ARCARDE_FEATHER_NRF52840_H
26+
#define _ARCARDE_FEATHER_NRF52840_H
2727

2828
#define _PINNUM(port, pin) ((port)*32 + (pin))
2929

@@ -75,69 +75,65 @@
7575
#define UF2_BOARD_ID "nRF52840-Feather-revD"
7676
#define UF2_INDEX_URL "https://www.adafruit.com/product/4062"
7777

78-
#ifdef DEFINE_BOOTLOADER_CONFIG
79-
#define BOOTLOADER_CONFIG_PRESENT 1
80-
__attribute__((used, section(".bootloaderConfig")))
81-
const uint32_t bootloaderConfig[] = {
82-
/* CF2 START */
83-
513675505, 539130489, // magic
84-
49, 100, // used entries, total entries
85-
4, 0x18, // PIN_BTN_A = PIN_RX
86-
5, 0xa, // PIN_BTN_B = PIN_D2
87-
13, 0x29, // PIN_LED = PIN_D13
88-
18, 0xf, // PIN_MISO = PA15
89-
19, 0xd, // PIN_MOSI = PA13
90-
20, 0x23, // PIN_NEOPIXEL = PB03
91-
21, 0x18, // PIN_RX = PA24
92-
23, 0xe, // PIN_SCK = PA14
93-
24, 0xb, // PIN_SCL = PA11
94-
25, 0xc, // PIN_SDA = PA12
95-
28, 0x19, // PIN_TX = PA25
96-
32, 0xe, // PIN_DISPLAY_SCK = PIN_SCK
97-
34, 0xd, // PIN_DISPLAY_MOSI = PIN_MOSI
98-
35, 0x1e, // PIN_DISPLAY_CS = PIN_A2
99-
36, 0x1c, // PIN_DISPLAY_DC = PIN_A3
100-
37, 0xa0, // DISPLAY_WIDTH = 160
101-
38, 0x80, // DISPLAY_HEIGHT = 128
102-
39, 0x80, // DISPLAY_CFG0 = 0x80
103-
40, 0x603, // DISPLAY_CFG1 = 0x603
104-
41, 0x20, // DISPLAY_CFG2 = 0x20
105-
43, 0x2, // PIN_DISPLAY_RST = PIN_A4
106-
44, 0x3, // PIN_DISPLAY_BL = PIN_A5
107-
47, 0x6, // PIN_BTN_LEFT = PIN_D11
108-
48, 0x1a, // PIN_BTN_RIGHT = PIN_D9
109-
49, 0x1b, // PIN_BTN_UP = PIN_D10
110-
50, 0x7, // PIN_BTN_DOWN = PIN_D6
111-
51, 0x8, // PIN_BTN_MENU = PIN_D12
112-
56, 0x2a, // PIN_LED2 = PB10
113-
60, 0x19, // PIN_JACK_TX = PIN_TX
114-
100, 0x4, // PIN_A0 = PA04
115-
101, 0x5, // PIN_A1 = PA05
116-
102, 0x1e, // PIN_A2 = PA30
117-
103, 0x1c, // PIN_A3 = PA28
118-
104, 0x2, // PIN_A4 = PA02
119-
105, 0x3, // PIN_A5 = PA03
120-
152, 0xa, // PIN_D2 = PA10
121-
155, 0x28, // PIN_D5 = PB08
122-
156, 0x7, // PIN_D6 = PA07
123-
159, 0x1a, // PIN_D9 = PA26
124-
160, 0x1b, // PIN_D10 = PA27
125-
161, 0x6, // PIN_D11 = PA06
126-
162, 0x8, // PIN_D12 = PA08
127-
163, 0x29, // PIN_D13 = PB09
128-
200, 0x1, // NUM_NEOPIXELS = 1
129-
204, 0x100000, // FLASH_BYTES = 0x100000
130-
205, 0x40000, // RAM_BYTES = 0x40000
131-
208, 0xd7688ea1, // BOOTLOADER_BOARD_ID = 0xd7688ea1
132-
209, 0xada52840, // UF2_FAMILY = 0xada52840
133-
210, 0x20, // PINS_PORT_SIZE = PA_32
134-
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,
135-
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,
136-
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,
137-
0, 0, 0, 0, 0, 0,
78+
#define BOOTLOADER_CONFIG_CF2 \
79+
/* CF2 START */ \
80+
513675505, 539130489, /* magic */ \
81+
49 , 100 , /* used entries, total entries */ \
82+
4 , 0x18 , /* PIN_BTN_A = PIN_RX */ \
83+
5 , 0xa , /* PIN_BTN_B = PIN_D2 */ \
84+
13 , 0x29 , /* PIN_LED = PIN_D13 */ \
85+
18 , 0xf , /* PIN_MISO = PA15 */ \
86+
19 , 0xd , /* PIN_MOSI = PA13 */ \
87+
20 , 0x23 , /* PIN_NEOPIXEL = PB03 */ \
88+
21 , 0x18 , /* PIN_RX = PA24 */ \
89+
23 , 0xe , /* PIN_SCK = PA14 */ \
90+
24 , 0xb , /* PIN_SCL = PA11 */ \
91+
25 , 0xc , /* PIN_SDA = PA12 */ \
92+
28 , 0x19 , /* PIN_TX = PA25 */ \
93+
32 , 0xe , /* PIN_DISPLAY_SCK = PIN_SCK */ \
94+
34 , 0xd , /* PIN_DISPLAY_MOSI = PIN_MOSI */ \
95+
35 , 0x1e , /* PIN_DISPLAY_CS = PIN_A2 */ \
96+
36 , 0x1c , /* PIN_DISPLAY_DC = PIN_A3 */ \
97+
37 , 0xa0 , /* DISPLAY_WIDTH = 160 */ \
98+
38 , 0x80 , /* DISPLAY_HEIGHT = 128 */ \
99+
39 , 0x80 , /* DISPLAY_CFG0 = 0x80 */ \
100+
40 , 0x603 , /* DISPLAY_CFG1 = 0x603 */ \
101+
41 , 0x20 , /* DISPLAY_CFG2 = 0x20 */ \
102+
43 , 0x2 , /* PIN_DISPLAY_RST = PIN_A4 */ \
103+
44 , 0x3 , /* PIN_DISPLAY_BL = PIN_A5 */ \
104+
47 , 0x6 , /* PIN_BTN_LEFT = PIN_D11 */ \
105+
48 , 0x1a , /* PIN_BTN_RIGHT = PIN_D9 */ \
106+
49 , 0x1b , /* PIN_BTN_UP = PIN_D10 */ \
107+
50 , 0x7 , /* PIN_BTN_DOWN = PIN_D6 */ \
108+
51 , 0x8 , /* PIN_BTN_MENU = PIN_D12 */ \
109+
56 , 0x2a , /* PIN_LED2 = PB10 */ \
110+
60 , 0x19 , /* PIN_JACK_TX = PIN_TX */ \
111+
100, 0x4 , /* PIN_A0 = PA04 */ \
112+
101, 0x5 , /* PIN_A1 = PA05 */ \
113+
102, 0x1e , /* PIN_A2 = PA30 */ \
114+
103, 0x1c , /* PIN_A3 = PA28 */ \
115+
104, 0x2 , /* PIN_A4 = PA02 */ \
116+
105, 0x3 , /* PIN_A5 = PA03 */ \
117+
152, 0xa , /* PIN_D2 = PA10 */ \
118+
155, 0x28 , /* PIN_D5 = PB08 */ \
119+
156, 0x7 , /* PIN_D6 = PA07 */ \
120+
159, 0x1a , /* PIN_D9 = PA26 */ \
121+
160, 0x1b , /* PIN_D10 = PA27 */ \
122+
161, 0x6 , /* PIN_D11 = PA06 */ \
123+
162, 0x8 , /* PIN_D12 = PA08 */ \
124+
163, 0x29 , /* PIN_D13 = PB09 */ \
125+
200, 0x1 , /* NUM_NEOPIXELS = 1 */ \
126+
204, 0x100000 , /* FLASH_BYTES = 0x100000 */ \
127+
205, 0x40000 , /* RAM_BYTES = 0x40000 */ \
128+
208, 0xd7688ea1, /* BOOTLOADER_BOARD_ID = 0xd7688ea1 */ \
129+
209, 0xada52840, /* UF2_FAMILY = 0xada52840 */ \
130+
210, 0x20 , /* PINS_PORT_SIZE = PA_32 */ \
131+
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, \
132+
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, \
133+
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, \
134+
0, 0, 0, 0, 0, 0 \
138135
/* CF2 END */
139-
};
140-
#endif
141136

142-
#endif // _FEATHER_NRF52840_H
137+
138+
#endif // _ARCARDE_FEATHER_NRF52840_H
143139

src/main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ void usb_teardown(void);
113113
#define BOOTLOADER_VERSION_REGISTER NRF_TIMER2->CC[0]
114114
#define DFU_SERIAL_STARTUP_INTERVAL 1000
115115

116+
// Allow for using reset button essentially to swap between application and bootloader.
117+
// This is controlled by a flag in the app and is the behavior of CPX and all Arcade boards when using MakeCode.
116118
#define APP_ASKS_FOR_SINGLE_TAP_RESET() (*((uint32_t*)(USER_FLASH_START + 0x200)) == 0x87eeb07c)
117119

118120
// These value must be the same with one in dfu_transport_ble.c

src/pinconfig.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
#define DEFINE_BOOTLOADER_CONFIG 1
21
#include "boards.h"
32

4-
#if defined(BOOTLOADER_CONFIG_PRESENT) && BOOTLOADER_CONFIG_PRESENT
5-
// nothing yet
3+
#ifdef BOOTLOADER_CONFIG_CF2
4+
5+
__attribute__((used, section(".bootloaderConfig")))
6+
const uint32_t bootloaderConfig[] = {
7+
BOOTLOADER_CONFIG_CF2
8+
};
9+
610
#endif

0 commit comments

Comments
 (0)