Merge pull request #284 from adafruit/test-travis
fix #240 let travis build all examples each commit
This commit is contained in:
16 files changed
+146
-75
No files matched your search
+22
-14
@@ -1,20 +1,28 @@
|
||||
language: c
|
||||
sudo: false
|
||||
cache:
|
||||
directories:
|
||||
- ~/arduino_ide
|
||||
|
||||
dist: xenial
|
||||
git:
|
||||
depth: false
|
||||
quiet: true
|
||||
|
||||
before_install:
|
||||
# - source <(curl -SLs https://raw.githubusercontent.com/hathach/travis-ci-arduino/test-nrf52/install.sh)
|
||||
script:
|
||||
- echo "test travis"
|
||||
# - build_platform adafruit:nrf52:feather52840
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- python3
|
||||
- python3-pip
|
||||
- python3-setuptools
|
||||
snaps:
|
||||
- name: ubuntu-make
|
||||
confinement: classic
|
||||
|
||||
notifications:
|
||||
email:
|
||||
on_success: change
|
||||
on_failure: change
|
||||
install:
|
||||
- pip3 install --user adafruit-nrfutil
|
||||
- umake electronics arduino $HOME/arduino_ide
|
||||
- export PATH=$HOME/arduino_ide:$PATH
|
||||
- arduino --pref "boardsmanager.additional.urls=https://adafruit.github.io/arduino-board-index/package_adafruit_index.json" --save-prefs
|
||||
- arduino --install-boards adafruit:nrf52
|
||||
- arduino --install-library "Adafruit NeoPixel","Adafruit NeoMatrix","Adafruit GFX Library","Adafruit SSD1306","MIDI Library",
|
||||
|
||||
before_script:
|
||||
|
||||
script:
|
||||
- python3 tools/build_all.py
|
||||
@@ -151,7 +151,7 @@ void GPIOTE_IRQHandler()
|
||||
if (channelMap[ch] != -1 && callbacksInt[ch]) {
|
||||
if ( callbackDeferred[ch] ) {
|
||||
// Adafruit defer callback to non-isr if configured so
|
||||
ada_callback_fromISR(NULL, 0, callbacksInt[ch]);
|
||||
ada_callback(NULL, 0, callbacksInt[ch]);
|
||||
}else{
|
||||
callbacksInt[ch]();
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime )
|
||||
do{
|
||||
uint8_t dummy = 0;
|
||||
uint32_t err_code = sd_nvic_critical_region_enter(&dummy);
|
||||
//APP_ERROR_CHECK(err_code);
|
||||
(void) err_code; //APP_ERROR_CHECK(err_code);
|
||||
}while (0);
|
||||
#else
|
||||
__disable_irq();
|
||||
@@ -229,7 +229,7 @@ void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime )
|
||||
}
|
||||
#ifdef SOFTDEVICE_PRESENT
|
||||
uint32_t err_code = sd_nvic_critical_region_exit(0);
|
||||
//APP_ERROR_CHECK(err_code);
|
||||
(void) err_code; //APP_ERROR_CHECK(err_code);
|
||||
#else
|
||||
__enable_irq();
|
||||
#endif
|
||||
|
||||
@@ -50,7 +50,7 @@ void adafruit_callback_task(void* arg)
|
||||
// PRINT_HEX(cb_data);
|
||||
// PRINT_HEX(cb_data->malloced_data);
|
||||
|
||||
void* func = cb_data->callback_func;
|
||||
const void* func = cb_data->callback_func;
|
||||
uint32_t* args = cb_data->arguments;
|
||||
|
||||
switch (cb_data->arg_count)
|
||||
@@ -72,17 +72,53 @@ void adafruit_callback_task(void* arg)
|
||||
}
|
||||
}
|
||||
|
||||
void ada_callback_queue(ada_callback_t* cb_data, bool from_isr)
|
||||
//! Test if in interrupt mode
|
||||
static inline bool is_isr(void)
|
||||
{
|
||||
if ( from_isr )
|
||||
return (SCB->ICSR & SCB_ICSR_VECTACTIVE_Msk) != 0 ;
|
||||
}
|
||||
|
||||
void ada_callback_queue(ada_callback_t* cb_item)
|
||||
{
|
||||
if ( is_isr() )
|
||||
{
|
||||
xQueueSendFromISR(_cb_queue, (void*) &cb_data, NULL);
|
||||
xQueueSendFromISR(_cb_queue, (void*) &cb_item, NULL);
|
||||
}else
|
||||
{
|
||||
xQueueSend(_cb_queue, (void*) &cb_data, CFG_CALLBACK_TIMEOUT);
|
||||
xQueueSend(_cb_queue, (void*) &cb_item, CFG_CALLBACK_TIMEOUT);
|
||||
}
|
||||
}
|
||||
|
||||
void ada_callback_invoke(const void* malloc_data, uint32_t malloc_len, const void* func, uint32_t arguments[], uint8_t argcount)
|
||||
{
|
||||
ada_callback_t* cb_data = (ada_callback_t*) rtos_malloc( sizeof(ada_callback_t) + (argcount ? (argcount-1)*4 : 0) );
|
||||
cb_data->malloced_data = NULL;
|
||||
cb_data->callback_func = func;
|
||||
cb_data->arg_count = argcount;
|
||||
|
||||
if ( malloc_data && malloc_len )
|
||||
{
|
||||
cb_data->malloced_data = rtos_malloc(malloc_len);
|
||||
memcpy(cb_data->malloced_data, malloc_data, malloc_len);
|
||||
}
|
||||
|
||||
if ( argcount )
|
||||
{
|
||||
// argument most likely has _mdata if used, change it to malloced one
|
||||
if ( malloc_data && malloc_len )
|
||||
{
|
||||
for(uint8_t i=0; i<argcount; i++)
|
||||
{
|
||||
if (arguments[i] == ((uint32_t) malloc_data)) arguments[i] = ((uint32_t) cb_data->malloced_data);
|
||||
}
|
||||
}
|
||||
|
||||
memcpy(cb_data->arguments, arguments, 4*argcount);
|
||||
}
|
||||
|
||||
ada_callback_queue(cb_data);
|
||||
}
|
||||
|
||||
void ada_callback_init(void)
|
||||
{
|
||||
// queue to hold "Pointer to callback data"
|
||||
|
||||
@@ -57,12 +57,11 @@ extern "C"{
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void* malloced_data;
|
||||
void* callback_func;
|
||||
void* malloced_data;
|
||||
void const* callback_func;
|
||||
|
||||
uint8_t arg_count;
|
||||
bool from_isr;
|
||||
// uint8_t _reserved[2];
|
||||
// uint8_t _reserved[3];
|
||||
|
||||
uint32_t arguments[1]; // flexible array holder
|
||||
}ada_callback_t;
|
||||
@@ -94,28 +93,11 @@ typedef void (*adacb_5arg_t) (uint32_t, uint32_t, uint32_t, uint32_t, uint32_t);
|
||||
/**
|
||||
* Macro function is called by other module with all intended parameters.
|
||||
*/
|
||||
#define _cb_setup(_from_isr, _mdata, _mlen, _func, ... ) \
|
||||
do { \
|
||||
uint8_t const _count = VA_ARGS_NUM(__VA_ARGS__); \
|
||||
ada_callback_t* cb_data = (ada_callback_t*) rtos_malloc( sizeof(ada_callback_t) + (_count ? (_count-1)*4 : 0) );\
|
||||
cb_data->malloced_data = NULL; \
|
||||
if ( (_mdata) && (_mlen) ) { \
|
||||
cb_data->malloced_data = rtos_malloc(_mlen); \
|
||||
memcpy(cb_data->malloced_data, _mdata, _mlen); \
|
||||
} \
|
||||
cb_data->callback_func = (void*)_func; \
|
||||
cb_data->arg_count = _count; \
|
||||
if ( _count ) { \
|
||||
uint32_t arguments[] = { _ADA_CB_ARGS(__VA_ARGS__) }; \
|
||||
/* argument most likely is _mdata if used, change it to malloced one */\
|
||||
if ( (_mdata) && (_mlen) ) { \
|
||||
for(uint8_t i=0; i<_count; i++) {\
|
||||
if (arguments[i] == ((uint32_t) (_mdata))) { arguments[i] = ((uint32_t) cb_data->malloced_data); } \
|
||||
}\
|
||||
}\
|
||||
memcpy(cb_data->arguments, arguments, 4*_count); \
|
||||
} \
|
||||
ada_callback_queue(cb_data, _from_isr); \
|
||||
#define _cb_setup(_malloc_data, _malloc_len, _func, ... ) \
|
||||
do { \
|
||||
uint8_t const _count = VA_ARGS_NUM(__VA_ARGS__); \
|
||||
uint32_t arguments[] = { _ADA_CB_ARGS(__VA_ARGS__) }; \
|
||||
ada_callback_invoke(_malloc_data, _malloc_len, (void const*) _func, arguments, _count); \
|
||||
} while(0)
|
||||
|
||||
/**
|
||||
@@ -127,15 +109,12 @@ typedef void (*adacb_5arg_t) (uint32_t, uint32_t, uint32_t, uint32_t, uint32_t);
|
||||
* - 3rd arg : function to be invoked
|
||||
* - 3rd-7th arg : function argument, will be cast to uint32_t
|
||||
*/
|
||||
#define ada_callback(... ) _cb_setup(false, __VA_ARGS__)
|
||||
#define ada_callback(...) _cb_setup(__VA_ARGS__)
|
||||
|
||||
/**
|
||||
* Similar to ada_callback() but invoke in ISR-context
|
||||
*/
|
||||
#define ada_callback_fromISR(... ) _cb_setup(true, __VA_ARGS__)
|
||||
|
||||
void ada_callback_init(void);
|
||||
void ada_callback_queue(ada_callback_t* cb_data, bool from_isr);
|
||||
void ada_callback_invoke(const void* mdata, uint32_t mlen, const void* func, uint32_t arguments[], uint8_t argcount);
|
||||
void ada_callback_queue(ada_callback_t* cb_item);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ void dbgDumpMemory(void const *buf, uint8_t size, uint16_t count, bool printOffs
|
||||
|
||||
const uint8_t item_per_line = 16 / size;
|
||||
|
||||
for(int i=0; i<count; i++)
|
||||
for(uint32_t i=0; i<count; i++)
|
||||
{
|
||||
uint32_t value=0;
|
||||
|
||||
@@ -246,10 +246,8 @@ void dbgDumpMemoryCFormat(const char* str, void const *buf, uint16_t count)
|
||||
|
||||
uint8_t const *buf8 = (uint8_t const *) buf;
|
||||
|
||||
for(int i=0; i<count; i++)
|
||||
for(uint32_t i=0; i<count; i++)
|
||||
{
|
||||
uint32_t value=0;
|
||||
|
||||
if ( i%16 == 0 )
|
||||
{
|
||||
if ( i != 0 ) printf(",\n ");
|
||||
@@ -258,7 +256,7 @@ void dbgDumpMemoryCFormat(const char* str, void const *buf, uint16_t count)
|
||||
if ( i != 0 ) printf(", ");
|
||||
}
|
||||
|
||||
printf("0x%02lX", *buf8);
|
||||
printf("0x%02X", *buf8);
|
||||
buf8++;
|
||||
}
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ const char* getBootloaderVersion(void)
|
||||
uint32_t const ver2 = (sd_version % 1000000)/1000;
|
||||
uint32_t const ver3 = sd_version % 1000;
|
||||
|
||||
sprintf(fw_str, "s%d %d.%d.%d", sd_id, ver1, ver2, ver3);
|
||||
sprintf(fw_str, "s%lu %lu.%lu.%lu", sd_id, ver1, ver2, ver3);
|
||||
}
|
||||
|
||||
return fw_str;
|
||||
@@ -93,7 +93,7 @@ const char* getMcuUniqueID(void)
|
||||
// Skip if already created
|
||||
if ( serial_str[0] == 0 )
|
||||
{
|
||||
sprintf(serial_str, "%08lX%08lX", NRF_FICR->DEVICEID[1], NRF_FICR->DEVICEID[0]);
|
||||
sprintf(serial_str, "%08lu%08lu", NRF_FICR->DEVICEID[1], NRF_FICR->DEVICEID[0]);
|
||||
}
|
||||
|
||||
return serial_str;
|
||||
|
||||
@@ -169,7 +169,7 @@ uint32_t analogRead( uint32_t ulPin )
|
||||
uint32_t pin = SAADC_CH_PSELP_PSELP_NC;
|
||||
uint32_t saadcResolution;
|
||||
uint32_t resolution;
|
||||
int16_t value;
|
||||
volatile int16_t value = 0;
|
||||
|
||||
if (ulPin >= PINS_COUNT) {
|
||||
return 0;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name=Adafruit Bluefruit nRF52 Libraries
|
||||
version=0.11.0
|
||||
version=0.11.1
|
||||
author=Adafruit
|
||||
maintainer=Adafruit <info@adafruit.com>
|
||||
sentence=Arduino library for nRF52-based Adafruit Bluefruit LE modules
|
||||
|
||||
@@ -106,6 +106,7 @@ static void bluefruit_blinky_cb( TimerHandle_t xTimer )
|
||||
|
||||
static void nrf_error_cb(uint32_t id, uint32_t pc, uint32_t info)
|
||||
{
|
||||
#if CFG_DEBUG
|
||||
PRINT_INT(id);
|
||||
PRINT_HEX(pc);
|
||||
PRINT_HEX(info);
|
||||
@@ -123,7 +124,6 @@ static void nrf_error_cb(uint32_t id, uint32_t pc, uint32_t info)
|
||||
LOG_LV1("SD Err", "assert at %s : %d", assert_info->p_file_name, assert_info->line_num);
|
||||
}
|
||||
|
||||
#if CFG_DEBUG
|
||||
while(1) { }
|
||||
#endif
|
||||
}
|
||||
@@ -865,6 +865,8 @@ void AdafruitBluefruit::_ble_handler(ble_evt_t* evt)
|
||||
case BLE_GAP_EVT_DATA_LENGTH_UPDATE_REQUEST:
|
||||
{
|
||||
ble_gap_data_length_params_t* param = &evt->evt.gap_evt.params.data_length_update_request.peer_params;
|
||||
(void) param;
|
||||
|
||||
LOG_LV2("GAP", "Data Length Req is (tx, rx) octets = (%d, %d), (tx, rx) time = (%d, %d) us",
|
||||
param->max_tx_octets, param->max_rx_octets, param->max_tx_time_us, param->max_rx_time_us);
|
||||
|
||||
@@ -876,6 +878,8 @@ void AdafruitBluefruit::_ble_handler(ble_evt_t* evt)
|
||||
case BLE_GAP_EVT_DATA_LENGTH_UPDATE:
|
||||
{
|
||||
ble_gap_data_length_params_t* datalen = &evt->evt.gap_evt.params.data_length_update.effective_params;
|
||||
(void) datalen;
|
||||
|
||||
LOG_LV2("GAP", "Data Length is (tx, rx) octets = (%d, %d), (tx, rx) time = (%d, %d) us",
|
||||
datalen->max_tx_octets, datalen->max_rx_octets, datalen->max_tx_time_us, datalen->max_rx_time_us);
|
||||
}
|
||||
@@ -884,11 +888,11 @@ void AdafruitBluefruit::_ble_handler(ble_evt_t* evt)
|
||||
case BLE_GAP_EVT_PHY_UPDATE_REQUEST:
|
||||
{
|
||||
ble_gap_phys_t* req_phy = &evt->evt.gap_evt.params.phy_update_request.peer_preferred_phys;
|
||||
|
||||
#if CFG_DEBUG >= 1
|
||||
char const *phy_str[] = { "Auto", "1 Mbps", "2 Mbps", "Coded" };
|
||||
|
||||
(void) req_phy;
|
||||
(void) phy_str;
|
||||
LOG_LV1("GAP", "PHY request tx: %s, rx: %s", phy_str[req_phy->tx_phys], phy_str[req_phy->rx_phys]);
|
||||
#endif
|
||||
|
||||
// Tell SoftDevice to choose PHY automatically
|
||||
ble_gap_phys_t phy = { BLE_GAP_PHY_AUTO, BLE_GAP_PHY_AUTO };
|
||||
@@ -900,16 +904,15 @@ void AdafruitBluefruit::_ble_handler(ble_evt_t* evt)
|
||||
{
|
||||
ble_gap_evt_phy_update_t* active_phy = &evt->evt.gap_evt.params.phy_update;
|
||||
|
||||
#if CFG_DEBUG >= 1
|
||||
if ( active_phy->status != BLE_HCI_STATUS_CODE_SUCCESS )
|
||||
{
|
||||
LOG_LV1("GAP", "Failed HCI status = 0x%02X", active_phy->status);
|
||||
}else
|
||||
{
|
||||
char const *phy_str[] = { "Auto", "1 Mbps", "2 Mbps", "Coded" };
|
||||
(void) phy_str;
|
||||
LOG_LV1("GAP", "PHY active tx: %s, rx: %s", phy_str[active_phy->tx_phy], phy_str[active_phy->rx_phy]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -39,9 +39,9 @@
|
||||
BLEClientHidAdafruit::BLEClientHidAdafruit(void)
|
||||
: BLEClientService(UUID16_SVC_HUMAN_INTERFACE_DEVICE),
|
||||
_protcol_mode(UUID16_CHR_PROTOCOL_MODE),
|
||||
_hid_info(UUID16_CHR_HID_INFORMATION), _hid_control(UUID16_CHR_HID_CONTROL_POINT),
|
||||
_kbd_boot_input(UUID16_CHR_BOOT_KEYBOARD_INPUT_REPORT), _kbd_boot_output(UUID16_CHR_BOOT_KEYBOARD_OUTPUT_REPORT),
|
||||
_mse_boot_input(UUID16_CHR_BOOT_MOUSE_INPUT_REPORT),
|
||||
_hid_info(UUID16_CHR_HID_INFORMATION), _hid_control(UUID16_CHR_HID_CONTROL_POINT)
|
||||
_mse_boot_input(UUID16_CHR_BOOT_MOUSE_INPUT_REPORT)
|
||||
{
|
||||
_kbd_cb = NULL;
|
||||
_mse_cb = NULL;
|
||||
|
||||
@@ -254,7 +254,7 @@ void bond_print_list(uint8_t role)
|
||||
char devname[len];
|
||||
file.read(devname, len);
|
||||
|
||||
printf(" %s : %s (%d bytes)\n", file.name(), devname, file.size());
|
||||
printf(" %s : %s (%lu bytes)\n", file.name(), devname, file.size());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -195,7 +195,7 @@ void HwRotaryEncoder::_irq_handler(void)
|
||||
if ( _cb )
|
||||
{
|
||||
int32_t step = read();
|
||||
if ( step ) ada_callback_fromISR(NULL, 0, _cb, step);
|
||||
if ( step ) ada_callback(NULL, 0, _cb, step);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ void SwRotaryEncoder::_irq_handler(void)
|
||||
_abs += step;
|
||||
_a_last = bita;
|
||||
|
||||
if (_cb) ada_callback_fromISR(NULL, 0, _cb, step);
|
||||
if (_cb) ada_callback(NULL, 0, _cb, step);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
name=Adafruit nRF52 Boards
|
||||
version=0.11.0
|
||||
version=0.11.1
|
||||
|
||||
# Compile variables
|
||||
# -----------------
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
import os
|
||||
import glob
|
||||
import sys
|
||||
import subprocess
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
home = str(Path.home())
|
||||
|
||||
exit_status = 0
|
||||
|
||||
travis = False
|
||||
if "TRAVIS" in os.environ and os.environ["TRAVIS"] == "true":
|
||||
travis = True
|
||||
|
||||
success_count = 0
|
||||
fail_count = 0
|
||||
|
||||
print("Setting board to Feather nRF52840")
|
||||
subprocess.run("arduino --board adafruit:nrf52:feather52840:softdevice=s140v6,debug=l0 --save-prefs", shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
|
||||
for sketch in glob.iglob('libraries/**/*.ino', recursive=True):
|
||||
start_time = time.monotonic()
|
||||
build_result = subprocess.run("arduino --verify {}".format(sketch), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
build_duration = time.monotonic() - start_time
|
||||
|
||||
if build_result.returncode != 0:
|
||||
exit_status = build_result.returncode
|
||||
success = "\033[31mfailed\033[0m"
|
||||
fail_count += 1
|
||||
else:
|
||||
success = "\033[32msucceeded\033[0m"
|
||||
success_count += 1
|
||||
|
||||
if travis:
|
||||
print('travis_fold:start:build-{}\\r'.format(sketch))
|
||||
|
||||
print("Build {} took {:.2f}s and {}".format(sketch, build_duration, success))
|
||||
if build_result.returncode != 0:
|
||||
print(build_result.stdout.decode("utf-8"))
|
||||
|
||||
if travis:
|
||||
print('travis_fold:end:build-{}\\r'.format(sketch))
|
||||
|
||||
|
||||
print("Build Sumamary: {} \033[32msucceeded\033[0m, {} \033[31mfailed\033[0m".format(success_count, fail_count))
|
||||
sys.exit(exit_status)
|
||||
Reference in new issue
Block a user