move bootloaderConfig into pinconfig.c

This commit is contained in:
hathach 2020-02-28 09:49:00 +07:00
parent fe5cbd8183
commit 7ddab6435f
No known key found for this signature in database
GPG Key ID: 2FA891220FBFD581
3 changed files with 70 additions and 68 deletions

View File

@ -22,8 +22,8 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
#ifndef _FEATHER_NRF52840_H #ifndef _ARCARDE_FEATHER_NRF52840_H
#define _FEATHER_NRF52840_H #define _ARCARDE_FEATHER_NRF52840_H
#define _PINNUM(port, pin) ((port)*32 + (pin)) #define _PINNUM(port, pin) ((port)*32 + (pin))
@ -75,69 +75,65 @@
#define UF2_BOARD_ID "nRF52840-Feather-revD" #define UF2_BOARD_ID "nRF52840-Feather-revD"
#define UF2_INDEX_URL "https://www.adafruit.com/product/4062" #define UF2_INDEX_URL "https://www.adafruit.com/product/4062"
#ifdef DEFINE_BOOTLOADER_CONFIG #define BOOTLOADER_CONFIG_CF2 \
#define BOOTLOADER_CONFIG_PRESENT 1 /* CF2 START */ \
__attribute__((used, section(".bootloaderConfig"))) 513675505, 539130489, /* magic */ \
const uint32_t bootloaderConfig[] = { 49 , 100 , /* used entries, total entries */ \
/* CF2 START */ 4 , 0x18 , /* PIN_BTN_A = PIN_RX */ \
513675505, 539130489, // magic 5 , 0xa , /* PIN_BTN_B = PIN_D2 */ \
49, 100, // used entries, total entries 13 , 0x29 , /* PIN_LED = PIN_D13 */ \
4, 0x18, // PIN_BTN_A = PIN_RX 18 , 0xf , /* PIN_MISO = PA15 */ \
5, 0xa, // PIN_BTN_B = PIN_D2 19 , 0xd , /* PIN_MOSI = PA13 */ \
13, 0x29, // PIN_LED = PIN_D13 20 , 0x23 , /* PIN_NEOPIXEL = PB03 */ \
18, 0xf, // PIN_MISO = PA15 21 , 0x18 , /* PIN_RX = PA24 */ \
19, 0xd, // PIN_MOSI = PA13 23 , 0xe , /* PIN_SCK = PA14 */ \
20, 0x23, // PIN_NEOPIXEL = PB03 24 , 0xb , /* PIN_SCL = PA11 */ \
21, 0x18, // PIN_RX = PA24 25 , 0xc , /* PIN_SDA = PA12 */ \
23, 0xe, // PIN_SCK = PA14 28 , 0x19 , /* PIN_TX = PA25 */ \
24, 0xb, // PIN_SCL = PA11 32 , 0xe , /* PIN_DISPLAY_SCK = PIN_SCK */ \
25, 0xc, // PIN_SDA = PA12 34 , 0xd , /* PIN_DISPLAY_MOSI = PIN_MOSI */ \
28, 0x19, // PIN_TX = PA25 35 , 0x1e , /* PIN_DISPLAY_CS = PIN_A2 */ \
32, 0xe, // PIN_DISPLAY_SCK = PIN_SCK 36 , 0x1c , /* PIN_DISPLAY_DC = PIN_A3 */ \
34, 0xd, // PIN_DISPLAY_MOSI = PIN_MOSI 37 , 0xa0 , /* DISPLAY_WIDTH = 160 */ \
35, 0x1e, // PIN_DISPLAY_CS = PIN_A2 38 , 0x80 , /* DISPLAY_HEIGHT = 128 */ \
36, 0x1c, // PIN_DISPLAY_DC = PIN_A3 39 , 0x80 , /* DISPLAY_CFG0 = 0x80 */ \
37, 0xa0, // DISPLAY_WIDTH = 160 40 , 0x603 , /* DISPLAY_CFG1 = 0x603 */ \
38, 0x80, // DISPLAY_HEIGHT = 128 41 , 0x20 , /* DISPLAY_CFG2 = 0x20 */ \
39, 0x80, // DISPLAY_CFG0 = 0x80 43 , 0x2 , /* PIN_DISPLAY_RST = PIN_A4 */ \
40, 0x603, // DISPLAY_CFG1 = 0x603 44 , 0x3 , /* PIN_DISPLAY_BL = PIN_A5 */ \
41, 0x20, // DISPLAY_CFG2 = 0x20 47 , 0x6 , /* PIN_BTN_LEFT = PIN_D11 */ \
43, 0x2, // PIN_DISPLAY_RST = PIN_A4 48 , 0x1a , /* PIN_BTN_RIGHT = PIN_D9 */ \
44, 0x3, // PIN_DISPLAY_BL = PIN_A5 49 , 0x1b , /* PIN_BTN_UP = PIN_D10 */ \
47, 0x6, // PIN_BTN_LEFT = PIN_D11 50 , 0x7 , /* PIN_BTN_DOWN = PIN_D6 */ \
48, 0x1a, // PIN_BTN_RIGHT = PIN_D9 51 , 0x8 , /* PIN_BTN_MENU = PIN_D12 */ \
49, 0x1b, // PIN_BTN_UP = PIN_D10 56 , 0x2a , /* PIN_LED2 = PB10 */ \
50, 0x7, // PIN_BTN_DOWN = PIN_D6 60 , 0x19 , /* PIN_JACK_TX = PIN_TX */ \
51, 0x8, // PIN_BTN_MENU = PIN_D12 100, 0x4 , /* PIN_A0 = PA04 */ \
56, 0x2a, // PIN_LED2 = PB10 101, 0x5 , /* PIN_A1 = PA05 */ \
60, 0x19, // PIN_JACK_TX = PIN_TX 102, 0x1e , /* PIN_A2 = PA30 */ \
100, 0x4, // PIN_A0 = PA04 103, 0x1c , /* PIN_A3 = PA28 */ \
101, 0x5, // PIN_A1 = PA05 104, 0x2 , /* PIN_A4 = PA02 */ \
102, 0x1e, // PIN_A2 = PA30 105, 0x3 , /* PIN_A5 = PA03 */ \
103, 0x1c, // PIN_A3 = PA28 152, 0xa , /* PIN_D2 = PA10 */ \
104, 0x2, // PIN_A4 = PA02 155, 0x28 , /* PIN_D5 = PB08 */ \
105, 0x3, // PIN_A5 = PA03 156, 0x7 , /* PIN_D6 = PA07 */ \
152, 0xa, // PIN_D2 = PA10 159, 0x1a , /* PIN_D9 = PA26 */ \
155, 0x28, // PIN_D5 = PB08 160, 0x1b , /* PIN_D10 = PA27 */ \
156, 0x7, // PIN_D6 = PA07 161, 0x6 , /* PIN_D11 = PA06 */ \
159, 0x1a, // PIN_D9 = PA26 162, 0x8 , /* PIN_D12 = PA08 */ \
160, 0x1b, // PIN_D10 = PA27 163, 0x29 , /* PIN_D13 = PB09 */ \
161, 0x6, // PIN_D11 = PA06 200, 0x1 , /* NUM_NEOPIXELS = 1 */ \
162, 0x8, // PIN_D12 = PA08 204, 0x100000 , /* FLASH_BYTES = 0x100000 */ \
163, 0x29, // PIN_D13 = PB09 205, 0x40000 , /* RAM_BYTES = 0x40000 */ \
200, 0x1, // NUM_NEOPIXELS = 1 208, 0xd7688ea1, /* BOOTLOADER_BOARD_ID = 0xd7688ea1 */ \
204, 0x100000, // FLASH_BYTES = 0x100000 209, 0xada52840, /* UF2_FAMILY = 0xada52840 */ \
205, 0x40000, // RAM_BYTES = 0x40000 210, 0x20 , /* PINS_PORT_SIZE = PA_32 */ \
208, 0xd7688ea1, // BOOTLOADER_BOARD_ID = 0xd7688ea1 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, \
209, 0xada52840, // UF2_FAMILY = 0xada52840 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, \
210, 0x20, // PINS_PORT_SIZE = PA_32 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, \
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, 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, 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, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
/* CF2 END */ /* CF2 END */
};
#endif
#endif // _FEATHER_NRF52840_H
#endif // _ARCARDE_FEATHER_NRF52840_H

View File

@ -113,6 +113,8 @@ void usb_teardown(void);
#define BOOTLOADER_VERSION_REGISTER NRF_TIMER2->CC[0] #define BOOTLOADER_VERSION_REGISTER NRF_TIMER2->CC[0]
#define DFU_SERIAL_STARTUP_INTERVAL 1000 #define DFU_SERIAL_STARTUP_INTERVAL 1000
// Allow for using reset button essentially to swap between application and bootloader.
// This is controlled by a flag in the app and is the behavior of CPX and all Arcade boards when using MakeCode.
#define APP_ASKS_FOR_SINGLE_TAP_RESET() (*((uint32_t*)(USER_FLASH_START + 0x200)) == 0x87eeb07c) #define APP_ASKS_FOR_SINGLE_TAP_RESET() (*((uint32_t*)(USER_FLASH_START + 0x200)) == 0x87eeb07c)
// These value must be the same with one in dfu_transport_ble.c // These value must be the same with one in dfu_transport_ble.c

View File

@ -1,6 +1,10 @@
#define DEFINE_BOOTLOADER_CONFIG 1
#include "boards.h" #include "boards.h"
#if defined(BOOTLOADER_CONFIG_PRESENT) && BOOTLOADER_CONFIG_PRESENT #ifdef BOOTLOADER_CONFIG_CF2
// nothing yet
__attribute__((used, section(".bootloaderConfig")))
const uint32_t bootloaderConfig[] = {
BOOTLOADER_CONFIG_CF2
};
#endif #endif