Add build script and hook it into Travis
This commit is contained in:
parent
2ece2daf90
commit
1b35dbf643
1
.gitignore
vendored
1
.gitignore
vendored
@ -53,3 +53,4 @@ dkms.conf
|
|||||||
|
|
||||||
src/segger/Output
|
src/segger/Output
|
||||||
_build-*/
|
_build-*/
|
||||||
|
bin/
|
||||||
|
28
.travis.yml
Normal file
28
.travis.yml
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
sudo: required
|
||||||
|
dist: xenial
|
||||||
|
language: c
|
||||||
|
compiler:
|
||||||
|
- gcc
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
provider: releases
|
||||||
|
api_key:
|
||||||
|
secure: "HGfSIgVPX8O+Wfs3E1l/qI8tJZ6wwEgFg3EO6E1+6eGZolr+LW+ANpMUTqcKy18VzbnSx+AH5Ktu8bw4XuPQRPaAvEIMDEZSbj//WE/nqo+p+SccxUy+mKK6x/gb4aiWUw8gYebeLNvWkU+JVupRqMkUdFOJJRZiIvp1usX+jNU8vTt07INNi90LZ8I/KvDEkvHJ/2nOBKW519rlp5XM0a5j8Bv+9gt5wgfl/hFW42JA4Gmj/nacZtro/3pYJWAZ4ZNLOsupMDPZGFX/Ndb+TqseBAkCLl2bvBZ5gFg4NvtaSRFZW532EXDmdCthUBLUGjw7V3VWq8shgHSi6Iq/5lL9t2jawkJPfp5JdiTPTLkUIZ8BfwwrbHp2qiTOGQHbN8kkfjtcQopjVdaPvavr4oaUN+ju6JNsTNc47FIcKivMi1TV6IUT4byjIWZ7ioV0X7KEdoD5WspjIYVhi1vwOBOLT0CEDMtPwIisZ3QuQGJ5clDMJ82ZU9LBfffzvBkeQNmMCM5L412FN7LP2lVNL5eafuJvFZS9Bpbp9uUhzHsDbbpLnz8TFa5rIMzKQXf1KbLnKZ7LHsieB2NleUE6OUxltNm1PwmWWxZKEZeRYxZSMgzbAOrl/Jl2F7zCU7RWCFRnvC73vVJAXaFJ3/DYBF21ew8NyOgMrRLOeH0s5rg="
|
||||||
|
file:
|
||||||
|
- $(ls -d1 bin/*/* | tr "\n" ":")
|
||||||
|
skip_cleanup: true
|
||||||
|
draft: true
|
||||||
|
on:
|
||||||
|
tags: true
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
- (wget https://s3.amazonaws.com/adafruit-circuit-python/gcc-arm-embedded_7-2018q2-1~xenial1_amd64.deb && sudo dpkg -i gcc-arm-embedded*_amd64.deb)
|
||||||
|
- pip3 install --user adafruit-nrfutil
|
||||||
|
|
||||||
|
# report some good version numbers to the build
|
||||||
|
- gcc --version
|
||||||
|
- arm-none-eabi-gcc --version
|
||||||
|
- python3 --version
|
||||||
|
|
||||||
|
script:
|
||||||
|
- python3 tools/build_all.py
|
7
Makefile
7
Makefile
@ -31,7 +31,6 @@ SD_API_PATH = $(SD_PATH)/$(SD_FILENAME)_API
|
|||||||
SD_HEX = $(SD_PATH)/$(SD_FILENAME)_softdevice.hex
|
SD_HEX = $(SD_PATH)/$(SD_FILENAME)_softdevice.hex
|
||||||
|
|
||||||
LD_FILE = $(SRC_PATH)/linker/$(SD_NAME)_v$(SD_VER1).ld
|
LD_FILE = $(SRC_PATH)/linker/$(SD_NAME)_v$(SD_VER1).ld
|
||||||
OUTPUT_FILENAME = $(BOARD)_bootloader
|
|
||||||
|
|
||||||
MERGED_FNAME = $(OUTPUT_FILENAME)_$(SD_NAME)_$(SD_VERSION_FULL)
|
MERGED_FNAME = $(OUTPUT_FILENAME)_$(SD_NAME)_$(SD_VERSION_FULL)
|
||||||
RELEASE_DIR = bin/$(BOARD)/$(SD_VERSION_FULL)
|
RELEASE_DIR = bin/$(BOARD)/$(SD_VERSION_FULL)
|
||||||
@ -39,6 +38,10 @@ RELEASE_DIR = bin/$(BOARD)/$(SD_VERSION_FULL)
|
|||||||
|
|
||||||
MK_DIS_FIRMWARE = "$(SD_NAME) $(SD_VERSION) r$(SD_VER4)"
|
MK_DIS_FIRMWARE = "$(SD_NAME) $(SD_VERSION) r$(SD_VER4)"
|
||||||
|
|
||||||
|
GIT_VERSION = $(shell git describe --dirty --always --tags)
|
||||||
|
GIT_SUBMODULE_VERSIONS = $(shell git submodule status | cut -d' ' -f3,4 | paste -s -d" " -)
|
||||||
|
|
||||||
|
OUTPUT_FILENAME = $(BOARD)_bootloader-$(GIT_VERSION)
|
||||||
#******************************************************************************
|
#******************************************************************************
|
||||||
# Tool configure
|
# Tool configure
|
||||||
#******************************************************************************
|
#******************************************************************************
|
||||||
@ -265,6 +268,8 @@ CFLAGS += -DFLOAT_ABI_HARD
|
|||||||
CFLAGS += -DMK_DIS_FIRMWARE='$(MK_DIS_FIRMWARE)'
|
CFLAGS += -DMK_DIS_FIRMWARE='$(MK_DIS_FIRMWARE)'
|
||||||
CFLAGS += -DDFU_APP_DATA_RESERVED=7*4096
|
CFLAGS += -DDFU_APP_DATA_RESERVED=7*4096
|
||||||
|
|
||||||
|
CFLAGS += -DUF2_VERSION='"$(GIT_VERSION) $(GIT_SUBMODULE_VERSIONS) $(SD_NAME) $(SD_VERSION) r$(SD_VER4)"'
|
||||||
|
|
||||||
CFLAGS += -DBOARD_$(shell echo $(BOARD) | tr '[:lower:]' '[:upper:]')
|
CFLAGS += -DBOARD_$(shell echo $(BOARD) | tr '[:lower:]' '[:upper:]')
|
||||||
|
|
||||||
ifneq ($(IS_NRF52840),)
|
ifneq ($(IS_NRF52840),)
|
||||||
|
24
README.md
24
README.md
@ -1,11 +1,14 @@
|
|||||||
# Adafruit Bluefruit nRF52 Bootloader
|
# Adafruit Bluefruit nRF52 Bootloader
|
||||||
|
|
||||||
This is a CDC/DFU/UF2 bootloader for Adafruit nRF52 boards and Nordic development boards.
|
This is a CDC/DFU/UF2 bootloader for nRF52 boards.
|
||||||
|
|
||||||
- [Adafruit Feather nRF52832](https://www.adafruit.com/product/3406)
|
- [Adafruit Feather nRF52832](https://www.adafruit.com/product/3406)
|
||||||
- Adafruit Feather nRF52840 Express
|
- Adafruit Feather nRF52840 Express
|
||||||
- Nordic nRF52840DK PCA10056
|
- Nordic nRF52840DK PCA10056
|
||||||
- Nordic nRF52840DK PCA10059 ("Dongle")
|
- Nordic nRF52840DK PCA10059 ("Dongle")
|
||||||
|
- Particle Argon
|
||||||
|
- Particle Boron
|
||||||
|
- Particle Xenon
|
||||||
|
|
||||||
UF2 is an easy-to-use bootloader that appears as a flash drive. You can just copy `.uf2`-format
|
UF2 is an easy-to-use bootloader that appears as a flash drive. You can just copy `.uf2`-format
|
||||||
application images to the flash drive to load new firmware.
|
application images to the flash drive to load new firmware.
|
||||||
@ -84,24 +87,7 @@ To upgrade with dfu serial
|
|||||||
make BOARD=feather_nrf52840_express VERSION=6.1.1r0 dfu-flash
|
make BOARD=feather_nrf52840_express VERSION=6.1.1r0 dfu-flash
|
||||||
```
|
```
|
||||||
|
|
||||||
Pre-builtin binaries are in the `bin` directory:
|
Pre-builtin binaries are available on GitHub releases.
|
||||||
|
|
||||||
```
|
|
||||||
bin/feather_nrf52832/
|
|
||||||
2.0.1
|
|
||||||
5.0.0
|
|
||||||
6.1.0r0
|
|
||||||
|
|
||||||
bin/feather_nrf52840_express
|
|
||||||
6.1.0r0
|
|
||||||
|
|
||||||
bin/pca10056:
|
|
||||||
6.1.0r0
|
|
||||||
|
|
||||||
bin/pca10059:
|
|
||||||
6.1.0r0
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
Note: The bootloader can be downgraded. Since the binary release is a merged version of
|
Note: The bootloader can be downgraded. Since the binary release is a merged version of
|
||||||
of both bootloader and the Nordic SoftDevice, you can freely upgrade/downgrade to any version you like.
|
of both bootloader and the Nordic SoftDevice, you can freely upgrade/downgrade to any version you like.
|
||||||
|
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
28
src/boards.c
28
src/boards.c
@ -45,12 +45,11 @@
|
|||||||
#define SCHED_MAX_EVENT_DATA_SIZE sizeof(app_timer_event_t) /**< Maximum size of scheduler events. */
|
#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. */
|
#define SCHED_QUEUE_SIZE 30 /**< Maximum number of events in the scheduler queue. */
|
||||||
|
|
||||||
//------------- IMPLEMENTATION -------------//
|
#if defined(LED_NEOPIXEL) || defined(LED_RGB_RED_PIN)
|
||||||
#ifdef OUTPUT_500HZ_PIN
|
void neopixel_write(uint8_t *pixels);
|
||||||
void init_clock_pwm(uint32_t pin);
|
|
||||||
void clock_pwm_teardown(void);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//------------- IMPLEMENTATION -------------//
|
||||||
void board_init(void)
|
void board_init(void)
|
||||||
{
|
{
|
||||||
// stop LF clock just in case we jump from application without reset
|
// stop LF clock just in case we jump from application without reset
|
||||||
@ -240,16 +239,25 @@ void led_state(uint32_t state)
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
uint8_t* final_color = NULL;
|
||||||
new_rgb_color &= BOARD_RGB_BRIGHTNESS;
|
new_rgb_color &= BOARD_RGB_BRIGHTNESS;
|
||||||
if (temp_color != 0){
|
if (temp_color != 0){
|
||||||
neopixel_write((uint8_t*)&temp_color);
|
temp_color &= BOARD_RGB_BRIGHTNESS;
|
||||||
|
final_color = (uint8_t*)&temp_color;
|
||||||
temp_color_active = true;
|
temp_color_active = true;
|
||||||
} else if (new_rgb_color != rgb_color) {
|
} else if (new_rgb_color != rgb_color) {
|
||||||
neopixel_write((uint8_t*)&new_rgb_color);
|
final_color = (uint8_t*)&new_rgb_color;
|
||||||
rgb_color = new_rgb_color;
|
rgb_color = new_rgb_color;
|
||||||
} else if (temp_color_active) {
|
} else if (temp_color_active) {
|
||||||
neopixel_write((uint8_t*)&rgb_color);
|
final_color = (uint8_t*)&rgb_color;
|
||||||
}
|
}
|
||||||
|
#if LED_NEOPIXEL || defined(LED_RGB_RED)
|
||||||
|
if (final_color != NULL) {
|
||||||
|
neopixel_write(final_color);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
(void) final_color;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LED_NEOPIXEL
|
#if LED_NEOPIXEL
|
||||||
@ -377,9 +385,3 @@ void neopixel_write (uint8_t *pixels)
|
|||||||
led_pwm_duty_cycle(LED_RGB_BLUE, pixels[0]);
|
led_pwm_duty_cycle(LED_RGB_BLUE, pixels[0]);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !LED_NEOPIXEL && !defined(LED_RGB_RED)
|
|
||||||
void neopixel_write(uint8_t* pixels) {
|
|
||||||
(void) pixels;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
// The secondary LED, when available, is usually blue.
|
// The secondary LED, when available, is usually blue.
|
||||||
#define LED_SECONDARY 1
|
#define LED_SECONDARY 1
|
||||||
|
|
||||||
// The internal
|
// Internal status colors are masked by this brightness setting.
|
||||||
#ifndef BOARD_RGB_BRIGHTNESS
|
#ifndef BOARD_RGB_BRIGHTNESS
|
||||||
#define BOARD_RGB_BRIGHTNESS 0x101010
|
#define BOARD_RGB_BRIGHTNESS 0x101010
|
||||||
#endif
|
#endif
|
||||||
@ -84,10 +84,6 @@ void led_pwm_enable(uint32_t led_index);
|
|||||||
void led_state(uint32_t state);
|
void led_state(uint32_t state);
|
||||||
void led_tick(void);
|
void led_tick(void);
|
||||||
|
|
||||||
#if defined(LED_NEOPIXEL) || defined(LED_RGB_RED_PIN)
|
|
||||||
void neopixel_write(uint8_t *pixels);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// BUTTONS
|
// BUTTONS
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
*------------------------------------------------------------------*/
|
*------------------------------------------------------------------*/
|
||||||
#define LEDS_NUMBER 2
|
#define LEDS_NUMBER 2
|
||||||
#define LED_PRIMARY_PIN 17 // Red
|
#define LED_PRIMARY_PIN 17 // Red
|
||||||
#define LED_SECODARY_PIN 19 // Blue
|
#define LED_SECONDARY_PIN 19 // Blue
|
||||||
#define LED_STATE_ON 1
|
#define LED_STATE_ON 1
|
||||||
|
|
||||||
/*------------------------------------------------------------------*/
|
/*------------------------------------------------------------------*/
|
||||||
|
@ -66,12 +66,11 @@
|
|||||||
#define RTS_PIN_NUMBER 5
|
#define RTS_PIN_NUMBER 5
|
||||||
#define HWFC false
|
#define HWFC false
|
||||||
|
|
||||||
#define OUTPUT_500HZ_PIN _PINNUM(0, 05) // A1
|
|
||||||
|
|
||||||
// Used as model string in OTA mode
|
// Used as model string in OTA mode
|
||||||
#define DIS_MANUFACTURER "Adafruit Industries"
|
#define DIS_MANUFACTURER "Adafruit Industries"
|
||||||
#define DIS_MODEL "Bluefruit Feather nRF52840 Express"
|
#define DIS_MODEL "Bluefruit Feather nRF52840 Express"
|
||||||
|
|
||||||
#define PRODUCT_NAME "Adafruit Feather nRF52840 Express"
|
#define PRODUCT_NAME "Adafruit Feather nRF52840 Express"
|
||||||
|
#define VOLUME_LABEL "FTHR840BOOT"
|
||||||
|
|
||||||
#endif // _FEATHER52840_H
|
#endif // _FEATHER52840_H
|
||||||
|
@ -42,11 +42,14 @@
|
|||||||
/*------------------------------------------------------------------*/
|
/*------------------------------------------------------------------*/
|
||||||
/* LED
|
/* LED
|
||||||
*------------------------------------------------------------------*/
|
*------------------------------------------------------------------*/
|
||||||
#define LEDS_NUMBER 2
|
#define LEDS_NUMBER 1
|
||||||
#define LED_RED _PINNUM(0, 13)
|
#define LED_PRIMARY_PIN _PINNUM(1, 12)
|
||||||
#define LED_BLUE _PINNUM(0, 15)
|
|
||||||
#define LED_STATE_ON 0
|
#define LED_STATE_ON 0
|
||||||
|
|
||||||
|
#define LED_RGB_RED_PIN _PINNUM(0, 13)
|
||||||
|
#define LED_RGB_GREEN_PIN _PINNUM(0, 14)
|
||||||
|
#define LED_RGB_BLUE_PIN _PINNUM(0, 15)
|
||||||
|
|
||||||
/*------------------------------------------------------------------*/
|
/*------------------------------------------------------------------*/
|
||||||
/* BUTTON
|
/* BUTTON
|
||||||
*------------------------------------------------------------------*/
|
*------------------------------------------------------------------*/
|
||||||
|
@ -66,8 +66,6 @@
|
|||||||
#define RTS_PIN_NUMBER 0
|
#define RTS_PIN_NUMBER 0
|
||||||
#define HWFC false
|
#define HWFC false
|
||||||
|
|
||||||
#define OUTPUT_500HZ_PIN _PINNUM(0, 04) // A1
|
|
||||||
|
|
||||||
// Used as model string in OTA mode
|
// Used as model string in OTA mode
|
||||||
#define DIS_MANUFACTURER "Particle Industries"
|
#define DIS_MANUFACTURER "Particle Industries"
|
||||||
#define DIS_MODEL "Boron"
|
#define DIS_MODEL "Boron"
|
||||||
|
@ -42,11 +42,14 @@
|
|||||||
/*------------------------------------------------------------------*/
|
/*------------------------------------------------------------------*/
|
||||||
/* LED
|
/* LED
|
||||||
*------------------------------------------------------------------*/
|
*------------------------------------------------------------------*/
|
||||||
#define LEDS_NUMBER 2
|
#define LEDS_NUMBER 1
|
||||||
#define LED_RED _PINNUM(0, 13)
|
#define LED_PRIMARY_PIN _PINNUM(1, 12)
|
||||||
#define LED_BLUE _PINNUM(0, 15)
|
|
||||||
#define LED_STATE_ON 0
|
#define LED_STATE_ON 0
|
||||||
|
|
||||||
|
#define LED_RGB_RED_PIN _PINNUM(0, 13)
|
||||||
|
#define LED_RGB_GREEN_PIN _PINNUM(0, 14)
|
||||||
|
#define LED_RGB_BLUE_PIN _PINNUM(0, 15)
|
||||||
|
|
||||||
/*------------------------------------------------------------------*/
|
/*------------------------------------------------------------------*/
|
||||||
/* BUTTON
|
/* BUTTON
|
||||||
*------------------------------------------------------------------*/
|
*------------------------------------------------------------------*/
|
||||||
|
@ -211,7 +211,7 @@ int main(void)
|
|||||||
|
|
||||||
led_state(STATE_BOOTLOADER_STARTED);
|
led_state(STATE_BOOTLOADER_STARTED);
|
||||||
|
|
||||||
if ( dfu_start || !valid_app || true)
|
if ( dfu_start || !valid_app )
|
||||||
{
|
{
|
||||||
if ( _ota_dfu )
|
if ( _ota_dfu )
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
#include "boards.h"
|
#include "boards.h"
|
||||||
|
|
||||||
#define UF2_VERSION "1.00"
|
|
||||||
|
|
||||||
#ifndef PRODUCT_NAME
|
#ifndef PRODUCT_NAME
|
||||||
#define PRODUCT_NAME DIS_MODEL
|
#define PRODUCT_NAME DIS_MODEL
|
||||||
#endif
|
#endif
|
||||||
|
55
tools/build_all.py
Normal file
55
tools/build_all.py
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
import sys
|
||||||
|
import subprocess
|
||||||
|
import time
|
||||||
|
|
||||||
|
subprocess.run("rm -rf _build*", shell=True)
|
||||||
|
subprocess.run("rm -rf bin/*", shell=True)
|
||||||
|
|
||||||
|
PARALLEL = "-j 5"
|
||||||
|
travis = False
|
||||||
|
if "TRAVIS" in os.environ and os.environ["TRAVIS"] == "true":
|
||||||
|
PARALLEL="-j 2"
|
||||||
|
travis = True
|
||||||
|
|
||||||
|
exit_status = 0
|
||||||
|
|
||||||
|
all_boards = []
|
||||||
|
for entry in os.scandir("src/boards"):
|
||||||
|
if not entry.name.endswith(".h"):
|
||||||
|
print("Misplaced file in src/boards: {}\n".format(entry.name))
|
||||||
|
exit_status = 1
|
||||||
|
continue
|
||||||
|
all_boards.append(entry.name[:-2])
|
||||||
|
|
||||||
|
#sha, version = build_info.get_version_info()
|
||||||
|
|
||||||
|
for board in all_boards:
|
||||||
|
bin_directory = "bin/{}/".format(board)
|
||||||
|
os.makedirs(bin_directory, exist_ok=True)
|
||||||
|
|
||||||
|
start_time = time.monotonic()
|
||||||
|
make_result = subprocess.run("make BOARD={} combinehex genpkg".format(board), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||||
|
build_duration = time.monotonic() - start_time
|
||||||
|
success = "\033[32msucceeded\033[0m"
|
||||||
|
if make_result.returncode != 0:
|
||||||
|
exit_status = make_result.returncode
|
||||||
|
success = "\033[31mfailed\033[0m"
|
||||||
|
|
||||||
|
for entry in os.scandir("_build-{}".format(board)):
|
||||||
|
for extension in ["zip", "hex"]:
|
||||||
|
if entry.name.endswith(extension):
|
||||||
|
shutil.copy(entry.path, bin_directory)
|
||||||
|
|
||||||
|
if travis:
|
||||||
|
print('travis_fold:start:build-{}-{}\\r'.format(language, board))
|
||||||
|
print("Build {} took {:.2f}s and {}".format(board, build_duration, success))
|
||||||
|
if make_result.returncode != 0:
|
||||||
|
print(make_result.stdout.decode("utf-8"))
|
||||||
|
if travis:
|
||||||
|
print('travis_fold:end:build-{}-{}\\r'.format(language, board))
|
||||||
|
|
||||||
|
print()
|
||||||
|
|
||||||
|
sys.exit(exit_status)
|
Loading…
Reference in New Issue
Block a user