Skip to content

Commit 99b6ca9

Browse files
Add a formal board definition for Ardunino Nano 33 BLE (#16)
* Add a formal board definition for Ardunino Nano 33 BLE * Update travis to point to new location * Update travis to point to new location * USe Docker image instead of rebuilding src each time * Updating README
1 parent f481a77 commit 99b6ca9

4 files changed

Lines changed: 118 additions & 35 deletions

File tree

.travis.yml

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,10 @@
11
dist: bionic
2-
language: c
2+
language: generic
33

4-
cache:
5-
directories:
6-
- $HOME/gcc-arm-none-eabi-9-2020-q2-major
7-
- $HOME/nrf_sdk/16.0.0
8-
9-
addons:
10-
apt:
11-
packages:
12-
- dos2unix
13-
- python
14-
- python-pip
4+
services:
5+
- docker
156

167
env:
17-
global:
18-
- GNU_INSTALL_ROOT="$HOME/gcc-arm-none-eabi-9-2020-q2-major/bin/"
19-
- NORDIC_SDK_PATH="$HOME/nrf_sdk/16.0.0"
20-
- PATH="$PATH:$HOME/gcc-arm-none-eabi-9-2020-q2-major/bin:$HOME/mergehex"
21-
228
matrix:
239
- BOARD=sparkfun-pro-mini
2410
- BOARD=sparkfun-pro-mini DEBUG=1
@@ -38,23 +24,17 @@ env:
3824
- BOARD=particle-argon DEBUG=1
3925
- BOARD=feather-express
4026
- BOARD=feather-express DEBUG=1
27+
- BOARD=arduino-nano-33-ble
28+
- BOARD=arduino-nano-33-ble DEBUG=1
4129
- BOARD=generic DEBUG=1
4230

4331
before_install:
44-
- chmod +x $TRAVIS_BUILD_DIR/.travis/before_install.sh
4532
- ln -s default_private.pem private.pem
4633
- ln -s default_dfu_public_key.c dfu_public_key.c
47-
48-
install:
49-
- $TRAVIS_BUILD_DIR/.travis/before_install.sh
50-
# Verify the arm-none-eabi-gcc binary is working correctly
51-
- arm-none-eabi-gcc --version
52-
# Verify mergehex is loaded into PATH
53-
- mergehex --version
54-
- pip install --user nrfutil
34+
- docker pull kaidyth/nrf52_toolchain:latest
5535

5636
script:
57-
- make clean_build
37+
- docker run -v${PWD-.}:/app --env BOARD=$BOARD --env DEBUG=$DEBUG kaidyth/nrf52_toolchain:latest
5838

5939
deploy:
6040
provider: releases
@@ -66,6 +46,6 @@ deploy:
6646
skip_cleanup: true
6747
draft: true
6848
on:
69-
repo: charlesportwoodii/kaidyth_nrf52_bootloader
49+
repo: kaidyth/nrf52_bootloader
7050
tags: true
7151
condition: $DEBUG=0

README.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Kaidyth Bootloader
22

3-
[![Travis Build Status](https://img.shields.io/travis/com/charlesportwoodii/kaidyth_nrf52_bootloader.svg?label=TravisCI&style=flat-square)](https://travis-ci.com/charlesportwoodii/kaidyth_nrf52_bootloader)
3+
[![Travis Build Status](https://img.shields.io/travis/com/kaidyth/nrf52_bootloader.svg?label=TravisCI&style=flat-square)](https://travis-ci.com/kaidyth/nrf52_bootloader)
44

55
A secure bluetooth DFU bootloader for nRF52 with support for the following boards:
66

@@ -12,6 +12,7 @@ A secure bluetooth DFU bootloader for nRF52 with support for the following board
1212
- [Adafruit nRF52840 Feather Express](https://www.adafruit.com/product/4062)
1313
- [Particle Xenon](https://docs.particle.io/xenon/)
1414
- [Pitaya Go](https://wiki.makerdiary.com/pitaya-go/)
15+
- [Arduino Nano 33 BLE](https://store.arduino.cc/usa/nano-33-ble)
1516

1617
## Features
1718

@@ -24,7 +25,7 @@ A secure bluetooth DFU bootloader for nRF52 with support for the following board
2425
### Planned Features
2526

2627
- Application Wipe via 2 Pin Reset
27-
- DFU using UF2
28+
- Arduino BLE* (see below)
2829

2930
## Flashing
3031

@@ -42,18 +43,19 @@ nrfjprog --memwr 0x10001304 --val 0xFFFFFFFD
4243
nrfjprog -f nf52 --reset
4344
```
4445

46+
> Note that the default bootloader is distributed with a public keypair for application signing. This will permit anyone who has access to the key to be able to flash and overwrite any application you have while in OTA DFU mode. If you're using this bootloader in a production setting, it is recommended to build your own binary with your own keypair.
47+
4548
### Unsupported Boards
4649

47-
While this bootloader has a variety of officially supported boards, your specific board, module, or chip may not yet have a formal definition. Published with the pre-built binaries is a generic board in DEBUG mode only that has no LEDS or buttons that you can flash to your solution and the bootloader will just "work".
50+
While this bootloader has a variety of officially supported boards, your specific board, module, or chip may not yet have a formal definition.
4851

49-
Alternatively, you can build the variant yourself by running:
52+
The generic variant can be built by running the following command.
5053

5154
```bash
5255
make BOARD=generic clean_build
5356
```
5457

55-
56-
> Note that the default bootloader is distributed with a public keypair for application signing. This will permit anyone who has access to the key to be able to flash and overwrite any application you have while in OTA DFU mode. If you're using this bootloader in a production setting, it is recommended to build your own binary with your own keypair.
58+
> The generic bootloader is distributed in `DEBUG` mode to aid in debugging and creating a formal definition. You are advised to create a formal production ready board definition for your variant before going into production.
5759
5860
### Building/Development
5961

@@ -64,8 +66,16 @@ docker build . -t kaidyth_dfu/toolchain:latest
6466
docker run -v${PWD-.}:/app --env BOARD=mdk-usb-dongle kaidyth_dfu/toolchain:latest
6567
```
6668

67-
Hex and .zip archives for DFU flashes are outputted to the `_build_<board>` directory after compilation succeeds.z
69+
Hex and .zip archives for DFU flashes are outputted to the `_build_<board>` directory after compilation succeeds.
6870

6971
> Note that patches the nRF52 SDK to to add some unoffocially supported functionality (such as `NRF_DFU_BL_ALLOW_DOWNGRADE` and `NRF_DFU_BL_ACCEPT_SAME_VERSION`). It's recommended to use the docker environment for building unless you plan on switching `NORDIC_SDK_PATH` between projects.
7072
7173
If you're interested in setting up your own development environment without docker, take a look at the [Getting Started](https://github.com/charlesportwoodii/kaidyth_nrf52_bootloader/wiki/Getting-Started) page for more information on the dependencies needed.
74+
75+
### Arduino Support
76+
77+
This bootloader should compatible with Arduino Libraries excluding ones that interface with the Soft Device. Things such as I2C, GPIO, and Neopixels should work using their respective libaries.
78+
79+
### Bluetooth / ArdinoBLE / Adarfruit NRF52 Bluefruit
80+
81+
The Nordic Secure Bootloader, and by proxy this bootloader do not officially support any operation that directly interfaces with the Soft Device, include Arduino BLE and Adafruit Bluefruit. If you want to use bluetooth functionality you are strongly encouraged to use the nRF5 SDK.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
include ../../Makefile.boards
2+
3+
CFLAGS += -DBOARD_CUSTOM
4+
5+
ASMFLAGS += -DBOARD_CUSTOM
6+
7+
ifeq ($(DEBUG), 1)
8+
CFLAGS += -DNRF_LOG_BACKEND_UART_TX_PIN=3
9+
CFLAGS += -DNRF_LOG_BACKEND_UART_RX_PIN=10
10+
ASMFLAGS += -DNRF_LOG_BACKEND_UART_TX_PIN=3
11+
ASMFLAGS += -DNRF_LOG_BACKEND_UART_RX_PIN=10
12+
endif
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
/**
2+
* Copyright (c) 2019-Present Charles R. Portwood II <charlesportwoodii@erianna.com>
3+
* All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without
6+
* modification, are permitted provided that the following conditions are met:
7+
* * Redistributions of source code must retain the above copyright
8+
* notice, this list of conditions and the following disclaimer.
9+
* * Redistributions in binary form must reproduce the above copyright
10+
* notice, this list of conditions and the following disclaimer in the
11+
* documentation and/or other materials provided with the distribution.
12+
* * Neither the name of the <organization> nor the
13+
* names of its contributors may be used to endorse or promote products
14+
* derived from this software without specific prior written permission.
15+
*
16+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19+
* DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
20+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26+
*/
27+
28+
#ifndef CUSTOM_BOARD_H
29+
#define CUSTOM_BOARD_H
30+
31+
#ifdef __cplusplus
32+
extern "C" {
33+
#endif
34+
35+
#include "nrf_gpio.h"
36+
37+
#define LEDS_NUMBER 5
38+
39+
#define LED_1 NRF_GPIO_PIN_MAP(0,24)
40+
#define LED_2 NRF_GPIO_PIN_MAP(0,16)
41+
#define LED_3 NRF_GPIO_PIN_MAP(0,6)
42+
#define LED_4 NRF_GPIO_PIN_MAP(0,13)
43+
#define LED_5 NRF_GPIO_PIN_MAP(1,9)
44+
45+
#define LED_RED LED_1
46+
#define LED_GREEN LED_2
47+
#define LED_BLUE LED_3
48+
49+
#define LED_BUILTIN LED_4
50+
#define LED_PWR LED_5
51+
52+
#define LED_START LED_1
53+
#define LED_STOP LED_3
54+
55+
#define LEDS_ACTIVE_STATE 0
56+
57+
#define LEDS_LIST { LED_1, LED_2, LED_3, LED_4, LED_5 }
58+
59+
#define LEDS_INV_MASK LEDS_MASK
60+
61+
#define BSP_LED_0 LED_1
62+
#define BSP_LED_1 LED_2
63+
#define BSP_LED_2 LED_3
64+
#define BSP_LED_3 LED_4
65+
#define BSP_LED_4 LED_5
66+
67+
#define BUTTONS_NUMBER 0
68+
#define BUTTON_PULL NRF_GPIO_PIN_PULLUP
69+
#define BUTTONS_ACTIVE_STATE 0
70+
71+
#define RX_PIN_NUMBER 10
72+
#define TX_PIN_NUMBER 3
73+
#define CTS_PIN_NUMBER 0xFFFFFFFF //NC
74+
#define RTS_PIN_NUMBER 0xFFFFFFFF //NC
75+
#define HWFC false
76+
77+
#ifdef __cplusplus
78+
}
79+
#endif
80+
81+
#endif // CUSTOM_BOARD_H

0 commit comments

Comments
 (0)