Skip to content

Commit

Permalink
Revert "Minor update"
Browse files Browse the repository at this point in the history
  • Loading branch information
hathach authored Jun 5, 2024
1 parent 8473ff6 commit 963ae8d
Show file tree
Hide file tree
Showing 11 changed files with 116 additions and 98 deletions.
2 changes: 2 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
*By completing this PR sufficiently, you help us to review this Pull Request quicker and also help improve the quality of Release Notes*

- [ ] Please provide specific title of the PR describing the change
- [ ] Please provide related links (*eg. Issue which will be closed by this Pull Request*)
- [ ] If you are adding an new boards, please make sure
- [ ] Provide link to your allocated VID/PID if applicable
- [ ] Add your board to [action ci](/.github/workflows) in correct workflow and alphabet order for release binary
- [ ] `UF2_BOARD_ID` in your board.h follow correct format from [uf2 specs](https://github.com/microsoft/uf2#files-exposed-by-bootloaders)

*This checklist items that are not applicable to your PR can be deleted.*
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/githubci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ jobs:
matrix:
board: ${{ fromJSON(needs.set-matrix.outputs.matrix) }}
steps:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Checkout Code
uses: actions/checkout@v4
with:
Expand Down
150 changes: 77 additions & 73 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_LIST_DIR}/cmake/toolchain/arm_${TOOLCHA

project(Adafruit_nRF52_Bootloader C ASM)

set(NRFX_DIR ${CMAKE_CURRENT_LIST_DIR}/lib/nrfx)
set(SDK11_DIR ${CMAKE_CURRENT_LIST_DIR}/lib/sdk11/components)
set(SDK_DIR ${CMAKE_CURRENT_LIST_DIR}/lib/sdk/components)
set(SOFTDEVICE_DIR ${CMAKE_CURRENT_LIST_DIR}/lib/softdevice)
set(TINYUSB_DIR ${CMAKE_CURRENT_LIST_DIR}/lib/tinyusb/src)
set(NRFX ${CMAKE_CURRENT_LIST_DIR}/lib/nrfx)
set(SDK11 ${CMAKE_CURRENT_LIST_DIR}/lib/sdk11/components)
set(SDK ${CMAKE_CURRENT_LIST_DIR}/lib/sdk/components)
set(SOFTDEVICE ${CMAKE_CURRENT_LIST_DIR}/lib/softdevice)
set(TUSB ${CMAKE_CURRENT_LIST_DIR}/lib/tinyusb/src)

set(UF2CONV_PY ${CMAKE_CURRENT_LIST_DIR}/lib/uf2/utils/uf2conv.py)
set(UF2_FAMILY_ID_BOOTLOADER 0xd663823c)
Expand All @@ -42,14 +42,10 @@ add_executable(bootloader)

# SD_VERSION can be overwritten by board.cmake
if(NOT DEFINED SD_VERSION)
if(MCU_VARIANT STREQUAL "nrf52833")
set(SD_VERSION 7.3.0)
else()
set(SD_VERSION 6.1.1)
endif()
set(SD_VERSION 6.1.1)
endif ()

set(MBR_HEX ${SOFTDEVICE_DIR}/mbr/hex/mbr_nrf52_2.4.1_mbr.hex)
set(MBR_HEX ${SOFTDEVICE}/mbr/hex/mbr_nrf52_2.4.1_mbr.hex)

target_sources(bootloader PUBLIC
# src
Expand All @@ -61,63 +57,63 @@ target_sources(bootloader PUBLIC
src/images.c
src/boards/boards.c
# nrfx
${NRFX_DIR}/drivers/src/nrfx_power.c
${NRFX_DIR}/drivers/src/nrfx_nvmc.c
${NRFX_DIR}/mdk/system_${MCU_VARIANT}.c
${NRFX}/drivers/src/nrfx_power.c
${NRFX}/drivers/src/nrfx_nvmc.c
${NRFX}/mdk/system_${MCU_VARIANT}.c
# sdk 11
${SDK11_DIR}/libraries/bootloader_dfu/bootloader.c
${SDK11_DIR}/libraries/bootloader_dfu/bootloader_settings.c
${SDK11_DIR}/libraries/bootloader_dfu/bootloader_util.c
${SDK11_DIR}/libraries/bootloader_dfu/dfu_transport_serial.c
${SDK11_DIR}/libraries/bootloader_dfu/dfu_transport_ble.c
${SDK11_DIR}/libraries/bootloader_dfu/dfu_single_bank.c
${SDK11_DIR}/ble/ble_services/ble_dfu/ble_dfu.c
${SDK11_DIR}/ble/ble_services/ble_dis/ble_dis.c
${SDK11_DIR}/drivers_nrf/pstorage/pstorage_raw.c
${SDK11}/libraries/bootloader_dfu/bootloader.c
${SDK11}/libraries/bootloader_dfu/bootloader_settings.c
${SDK11}/libraries/bootloader_dfu/bootloader_util.c
${SDK11}/libraries/bootloader_dfu/dfu_transport_serial.c
${SDK11}/libraries/bootloader_dfu/dfu_transport_ble.c
${SDK11}/libraries/bootloader_dfu/dfu_single_bank.c
${SDK11}/ble/ble_services/ble_dfu/ble_dfu.c
${SDK11}/ble/ble_services/ble_dis/ble_dis.c
${SDK11}/drivers_nrf/pstorage/pstorage_raw.c
# latest sdk
${SDK_DIR}/libraries/timer/app_timer.c
${SDK_DIR}/libraries/scheduler/app_scheduler.c
${SDK_DIR}/libraries/util/app_error.c
${SDK_DIR}/libraries/util/app_util_platform.c
${SDK_DIR}/libraries/crc16/crc16.c
${SDK_DIR}/libraries/hci/hci_mem_pool.c
${SDK_DIR}/libraries/hci/hci_slip.c
${SDK_DIR}/libraries/hci/hci_transport.c
${SDK_DIR}/libraries/util/nrf_assert.c
${SDK}/libraries/timer/app_timer.c
${SDK}/libraries/scheduler/app_scheduler.c
${SDK}/libraries/util/app_error.c
${SDK}/libraries/util/app_util_platform.c
${SDK}/libraries/crc16/crc16.c
${SDK}/libraries/hci/hci_mem_pool.c
${SDK}/libraries/hci/hci_slip.c
${SDK}/libraries/hci/hci_transport.c
${SDK}/libraries/util/nrf_assert.c
# ASM
${NRFX_DIR}/mdk/gcc_startup_${MCU_VARIANT}.S
${NRFX}/mdk/gcc_startup_${MCU_VARIANT}.S
)
target_include_directories(bootloader PUBLIC
src
src/boards
src/boards/${BOARD}
src/cmsis/include
src/usb
${TINYUSB_DIR}
${TUSB}
# nrfx
${NRFX_DIR}
${NRFX_DIR}/mdk
${NRFX_DIR}/hal
${NRFX_DIR}/drivers/include
${NRFX_DIR}/drivers/src
${NRFX}
${NRFX}/mdk
${NRFX}/hal
${NRFX}/drivers/include
${NRFX}/drivers/src
# sdk 11 for cdc/ble dfu
${SDK11_DIR}/libraries/bootloader_dfu
${SDK11_DIR}/libraries/bootloader_dfu/hci_transport
${SDK11_DIR}/drivers_nrf/pstorage
${SDK11_DIR}/ble/common
${SDK11_DIR}/ble/ble_services/ble_dfu
${SDK11_DIR}/ble/ble_services/ble_dis
${SDK11}/libraries/bootloader_dfu
${SDK11}/libraries/bootloader_dfu/hci_transport
${SDK11}/drivers_nrf/pstorage
${SDK11}/ble/common
${SDK11}/ble/ble_services/ble_dfu
${SDK11}/ble/ble_services/ble_dis
# later sdk with updated drivers
${SDK_DIR}/libraries/timer
${SDK_DIR}/libraries/scheduler
${SDK_DIR}/libraries/crc16
${SDK_DIR}/libraries/util
${SDK_DIR}/libraries/hci/config
${SDK_DIR}/libraries/hci
${SDK_DIR}/libraries/uart
${SDK_DIR}/drivers_nrf/delay
${SDK}/libraries/timer
${SDK}/libraries/scheduler
${SDK}/libraries/crc16
${SDK}/libraries/util
${SDK}/libraries/hci/config
${SDK}/libraries/hci
${SDK}/libraries/uart
${SDK}/drivers_nrf/delay
# Softdevice
${SOFTDEVICE_DIR}/mbr/headers
${SOFTDEVICE}/mbr/headers
)

# Debug option
Expand Down Expand Up @@ -149,7 +145,7 @@ endif ()

target_link_options(bootloader PUBLIC
"LINKER:--script=${LD_FILE}"
-L${NRFX_DIR}/mdk
-L${NRFX}/mdk
--specs=nosys.specs --specs=nano.specs
)
target_compile_options(bootloader PUBLIC
Expand Down Expand Up @@ -185,14 +181,14 @@ endif ()
if (MCU_VARIANT STREQUAL "nrf52")
# UART transport
target_sources(bootloader PUBLIC
${SDK_DIR}/libraries/uart/app_uart.c
${SDK_DIR}/drivers_nrf/uart/nrf_drv_uart.c
${SDK_DIR}/drivers_nrf/common/nrf_drv_common.c
${SDK}/libraries/uart/app_uart.c
${SDK}/drivers_nrf/uart/nrf_drv_uart.c
${SDK}/drivers_nrf/common/nrf_drv_common.c
)
target_include_directories(bootloader PUBLIC
${SDK11_DIR}/libraries/util
${SDK_DIR}/drivers_nrf/common
${SDK_DIR}/drivers_nrf/uart
${SDK11}/libraries/util
${SDK}/drivers_nrf/common
${SDK}/drivers_nrf/uart
)
else ()
# USB transport
Expand All @@ -203,13 +199,13 @@ else ()
src/usb/usb_desc.c
src/usb/uf2/ghostfat.c
# TinyUSB
${TINYUSB_DIR}/portable/nordic/nrf5x/dcd_nrf5x.c
${TINYUSB_DIR}/common/tusb_fifo.c
${TINYUSB_DIR}/device/usbd.c
${TINYUSB_DIR}/device/usbd_control.c
${TINYUSB_DIR}/class/cdc/cdc_device.c
${TINYUSB_DIR}/class/msc/msc_device.c
${TINYUSB_DIR}/tusb.c
${TUSB}/portable/nordic/nrf5x/dcd_nrf5x.c
${TUSB}/common/tusb_fifo.c
${TUSB}/device/usbd.c
${TUSB}/device/usbd_control.c
${TUSB}/class/cdc/cdc_device.c
${TUSB}/class/msc/msc_device.c
${TUSB}/tusb.c
)
endif ()

Expand All @@ -226,6 +222,10 @@ if (MCU_VARIANT STREQUAL "nrf52")
NRF52832_XXAA
S132
)
target_include_directories(bootloader PUBLIC
${SOFTDEVICE}/s132_nrf52_6.1.1/s132_nrf52_6.1.1_API/include
)

elseif (MCU_VARIANT STREQUAL "nrf52833")
set(SD_NAME s140)
set(DFU_DEV_REV 52833)
Expand All @@ -234,6 +234,10 @@ elseif (MCU_VARIANT STREQUAL "nrf52833")
NRF52833_XXAA
S140
)
target_include_directories(bootloader PUBLIC
${SOFTDEVICE}/s140_nrf52_6.1.1/s140_nrf52_6.1.1_API/include
)

elseif (MCU_VARIANT STREQUAL "nrf52840")
set(SD_NAME s140)
set(DFU_DEV_REV 52840)
Expand All @@ -243,16 +247,16 @@ elseif (MCU_VARIANT STREQUAL "nrf52840")
NRF52840_XXAA
S140
)
target_include_directories(bootloader PUBLIC
${SOFTDEVICE}/s140_nrf52_6.1.1/s140_nrf52_6.1.1_API/include
)

else ()
message(FATAL_ERROR "MCU_VARIANT ${MCU_VARIANT} is unknown")
endif ()

set(SD_FILENAME ${SD_NAME}_nrf52_${SD_VERSION})
set(SD_HEX ${SOFTDEVICE_DIR}/${SD_FILENAME}/${SD_FILENAME}_softdevice.hex)

target_include_directories(bootloader PUBLIC
${SOFTDEVICE_DIR}/${SD_FILENAME}/${SD_FILENAME}_API/include
)
set(SD_HEX ${SOFTDEVICE}/${SD_FILENAME}/${SD_FILENAME}_softdevice.hex)

if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
target_compile_definitions(bootloader PUBLIC DFU_APP_DATA_RESERVED=${DFU_APP_DATA_RESERVED})
Expand Down
24 changes: 16 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
# local customization
-include Makefile.user

# Board specific
-include src/boards/$(BOARD)/board.mk

SDK_PATH = lib/sdk/components
SDK11_PATH = lib/sdk11/components
TUSB_PATH = lib/tinyusb/src
Expand All @@ -21,11 +18,7 @@ SD_PATH = lib/softdevice/$(SD_FILENAME)

# SD_VERSION can be overwritten by board.mk
ifndef SD_VERSION
ifeq ($(MCU_SUB_VARIANT),nrf52833)
SD_VERSION = 7.3.0
else
SD_VERSION = 6.1.1
endif
SD_VERSION = 6.1.1
endif

SD_FILENAME = $(SD_NAME)_nrf52_$(SD_VERSION)
Expand Down Expand Up @@ -96,10 +89,25 @@ endif
BMP_PORT ?= $(shell ls -1 /dev/cu.usbmodem????????1 | head -1)
GDB_BMP = $(GDB) -ex 'target extended-remote $(BMP_PORT)' -ex 'monitor swdp_scan' -ex 'attach 1'

#---------------------------------
# Select the board to build
#---------------------------------
# Note: whitespace is not allowed in the filenames... it WILL break this part of the script
BOARD_LIST = $(sort $(filter-out boards.h boards.c,$(notdir $(wildcard src/boards/*))))

ifeq ($(filter $(BOARD),$(BOARD_LIST)),)
$(info You must provide a BOARD parameter with 'BOARD='. Supported boards are:)
$(foreach b,$(BOARD_LIST),$(info - $(b)))
$(error Invalid BOARD specified)
endif

# Build directory
BUILD = _build/build-$(BOARD)
BIN = _bin/$(BOARD)

# Board specific
-include src/boards/$(BOARD)/board.mk

# MCU_SUB_VARIANT can be nrf52 (nrf52832), nrf52833, nrf52840
ifeq ($(MCU_SUB_VARIANT),nrf52)
SD_NAME = s132
Expand Down
6 changes: 3 additions & 3 deletions src/boards/particle_argon/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@
// USB
//--------------------------------------------------------------------+

// Shared VID/PID with pca10056
// Shared VID/PID with Feather nRF52840, will be disabled for building in the future
#define USB_DESC_VID 0x239A
#define USB_DESC_UF2_PID 0x00DA
#define USB_DESC_CDC_ONLY_PID 0x00DA
#define USB_DESC_UF2_PID 0x0029
#define USB_DESC_CDC_ONLY_PID 0x0029

#define UF2_PRODUCT_NAME "Particle Argon"
#define UF2_VOLUME_LABEL "ARGONBOOT "
Expand Down
6 changes: 3 additions & 3 deletions src/boards/particle_boron/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@
// USB
//--------------------------------------------------------------------+

// Shared VID/PID with pca10056
// Shared VID/PID with Feather nRF52840, will be disabled for building in the future
#define USB_DESC_VID 0x239A
#define USB_DESC_UF2_PID 0x00DA
#define USB_DESC_CDC_ONLY_PID 0x00DA
#define USB_DESC_UF2_PID 0x0029
#define USB_DESC_CDC_ONLY_PID 0x0029

#define UF2_PRODUCT_NAME "Particle Boron"
#define UF2_VOLUME_LABEL "BORONBOOT "
Expand Down
6 changes: 3 additions & 3 deletions src/boards/particle_xenon/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@
// USB
//--------------------------------------------------------------------+

// Shared VID/PID with pca10056
// Shared VID/PID with Feather nRF52840, will be disabled for building in the future
#define USB_DESC_VID 0x239A
#define USB_DESC_UF2_PID 0x00DA
#define USB_DESC_CDC_ONLY_PID 0x00DA
#define USB_DESC_UF2_PID 0x0029
#define USB_DESC_CDC_ONLY_PID 0x0029

#define UF2_PRODUCT_NAME "Particle Xenon"
#define UF2_VOLUME_LABEL "XENONBOOT "
Expand Down
4 changes: 2 additions & 2 deletions src/boards/pca10056/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@

// Shared VID/PID with Feather nRF52840, will be disabled for building in the future
#define USB_DESC_VID 0x239A
#define USB_DESC_UF2_PID 0x00DA
#define USB_DESC_CDC_ONLY_PID 0x00DA
#define USB_DESC_UF2_PID 0x0029
#define USB_DESC_CDC_ONLY_PID 0x0029

#define UF2_PRODUCT_NAME "Nordic nRF52840 DK"
#define UF2_BOARD_ID "nRF52840-pca10056-v1"
Expand Down
1 change: 0 additions & 1 deletion src/boards/pca10100/board.cmake

This file was deleted.

7 changes: 3 additions & 4 deletions src/boards/pca10100/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,11 @@
//--------------------------------------------------------------------+
// USB
//--------------------------------------------------------------------+
#define USB_DESC_VID 0x239A
#define USB_DESC_UF2_PID 0x00D8
#define USB_DESC_CDC_ONLY_PID 0x00D8
#define USB_DESC_VID 0x1915
#define USB_DESC_UF2_PID 0x521F
#define USB_DESC_CDC_ONLY_PID 0x521F

#define UF2_PRODUCT_NAME "Nordic nRF52833 DK"
#define UF2_VOLUME_LABEL "NRF833BOOT"
#define UF2_BOARD_ID "nRF52833-pca10100-v1"
#define UF2_INDEX_URL "https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52833-DK"

Expand Down
3 changes: 2 additions & 1 deletion src/boards/pca10100/board.mk
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
MCU_SUB_VARIANT = nrf52833
MCU_SUB_VARIANT = nrf52833
SD_VERSION=7.2.0

0 comments on commit 963ae8d

Please sign in to comment.