mirror of
https://github.com/oltaco/Adafruit_nRF52_Bootloader_OTAFIX.git
synced 2026-10-24 21:33:49 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c01b7f9285 | ||
|
|
3718aaeeaf | ||
|
|
0526a2b120 | ||
|
|
ab4ecd141f | ||
|
|
8ccb638a84 | ||
|
|
fc63d5096a | ||
|
|
7d59a758da | ||
|
|
e2e220a505 | ||
|
|
9df8b8b870 | ||
|
|
802437220c | ||
|
|
80e0c1501e | ||
|
|
7bd3c5489f | ||
|
|
2446d02e59 | ||
|
|
c55783d9b5 | ||
|
|
c7cb5f971e | ||
|
|
be2ba81b4b | ||
|
|
7ddab6435f | ||
|
|
fe5cbd8183 | ||
|
|
563f15158d | ||
|
|
c5c2039bfd | ||
|
|
dd43e2ac87 | ||
|
|
27cd385c58 | ||
|
|
995b977b8a | ||
|
|
ddae34c381 | ||
|
|
6c2867bc00 | ||
|
|
9c6c0d3031 | ||
|
|
db63651473 | ||
|
|
32bfb2adae |
No files matched your search
@@ -56,3 +56,5 @@ _build-*/
|
||||
bin/
|
||||
*.emSession
|
||||
*.jlink
|
||||
|
||||
TAGS
|
||||
@@ -41,6 +41,9 @@ else
|
||||
NRFJPROG = nrfjprog
|
||||
endif
|
||||
|
||||
# auto-detect BMP on macOS, otherwise have to specify
|
||||
BMP_PORT ?= $(shell ls -1 /dev/cu.usbmodem????????1 | head -1)
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
PROGFILES = C:/Program Files (x86)
|
||||
GNU_INSTALL_ROOT = $(PROGFILES)/GNU Tools ARM Embedded/7 2018-q2-update/bin/
|
||||
@@ -67,6 +70,9 @@ NM := '$(GNU_INSTALL_ROOT)$(GNU_PREFIX)-nm'
|
||||
OBJDUMP := '$(GNU_INSTALL_ROOT)$(GNU_PREFIX)-objdump'
|
||||
OBJCOPY := '$(GNU_INSTALL_ROOT)$(GNU_PREFIX)-objcopy'
|
||||
SIZE := '$(GNU_INSTALL_ROOT)$(GNU_PREFIX)-size'
|
||||
GDB := '$(GNU_INSTALL_ROOT)$(GNU_PREFIX)-gdb'
|
||||
|
||||
GDB_BMP = arm-none-eabi-gdb -ex 'target extended-remote $(BMP_PORT)' -ex 'monitor swdp_scan' -ex 'attach 1'
|
||||
|
||||
#function for removing duplicates in a list
|
||||
remduplicates = $(strip $(if $1,$(firstword $1) $(call remduplicates,$(filter-out $(firstword $1),$1))))
|
||||
@@ -116,6 +122,9 @@ C_SOURCE_FILES += $(SRC_PATH)/flash_nrf5x.c
|
||||
C_SOURCE_FILES += $(SRC_PATH)/dfu_ble_svc.c
|
||||
C_SOURCE_FILES += $(SRC_PATH)/dfu_init.c
|
||||
|
||||
# all sources files in specific board
|
||||
C_SOURCE_FILES += $(wildcard $(SRC_PATH)/boards/$(BOARD)/*.c)
|
||||
|
||||
# nrfx
|
||||
C_SOURCE_FILES += $(NRFX_PATH)/drivers/src/nrfx_power.c
|
||||
C_SOURCE_FILES += $(NRFX_PATH)/drivers/src/nrfx_nvmc.c
|
||||
@@ -340,6 +349,13 @@ erase:
|
||||
@echo Erasing chip
|
||||
$(NRFJPROG) --eraseall -f nrf52
|
||||
|
||||
gdbflash: $(BUILD)/$(MERGED_FNAME).hex
|
||||
@echo Flashing: $<
|
||||
@$(GDB_BMP) -nx --batch -ex 'load $<' -ex 'compare-sections' -ex 'kill'
|
||||
|
||||
gdb: $(BUILD)/$(OUTPUT_FILENAME)-nosd.out
|
||||
$(GDB_BMP) $<
|
||||
|
||||
#******************* Compile rules *******************
|
||||
|
||||
## Create build directories
|
||||
|
||||
@@ -4,9 +4,12 @@
|
||||
|
||||
This is a CDC/DFU/UF2 bootloader for nRF52 boards.
|
||||
|
||||
- [Adafruit CLUE](https://www.adafruit.com/product/4500)
|
||||
- [Adafruit Circuit Playground Bluefruit](https://www.adafruit.com/product/4333)
|
||||
- [Adafruit Feather nRF52832](https://www.adafruit.com/product/3406)
|
||||
- [Adafruit Feather nRF52840 Express](https://www.adafruit.com/product/4062)
|
||||
- [Adafruit Circuit Playground Bluefruit](https://www.adafruit.com/product/4333)
|
||||
- [Adafruit Feather nRF52840 Sense](https://www.adafruit.com/product/4516)
|
||||
- [Adafruit ItsyBitsy nRF52840 Express](https://www.adafruit.com/product/4481)
|
||||
- Adafruit Metro nRF52840 Express
|
||||
- [Electronut Labs Papyr](https://docs.electronut.in/papyr/)
|
||||
- MakerDiary MDK nRF52840 USB Dongle
|
||||
|
||||
+9
-3
@@ -1,5 +1,12 @@
|
||||
# Adafruit nRF52 Bootloader Changelog
|
||||
|
||||
## 0.3.2 - 2020.03.12
|
||||
|
||||
- Make sure all pins are in reset state when jumping to app mode.
|
||||
|
||||
## 0.3.1 - 2020.03.05
|
||||
- Correct LED1 for Feather Sense and change volume name to FTHRSNSBOOT.
|
||||
|
||||
## 0.3.0 - 2020.01.13
|
||||
|
||||
- Upgrade nrfx to v2 for supporting future nrf mcu such as nrf52833, nrf5340
|
||||
@@ -29,7 +36,7 @@
|
||||
- NFC pins are forced to GPIO mode by bootloader
|
||||
- Added Metro nRF52840 Express VID/PID
|
||||
- Enhance board management
|
||||
- Added electronut/papyr_support
|
||||
- Added electronut/papyr_support
|
||||
|
||||
## 0.2.9
|
||||
|
||||
@@ -45,7 +52,7 @@
|
||||
- Fixed PWM psel[1] is not reset
|
||||
- Fixed #41 move RXD, TXD into board header
|
||||
- Added Metro nRF52840 Rev A
|
||||
- Fixed #40 OTA issue with BLE_GAP_EVT_PHY_UPDATE_REQUEST e.g connecting with iPhone X
|
||||
- Fixed #40 OTA issue with BLE_GAP_EVT_PHY_UPDATE_REQUEST e.g connecting with iPhone X
|
||||
|
||||
## 0.2.6
|
||||
|
||||
@@ -63,4 +70,3 @@
|
||||
- Fully support Feather nRF52840
|
||||
- Update bootloader with new led pattern
|
||||
- Fix #203: return software timer handle
|
||||
|
||||
+7
-1
@@ -104,7 +104,6 @@ void board_teardown(void)
|
||||
#if defined(LED_NEOPIXEL) || defined(LED_RGB_RED_PIN)
|
||||
neopixel_teardown();
|
||||
#endif
|
||||
// Button
|
||||
|
||||
// Stop RTC1 used by app_timer
|
||||
NVIC_DisableIRQ(RTC1_IRQn);
|
||||
@@ -115,6 +114,13 @@ void board_teardown(void)
|
||||
|
||||
// Stop LF clock
|
||||
NRF_CLOCK->TASKS_LFCLKSTOP = 1UL;
|
||||
|
||||
// make sure all pins are back in reset state
|
||||
// NUMBER_OF_PINS is defined in nrf_gpio.h
|
||||
for (int i = 0; i < NUMBER_OF_PINS; ++i)
|
||||
{
|
||||
nrf_gpio_cfg_default(i);
|
||||
}
|
||||
}
|
||||
|
||||
static uint32_t _systick_count = 0;
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include "nrf.h"
|
||||
#include "nrf_gpio.h"
|
||||
|
||||
#include "board.h"
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Uri Shaked
|
||||
* Copyright (c) 2019 Benjamin Meisels
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _ARAMCON_BADGE_2019_H
|
||||
#define _ARAMCON_BADGE_2019_H
|
||||
|
||||
#define _PINNUM(port, pin) ((port)*32 + (pin))
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* LED
|
||||
*------------------------------------------------------------------*/
|
||||
#define LEDS_NUMBER 1
|
||||
#define LED_PRIMARY_PIN _PINNUM(1, 11) // Red
|
||||
|
||||
#define LED_NEOPIXEL _PINNUM(0, 8)
|
||||
#define NEOPIXELS_NUMBER 4
|
||||
#define BOARD_RGB_BRIGHTNESS 0x040404
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* BUTTON
|
||||
*------------------------------------------------------------------*/
|
||||
#define BUTTONS_NUMBER 2
|
||||
#define BUTTON_1 _PINNUM(0, 2) // left Button
|
||||
#define BUTTON_2 _PINNUM(0, 29) // middle button
|
||||
#define BUTTON_PULL NRF_GPIO_PIN_PULLUP
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* UART (only used by nRF52832)
|
||||
*------------------------------------------------------------------*/
|
||||
#define RX_PIN_NUMBER _PINNUM(0, 28) // SDA
|
||||
#define TX_PIN_NUMBER _PINNUM(0, 3) // SCL
|
||||
#define CTS_PIN_NUMBER 0
|
||||
#define RTS_PIN_NUMBER 0
|
||||
#define HWFC false
|
||||
|
||||
// Used as model string in OTA mode
|
||||
#define BLEDIS_MANUFACTURER "ARAMCON Badge Team"
|
||||
#define BLEDIS_MODEL "ARAMCON Badge 2019"
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// USB
|
||||
//--------------------------------------------------------------------+
|
||||
#define USB_DESC_VID 0x239A
|
||||
#define USB_DESC_UF2_PID 0x0079
|
||||
#define USB_DESC_CDC_ONLY_PID 0x0079
|
||||
|
||||
//------------- UF2 -------------//
|
||||
#define UF2_PRODUCT_NAME "ARAMCON Badge 2019"
|
||||
#define UF2_VOLUME_LABEL "ARAMBOOT"
|
||||
#define UF2_BOARD_ID "nrf52840-ARAMCON-Badge-2019"
|
||||
#define UF2_INDEX_URL "https://github.com/aramcon-badge"
|
||||
|
||||
#endif // _ARAMCON_BADGE_2019_H
|
||||
@@ -0,0 +1 @@
|
||||
MCU_SUB_VARIANT = nrf52840
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 Ha Thach 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.
|
||||
*/
|
||||
|
||||
#ifndef _ARCARDE_FEATHER_NRF52840_H
|
||||
#define _ARCARDE_FEATHER_NRF52840_H
|
||||
|
||||
#define _PINNUM(port, pin) ((port)*32 + (pin))
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* LED
|
||||
*------------------------------------------------------------------*/
|
||||
#define LEDS_NUMBER 2
|
||||
#define LED_PRIMARY_PIN _PINNUM(1, 15)
|
||||
#define LED_SECONDARY_PIN _PINNUM(1, 10)
|
||||
#define LED_STATE_ON 1
|
||||
|
||||
#define LED_NEOPIXEL _PINNUM(0, 16)
|
||||
#define NEOPIXELS_NUMBER 1
|
||||
#define BOARD_RGB_BRIGHTNESS 0x040404
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* BUTTON
|
||||
*------------------------------------------------------------------*/
|
||||
#define BUTTONS_NUMBER 2
|
||||
#define BUTTON_1 _PINNUM(1, 02)
|
||||
#define BUTTON_2 _PINNUM(0, 10)
|
||||
#define BUTTON_PULL NRF_GPIO_PIN_PULLUP
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* UART (only used by nRF52832)
|
||||
*------------------------------------------------------------------*/
|
||||
#define RX_PIN_NUMBER 8
|
||||
#define TX_PIN_NUMBER 6
|
||||
#define CTS_PIN_NUMBER 0
|
||||
#define RTS_PIN_NUMBER 0
|
||||
#define HWFC false
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// BLE OTA
|
||||
//--------------------------------------------------------------------+
|
||||
#define BLEDIS_MANUFACTURER "Adafruit Industries"
|
||||
#define BLEDIS_MODEL "Feather nRF52840 Express"
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// USB
|
||||
//--------------------------------------------------------------------+
|
||||
#define USB_DESC_VID 0x239A
|
||||
#define USB_DESC_UF2_PID 0x0029
|
||||
#define USB_DESC_CDC_ONLY_PID 0x002A
|
||||
|
||||
//------------- UF2 -------------//
|
||||
#define UF2_PRODUCT_NAME "Adafruit Feather nRF52840 Express"
|
||||
#define UF2_VOLUME_LABEL "ARCADE-N4"
|
||||
#define UF2_BOARD_ID "nRF52840-Feather-revD"
|
||||
#define UF2_INDEX_URL "https://www.adafruit.com/product/4062"
|
||||
|
||||
#endif // _ARCARDE_FEATHER_NRF52840_H
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
MCU_SUB_VARIANT = nrf52840
|
||||
@@ -0,0 +1,62 @@
|
||||
#include "boards.h"
|
||||
|
||||
__attribute__((used, section(".bootloaderConfig")))
|
||||
const uint32_t bootloaderConfig[] = {
|
||||
/* CF2 START */
|
||||
513675505, 539130489, // magic
|
||||
49, 100, // used entries, total entries
|
||||
4, 0x18, // PIN_BTN_A = PIN_RX
|
||||
5, 0xa, // PIN_BTN_B = PIN_D2
|
||||
13, 0x29, // PIN_LED = PIN_D13
|
||||
18, 0xf, // PIN_MISO = PA15
|
||||
19, 0xd, // PIN_MOSI = PA13
|
||||
20, 0x23, // PIN_NEOPIXEL = PB03
|
||||
21, 0x18, // PIN_RX = PA24
|
||||
23, 0xe, // PIN_SCK = PA14
|
||||
24, 0xb, // PIN_SCL = PA11
|
||||
25, 0xc, // PIN_SDA = PA12
|
||||
28, 0x19, // PIN_TX = PA25
|
||||
32, 0xe, // PIN_DISPLAY_SCK = PIN_SCK
|
||||
34, 0xd, // PIN_DISPLAY_MOSI = PIN_MOSI
|
||||
35, 0x1e, // PIN_DISPLAY_CS = PIN_A2
|
||||
36, 0x1c, // PIN_DISPLAY_DC = PIN_A3
|
||||
37, 0xa0, // DISPLAY_WIDTH = 160
|
||||
38, 0x80, // DISPLAY_HEIGHT = 128
|
||||
39, 0x80, // DISPLAY_CFG0 = 0x80
|
||||
40, 0x603, // DISPLAY_CFG1 = 0x603
|
||||
41, 0x20, // DISPLAY_CFG2 = 0x20
|
||||
43, 0x2, // PIN_DISPLAY_RST = PIN_A4
|
||||
44, 0x3, // PIN_DISPLAY_BL = PIN_A5
|
||||
47, 0x6, // PIN_BTN_LEFT = PIN_D11
|
||||
48, 0x1a, // PIN_BTN_RIGHT = PIN_D9
|
||||
49, 0x1b, // PIN_BTN_UP = PIN_D10
|
||||
50, 0x7, // PIN_BTN_DOWN = PIN_D6
|
||||
51, 0x8, // PIN_BTN_MENU = PIN_D12
|
||||
56, 0x2a, // PIN_LED2 = PB10
|
||||
60, 0x19, // PIN_JACK_TX = PIN_TX
|
||||
100, 0x4, // PIN_A0 = PA04
|
||||
101, 0x5, // PIN_A1 = PA05
|
||||
102, 0x1e, // PIN_A2 = PA30
|
||||
103, 0x1c, // PIN_A3 = PA28
|
||||
104, 0x2, // PIN_A4 = PA02
|
||||
105, 0x3, // PIN_A5 = PA03
|
||||
152, 0xa, // PIN_D2 = PA10
|
||||
155, 0x28, // PIN_D5 = PB08
|
||||
156, 0x7, // PIN_D6 = PA07
|
||||
159, 0x1a, // PIN_D9 = PA26
|
||||
160, 0x1b, // PIN_D10 = PA27
|
||||
161, 0x6, // PIN_D11 = PA06
|
||||
162, 0x8, // PIN_D12 = PA08
|
||||
163, 0x29, // PIN_D13 = PB09
|
||||
200, 0x1, // NUM_NEOPIXELS = 1
|
||||
204, 0x100000, // FLASH_BYTES = 0x100000
|
||||
205, 0x40000, // RAM_BYTES = 0x40000
|
||||
208, 0xd7688ea1, // BOOTLOADER_BOARD_ID = 0xd7688ea1
|
||||
209, 0xada52840, // UF2_FAMILY = 0xada52840
|
||||
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,
|
||||
/* CF2 END */
|
||||
};
|
||||
@@ -57,7 +57,7 @@
|
||||
|
||||
// Used as model string in OTA mode
|
||||
#define BLEDIS_MANUFACTURER "Adafruit Industries"
|
||||
#define BLEDIS_MODEL "Clue nRF52840"
|
||||
#define BLEDIS_MODEL "CLUE nRF52840"
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// USB
|
||||
@@ -67,9 +67,9 @@
|
||||
#define USB_DESC_CDC_ONLY_PID 0x0071
|
||||
|
||||
//------------- UF2 -------------//
|
||||
#define UF2_PRODUCT_NAME "Adafruit Clue nRF52840"
|
||||
#define UF2_PRODUCT_NAME "Adafruit CLUE nRF52840"
|
||||
#define UF2_VOLUME_LABEL "CLUEBOOT"
|
||||
#define UF2_BOARD_ID "nRF52840-Clue-revA"
|
||||
#define UF2_INDEX_URL "https://www.adafruit.com/"
|
||||
#define UF2_BOARD_ID "nRF52840-CLUE-revA"
|
||||
#define UF2_INDEX_URL "https://www.adafruit.com/product/4500"
|
||||
|
||||
#endif // _CLUE_NRF52840_H
|
||||
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 Ha Thach 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.
|
||||
*/
|
||||
|
||||
#ifndef _FEATHER_NRF52840_SENSE_H
|
||||
#define _FEATHER_NRF52840_SENSE_H
|
||||
|
||||
#define _PINNUM(port, pin) ((port)*32 + (pin))
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* LED
|
||||
*------------------------------------------------------------------*/
|
||||
#define LEDS_NUMBER 2
|
||||
#define LED_PRIMARY_PIN _PINNUM(1, 9)
|
||||
#define LED_SECONDARY_PIN _PINNUM(1, 10)
|
||||
#define LED_STATE_ON 1
|
||||
|
||||
#define LED_NEOPIXEL _PINNUM(0, 16)
|
||||
#define NEOPIXELS_NUMBER 1
|
||||
#define BOARD_RGB_BRIGHTNESS 0x040404
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* BUTTON
|
||||
*------------------------------------------------------------------*/
|
||||
#define BUTTONS_NUMBER 2
|
||||
#define BUTTON_1 _PINNUM(1, 02)
|
||||
#define BUTTON_2 _PINNUM(0, 10)
|
||||
#define BUTTON_PULL NRF_GPIO_PIN_PULLUP
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* UART (only used by nRF52832)
|
||||
*------------------------------------------------------------------*/
|
||||
#define RX_PIN_NUMBER 8
|
||||
#define TX_PIN_NUMBER 6
|
||||
#define CTS_PIN_NUMBER 0
|
||||
#define RTS_PIN_NUMBER 0
|
||||
#define HWFC false
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// BLE OTA
|
||||
//--------------------------------------------------------------------+
|
||||
#define BLEDIS_MANUFACTURER "Adafruit Industries"
|
||||
#define BLEDIS_MODEL "Feather nRF52840 Sense"
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// USB
|
||||
//--------------------------------------------------------------------+
|
||||
#define USB_DESC_VID 0x239A
|
||||
#define USB_DESC_UF2_PID 0x0087
|
||||
#define USB_DESC_CDC_ONLY_PID 0x0088
|
||||
|
||||
//------------- UF2 -------------//
|
||||
#define UF2_PRODUCT_NAME "Adafruit Feather nRF52840 Sense"
|
||||
#define UF2_VOLUME_LABEL "FTHRSNSBOOT"
|
||||
#define UF2_BOARD_ID "nRF52840-Feather-Sense"
|
||||
#define UF2_INDEX_URL "https://www.adafruit.com/product/4516"
|
||||
|
||||
#endif // _FEATHER_NRF52840_SENSE_H
|
||||
@@ -0,0 +1 @@
|
||||
MCU_SUB_VARIANT = nrf52840
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 Ha Thach for Adafruit Industries
|
||||
* Copyright (c) 2020 Michael Welling
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _OHS2020_BADGE_H
|
||||
#define _OHS2020_BADGE_H
|
||||
|
||||
#define _PINNUM(port, pin) ((port)*32 + (pin))
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* LED
|
||||
*------------------------------------------------------------------*/
|
||||
#define LEDS_NUMBER 1
|
||||
#define LED_PRIMARY_PIN _PINNUM(0, 04) // fake LED since we have none
|
||||
#define LED_STATE_ON 1
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* BUTTON
|
||||
*------------------------------------------------------------------*/
|
||||
#define BUTTONS_NUMBER 2
|
||||
#define BUTTON_1 _PINNUM(0, 29) // SW2
|
||||
#define BUTTON_2 _PINNUM(0, 03) // SW1
|
||||
#define BUTTON_PULL NRF_GPIO_PIN_PULLUP
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* UART (only used by nRF52832)
|
||||
*------------------------------------------------------------------*/
|
||||
#define RX_PIN_NUMBER _PINNUM(0, 09)
|
||||
#define TX_PIN_NUMBER _PINNUM(0, 10)
|
||||
#define CTS_PIN_NUMBER 0
|
||||
#define RTS_PIN_NUMBER 0
|
||||
#define HWFC false
|
||||
|
||||
// Used as model string in OTA mode
|
||||
#define BLEDIS_MANUFACTURER "OSHWA"
|
||||
#define BLEDIS_MODEL "OHS2020 Badge"
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// USB
|
||||
//--------------------------------------------------------------------+
|
||||
#define USB_DESC_VID 0x239A
|
||||
#define USB_DESC_UF2_PID 0x007F
|
||||
#define USB_DESC_CDC_ONLY_PID 0x007F
|
||||
|
||||
//------------- UF2 -------------//
|
||||
#define UF2_PRODUCT_NAME "OHS2020 Badge"
|
||||
#define UF2_VOLUME_LABEL "BADGEBOOT"
|
||||
#define UF2_BOARD_ID "OHS2020-Badge-revA"
|
||||
#define UF2_INDEX_URL "https://2020.oshwa.org/"
|
||||
|
||||
#endif // _OHS2020_BADGE_H
|
||||
@@ -0,0 +1 @@
|
||||
MCU_SUB_VARIANT = nrf52840
|
||||
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _WAVESHARE_NRF52840_H
|
||||
#define _WAVESHARE_NRF52840_H
|
||||
|
||||
#define _PINNUM(port, pin) ((port)*32 + (pin))
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* LED
|
||||
*------------------------------------------------------------------*/
|
||||
#define LEDS_NUMBER 2
|
||||
/* This is led marked LED1 on the board */
|
||||
#define LED_PRIMARY_PIN _PINNUM(0, 13)
|
||||
/* This is led marked LED2 on the board */
|
||||
#define LED_SECONDARY_PIN _PINNUM(0, 14)
|
||||
/* There are two more LEDs, but for the purposes of bootloader that
|
||||
* doesn't matter. */
|
||||
#define LED_STATE_ON 0
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* BUTTON
|
||||
*------------------------------------------------------------------*/
|
||||
#define BUTTONS_NUMBER 2
|
||||
/* This is the 'KEY1' in top left of the board under RESET key.
|
||||
* It is used to remain in bootloader mode after reset. */
|
||||
#define BUTTON_1 _PINNUM(0, 11)
|
||||
/* Pin below is in the bottom left of PCB, and can be shorted to GND
|
||||
* with a regular 2.54mm jumper or tweezers. This pin is used to
|
||||
* clear user firmware and remain in bootloader mode. */
|
||||
#define BUTTON_2 _PINNUM(0, 29)
|
||||
#define BUTTON_PULL NRF_GPIO_PIN_PULLUP
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* UART (only used by nRF52832)
|
||||
*------------------------------------------------------------------*/
|
||||
#define RX_PIN_NUMBER 8
|
||||
#define TX_PIN_NUMBER 6
|
||||
#define CTS_PIN_NUMBER 0
|
||||
#define RTS_PIN_NUMBER 0
|
||||
#define HWFC false
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// BLE OTA
|
||||
//--------------------------------------------------------------------+
|
||||
#define BLEDIS_MANUFACTURER "Waveshare"
|
||||
#define BLEDIS_MODEL "nRF52840 Eval"
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// USB
|
||||
//--------------------------------------------------------------------+
|
||||
#define USB_DESC_VID 0x239A
|
||||
#define USB_DESC_UF2_PID 0x0029
|
||||
#define USB_DESC_CDC_ONLY_PID 0x002A
|
||||
|
||||
//------------- UF2 -------------//
|
||||
#define UF2_PRODUCT_NAME "Waveshare nRF52840 Eval"
|
||||
#define UF2_VOLUME_LABEL "WS52840EVK"
|
||||
#define UF2_BOARD_ID "WS-nRF52840-EVK"
|
||||
#define UF2_INDEX_URL "https://www.waveshare.com/wiki/NRF52840_Eval_Kit"
|
||||
|
||||
#endif // _WAVESHARE_NRF52840_H
|
||||
@@ -0,0 +1 @@
|
||||
MCU_SUB_VARIANT = nrf52840
|
||||
@@ -11,7 +11,9 @@ MEMORY
|
||||
* those values do not match. The check is performed in main.c, see
|
||||
* APP_ERROR_CHECK_BOOL(*((uint32_t *)NRF_UICR_BOOT_START_ADDRESS) == BOOTLOADER_REGION_START);
|
||||
*/
|
||||
FLASH (rx) : ORIGIN = 0xF4000, LENGTH = 0xFE000-0xF4000 /* 40 KB */
|
||||
FLASH (rx) : ORIGIN = 0xF4000, LENGTH = 0xFE000-0xF4000-2048 /* 38 KB */
|
||||
|
||||
BOOTLOADER_CONFIG (r): ORIGIN = 0xFE000 - 2048, LENGTH = 2048
|
||||
|
||||
/** Location of mbr params page in flash. */
|
||||
MBR_PARAMS_PAGE (rw) : ORIGIN = 0xFE000, LENGTH = 0x1000
|
||||
@@ -50,6 +52,11 @@ SECTIONS
|
||||
PROVIDE( __stop_fs_data = .);
|
||||
} = 0
|
||||
|
||||
.bootloaderConfig :
|
||||
{
|
||||
KEEP(*(.bootloaderConfig))
|
||||
} > BOOTLOADER_CONFIG
|
||||
|
||||
/* Place the bootloader settings page in flash. */
|
||||
.bootloaderSettings(NOLOAD) :
|
||||
{
|
||||
|
||||
+18
-2
@@ -61,6 +61,7 @@
|
||||
#include "nrf_error.h"
|
||||
|
||||
#include "boards.h"
|
||||
#include "uf2/uf2.h"
|
||||
|
||||
#include "pstorage_platform.h"
|
||||
#include "nrf_mbr.h"
|
||||
@@ -105,12 +106,17 @@ void usb_teardown(void);
|
||||
#define DFU_MAGIC_UF2_RESET 0x57
|
||||
|
||||
#define DFU_DBL_RESET_MAGIC 0x5A1AD5 // SALADS
|
||||
#define DFU_DBL_RESET_APP 0x4ee5677e
|
||||
#define DFU_DBL_RESET_DELAY 500
|
||||
#define DFU_DBL_RESET_MEM 0x20007F7C
|
||||
|
||||
#define BOOTLOADER_VERSION_REGISTER NRF_TIMER2->CC[0]
|
||||
#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)
|
||||
|
||||
// These value must be the same with one in dfu_transport_ble.c
|
||||
#define BLEGAP_EVENT_LENGTH 6
|
||||
#define BLEGATT_ATT_MTU_MAX 247
|
||||
@@ -197,9 +203,13 @@ int main(void)
|
||||
_ota_dfu = _ota_dfu || ( button_pressed(BUTTON_DFU) && button_pressed(BUTTON_FRESET) ) ;
|
||||
|
||||
bool const valid_app = bootloader_app_is_valid(DFU_BANK_0_REGION_START);
|
||||
bool const just_start_app = valid_app && !dfu_start && (*dbl_reset_mem) == DFU_DBL_RESET_APP;
|
||||
|
||||
if (!just_start_app && APP_ASKS_FOR_SINGLE_TAP_RESET())
|
||||
dfu_start = 1;
|
||||
|
||||
// App mode: register 1st reset and DFU startup (nrf52832)
|
||||
if ( ! (dfu_start || !valid_app) )
|
||||
if ( ! (just_start_app || dfu_start || !valid_app) )
|
||||
{
|
||||
// Register our first reset for double reset detection
|
||||
(*dbl_reset_mem) = DFU_DBL_RESET_MAGIC;
|
||||
@@ -218,7 +228,10 @@ int main(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
(*dbl_reset_mem) = 0;
|
||||
if (APP_ASKS_FOR_SINGLE_TAP_RESET())
|
||||
(*dbl_reset_mem) = DFU_DBL_RESET_APP;
|
||||
else
|
||||
(*dbl_reset_mem) = 0;
|
||||
|
||||
if ( dfu_start || !valid_app )
|
||||
{
|
||||
@@ -261,6 +274,9 @@ int main(void)
|
||||
// MBR must be init before start application
|
||||
if ( !sd_inited ) softdev_mbr_init();
|
||||
|
||||
// clear in case we kept DFU_DBL_RESET_APP there
|
||||
(*dbl_reset_mem) = 0;
|
||||
|
||||
// Select a bank region to use as application region.
|
||||
// @note: Only applications running from DFU_BANK_0_REGION_START is supported.
|
||||
bootloader_app_start(DFU_BANK_0_REGION_START);
|
||||
|
||||
Reference in new issue
Block a user