Compare commits

...

53 commits

Author SHA1 Message Date
Ha Thach
6a9a6a3e6d
Merge pull request #359 from JuergenLeber/add-sd-s340-support
feat: add support for SoftDevice S340
2025-06-30 17:54:31 +07:00
hathach
31c3081668
update makefile/cmake for softdevice macro. Remove the _s340 filter in ci 2025-06-30 17:32:49 +07:00
hathach
d475f25154
Merge branch 'master' into fork/JuergenLeber/add-sd-s340-support
# Conflicts:
#	README.md
2025-06-30 16:14:29 +07:00
Ha Thach
4bce0cc1f2
Merge pull request #358 from JuergenLeber/repair-debug-build
fix: repair build with DEBUG=1 option
2025-06-30 14:31:04 +07:00
Ha Thach
b1e088396a
Merge pull request #347 from OmarEMbed/master
Adding Omnimo-nRF52840 board
2025-06-30 14:29:50 +07:00
Ha Thach
df983b53c7
Merge pull request #357 from JuergenLeber/minor-updates-and-fixes
chore: update uf2 submodule and fix a small typo
2025-06-30 11:28:32 +07:00
Ha Thach
0e98348d96
Merge pull request #354 from andreaskurz/askz/fix-cmake-build
fix: CMake build producing too large binaries
2025-06-30 10:50:43 +07:00
hathach
70da7d88f4
set CMAKE_BUILD_TYPE to MinSizeRel if not defined instead of forcing -Os
add CONFIG_GPIO_AS_PINRESET
2025-06-30 10:45:38 +07:00
JuergenLeber
3182f6036d fix: remove -lnosys option for debug linker scripts as it conflicts with RTT printf retarget 2025-06-10 19:10:53 +02:00
JuergenLeber
de9a9b79f4 refactor: deduplicate code for disabling SD 2025-06-10 19:05:21 +02:00
JuergenLeber
b8544f5c8c feat: add SD S340 support for nRF52840 and nRF52833 2025-06-10 19:05:21 +02:00
JuergenLeber
00b5e72496 fix: fix small typo 2025-06-10 18:58:34 +02:00
JuergenLeber
389e5b004d chore: update uf2 submodule to latest 2025-06-10 18:58:34 +02:00
Andreas Kurz
ddcb2dba8c
chore: add documentation for CMake
In this repository CMake and Make co-exists. Unfortunately there was no
documentation on how to properly use CMake so this is a starting point.

Signed-off-by: Andreas Kurz <info@akurz.net>
2025-05-09 10:31:05 +02:00
Andreas Kurz
73020f3567
fix: add size optimization
This flag is also present in the Makefile and optimises the resulting binary for the size of the binary. Without that flag the flash consumption would be too high to fit inside the allocated space.

Signed-off-by: Andreas Kurz <info@akurz.net>
2025-05-09 10:17:09 +02:00
Ha Thach
a48e944f0b
Merge pull request #353 from andreaskurz/askz/fix-array-subscript
fix: array subscript 0 outside array bounds
2025-05-05 17:06:44 +07:00
Andreas Kurz
c83fa9fc2b
fix: array subscript 0 outside array bounds
This will also add version 14.x of the compiler to apply additional CLFAGS.

 #339

Signed-off-by: Andreas Kurz <info@akurz.net>
2025-05-04 20:59:12 +02:00
OmarEMbed
8970125e51
Update board.h 2025-02-16 14:00:12 +01:00
OmarEMbed
22224cef7b
Add files via upload 2025-02-16 11:04:50 +01:00
Ha Thach
4329614a8f
Merge pull request #343 from chibiegg/board_MBN52832DK
Add support Murata MBN52832DK board
2025-02-07 17:04:16 +07:00
Ha Thach
bd12455029
Merge pull request #344 from fanoush/fix-regout0-bootloop
fix reboot loop - set REGOUT0 only when value is erased to default
2025-02-07 17:03:06 +07:00
Ha Thach
3a2708b30a
Merge pull request #342 from pdcook/master
Add support for nRFMicro
2024-12-25 16:14:00 +07:00
fanoush
fb557b2af9
set REGOUT0 only when value is erased to default
this fixes reboot loop when REGOUT0 is explicitly set to different value that cannot be rewritten by clearing bits in flash
2024-11-16 10:28:42 +01:00
chibiegg
7f2b127506 Add support Murata MBN52832DK board 2024-11-05 14:05:57 +09:00
Patrick Cook
5a96435322 commit correct file for nRFMicro 2024-09-11 23:19:40 -04:00
Patrick Cook
f3b3a0de40 reduced number of chars, updated potential PID 2024-09-08 18:31:25 -04:00
Patrick Cook
6940c5b73e rename promicro->nrfmicro 2024-09-08 18:29:19 -04:00
Patrick Cook
4786a4a251 fixed board-id to conform to standards 2024-09-08 17:14:35 -04:00
Patrick Cook
9027359cec add support for promicro/supermini nrf52 boards 2024-09-08 17:11:05 -04:00
Ha Thach
eefbe6bda9
Merge pull request #337 from adafruit/support-itsybitsy-dotstar
support itsybitsy dotstar led
2024-07-19 13:06:13 +07:00
hathach
ab74be4811
correct itsybitsy dotstar 2024-07-19 13:02:31 +07:00
Ha Thach
488711a9b3
Merge pull request #336 from markbirss/master
Add support for Seeed T1000-E boards
2024-07-12 20:22:34 +07:00
Mark Trevor Birss
91fc6735e9
Update board.h 2024-07-12 12:34:49 +02:00
Mark Trevor Birss
6b62aacdc9
Update board.h 2024-07-12 09:20:53 +02:00
Mark Trevor Birss
4f747e416b
Update board.h 2024-07-12 09:02:34 +02:00
Mark Trevor Birss
155dedb048
Add files via upload 2024-07-12 08:55:57 +02:00
Ha Thach
29ca3ebfab
Merge pull request #332 from adafruit/bump-feather833-sd
remove feather 833 specific SD_VERSION
2024-06-05 17:45:15 +07:00
hathach
4e700d4904
bump feather 833 SD to 7.3.0 2024-06-05 17:42:13 +07:00
Ha Thach
8473ff6f35
Merge pull request #331 from adafruit/minor-update
Minor update
2024-06-05 17:38:36 +07:00
hathach
5f99d530ff
revert fetch-depth 0 2024-06-05 17:34:56 +07:00
hathach
c5150ccf02
update PR template 2024-06-05 17:32:51 +07:00
hathach
438a08e0ac
change PID of argon,boron,xenon, pca10056 to 0x00DA (allocated by Adafruit), previously these shared with feather nrf52840
change PID of pca10100 to 0x00D8 (allocated by Adafruit)
2024-06-05 17:30:27 +07:00
hathach
2d68ec56e3
default SD version to 7.3.0 for 833, 6.1.1 for 840 and 832
some cmake rename
2024-06-05 17:29:26 +07:00
Ha Thach
836c8dcc76
Merge pull request #329 from adafruit/ci-auto-matrix
use script to set board matrix
2024-05-09 21:40:35 +07:00
hathach
9e25f4ac0a
use script to set board matrix 2024-05-09 20:40:04 +07:00
Ha Thach
a73fe207a8
Merge pull request #328 from adafruit/feather840-revE
add neopixl power pin for Feather840 revE
2024-05-09 20:25:30 +07:00
hathach
ea3bb737de
fix ci warning 2024-05-09 20:17:33 +07:00
hathach
0bc8a8993f
- add P1.14 as NEOPIXEL_POWER_PIN for feather nrf52840 revE
- remove linkermap from ci
2024-05-09 20:15:16 +07:00
hathach
78b39b4347
bump up gcc to 12.3Rel1 2024-05-09 19:56:52 +07:00
Ha Thach
e7450022a8
Merge pull request #321 from SaidAlvarado/fix-273-for-gcc-13
fix compilation issue 'array subscript 0 is outside array bounds' for arm-none-eabi-gcc version 13
2024-02-05 10:12:06 +07:00
Said Alvarado-Marin
4f8c2afabf fix compilation for arm-none-eabi-gcc version 13 2024-02-04 14:33:02 +01:00
Ha Thach
2e6c877d1b
Merge pull request #320 from adafruit/sense-tft
add & enable DISPLAY_VSENSOR_PIN if available (required for sense tft)
2024-01-29 17:03:31 +07:00
hathach
59df4f9e8c add & enable DISPLAY_VSENSOR_PIN if available (required for sense tft) 2024-01-29 16:41:46 +07:00
39 changed files with 749 additions and 225 deletions

View file

@ -3,10 +3,8 @@
*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.*

View file

@ -9,96 +9,51 @@ on:
- created
jobs:
set-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set matrix
id: set-matrix
working-directory: src/boards
run: |
MATRIX_JSON=$(ls -d */ | sed 's/\/$//' | jq -R -s -c 'split("\n")[:-1]')
echo "matrix=$MATRIX_JSON"
echo "matrix=$MATRIX_JSON" >> $GITHUB_OUTPUT
build:
needs: set-matrix
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
board:
# Adafruit Boards
- 'circuitplayground_nrf52840'
- 'clue_nrf52840'
- 'feather_nrf52832'
- 'feather_nrf52833_express'
- 'feather_nrf52840_express'
- 'feather_nrf52840_sense'
- 'feather_nrf52840_sense_tft'
- 'itsybitsy_nrf52840_express'
- 'metro_nrf52840_express'
- 'ledglasses_nrf52840'
# Other Makers (Alphabetical order)
- 'adm_b_nrf52840_1'
- 'ae_bl652_bo'
- 'aramcon_badge_2019'
- 'aramcon2_badge'
- 'arcade_feather_nrf52840_express'
- 'arduino_nano_33_ble'
- 'bast_ble'
- 'bluemicro_nrf52833'
- 'bluemicro_nrf52840'
- 'challenger_840_ble'
- 'ebyte_e104_bt5032a'
- 'ebyte_e73_tbb'
- 'electronut_labs_papyr'
- 'ikigaisense_vita'
- 'm60_keyboard'
- 'mdk_nrf52840_dongle'
- 'mikoto'
- 'nice_nano'
- 'nrf52840_bboard'
- 'nRF52840_connect_kit'
- 'nrf52840_m2'
- 'ohs2020_badge'
- 'particle_argon'
- 'particle_boron'
- 'particle_xenon'
- 'pca10056'
- 'pca10059'
- 'pca10100'
- 'pitaya_go'
- 'raytac_mdbt50q_db_40'
- 'raytac_mdbt50q_rx'
- 'sparkfun_nrf52840_micromod'
- 'waveshare_nrf52840_eval'
- 'xiao_nrf52840_ble'
- 'xiao_nrf52840_ble_sense'
board: ${{ fromJSON(needs.set-matrix.outputs.matrix) }}
steps:
- name: Setup Python
uses: actions/setup-python@v3
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: Checkout linkermap
uses: actions/checkout@v4
with:
repository: hathach/linkermap
path: linkermap
- name: Install ARM GCC
uses: carlosperate/arm-none-eabi-gcc-action@v1
with:
release: '10-2020-q4'
release: '12.3.Rel1'
- name: Install Tools
run: |
pip3 install adafruit-nrfutil uritemplate requests intelhex setuptools
pip3 install linkermap/
- name: Build
run: |
arm-none-eabi-gcc --version
make BOARD=${{ matrix.board }} all
make BOARD=${{ matrix.board }} copy-artifact
- name: Linker Map
run: make BOARD=${{ matrix.board }} linkermap
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.board }}
path: _bin/${{ matrix.board }}

4
.gitignore vendored
View file

@ -65,3 +65,7 @@ TAGS
.DS_Store
Makefile.user
# Exclude all SoftDevice S340 files
lib/softdevice/s340*

View file

@ -25,15 +25,19 @@ set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_LIST_DIR}/cmake/toolchain/arm_${TOOLCHA
project(Adafruit_nRF52_Bootloader C ASM)
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(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(UF2CONV_PY ${CMAKE_CURRENT_LIST_DIR}/lib/uf2/utils/uf2conv.py)
set(UF2_FAMILY_ID_BOOTLOADER 0xd663823c)
if (NOT DEFINED CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "")
set(CMAKE_BUILD_TYPE MinSizeRel CACHE STRING "Build type" FORCE)
endif ()
#-------------------
# Bootloader
#-------------------
@ -42,10 +46,14 @@ add_executable(bootloader)
# SD_VERSION can be overwritten by board.cmake
if(NOT DEFINED SD_VERSION)
set(SD_VERSION 6.1.1)
if(MCU_VARIANT STREQUAL "nrf52833")
set(SD_VERSION 7.3.0)
else()
set(SD_VERSION 6.1.1)
endif()
endif ()
set(MBR_HEX ${SOFTDEVICE}/mbr/hex/mbr_nrf52_2.4.1_mbr.hex)
set(MBR_HEX ${SOFTDEVICE_DIR}/mbr/hex/mbr_nrf52_2.4.1_mbr.hex)
target_sources(bootloader PUBLIC
# src
@ -57,31 +65,31 @@ target_sources(bootloader PUBLIC
src/images.c
src/boards/boards.c
# nrfx
${NRFX}/drivers/src/nrfx_power.c
${NRFX}/drivers/src/nrfx_nvmc.c
${NRFX}/mdk/system_${MCU_VARIANT}.c
${NRFX_DIR}/drivers/src/nrfx_power.c
${NRFX_DIR}/drivers/src/nrfx_nvmc.c
${NRFX_DIR}/mdk/system_${MCU_VARIANT}.c
# sdk 11
${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
${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
# latest sdk
${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
${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
# ASM
${NRFX}/mdk/gcc_startup_${MCU_VARIANT}.S
${NRFX_DIR}/mdk/gcc_startup_${MCU_VARIANT}.S
)
target_include_directories(bootloader PUBLIC
src
@ -89,31 +97,31 @@ target_include_directories(bootloader PUBLIC
src/boards/${BOARD}
src/cmsis/include
src/usb
${TUSB}
${TINYUSB_DIR}
# nrfx
${NRFX}
${NRFX}/mdk
${NRFX}/hal
${NRFX}/drivers/include
${NRFX}/drivers/src
${NRFX_DIR}
${NRFX_DIR}/mdk
${NRFX_DIR}/hal
${NRFX_DIR}/drivers/include
${NRFX_DIR}/drivers/src
# sdk 11 for cdc/ble dfu
${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
${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
# later sdk with updated drivers
${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
${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
# Softdevice
${SOFTDEVICE}/mbr/headers
${SOFTDEVICE_DIR}/mbr/headers
)
# Debug option
@ -127,7 +135,6 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug")
target_include_directories(bootloader PUBLIC
lib/SEGGER_RTT/RTT
)
target_compile_definitions(bootloader PUBLIC
CFG_DEBUG
SEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL
@ -145,7 +152,7 @@ endif ()
target_link_options(bootloader PUBLIC
"LINKER:--script=${LD_FILE}"
-L${NRFX}/mdk
-L${NRFX_DIR}/mdk
--specs=nosys.specs --specs=nano.specs
)
target_compile_options(bootloader PUBLIC
@ -167,10 +174,11 @@ target_compile_options(bootloader PUBLIC
-Wno-endif-labels
-Wunreachable-code
# Suppress warning caused by SDK
-Wno-unused-parameter -Wno-expansion-to-defined
-Wno-unused-parameter -Wno-expansion-to-defined -Wno-array-bounds
)
target_compile_definitions(bootloader PUBLIC
SOFTDEVICE_PRESENT
CONFIG_GPIO_AS_PINRESET
)
if (TRACE_ETM STREQUAL "1")
@ -181,14 +189,14 @@ endif ()
if (MCU_VARIANT STREQUAL "nrf52")
# UART transport
target_sources(bootloader PUBLIC
${SDK}/libraries/uart/app_uart.c
${SDK}/drivers_nrf/uart/nrf_drv_uart.c
${SDK}/drivers_nrf/common/nrf_drv_common.c
${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
)
target_include_directories(bootloader PUBLIC
${SDK11}/libraries/util
${SDK}/drivers_nrf/common
${SDK}/drivers_nrf/uart
${SDK11_DIR}/libraries/util
${SDK_DIR}/drivers_nrf/common
${SDK_DIR}/drivers_nrf/uart
)
else ()
# USB transport
@ -199,13 +207,13 @@ else ()
src/usb/usb_desc.c
src/usb/uf2/ghostfat.c
# TinyUSB
${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
${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
)
endif ()
@ -217,46 +225,35 @@ if (MCU_VARIANT STREQUAL "nrf52")
set(SD_NAME s132)
set(DFU_DEV_REV 0xADAF)
set(DFU_APP_DATA_RESERVED 7*4096)
target_compile_definitions(bootloader PUBLIC
NRF52
NRF52832_XXAA
S132
)
target_include_directories(bootloader PUBLIC
${SOFTDEVICE}/s132_nrf52_6.1.1/s132_nrf52_6.1.1_API/include
)
target_compile_definitions(bootloader PUBLIC NRF52 NRF52832_XXAA)
elseif (MCU_VARIANT STREQUAL "nrf52833")
set(SD_NAME s140)
set(DFU_DEV_REV 52833)
set(DFU_APP_DATA_RESERVED 7*4096)
target_compile_definitions(bootloader PUBLIC
NRF52833_XXAA
S140
)
target_include_directories(bootloader PUBLIC
${SOFTDEVICE}/s140_nrf52_6.1.1/s140_nrf52_6.1.1_API/include
)
target_compile_definitions(bootloader PUBLIC NRF52833_XXAA)
if (NOT DEFINED SD_NAME)
set(SD_NAME s140)
endif ()
elseif (MCU_VARIANT STREQUAL "nrf52840")
set(SD_NAME s140)
set(DFU_DEV_REV 52840)
# App reserved 40KB (8+32) to match circuitpython for 840
set(DFU_APP_DATA_RESERVED 10*4096)
target_compile_definitions(bootloader PUBLIC
NRF52840_XXAA
S140
)
target_include_directories(bootloader PUBLIC
${SOFTDEVICE}/s140_nrf52_6.1.1/s140_nrf52_6.1.1_API/include
)
target_compile_definitions(bootloader PUBLIC NRF52840_XXAA)
if (NOT DEFINED SD_NAME)
set(SD_NAME s140)
endif ()
else ()
message(FATAL_ERROR "MCU_VARIANT ${MCU_VARIANT} is unknown")
endif ()
string(TOUPPER ${SD_NAME} SD_NAME_UPPER)
target_compile_definitions(bootloader PUBLIC ${SD_NAME_UPPER})
set(SD_FILENAME ${SD_NAME}_nrf52_${SD_VERSION})
set(SD_HEX ${SOFTDEVICE}/${SD_FILENAME}/${SD_FILENAME}_softdevice.hex)
set(SD_HEX ${SOFTDEVICE_DIR}/${SD_FILENAME}/${SD_FILENAME}_softdevice.hex)
target_include_directories(bootloader PUBLIC
${SOFTDEVICE_DIR}/${SD_FILENAME}/${SD_FILENAME}_API/include
)
if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
target_compile_definitions(bootloader PUBLIC DFU_APP_DATA_RESERVED=${DFU_APP_DATA_RESERVED})
@ -337,4 +334,11 @@ add_custom_target(flash-mbr
add_custom_target(flash-erase
COMMAND ${NRFJPROG} -f nrf52 --eraseall
)
)
# flash skip crc magic ( app valid = 0x0001, crc = 0x0000 )
#add_custom_target(flash-skip-crc
# #COMMAND ${NRFJPROG} --memwr $(BOOT_SETTING_ADDR) --val 0x00000001 -f nrf52
# COMMAND ${NRFJPROG} --memwr 0xFF000 --val 0x00000001 -f nrf52
# #COMMAND ${NRFJPROG} --memwr 0x7F000 --val 0x00000001 -f nrf52
# )

View file

@ -10,6 +10,9 @@
# 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
@ -18,7 +21,11 @@ SD_PATH = lib/softdevice/$(SD_FILENAME)
# SD_VERSION can be overwritten by board.mk
ifndef SD_VERSION
SD_VERSION = 6.1.1
ifeq ($(MCU_SUB_VARIANT),nrf52833)
SD_VERSION = 7.3.0
else
SD_VERSION = 6.1.1
endif
endif
SD_FILENAME = $(SD_NAME)_nrf52_$(SD_VERSION)
@ -42,6 +49,8 @@ OUT_NAME = $(BOARD)_bootloader-$(GIT_VERSION)
# merged file = compiled + sd
MERGED_FILE = $(OUT_NAME)_$(SD_NAME)_$(SD_VERSION)
UF2_FAMILY_ID_BOOTLOADER = 0xd663823c
#------------------------------------------------------------------------------
# Tool Configure
#------------------------------------------------------------------------------
@ -89,46 +98,38 @@ 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)
CFLAGS += -DNRF52 -DNRF52832_XXAA
SD_NAME = s132
DFU_DEV_REV = 0xADAF
CFLAGS += -DNRF52 -DNRF52832_XXAA -DS132
DFU_APP_DATA_RESERVED=7*4096
else ifeq ($(MCU_SUB_VARIANT),nrf52833)
SD_NAME = s140
CFLAGS += -DNRF52833_XXAA
DFU_DEV_REV = 52833
CFLAGS += -DNRF52833_XXAA -DS140
DFU_APP_DATA_RESERVED=7*4096
ifndef SD_NAME
SD_NAME = s140
endif
else ifeq ($(MCU_SUB_VARIANT),nrf52840)
SD_NAME = s140
CFLAGS += -DNRF52840_XXAA
DFU_DEV_REV = 52840
CFLAGS += -DNRF52840_XXAA -DS140
# App reserved 40KB (8+32) to match circuitpython for 840
DFU_APP_DATA_RESERVED=10*4096
ifndef SD_NAME
SD_NAME = s140
endif
else
$(error Sub Variant $(MCU_SUB_VARIANT) is unknown)
endif
SD_NAME_UPPER = $(subst s,S,${SD_NAME})
CFLAGS += -D$(SD_NAME_UPPER)
#------------------------------------------------------------------------------
# SOURCE FILES
#------------------------------------------------------------------------------
@ -342,7 +343,8 @@ endif
CFLAGS += -DDFU_APP_DATA_RESERVED=$(DFU_APP_DATA_RESERVED)
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105523
ifneq ($(findstring 12.,$(shell $(CC) --version 2>/dev/null)),)
# Fixes for gcc version 12, 13 and 14.
ifneq (,$(filter 12.% 13.% 14.%,$(shell $(CC) -dumpversion 2>/dev/null)))
CFLAGS += --param=min-pagesize=0
endif
@ -442,7 +444,7 @@ $(BUILD)/$(OUT_NAME)_nosd.hex: $(BUILD)/$(OUT_NAME).hex
# Bootolader self-update uf2
$(BUILD)/update-$(OUT_NAME)_nosd.uf2: $(BUILD)/$(OUT_NAME)_nosd.hex
@echo Create $(notdir $@)
@python3 lib/uf2/utils/uf2conv.py -f 0xd663823c -c -o $@ $^
@python3 lib/uf2/utils/uf2conv.py -f $(UF2_FAMILY_ID_BOOTLOADER) -c -o $@ $^
# merge bootloader and sd hex together
$(BUILD)/$(MERGED_FILE).hex: $(BUILD)/$(OUT_NAME).hex
@ -495,12 +497,17 @@ flash-mbr:
@echo Flashing: $(MBR_HEX)
$(call FLASH_NOUICR_CMD,$(MBR_HEX))
# flash using uf2
flash-uf2: $(BUILD)/update-$(OUT_NAME)_nosd.uf2
@echo Flashing: $(notdir $<)
python lib/uf2/utils/uf2conv.py -f $(UF2_FAMILY_ID_BOOTLOADER) --deploy $<
# dfu with adafruit-nrfutil using CDC interface
dfu-flash: flash-dfu
flash-dfu: $(BUILD)/$(MERGED_FILE).zip
@:$(call check_defined, SERIAL, example: SERIAL=/dev/ttyACM0)
$(NRFUTIL) --verbose dfu serial --package $< -p $(SERIAL) -b 115200 --singlebank --touch 1200
# flash skip crc magic ( app valid = 0x0001, crc = 0x0000 )
#flash-skip-crc:
# nrfjprog --memwr $(BOOT_SETTING_ADDR) --val 0x00000001 -f nrf52

View file

@ -114,14 +114,20 @@ You must have have a J-Link available to "unbrick" your device.
### Build:
Firstly clone this repo with following commands
Firstly clone this repo including its submodules with following command:
```
git clone --recurse-submodules https://github.com/adafruit/Adafruit_nRF52_Bootloader
```
For git versions before `2.13.0` you have to do that manually:
```
git clone https://github.com/adafruit/Adafruit_nRF52_Bootloader
cd Adafruit_nRF52_Bootloader
git submodule update --init
```
#### Build using `make`
Then build it with `make BOARD={board} all`, for example:
```
@ -137,6 +143,37 @@ Supported boards are: feather_nrf52840_express feather_nrf52840_express pca10056
Makefile:90: *** BOARD not defined. Stop
```
#### Build using `cmake`
Firstly initialize your build environment by passing your board to `cmake` via `-DBOARD={board}`:
```bash
mkdir build
cd build
cmake .. -DBOARD=feather_nrf52840_express
```
And then build it with:
```bash
make
```
You can also use the generator of your choice. For example adding the `-GNinja` and then you can invoke `ninja build` instead of `make`.
To list all supported targets, run:
```bash
cmake --build . --target help
```
To build individual targets, you can specify it directly with `make` or using `cmake --build`:
```bash
make bootloader
cmake --build . --target bootloader
```
### Flash
To flash the bootloader (without softdevice/mbr) using JLink:

View file

@ -0,0 +1,18 @@
## Working with SoftDevice S340
The SoftDevice S340 is closed-source, not publicly available and is only distributed by Garmin Canada Inc.
In order to be able to download the required ANT+ capable SoftDevice and place SoftDevice S340 v7.0.1 files here. You need to register an 'ANT+ Adopter' account at [thisisant.com](https://www.thisisant.com/register/). After around one business day you will receive access to the resources there. Then do the following steps:
- Download the SoftDevice S340 v7.0.1 [(here)](https://www.thisisant.com/developer/components/nrf52832#tab_protocol_stacks_tab) and extract its contents
- Under `lib/softdevice` in this repository there is a folder called `s340_nrf52_7.0.1`
- Copy the API folder `ANT_s340_nrf52_7.0.1.API`, the license agreement `License_Agreement_ANT_Softdevice_rev3_3.pdf` and the hex file `ANT_s340_nrf52_7.0.1.hex` from the extracted contents to it.
- Rename the API folder to `s340_nrf52_7.0.1_API`
- Rename the hex file to `s340_nrf52_7.0.1_softdevice.hex`
- Modify `lib/softdevice/s340_nrf52_7.0.1_API/include/nrf_sdm.h` on line 191 and remove the two slashes at the beginning of `//#define...` to use the *evaluation key* for the ANT SoftDevice.
- **VERY IMPORTANT:** You MUST obtain a valid commercial license key BEFORE releasing a product to market that uses the ANT SoftDevice!
To add or modify a board with an ANT+ capable SoftDevice S340 the `SD_VERSION` and `SD_NAME` parameters in the corresponding `board.mk` file have to be set:
```
SD_VERSION = 7.0.1
SD_NAME = s340
```

@ -1 +1 @@
Subproject commit adbb8c7260f938e810eb37f2287f8e1a055ff402
Subproject commit b19ac9ad613e11a062e4d00845e2b80e6b0ad29f

View file

@ -1,7 +1,7 @@
/* Linker script to configure memory regions. */
SEARCH_DIR(.)
GROUP(-lgcc -lc -lnosys)
GROUP(-lgcc -lc)
MEMORY
{

View file

@ -1,7 +1,7 @@
/* Linker script to configure memory regions. */
SEARCH_DIR(.)
GROUP(-lgcc -lc -lnosys)
GROUP(-lgcc -lc)
MEMORY
{

View file

@ -1,7 +1,7 @@
/* Linker script to configure memory regions. */
SEARCH_DIR(.)
GROUP(-lgcc -lc -lnosys)
GROUP(-lgcc -lc)
MEMORY
{

View file

@ -27,14 +27,14 @@
#include "app_scheduler.h"
#include "app_timer.h"
#ifdef LED_APA102
#ifdef LED_APA102_CLK
#include "nrf_spim.h"
#endif
#define SCHED_MAX_EVENT_DATA_SIZE sizeof(app_timer_event_t) /**< Maximum size of scheduler events. */
#define SCHED_QUEUE_SIZE 30 /**< Maximum number of events in the scheduler queue. */
#if defined(LED_NEOPIXEL) || defined(LED_RGB_RED_PIN) || defined(LED_APA102)
#if defined(LED_NEOPIXEL) || defined(LED_RGB_RED_PIN) || defined(LED_APA102_CLK)
void neopixel_init(void);
void neopixel_write(uint8_t* pixels);
void neopixel_teardown(void);
@ -86,7 +86,7 @@ void board_init(void) {
#endif
#endif
#if defined(LED_NEOPIXEL) || defined(LED_RGB_RED_PIN) || defined(LED_APA102)
#if defined(LED_NEOPIXEL) || defined(LED_RGB_RED_PIN) || defined(LED_APA102_CLK)
// use neopixel for use enumeration
#ifdef NEOPIXEL_POWER_PIN
nrf_gpio_cfg_output(NEOPIXEL_POWER_PIN);
@ -111,7 +111,7 @@ void board_init(void) {
// #define UICR_REGOUT0_VALUE UICR_REGOUT0_VOUT_3V3
// in board.h when using that power configuration.
#ifdef UICR_REGOUT0_VALUE
if ((NRF_UICR->REGOUT0 & UICR_REGOUT0_VOUT_Msk) != (UICR_REGOUT0_VALUE << UICR_REGOUT0_VOUT_Pos)){
if ((NRF_UICR->REGOUT0 & UICR_REGOUT0_VOUT_Msk) == (UICR_REGOUT0_VOUT_DEFAULT << UICR_REGOUT0_VOUT_Pos)){
NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos;
while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
NRF_UICR->REGOUT0 = (NRF_UICR->REGOUT0 & ~((uint32_t)UICR_REGOUT0_VOUT_Msk)) |
@ -147,7 +147,7 @@ void board_teardown(void) {
led_pwm_teardown();
#endif
#if defined(LED_NEOPIXEL) || defined(LED_RGB_RED_PIN) || defined(LED_APA102)
#if defined(LED_NEOPIXEL) || defined(LED_RGB_RED_PIN) || defined(LED_APA102_CLK)
neopixel_teardown();
#endif
@ -250,6 +250,11 @@ void board_display_init(void) {
//------------- Display Init -------------//
nrf_gpio_cfg_output(DISPLAY_PIN_DC);
#if defined(DISPLAY_VSENSOR_PIN) && DISPLAY_VSENSOR_PIN >= 0
nrf_gpio_cfg_output(DISPLAY_VSENSOR_PIN);
nrf_gpio_pin_write(DISPLAY_VSENSOR_PIN, DISPLAY_VSENSOR_ON);
#endif
#if defined(DISPLAY_PIN_RST) && DISPLAY_PIN_RST >= 0
nrf_gpio_cfg_output(DISPLAY_PIN_RST);
nrf_gpio_pin_clear(DISPLAY_PIN_RST);
@ -357,7 +362,7 @@ static uint32_t primary_cycle_length;
static uint32_t secondary_cycle_length;
#endif
void led_tick() {
void led_tick(void) {
uint32_t millis = _systick_count;
uint32_t cycle = millis % primary_cycle_length;
@ -447,7 +452,7 @@ void led_state(uint32_t state) {
final_color = (uint8_t*) &rgb_color;
}
#if defined(LED_NEOPIXEL) || defined(LED_RGB_RED_PIN) || defined(LED_APA102)
#if defined(LED_NEOPIXEL) || defined(LED_RGB_RED_PIN) || defined(LED_APA102_CLK)
if (final_color != NULL) {
neopixel_write(final_color);
}
@ -555,7 +560,7 @@ void neopixel_write(uint8_t* pixels) {
#endif
#ifdef LED_APA102
#ifdef LED_APA102_CLK
#define BYTE_PER_PIXEL 4
// 4 zero bytes are required to initiate update
@ -771,4 +776,4 @@ static void tft_controller_init(void) {
}
}
#endif
#endif

View file

@ -1,2 +1 @@
MCU_SUB_VARIANT = nrf52833
SD_VERSION = 7.3.0

View file

@ -36,6 +36,7 @@
#define LED_STATE_ON 1
#define LED_NEOPIXEL _PINNUM(0, 16)
#define NEOPIXEL_POWER_PIN _PINNUM(1, 14)
#define NEOPIXELS_NUMBER 1
#define BOARD_RGB_BRIGHTNESS 0x040404
@ -63,7 +64,7 @@
//------------- UF2 -------------//
#define UF2_PRODUCT_NAME "Adafruit Feather nRF52840 Express"
#define UF2_VOLUME_LABEL "FTHR840BOOT"
#define UF2_BOARD_ID "nRF52840-Feather-revD"
#define UF2_BOARD_ID "nRF52840-Feather-revE"
#define UF2_INDEX_URL "https://www.adafruit.com/product/4062"
#endif // _FEATHER_NRF52840_H

View file

@ -50,6 +50,11 @@
//--------------------------------------------------------------------+
// Display
//--------------------------------------------------------------------+
// VSensor required to power the display
#define DISPLAY_VSENSOR_PIN _PINNUM(1, 7)
#define DISPLAY_VSENSOR_ON 1
#define DISPLAY_CONTROLLER_ST7789
#define DISPLAY_PIN_SCK _PINNUM(0, 26)

View file

@ -0,0 +1 @@
set(MCU_VARIANT nrf52840)

View file

@ -34,9 +34,14 @@
#define LED_PRIMARY_PIN _PINNUM(0, 6)
#define LED_STATE_ON 1
#define LED_NEOPIXEL _PINNUM(0, 8)
#define NEOPIXELS_NUMBER 1
#define BOARD_RGB_BRIGHTNESS 0x040404
#define LED_APA102_CLK _PINNUM(1, 9)
#define LED_APA102_DATA _PINNUM(0, 8)
#define LED_APA102_BRIGHTNESS 0x1
#define APA102_NUMBER 1
// For dotstart set to max for colour information is not masked off
#define BOARD_RGB_BRIGHTNESS 0xffffffff
/*------------------------------------------------------------------*/
/* BUTTON

View file

@ -0,0 +1,63 @@
/*
* 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 _MBN52832DK_H
#define _MBN52832DK_H
/*------------------------------------------------------------------*/
/* LED
*------------------------------------------------------------------*/
#define LEDS_NUMBER 2
#define LED_PRIMARY_PIN 17 // LED1
#define LED_SECONDARY_PIN 18 // LED2
#define LED_STATE_ON 1
/*------------------------------------------------------------------*/
/* BUTTON
*------------------------------------------------------------------*/
#define BUTTONS_NUMBER 2
#define BUTTON_1 13
#define BUTTON_2 14
#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 "Murata"
#define BLEDIS_MODEL "MBN52832DK"
#define UF2_BOARD_ID "nRF52832-MBN52832DK-v1"
#define UF2_PRODUCT_NAME "Murata MBN52832DK"
#define UF2_INDEX_URL "https://www.murata.com/ja-jp/products/connectivitymodule/bluetooth/overview/lineup/mbn52832"
#endif // _MBN52832DK_H

View file

@ -0,0 +1,2 @@
# nrf52 is nrf52832
MCU_SUB_VARIANT = nrf52

View file

@ -0,0 +1,66 @@
/*
* 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 _NRFMICRO_NRF52840
#define _NRFMICRO_NRF52840
#define _PINNUM(port, pin) ((port)*32 + (pin))
/*------------------------------------------------------------------*/
/* LED
*------------------------------------------------------------------*/
#define LEDS_NUMBER 1
#define LED_PRIMARY_PIN _PINNUM(1, 10)
#define LED_STATE_ON 1 // State when LED is lit (active HIGH)
#define NEOPIXELS_NUMBER 0
/*------------------------------------------------------------------*/
/* BUTTON
*------------------------------------------------------------------*/
#define BUTTONS_NUMBER 2
#define BUTTON_1 _PINNUM(1, 2) // DFU
#define BUTTON_2 _PINNUM(0, 12) // FRST
#define BUTTON_PULL NRF_GPIO_PIN_PULLUP
//--------------------------------------------------------------------+
// BLE OTA
//--------------------------------------------------------------------+
#define BLEDIS_MANUFACTURER "nRFMicro"
#define BLEDIS_MODEL "nRFMicro nRF52840"
//--------------------------------------------------------------------+
// USB
//--------------------------------------------------------------------+
#define USB_DESC_VID 0x1209
#define USB_DESC_UF2_PID 0x5284
#define USB_DESC_CDC_ONLY_PID 0x5284
//------------- UF2 -------------//
#define UF2_PRODUCT_NAME "nRFMicro"
#define UF2_VOLUME_LABEL "NRFMICRO"
#define UF2_BOARD_ID "nRF52840-nRFMicro-v0"
#define UF2_INDEX_URL "https://github.com/joric/nrfmicro/wiki"
#endif // _NRFMICRO_NRF52840

View file

@ -0,0 +1,2 @@
MCU_SUB_VARIANT = nrf52840
SD_VERSION = 7.3.0

View file

@ -0,0 +1,19 @@
#include "boards.h"
#include "uf2/configkeys.h"
__attribute__((used, section(".bootloaderConfig")))
const uint32_t bootloaderConfig[] =
{
/* CF2 START */
CFG_MAGIC0, CFG_MAGIC1, // magic
5, 100, // used entries, total entries
204, 0x100000, // FLASH_BYTES = 0x100000
205, 0x40000, // RAM_BYTES = 0x40000
208, (USB_DESC_VID << 16) | USB_DESC_UF2_PID, // BOOTLOADER_BOARD_ID = USB VID+PID, used for verification when updating bootloader via uf2
209, 0xada52840, // UF2_FAMILY = 0xada52840
210, 0x20, // PINS_PORT_SIZE = PA_32
0, 0, 0, 0, 0, 0, 0, 0
/* CF2 END */
};

View file

@ -0,0 +1 @@
set(MCU_VARIANT nrf52840)

View file

@ -0,0 +1,72 @@
/*
* 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 _OMNIMO_NRF52840_H
#define _OMNIMO_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(1, 07)
#define BUTTON_PULL NRF_GPIO_PIN_PULLUP
//--------------------------------------------------------------------+
// BLE OTA
//--------------------------------------------------------------------+
#define BLEDIS_MANUFACTURER "eAFAQ"
#define BLEDIS_MODEL "OMNIMO nRF52840"
//--------------------------------------------------------------------+
// USB
//--------------------------------------------------------------------+
//Shared VID/PID with pca10056
#define USB_DESC_VID 0x1209
#define USB_DESC_UF2_PID 0xCECE
#define USB_DESC_CDC_ONLY_PID 0xCECE
//------------- UF2 -------------//
#define UF2_PRODUCT_NAME "Omnimo nRF52840"
#define UF2_VOLUME_LABEL "OMNIn52BOOT"
#define UF2_BOARD_ID "nRF52840-Omnimo"
#define UF2_INDEX_URL "https://www.crowdsupply.com/eafaq/omnimo-nrf52840"
#endif // _OMNIMO_NRF52840_H

View file

@ -0,0 +1 @@
MCU_SUB_VARIANT = nrf52840

View file

@ -0,0 +1,19 @@
#include "boards.h"
#include "uf2/configkeys.h"
__attribute__((used, section(".bootloaderConfig")))
const uint32_t bootloaderConfig[] =
{
/* CF2 START */
CFG_MAGIC0, CFG_MAGIC1, // magic
5, 100, // used entries, total entries
204, 0x100000, // FLASH_BYTES = 0x100000
205, 0x40000, // RAM_BYTES = 0x40000
208, (USB_DESC_VID << 16) | USB_DESC_UF2_PID, // BOOTLOADER_BOARD_ID = USB VID+PID, used for verification when updating bootloader via uf2
209, 0xada52840, // UF2_FAMILY = 0xada52840
210, 0x20, // PINS_PORT_SIZE = PA_32
0, 0, 0, 0, 0, 0, 0, 0
/* CF2 END */
};

View file

@ -57,10 +57,10 @@
// USB
//--------------------------------------------------------------------+
// Shared VID/PID with Feather nRF52840, will be disabled for building in the future
// Shared VID/PID with pca10056
#define USB_DESC_VID 0x239A
#define USB_DESC_UF2_PID 0x0029
#define USB_DESC_CDC_ONLY_PID 0x0029
#define USB_DESC_UF2_PID 0x00DA
#define USB_DESC_CDC_ONLY_PID 0x00DA
#define UF2_PRODUCT_NAME "Particle Argon"
#define UF2_VOLUME_LABEL "ARGONBOOT "

View file

@ -57,10 +57,10 @@
// USB
//--------------------------------------------------------------------+
// Shared VID/PID with Feather nRF52840, will be disabled for building in the future
// Shared VID/PID with pca10056
#define USB_DESC_VID 0x239A
#define USB_DESC_UF2_PID 0x0029
#define USB_DESC_CDC_ONLY_PID 0x0029
#define USB_DESC_UF2_PID 0x00DA
#define USB_DESC_CDC_ONLY_PID 0x00DA
#define UF2_PRODUCT_NAME "Particle Boron"
#define UF2_VOLUME_LABEL "BORONBOOT "

View file

@ -57,10 +57,10 @@
// USB
//--------------------------------------------------------------------+
// Shared VID/PID with Feather nRF52840, will be disabled for building in the future
// Shared VID/PID with pca10056
#define USB_DESC_VID 0x239A
#define USB_DESC_UF2_PID 0x0029
#define USB_DESC_CDC_ONLY_PID 0x0029
#define USB_DESC_UF2_PID 0x00DA
#define USB_DESC_CDC_ONLY_PID 0x00DA
#define UF2_PRODUCT_NAME "Particle Xenon"
#define UF2_VOLUME_LABEL "XENONBOOT "

View file

@ -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 0x0029
#define USB_DESC_CDC_ONLY_PID 0x0029
#define USB_DESC_UF2_PID 0x00DA
#define USB_DESC_CDC_ONLY_PID 0x00DA
#define UF2_PRODUCT_NAME "Nordic nRF52840 DK"
#define UF2_BOARD_ID "nRF52840-pca10056-v1"

View file

@ -0,0 +1 @@
set(MCU_VARIANT nrf52833)

View file

@ -50,11 +50,12 @@
//--------------------------------------------------------------------+
// USB
//--------------------------------------------------------------------+
#define USB_DESC_VID 0x1915
#define USB_DESC_UF2_PID 0x521F
#define USB_DESC_CDC_ONLY_PID 0x521F
#define USB_DESC_VID 0x239A
#define USB_DESC_UF2_PID 0x00D8
#define USB_DESC_CDC_ONLY_PID 0x00D8
#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"

View file

@ -1,2 +1 @@
MCU_SUB_VARIANT = nrf52833
SD_VERSION=7.2.0
MCU_SUB_VARIANT = nrf52833

View file

@ -0,0 +1,67 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2020 Yihui Xiong for Makerdiary
*
* 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 _T1000_E_H
#define _T1000_E_H
#define _PINNUM(port, pin) ((port)*32 + (pin))
/*------------------------------------------------------------------*/
/* LED
*------------------------------------------------------------------*/
#define LEDS_NUMBER 1
#define LED_PRIMARY_PIN _PINNUM(0, 24) // Green
#define LED_STATE_ON 0
/*------------------------------------------------------------------*/
/* BUTTON
*------------------------------------------------------------------*/
#define BUTTONS_NUMBER 2
#define BUTTON_1 _PINNUM(0, 6) // Primary Button
#define BUTTON_2 _PINNUM(0, 18) // unusable: RESET
#define BUTTON_PULL NRF_GPIO_PIN_PULLUP
//--------------------------------------------------------------------+
// BLE OTA
//--------------------------------------------------------------------+
#define BLEDIS_MANUFACTURER "Seeed Studio"
#define BLEDIS_MODEL "T1000-E"
//--------------------------------------------------------------------+
// USB
//--------------------------------------------------------------------+
#define USB_DESC_VID 0x2886
#define USB_DESC_UF2_PID 0x0057
#define USB_DESC_CDC_ONLY_PID 0x0057
//--------------------------------------------------------------------+
// UF2
//--------------------------------------------------------------------+
#define UF2_PRODUCT_NAME "Seeed T1000-E for Meshtastic"
#define UF2_VOLUME_LABEL "T1000-E"
#define UF2_BOARD_ID "nRF52840-T1000-E-v1"
#define UF2_INDEX_URL "https://www.seeedstudio.com/SenseCAP-Card-Tracker-T1000-E-for-Meshtastic-p-5913.html"
#endif /* _T1000_E_H */

View file

@ -0,0 +1,3 @@
MCU_SUB_VARIANT = nrf52840
SD_VERSION = 7.3.0

View file

@ -0,0 +1,19 @@
#include "boards.h"
#include "uf2/configkeys.h"
__attribute__((used, section(".bootloaderConfig")))
const uint32_t bootloaderConfig[] =
{
/* CF2 START */
CFG_MAGIC0, CFG_MAGIC1, // magic
5, 100, // used entries, total entries
204, 0x100000, // FLASH_BYTES = 0x100000
205, 0x40000, // RAM_BYTES = 0x40000
208, (USB_DESC_VID << 16) | USB_DESC_UF2_PID, // BOOTLOADER_BOARD_ID = USB VID+PID, used for verification when updating bootloader via uf2
209, 0xada52840, // UF2_FAMILY = 0xada52840
210, 0x20, // PINS_PORT_SIZE = PA_32
0, 0, 0, 0, 0, 0, 0, 0
/* CF2 END */
};

View file

@ -157,6 +157,15 @@ static void mbr_init_sd(void) {
sd_mbr_command(&com);
}
// Disable the SoftDevice if it is enabled.
static void disable_softdevice(void) {
uint8_t sd_enabled = 0;
sd_softdevice_is_enabled(&sd_enabled);
if (sd_enabled == 1) {
sd_softdevice_disable();
}
}
//--------------------------------------------------------------------+
//
//--------------------------------------------------------------------+
@ -206,13 +215,14 @@ int main(void) {
if (!_sd_inited) mbr_init_sd();
// Make sure SD is disabled
sd_softdevice_disable();
disable_softdevice();
}
// clear in case we kept DFU_DBL_RESET_APP there
(*dbl_reset_mem) = 0;
// start application
PRINTF("Starting app...\r\n");
bootloader_app_start();
}
@ -306,14 +316,14 @@ static void check_dfu_mode(void) {
}
if (_ota_dfu) {
sd_softdevice_disable();
disable_softdevice();
} else {
usb_teardown();
}
}
}
// Initializes the SotdDevice by following SD specs section
// Initializes the SoftDevice by following SD specs section
// "Master Boot Record and SoftDevice initializaton procedure"
static uint32_t ble_stack_init(void) {
// Forward vector table to bootloader address so that we can handle BLE events
@ -326,7 +336,11 @@ static uint32_t ble_stack_init(void) {
.rc_temp_ctiv = 2,
.accuracy = NRF_CLOCK_LF_ACCURACY_250_PPM
};
sd_softdevice_enable(&clock_cfg, app_error_fault_handler);
#ifdef ANT_LICENSE_KEY
sd_softdevice_enable(&clock_cfg, app_error_fault_handler, ANT_LICENSE_KEY);
#else
sd_softdevice_enable(&clock_cfg, app_error_fault_handler);
#endif
sd_nvic_EnableIRQ(SD_EVT_IRQn);
/*------------- Configure BLE params -------------*/

View file

@ -10,6 +10,7 @@
#define NRFX_PRS_ENABLED 0
// PWM
#define NRFX_PWM_ENABLED 0
#define NRFX_PWM0_ENABLED 0
#define NRFX_PWM1_ENABLED 0

135
src/nrfx_log.h Normal file
View file

@ -0,0 +1,135 @@
/*
* Copyright (c) 2017 - 2019, Nordic Semiconductor ASA
* 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 holder 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 AND CONTRIBUTORS "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 OR CONTRIBUTORS 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 NRFX_LOG_H__
#define NRFX_LOG_H__
// THIS IS A TEMPLATE FILE.
// It should be copied to a suitable location within the host environment into
// which nrfx is integrated, and the following macros should be provided with
// appropriate implementations.
// And this comment should be removed from the customized file.
#ifdef __cplusplus
extern "C" {
#endif
/**
* @defgroup nrfx_log nrfx_log.h
* @{
* @ingroup nrfx
*
* @brief This file contains macros that should be implemented according to
* the needs of the host environment into which @em nrfx is integrated.
*/
/**
* @brief Macro for logging a message with the severity level ERROR.
*
* @param format printf-style format string, optionally followed by arguments
* to be formatted and inserted in the resulting string.
*/
#define NRFX_LOG_ERROR(format, ...)
/**
* @brief Macro for logging a message with the severity level WARNING.
*
* @param format printf-style format string, optionally followed by arguments
* to be formatted and inserted in the resulting string.
*/
#define NRFX_LOG_WARNING(format, ...)
/**
* @brief Macro for logging a message with the severity level INFO.
*
* @param format printf-style format string, optionally followed by arguments
* to be formatted and inserted in the resulting string.
*/
#define NRFX_LOG_INFO(format, ...)
/**
* @brief Macro for logging a message with the severity level DEBUG.
*
* @param format printf-style format string, optionally followed by arguments
* to be formatted and inserted in the resulting string.
*/
#define NRFX_LOG_DEBUG(format, ...)
/**
* @brief Macro for logging a memory dump with the severity level ERROR.
*
* @param[in] p_memory Pointer to the memory region to be dumped.
* @param[in] length Length of the memory region in bytes.
*/
#define NRFX_LOG_HEXDUMP_ERROR(p_memory, length)
/**
* @brief Macro for logging a memory dump with the severity level WARNING.
*
* @param[in] p_memory Pointer to the memory region to be dumped.
* @param[in] length Length of the memory region in bytes.
*/
#define NRFX_LOG_HEXDUMP_WARNING(p_memory, length)
/**
* @brief Macro for logging a memory dump with the severity level INFO.
*
* @param[in] p_memory Pointer to the memory region to be dumped.
* @param[in] length Length of the memory region in bytes.
*/
#define NRFX_LOG_HEXDUMP_INFO(p_memory, length)
/**
* @brief Macro for logging a memory dump with the severity level DEBUG.
*
* @param[in] p_memory Pointer to the memory region to be dumped.
* @param[in] length Length of the memory region in bytes.
*/
#define NRFX_LOG_HEXDUMP_DEBUG(p_memory, length)
/**
* @brief Macro for getting the textual representation of a given error code.
*
* @param[in] error_code Error code.
*
* @return String containing the textual representation of the error code.
*/
#define NRFX_LOG_ERROR_STRING_GET(error_code)
/** @} */
#ifdef __cplusplus
}
#endif
#endif // NRFX_LOG_H__