Merge pull request #44 from adafruit/develop

merge from Develop
This commit is contained in:
hathach 2019-01-31 23:45:31 +07:00 committed by GitHub
commit 6338794c61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 257 additions and 159 deletions

View File

@ -56,10 +56,11 @@ endif
MK := mkdir
RM := rm -rf
# Verbose mode (V=). 0: default, 1: print out CFLAG, LDFLAG 2: print all compile command
ifeq ("$(V)","2")
QUIET :=
QUIET =
else
QUIET := @
QUIET = @
endif
GNU_PREFIX = arm-none-eabi
@ -82,8 +83,8 @@ remduplicates = $(strip $(if $1,$(firstword $1) $(call remduplicates,$(filter-ou
#*********************************
BOARD_LIST = $(sort $(subst .h,,$(subst src/boards/,,$(wildcard src/boards/*.h))))
NRF52840_BOARDLIST = pca10056 pca10059 feather_nrf52840_express particle_argon particle_boron particle_xenon
IS_NRF52840 = $(filter $(BOARD),$(NRF52840_BOARDLIST))
NRF52832_BOARDLIST = feather_nrf52832
IS_52832 = $(filter $(BOARD),$(NRF52832_BOARDLIST))
ifeq ($(filter $(MAKECMDGOALS),all-board all-release help),)
ifeq ($(BOARD),)
@ -100,12 +101,12 @@ endif
BUILD = _build-$(BOARD)
ifneq ($(IS_NRF52840),)
SD_NAME = s140
DFU_DEV_REV = 52840
else
ifneq ($(IS_52832),)
SD_NAME = s132
DFU_DEV_REV = 0xADAF
else
SD_NAME = s140
DFU_DEV_REV = 52840
endif
@ -149,7 +150,19 @@ C_SOURCE_FILES += $(SDK_PATH)/libraries/hci/hci_slip.c
C_SOURCE_FILES += $(SDK_PATH)/libraries/hci/hci_transport.c
C_SOURCE_FILES += $(SDK_PATH)/libraries/util/nrf_assert.c
ifneq ($(IS_NRF52840),)
ifneq ($(IS_52832),)
C_SOURCE_FILES += $(NRFX_PATH)/mdk/system_nrf52.c
C_SOURCE_FILES += $(SDK_PATH)/libraries/uart/app_uart.c
C_SOURCE_FILES += $(SDK_PATH)/drivers_nrf/uart/nrf_drv_uart.c
C_SOURCE_FILES += $(SDK_PATH)/drivers_nrf/common/nrf_drv_common.c
IPATH += $(SDK11_PATH)/libraries/util
IPATH += $(SDK_PATH)/drivers_nrf/common
IPATH += $(SDK_PATH)/drivers_nrf/uart
else
# src
C_SOURCE_FILES += $(SRC_PATH)/usb/usb_desc.c
@ -171,28 +184,16 @@ C_SOURCE_FILES += $(TUSB_PATH)/class/msc/msc_device.c
C_SOURCE_FILES += $(TUSB_PATH)/class/custom/custom_device.c
C_SOURCE_FILES += $(TUSB_PATH)/tusb.c
else
C_SOURCE_FILES += $(NRFX_PATH)/mdk/system_nrf52.c
C_SOURCE_FILES += $(SDK_PATH)/libraries/uart/app_uart.c
C_SOURCE_FILES += $(SDK_PATH)/drivers_nrf/uart/nrf_drv_uart.c
C_SOURCE_FILES += $(SDK_PATH)/drivers_nrf/common/nrf_drv_common.c
IPATH += $(SDK11_PATH)/libraries/util
IPATH += $(SDK_PATH)/drivers_nrf/common
IPATH += $(SDK_PATH)/drivers_nrf/uart
endif
#******************************************************************************
# Assembly Files
#******************************************************************************
ifneq ($(IS_NRF52840),)
ASM_SOURCE_FILES = $(NRFX_PATH)/mdk/gcc_startup_nrf52840.S
else
ifneq ($(IS_52832),)
ASM_SOURCE_FILES = $(NRFX_PATH)/mdk/gcc_startup_nrf52.S
else
ASM_SOURCE_FILES = $(NRFX_PATH)/mdk/gcc_startup_nrf52840.S
endif
#******************************************************************************
@ -203,6 +204,7 @@ endif
IPATH += $(SRC_PATH)
IPATH += $(SRC_PATH)/cmsis/include
IPATH += $(SRC_PATH)/usb
IPATH += $(SRC_PATH)/boards
IPATH += $(TUSB_PATH)
# nrfx
@ -263,20 +265,16 @@ CFLAGS += -DMK_DIS_FIRMWARE='$(MK_DIS_FIRMWARE)'
CFLAGS += -DDFU_APP_DATA_RESERVED=7*4096
CFLAGS += -DUF2_VERSION='"$(GIT_VERSION) $(GIT_SUBMODULE_VERSIONS) $(SD_NAME) $(SD_VERSION)"'
CFLAGS += -DBOARD_$(shell echo $(BOARD) | tr '[:lower:]' '[:upper:]')
CFLAGS += -DBOARD_HEADER_FILE='"$(BOARD).h"'
ifneq ($(IS_NRF52840),)
CFLAGS += -DNRF52840_XXAA
CFLAGS += -DS140
else
ifneq ($(IS_52832),)
CFLAGS += -DNRF52
CFLAGS += -DNRF52832_XXAA
CFLAGS += -DS132
else
CFLAGS += -DNRF52840_XXAA
CFLAGS += -DS140
endif
@ -310,19 +308,14 @@ ASMFLAGS += -DSWI_DISABLE0
ASMFLAGS += -DSOFTDEVICE_PRESENT
ASMFLAGS += -DFLOAT_ABI_HARD
ifneq ($(IS_NRF52840),)
ASMFLAGS += -DNRF52840_XXAA
ASMFLAGS += -DS140
else
ifneq ($(IS_52832),)
ASMFLAGS += -DNRF52
ASMFLAGS += -DS132
else
ASMFLAGS += -DNRF52840_XXAA
ASMFLAGS += -DS140
endif
C_SOURCE_FILE_NAMES = $(notdir $(C_SOURCE_FILES))
C_PATHS = $(call remduplicates, $(dir $(C_SOURCE_FILES) ) )
C_OBJECTS = $(addprefix $(BUILD)/, $(C_SOURCE_FILE_NAMES:.c=.o) )
@ -345,6 +338,8 @@ $(info CFLAGS $(CFLAGS))
$(info )
$(info LDFLAGS $(LDFLAGS))
$(info )
$(info ASMFLAGS $(ASMFLAGS))
$(info )
endif
.phony: all clean size flash sd erase

26
changelog.md Normal file
View File

@ -0,0 +1,26 @@
# Adafruit nRF52 Bootloader Changelog
## 0.2.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
## 0.2.6
- Fixed copy/restore current.uf2 issue
- Fixed neopixel won't turn off after dfu cdc
## 0.2.5
- Make led pattern more consistent
- Fixed issue nrf52840 not reset properly when upgrading bootloader+sd combo
- Make led pattern more consistent
## 0.2.3
- Fully support Feather nRF52840
- Update bootloader with new led pattern
- Fix #203: return software timer handle

View File

@ -885,6 +885,14 @@ static void on_ble_evt(ble_evt_t * p_ble_evt)
APP_ERROR_CHECK( sd_ble_gap_data_length_update(m_conn_handle, NULL, NULL) );
break;
case BLE_GAP_EVT_PHY_UPDATE_REQUEST:
{
// Tell SoftDevice to choose PHY automatically
ble_gap_phys_t phy = { BLE_GAP_PHY_AUTO, BLE_GAP_PHY_AUTO };
(void) sd_ble_gap_phy_update(m_conn_handle, &phy);
}
break;
case BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST:
{
uint16_t att_mtu = MIN(p_ble_evt->evt.gatts_evt.params.exchange_mtu_request.client_rx_mtu, BLEGATT_ATT_MTU_MAX);

View File

@ -46,17 +46,9 @@
#define BOOTLOADER_SETTINGS_ADDRESS 0x0007F000 /**< The field specifies the page location of the bootloader settings address. */
#define BOOTLOADER_MBR_PARAMS_PAGE_ADDRESS 0x0007E000 /**< The field specifies the page location of the mbr params page address. */
#elif defined(NRF52840_XXAA)
// Increase bootloader size to application data region for easy debugging
#ifdef DEBUG_SIZE_EXPAND
#define BOOTLOADER_REGION_START (0x000F4000 - CODE_PAGE_SIZE*7)
#define DFU_APP_DATA_RESERVED 0
#else
#define BOOTLOADER_REGION_START 0x000F4000 /**< This field should correspond to start address of the bootloader, found in UICR.RESERVED, 0x10001014, register. This value is used for sanity check, so the bootloader will fail immediately if this value differs from runtime value. The value is used to determine max application size for updating. */
#endif
#define BOOTLOADER_SETTINGS_ADDRESS 0x000FF000 /**< The field specifies the page location of the bootloader settings address. */
#define BOOTLOADER_MBR_PARAMS_PAGE_ADDRESS 0x000FE000 /**< The field specifies the page location of the mbr params page address. */

View File

@ -83,7 +83,6 @@ void board_init(void)
// Configure Systick for led blinky
NVIC_SetPriority(SysTick_IRQn, 7);
extern uint32_t SystemCoreClock;
SysTick_Config(SystemCoreClock/1000);
}
@ -132,6 +131,9 @@ void pwm_teardown(NRF_PWM_Type* pwm )
pwm->ENABLE = 0;
pwm->PSEL.OUT[0] = 0xFFFFFFFF;
pwm->PSEL.OUT[1] = 0xFFFFFFFF;
pwm->PSEL.OUT[2] = 0xFFFFFFFF;
pwm->PSEL.OUT[3] = 0xFFFFFFFF;
pwm->MODE = 0;
pwm->COUNTERTOP = 0x3FF;
@ -301,6 +303,7 @@ void led_state(uint32_t state)
static uint16_t pixels_pattern[NEO_NUMBYTE * 8 + 2];
// use PWM1 for neopixel
void neopixel_init(void)
{
// To support both the SoftDevice + Neopixels we use the EasyDMA
@ -310,7 +313,7 @@ void neopixel_init(void)
// totalMem = numBytes*8*2+(2*2)
// The two additional bytes at the end are needed to reset the
// sequence.
NRF_PWM_Type* pwm = NRF_PWM2;
NRF_PWM_Type* pwm = NRF_PWM1;
// Set the wave mode to count UP
// Set the PWM to use the 16MHz clock
@ -353,7 +356,7 @@ void neopixel_teardown(void)
neopixel_write(grb);
NRFX_DELAY_US(50); // wait for this write
pwm_teardown(NRF_PWM2);
pwm_teardown(NRF_PWM1);
}
// write 3 bytes color to a built-in neopixel
@ -376,17 +379,16 @@ void neopixel_write (uint8_t *pixels)
pixels_pattern[pos++] = 0 | (0x8000); // Seq end
pixels_pattern[pos++] = 0 | (0x8000); // Seq end
NRF_PWM_Type* pwm = NRF_PWM2;
NRF_PWM_Type* pwm = NRF_PWM1;
nrf_pwm_seq_ptr_set(pwm, 0, pixels_pattern);
nrf_pwm_seq_cnt_set(pwm, 0, sizeof(pixels_pattern)/2);
nrf_pwm_event_clear(pwm, NRF_PWM_EVENT_SEQEND0);
nrf_pwm_task_trigger(pwm, NRF_PWM_TASK_SEQSTART0);
// no need to blocking wait for sequence complete
// while( !nrf_pwm_event_check(pwm, NRF_PWM_EVENT_SEQEND0) ) {}
// nrf_pwm_event_clear(pwm, NRF_PWM_EVENT_SEQEND0);
// blocking wait for sequence complete
while( !nrf_pwm_event_check(pwm, NRF_PWM_EVENT_SEQEND0) ) {}
nrf_pwm_event_clear(pwm, NRF_PWM_EVENT_SEQEND0);
}
#endif

View File

@ -17,23 +17,7 @@
#include <string.h>
#include "nrf_gpio.h"
#if defined BOARD_FEATHER_NRF52840_EXPRESS
#include "boards/feather_nrf52840_express.h"
#elif defined BOARD_FEATHER_NRF52832
#include "boards/feather_nrf52832.h"
#elif defined BOARD_PCA10056
#include "boards/pca10056.h"
#elif defined BOARD_PCA10059
#include "boards/pca10059.h"
#elif defined BOARD_PARTICLE_ARGON
#include "boards/particle_argon.h"
#elif defined BOARD_PARTICLE_BORON
#include "boards/particle_boron.h"
#elif defined BOARD_PARTICLE_XENON
#include "boards/particle_xenon.h"
#else
#error No boards defined
#endif
#include BOARD_HEADER_FILE
#ifndef BUTTON_DFU
#define BUTTON_DFU BUTTON_1
@ -73,15 +57,17 @@ void board_teardown(void);
#define bit(b) (1UL << (b))
#define STATE_BOOTLOADER_STARTED 0
#define STATE_USB_MOUNTED 1
#define STATE_USB_UNMOUNTED 2
#define STATE_FACTORY_RESET_STARTED 3
#define STATE_FACTORY_RESET_FINISHED 4
#define STATE_WRITING_STARTED 5
#define STATE_WRITING_FINISHED 6
#define STATE_BLE_CONNECTED 7
#define STATE_BLE_DISCONNECTED 8
enum {
STATE_BOOTLOADER_STARTED = 0,
STATE_USB_MOUNTED,
STATE_USB_UNMOUNTED,
STATE_FACTORY_RESET_STARTED,
STATE_FACTORY_RESET_FINISHED,
STATE_WRITING_STARTED,
STATE_WRITING_FINISHED,
STATE_BLE_CONNECTED,
STATE_BLE_DISCONNECTED
};
void led_pwm_init(uint32_t led_index, uint32_t led_pin);
void led_pwm_teardown(void);

View File

@ -58,8 +58,8 @@
*------------------------------------------------------------------*/
#define RX_PIN_NUMBER 8
#define TX_PIN_NUMBER 6
#define CTS_PIN_NUMBER 7
#define RTS_PIN_NUMBER 5
#define CTS_PIN_NUMBER 0
#define RTS_PIN_NUMBER 0
#define HWFC false
// Used as model string in OTA mode

View File

@ -62,8 +62,8 @@
*------------------------------------------------------------------*/
#define RX_PIN_NUMBER 8
#define TX_PIN_NUMBER 6
#define CTS_PIN_NUMBER 7
#define RTS_PIN_NUMBER 5
#define CTS_PIN_NUMBER 0
#define RTS_PIN_NUMBER 0
#define HWFC false
// Used as model string in OTA mode

View File

@ -0,0 +1,77 @@
/**************************************************************************/
/*!
@file metro_nrf52840_express.h
@author hathach (tinyusb.org)
@section LICENSE
Software License Agreement (BSD License)
Copyright (c) 2019, Adafruit Industries (adafruit.com)
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holders nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**************************************************************************/
#ifndef _METRO_NRF52840_EXPRESS_H_
#define _METRO_NRF52840_EXPRESS_H_
#define _PINNUM(port, pin) ((port)*32 + (pin))
/*------------------------------------------------------------------*/
/* LED
*------------------------------------------------------------------*/
#define LEDS_NUMBER 2
#define LED_PRIMARY_PIN _PINNUM(1, 13)
#define LED_SECONDARY_PIN _PINNUM(1, 15)
#define LED_NEOPIXEL _PINNUM(0, 13)
#define BOARD_RGB_BRIGHTNESS 0x040404
#define LED_STATE_ON 1
/*------------------------------------------------------------------*/
/* BUTTON
*------------------------------------------------------------------*/
#define BUTTONS_NUMBER 2
#define BUTTON_1 _PINNUM(1, 0)
#define BUTTON_2 _PINNUM(2, 2)
#define BUTTON_PULL NRF_GPIO_PIN_PULLUP
/*------------------------------------------------------------------*/
/* UART
*------------------------------------------------------------------*/
#define RX_PIN_NUMBER 8
#define TX_PIN_NUMBER 6
#define CTS_PIN_NUMBER 0
#define RTS_PIN_NUMBER 0
#define HWFC false
// Used as model string in OTA mode
#define DIS_MANUFACTURER "Adafruit Industries"
#define DIS_MODEL "Bluefruit Metro nRF52840 Express"
#define PRODUCT_NAME "Adafruit Metro nRF52840 Express"
#define VOLUME_LABEL "METR840BOOT"
#endif /* _METRO_NRF52840_EXPRESS_H_ */

View File

@ -58,8 +58,8 @@
*------------------------------------------------------------------*/
#define RX_PIN_NUMBER 8
#define TX_PIN_NUMBER 6
#define CTS_PIN_NUMBER 7
#define RTS_PIN_NUMBER 5
#define CTS_PIN_NUMBER 0
#define RTS_PIN_NUMBER 0
#define HWFC false
// Used as model string in OTA mode

View File

@ -37,6 +37,8 @@
#ifndef PCA10059_H
#define PCA10059_H
#define _PINNUM(port, pin) ((port)*32 + (pin))
/*------------------------------------------------------------------*/
/* LED
*------------------------------------------------------------------*/
@ -50,8 +52,8 @@
*------------------------------------------------------------------*/
#define BUTTONS_NUMBER 2
#define BUTTON_1 (1 << 5 | 6)
#define BUTTON_2 (1 << 5 | 10)
#define BUTTON_1 _PINNUM(1, 6)
#define BUTTON_2 _PINNUM(1, 10)
#define BUTTON_PULL NRF_GPIO_PIN_PULLUP
/*------------------------------------------------------------------*/

View File

@ -43,17 +43,19 @@
#ifndef SDK_CONFIG_H
#define SDK_CONFIG_H
#include "boards.h"
//==========================================================
// <e> HCI_SLIP_ENABLED - hci_slip - SLIP protocol implementation used by HCI
//==========================================================
#define HCI_SLIP_ENABLED 1
#define HCI_UART_BAUDRATE UART_BAUDRATE_BAUDRATE_Baud115200
#define HCI_UART_FLOW_CONTROL 0
#define HCI_UART_RX_PIN 8
#define HCI_UART_TX_PIN 6
#define HCI_UART_RTS_PIN 5
#define HCI_UART_CTS_PIN 7
#define HCI_UART_FLOW_CONTROL HWFC
#define HCI_UART_RX_PIN RX_PIN_NUMBER
#define HCI_UART_TX_PIN TX_PIN_NUMBER
#define HCI_UART_CTS_PIN CTS_PIN_NUMBER
#define HCI_UART_RTS_PIN RTS_PIN_NUMBER
#define HCI_TRANSPORT_ENABLED 1
#define HCI_MAX_PACKET_SIZE_IN_BITS 8000

View File

@ -18,10 +18,12 @@
arm_target_debug_interface_type="ADIv5"
arm_target_device_name="nRF52840_xxAA"
arm_target_interface_type="SWD"
build_treat_warnings_as_errors="Yes"
c_preprocessor_definitions="__nRF_FAMILY;ARM_MATH_CM4;FLASH_PLACEMENT=1;NO_VTOR_CONFIG;MK_BOOTLOADER_VERSION=0x06010000;CONFIG_GPIO_AS_PINRESET;BLE_STACK_SUPPORT_REQD;SWI_DISABLE0;SOFTDEVICE_PRESENT;FLOAT_ABI_HARD;CFG_TUSB_DEBUG=2;UF2_VERSION=&quot;Segger&quot;"
c_user_include_directories="../;../usb;../cmsis/include;$(tusbDir);$(nrfxDir);$(nrfxDir)/mdk;$(nrfxDir)/hal;$(nrfxDir)/drivers/include;$(sdDir)/include;$(sdDir)/include/nrf52;$(sdk11Dir)/drivers_nrf/pstorage;$(sdk11Dir)/ble/common/;$(sdk11Dir)/ble/ble_services/ble_dfu;$(sdk11Dir)/ble/ble_services/ble_dis;$(sdk11Dir)/libraries/bootloader_dfu;$(sdk11Dir)/libraries/bootloader_dfu/hci_transport;$(sdk11Dir)/libraries/util;$(sdkDir)/toolchain/cmsis/include;$(sdkDir)/device;$(sdkDir)/toolchain;$(sdkDir)/drivers_nrf/hal;$(sdkDir)/drivers_nrf/systick;$(sdkDir)/drivers_nrf/uart;$(sdkDir)/drivers_nrf/usbd;$(sdkDir)/drivers_nrf/common;$(sdkDir)/drivers_nrf/delay;$(sdkDir)/drivers_nrf/power;$(sdkDir)/drivers_nrf/clock;$(sdkDir)/libraries/util;$(sdkDir)/libraries/timer;$(sdkDir)/libraries/scheduler;$(sdkDir)/libraries/crc16;$(sdkDir)/libraries/util;$(sdkDir)/libraries/hci/config;$(sdkDir)/libraries/uart;$(sdkDir)/libraries/hci;$(sdkDir)/external/fprintf;$(sdkDir)/libraries/strerror;$(sdkDir)/libraries/atomic;$(sdkDir)/libraries/balloc;$(sdkDir)/libraries/experimental_log/src;$(sdkDir)/libraries/experimental_log;$(sdkDir)/libraries/experimental_section_vars;$(sdkDir)/libraries/experimental_memobj"
c_user_include_directories="../;../usb;../boards;../cmsis/include;$(tusbDir);$(nrfxDir);$(nrfxDir)/mdk;$(nrfxDir)/hal;$(nrfxDir)/drivers/include;$(sdDir)/include;$(sdDir)/include/nrf52;$(sdk11Dir)/drivers_nrf/pstorage;$(sdk11Dir)/ble/common/;$(sdk11Dir)/ble/ble_services/ble_dfu;$(sdk11Dir)/ble/ble_services/ble_dis;$(sdk11Dir)/libraries/bootloader_dfu;$(sdk11Dir)/libraries/bootloader_dfu/hci_transport;$(sdk11Dir)/libraries/util;$(sdkDir)/toolchain/cmsis/include;$(sdkDir)/device;$(sdkDir)/toolchain;$(sdkDir)/drivers_nrf/hal;$(sdkDir)/drivers_nrf/systick;$(sdkDir)/drivers_nrf/uart;$(sdkDir)/drivers_nrf/usbd;$(sdkDir)/drivers_nrf/common;$(sdkDir)/drivers_nrf/delay;$(sdkDir)/drivers_nrf/power;$(sdkDir)/drivers_nrf/clock;$(sdkDir)/libraries/util;$(sdkDir)/libraries/timer;$(sdkDir)/libraries/scheduler;$(sdkDir)/libraries/crc16;$(sdkDir)/libraries/util;$(sdkDir)/libraries/hci/config;$(sdkDir)/libraries/uart;$(sdkDir)/libraries/hci;$(sdkDir)/external/fprintf;$(sdkDir)/libraries/strerror;$(sdkDir)/libraries/atomic;$(sdkDir)/libraries/balloc;$(sdkDir)/libraries/experimental_log/src;$(sdkDir)/libraries/experimental_log;$(sdkDir)/libraries/experimental_section_vars;$(sdkDir)/libraries/experimental_memobj"
debug_register_definition_file="$(ProjectDir)/nrf52840_Registers.xml"
debug_target_connection="J-Link"
gcc_enable_all_warnings="No"
gcc_entry_point="Reset_Handler"
linker_memory_map_file="$(ProjectDir)/nRF52840_xxAA_MemoryMap.xml"
linker_section_placement_file="$(ProjectDir)/flash_placement.xml"
@ -327,6 +329,7 @@
<configuration
Name="Feather52840"
build_exclude_from_build="Yes" />
<configuration Name="PCA10056" build_exclude_from_build="Yes" />
</file>
<file file_name="../../lib/nrfx/mdk/ses_startup_nrf52840.s">
<configuration
@ -349,6 +352,7 @@
<configuration
Name="Feather52840"
build_exclude_from_build="Yes" />
<configuration Name="PCA10056" build_exclude_from_build="Yes" />
</file>
<file file_name="../../lib/nrfx/mdk/system_nrf52.h" />
<file file_name="../../lib/nrfx/mdk/system_nrf52840.c">
@ -370,16 +374,19 @@
</folder>
<configuration
Name="Feather52840"
c_preprocessor_definitions="NRF52840_XXAA;MK_DIS_FIRMWARE=&quot;s140 6.1.1 r0&quot;;S140;BOARD_PCA10056"
c_preprocessor_definitions="NRF52840_XXAA;MK_DIS_FIRMWARE=&quot;s140 6.1.1 r0&quot;;S140;BOARD_FEATHER_NRF52840_EXPRESS;BOARD_HEADER_FILE=&quot;feather_nrf52840_express.h&quot;"
linker_memory_map_file="nRF52840_xxAA_MemoryMap.xml" />
<configuration
Name="Feather52832"
c_preprocessor_definitions="NRF52832_XXAA;MK_DIS_FIRMWARE=&quot;s132 6.1.1 r0&quot;;S132;BOARD_FEATHER_NRF52832"
c_preprocessor_definitions="NRF52832_XXAA;MK_DIS_FIRMWARE=&quot;s132 6.1.1 r0&quot;;S132;BOARD_FEATHER_NRF52832;BOARD_HEADER_FILE=&quot;feather_nrf52832.h&quot;"
linker_memory_map_file="nRF52832_xxAA_MemoryMap.xml" />
</project>
<configuration
Name="Feather52840"
build_treat_warnings_as_errors="Yes"
c_preprocessor_definitions="DEBUG_SIZE_EXPAND" />
Name="PCA10056"
c_preprocessor_definitions="NRF52840_XXAA;MK_DIS_FIRMWARE=&quot;s140 6.1.1 r0&quot;;S140;BOARD_PCA10056;BOARD_HEADER_FILE=&quot;pca10056.h&quot;"
gcc_optimization_level="Debug"
linker_memory_map_file="nRF52840_xxAA_MemoryMap.xml" />
</project>
<configuration Name="Feather52840" />
<configuration Name="Feather52832" />
<configuration Name="PCA10056" />
</solution>

View File

@ -1,7 +1,6 @@
<!DOCTYPE Board_Memory_Definition_File>
<root name="nRF52840_xxAA">
<!--MemorySegment name="FLASH" start="0x000F4000" size="0xA000" access="ReadOnly" /-->
<MemorySegment name="FLASH" start="0x000ED000" size="0x11000" access="ReadOnly" />
<MemorySegment name="FLASH" start="0x000F4000" size="0xA000" access="ReadOnly" />
<MemorySegment name="BOOTLOADER_SETTINGS" start="0x000FF000" size="0x1000" access="ReadOnly" />
<MemorySegment name="MBR_PARAMS_PAGE" start="0x000FE000" size="0x1000" access="ReadOnly" />
<MemorySegment name="UICR_BOOTLOADER" start="0x10001014" size="0x04" access="ReadOnly" />

View File

@ -79,6 +79,8 @@ void usb_init(bool cdc_only)
_inited = true;
NVIC_SetPriority(USBD_IRQn, 2);
// USB power may already be ready at this time -> no event generated
// We need to invoke the handler based on the status initially
uint32_t usb_reg;