Add build script and hook it into Travis

This commit is contained in:
Scott Shawcroft 2018-12-04 15:18:49 -08:00
parent 2ece2daf90
commit 1b35dbf643
No known key found for this signature in database
GPG Key ID: FD0EDC4B6C53CA59
32 changed files with 128 additions and 90081 deletions

1
.gitignore vendored
View File

@ -53,3 +53,4 @@ dkms.conf
src/segger/Output
_build-*/
bin/

28
.travis.yml Normal file
View 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

View File

@ -31,7 +31,6 @@ SD_API_PATH = $(SD_PATH)/$(SD_FILENAME)_API
SD_HEX = $(SD_PATH)/$(SD_FILENAME)_softdevice.hex
LD_FILE = $(SRC_PATH)/linker/$(SD_NAME)_v$(SD_VER1).ld
OUTPUT_FILENAME = $(BOARD)_bootloader
MERGED_FNAME = $(OUTPUT_FILENAME)_$(SD_NAME)_$(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)"
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
#******************************************************************************
@ -265,6 +268,8 @@ CFLAGS += -DFLOAT_ABI_HARD
CFLAGS += -DMK_DIS_FIRMWARE='$(MK_DIS_FIRMWARE)'
CFLAGS += -DDFU_APP_DATA_RESERVED=7*4096
CFLAGS += -DUF2_VERSION='"$(GIT_VERSION) $(GIT_SUBMODULE_VERSIONS) $(SD_NAME) $(SD_VERSION) r$(SD_VER4)"'
CFLAGS += -DBOARD_$(shell echo $(BOARD) | tr '[:lower:]' '[:upper:]')
ifneq ($(IS_NRF52840),)

View File

@ -1,11 +1,14 @@
# 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 nRF52840 Express
- Nordic nRF52840DK PCA10056
- 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
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
```
Pre-builtin binaries are in the `bin` directory:
```
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
```
Pre-builtin binaries are available on GitHub releases.
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.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -45,12 +45,11 @@
#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. */
//------------- IMPLEMENTATION -------------//
#ifdef OUTPUT_500HZ_PIN
void init_clock_pwm(uint32_t pin);
void clock_pwm_teardown(void);
#if defined(LED_NEOPIXEL) || defined(LED_RGB_RED_PIN)
void neopixel_write(uint8_t *pixels);
#endif
//------------- IMPLEMENTATION -------------//
void board_init(void)
{
// stop LF clock just in case we jump from application without reset
@ -240,16 +239,25 @@ void led_state(uint32_t state)
default:
break;
}
uint8_t* final_color = NULL;
new_rgb_color &= BOARD_RGB_BRIGHTNESS;
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;
} 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;
} 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
@ -377,9 +385,3 @@ void neopixel_write (uint8_t *pixels)
led_pwm_duty_cycle(LED_RGB_BLUE, pixels[0]);
}
#endif
#if !LED_NEOPIXEL && !defined(LED_RGB_RED)
void neopixel_write(uint8_t* pixels) {
(void) pixels;
}
#endif

View File

@ -47,7 +47,7 @@
// The secondary LED, when available, is usually blue.
#define LED_SECONDARY 1
// The internal
// Internal status colors are masked by this brightness setting.
#ifndef BOARD_RGB_BRIGHTNESS
#define BOARD_RGB_BRIGHTNESS 0x101010
#endif
@ -84,10 +84,6 @@ void led_pwm_enable(uint32_t led_index);
void led_state(uint32_t state);
void led_tick(void);
#if defined(LED_NEOPIXEL) || defined(LED_RGB_RED_PIN)
void neopixel_write(uint8_t *pixels);
#endif
//--------------------------------------------------------------------+
// BUTTONS
//--------------------------------------------------------------------+

View File

@ -42,7 +42,7 @@
*------------------------------------------------------------------*/
#define LEDS_NUMBER 2
#define LED_PRIMARY_PIN 17 // Red
#define LED_SECODARY_PIN 19 // Blue
#define LED_SECONDARY_PIN 19 // Blue
#define LED_STATE_ON 1
/*------------------------------------------------------------------*/

View File

@ -66,12 +66,11 @@
#define RTS_PIN_NUMBER 5
#define HWFC false
#define OUTPUT_500HZ_PIN _PINNUM(0, 05) // A1
// Used as model string in OTA mode
#define DIS_MANUFACTURER "Adafruit Industries"
#define DIS_MODEL "Bluefruit Feather nRF52840 Express"
#define PRODUCT_NAME "Adafruit Feather nRF52840 Express"
#define VOLUME_LABEL "FTHR840BOOT"
#endif // _FEATHER52840_H

View File

@ -42,11 +42,14 @@
/*------------------------------------------------------------------*/
/* LED
*------------------------------------------------------------------*/
#define LEDS_NUMBER 2
#define LED_RED _PINNUM(0, 13)
#define LED_BLUE _PINNUM(0, 15)
#define LEDS_NUMBER 1
#define LED_PRIMARY_PIN _PINNUM(1, 12)
#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
*------------------------------------------------------------------*/

View File

@ -66,8 +66,6 @@
#define RTS_PIN_NUMBER 0
#define HWFC false
#define OUTPUT_500HZ_PIN _PINNUM(0, 04) // A1
// Used as model string in OTA mode
#define DIS_MANUFACTURER "Particle Industries"
#define DIS_MODEL "Boron"

View File

@ -42,11 +42,14 @@
/*------------------------------------------------------------------*/
/* LED
*------------------------------------------------------------------*/
#define LEDS_NUMBER 2
#define LED_RED _PINNUM(0, 13)
#define LED_BLUE _PINNUM(0, 15)
#define LEDS_NUMBER 1
#define LED_PRIMARY_PIN _PINNUM(1, 12)
#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
*------------------------------------------------------------------*/

View File

@ -211,7 +211,7 @@ int main(void)
led_state(STATE_BOOTLOADER_STARTED);
if ( dfu_start || !valid_app || true)
if ( dfu_start || !valid_app )
{
if ( _ota_dfu )
{

View File

@ -1,7 +1,5 @@
#include "boards.h"
#define UF2_VERSION "1.00"
#ifndef PRODUCT_NAME
#define PRODUCT_NAME DIS_MODEL
#endif

55
tools/build_all.py Normal file
View 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)