Add compilation to CI #155
@@ -24,3 +24,39 @@ jobs:
|
||||
with:
|
||||
skip: ./pico-extras,./ArduinoCore-API,./libraries/SdFat,./libraries/Adafruit_TinyUSB_Arduino,./libraries/LittleFS/lib,./tools/pyserial,./pico-sdk,./.github,./docs/i2s.rst
|
||||
ignore_words_list: ser,DOUT
|
||||
|
||||
|
||||
build-linux:
|
||||
name: Build ${{ matrix.chunk }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
chunk: [0, 1, 2, 3, 4, 5, 6, 7]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: '3.x'
|
||||
- name: Cache Linux toolchain
|
||||
id: cache-linux
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ./tools/dist
|
||||
key: ${{ runner.os }}-${{ hashFiles('package/package_pico_index.template.json', 'tests/common.sh') }}
|
||||
- name: Build Sketches
|
||||
env:
|
||||
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||
TRAVIS_TAG: ${{ github.ref }}
|
||||
BUILD_PARITY: custom
|
||||
mod: 8
|
||||
rem: ${{ matrix.chunk }}
|
||||
run: |
|
||||
cd pico-sdk
|
||||
git submodule update --init
|
||||
cd ../pico-extras
|
||||
git submodule update --init
|
||||
cd ..
|
||||
bash ./tests/build.sh
|
||||
|
||||
|
||||
@@ -161,7 +161,6 @@ uint8_t const * tud_hid_descriptor_report_cb(void)
|
||||
|
||||
const uint8_t *tud_descriptor_configuration_cb(uint8_t index) {
|
||||
(void)index;
|
||||
int len = 0;
|
||||
static uint8_t *usbd_desc_cfg;
|
||||
|
||||
if (!usbd_desc_cfg) {
|
||||
@@ -217,6 +216,7 @@ const uint8_t *tud_descriptor_configuration_cb(uint8_t index) {
|
||||
}
|
||||
|
||||
const uint16_t *tud_descriptor_string_cb(uint8_t index, uint16_t langid) {
|
||||
(void) langid;
|
||||
#define DESC_STR_MAX (20)
|
||||
static uint16_t desc_str[DESC_STR_MAX];
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ size_t SerialUSB::write(const uint8_t *buf, size_t length) {
|
||||
static uint64_t last_avail_time;
|
||||
int i = 0;
|
||||
if (tud_cdc_connected()) {
|
||||
for (int i = 0; i < length;) {
|
||||
for (size_t i = 0; i < length;) {
|
||||
int n = length - i;
|
||||
int avail = tud_cdc_write_available();
|
||||
if (n > avail) n = avail;
|
||||
@@ -173,12 +173,14 @@ static void CheckSerialReset() {
|
||||
}
|
||||
|
||||
extern "C" void tud_cdc_line_state_cb(uint8_t itf, bool dtr, bool rts) {
|
||||
(void) itf;
|
||||
_dtr = dtr ? true : false;
|
||||
_rts = rts ? true : false;
|
||||
CheckSerialReset();
|
||||
}
|
||||
|
||||
extern "C" void tud_cdc_line_coding_cb(uint8_t itf, cdc_line_coding_t const* p_line_coding) {
|
||||
(void) itf;
|
||||
_bps = p_line_coding->bit_rate;
|
||||
CheckSerialReset();
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ class SerialUSB : public HardwareSerial {
|
||||
public:
|
||||
SerialUSB() { }
|
||||
void begin(unsigned long baud = 115200) override;
|
||||
void begin(unsigned long baud, uint16_t config) override { begin(baud); };
|
||||
void begin(unsigned long baud, uint16_t config) override { (void) config; begin(baud); };
|
||||
void end() override;
|
||||
|
||||
virtual int peek() override;
|
||||
|
||||
@@ -39,7 +39,7 @@ static PIOProgram _tonePgm(&tone_program);
|
||||
static std::map<pin_size_t, Tone *> _toneMap;
|
||||
|
||||
void tone(uint8_t pin, unsigned int frequency, unsigned long duration) {
|
||||
if ((pin < 0) || (pin > 29)) {
|
||||
if (pin > 29) {
|
||||
DEBUGCORE("ERROR: Illegal pin in tone (%d)\n", pin);
|
||||
return;
|
||||
}
|
||||
@@ -87,7 +87,7 @@ void tone(uint8_t pin, unsigned int frequency, unsigned long duration) {
|
||||
void noTone(uint8_t pin) {
|
||||
CoreMutex m(&_toneMutex);
|
||||
|
||||
if ((pin < 0) || (pin > 29) || !m) {
|
||||
if ((pin > 29) || !m) {
|
||||
DEBUGCORE("ERROR: Illegal pin in tone (%d)\n", pin);
|
||||
return;
|
||||
}
|
||||
|
||||
+41
-2
@@ -35,23 +35,34 @@ extern "C" int errno;
|
||||
|
||||
extern "C" ssize_t _write(int fd, const void *buf, size_t count) {
|
||||
#if defined DEBUG_RP2040_PORT
|
||||
(void) fd;
|
||||
return DEBUG_RP2040_PORT.write((const char *)buf, count);
|
||||
#else
|
||||
(void) fd;
|
||||
(void) buf;
|
||||
(void) count;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
extern "C" int _chown (const char *path, uid_t owner, gid_t group) {
|
||||
(void) path;
|
||||
(void) owner;
|
||||
(void) group;
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
extern "C" int _close (int fildes) {
|
||||
extern "C" int _close (int fd) {
|
||||
(void) fd;
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
extern "C" int _execve (char *name, char **argv, char **env) {
|
||||
(void) name;
|
||||
(void) argv;
|
||||
(void) env;
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
@@ -61,7 +72,9 @@ extern "C" int _fork (void) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
extern "C" int _fstat (int fildes, struct stat *st) {
|
||||
extern "C" int _fstat (int fd, struct stat *st) {
|
||||
(void) fd;
|
||||
(void) st;
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
@@ -74,6 +87,7 @@ extern "C" int _getpid (void) {
|
||||
static int64_t __timedelta_us = 0.0;
|
||||
|
||||
extern "C" int _gettimeofday (struct timeval *tv, void *tz) {
|
||||
(void) tz;
|
||||
uint64_t now_us = to_us_since_boot(get_absolute_time()) + __timedelta_us;
|
||||
if (tv) {
|
||||
tv->tv_sec = now_us / 1000000L;
|
||||
@@ -83,6 +97,7 @@ extern "C" int _gettimeofday (struct timeval *tv, void *tz) {
|
||||
}
|
||||
|
||||
extern "C" int settimeofday (const struct timeval *tv, const struct timezone *tz) {
|
||||
(void) tz;
|
||||
uint64_t now_us = to_us_since_boot(get_absolute_time());
|
||||
if (tv) {
|
||||
uint64_t newnow_us;
|
||||
@@ -94,62 +109,86 @@ extern "C" int settimeofday (const struct timeval *tv, const struct timezone *tz
|
||||
}
|
||||
|
||||
extern "C" int _isatty (int file) {
|
||||
(void) file;
|
||||
errno = ENOSYS;
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern "C" int _kill (int pid, int sig) {
|
||||
(void) pid;
|
||||
(void) sig;
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
extern "C" int _link (char *existing, char *newlink) {
|
||||
(void) existing;
|
||||
(void) newlink;
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
extern "C" int _lseek (int file, int ptr, int dir) {
|
||||
(void) file;
|
||||
(void) ptr;
|
||||
(void) dir;
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
extern "C" int _open (char *file, int flags, int mode) {
|
||||
(void) file;
|
||||
(void) flags;
|
||||
(void) mode;
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
extern "C" int _read (int file, char *ptr, int len)
|
||||
{
|
||||
(void) file;
|
||||
(void) ptr;
|
||||
(void) len;
|
||||
// return Serial.read(ptr, len);
|
||||
return -1;
|
||||
}
|
||||
|
||||
extern "C" int _readlink (const char *path, char *buf, size_t bufsize) {
|
||||
(void) path;
|
||||
(void) buf;
|
||||
(void) bufsize;
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
extern "C" int _stat (const char *file, struct stat *st) {
|
||||
(void) file;
|
||||
(void) st;
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
extern "C" int _symlink (const char *path1, const char *path2) {
|
||||
(void) path1;
|
||||
(void) path2;
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
extern "C" clock_t _times (struct tms *buf) {
|
||||
(void) buf;
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
extern "C" int _unlink (char *name) {
|
||||
(void) name;
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
extern "C" int _wait (int *status) {
|
||||
(void) status;
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -26,8 +26,7 @@
|
||||
#include <hardware/pll.h>
|
||||
#include <hardware/adc.h>
|
||||
|
||||
static int32_t analogScale = 255;
|
||||
static uint32_t analogMap = 0;
|
||||
static uint32_t analogScale = 255;
|
||||
static uint16_t analogFreq = 1000;
|
||||
static bool pwmInitted = false;
|
||||
static bool adcInitted = false;
|
||||
@@ -73,7 +72,7 @@ extern "C" void analogWriteResolution(int res) {
|
||||
extern "C" void analogWrite(pin_size_t pin, int val) {
|
||||
CoreMutex m(&_dacMutex);
|
||||
|
||||
if ((pin < 0) || (pin > 29) || !m) {
|
||||
if ((pin > 29) || !m) {
|
||||
DEBUGCORE("ERROR: Illegal analogWrite pin (%d)\n", pin);
|
||||
return;
|
||||
}
|
||||
@@ -89,7 +88,7 @@ extern "C" void analogWrite(pin_size_t pin, int val) {
|
||||
|
||||
if (val < 0) {
|
||||
val = 0;
|
||||
} else if (val > analogScale) {
|
||||
} else if ((uint32_t)val > analogScale) {
|
||||
val = analogScale;
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ extern "C" void pinMode( pin_size_t ulPin, PinMode ulMode ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((ulPin < 0) || (ulPin > 29)) {
|
||||
if (ulPin > 29) {
|
||||
DEBUGCORE("ERROR: Illegal pin in pinMode (%d)\n", ulPin);
|
||||
return;
|
||||
}
|
||||
@@ -59,7 +59,7 @@ extern "C" void pinMode( pin_size_t ulPin, PinMode ulMode ) {
|
||||
}
|
||||
|
||||
extern "C" void digitalWrite( pin_size_t ulPin, PinStatus ulVal ) {
|
||||
if ((ulPin < 0) || (ulPin > 29)) {
|
||||
if (ulPin > 29) {
|
||||
DEBUGCORE("ERROR: Illegal pin in pinMode (%d)\n", ulPin);
|
||||
return;
|
||||
}
|
||||
@@ -81,10 +81,9 @@ extern "C" void digitalWrite( pin_size_t ulPin, PinStatus ulVal ) {
|
||||
}
|
||||
|
||||
extern "C" PinStatus digitalRead( pin_size_t ulPin ) {
|
||||
if ((ulPin < 0) || (ulPin > 29)) {
|
||||
if (ulPin > 29) {
|
||||
DEBUGCORE("ERROR: Illegal pin in digitalRead (%d)\n", ulPin);
|
||||
return LOW;
|
||||
}
|
||||
return gpio_get(ulPin) ? HIGH : LOW;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ auto_init_mutex(_irqMutex);
|
||||
static std::map<pin_size_t, voidFuncPtr> _map;
|
||||
|
||||
void _gpioInterruptDispatcher(uint gpio, uint32_t events) {
|
||||
(void) events;
|
||||
// Only need to lock around the std::map check, not the whole IRQ callback
|
||||
voidFuncPtr cb = nullptr;
|
||||
{
|
||||
|
||||
@@ -27,7 +27,7 @@ extern "C" unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeo
|
||||
uint64_t start = time_us_64();
|
||||
uint64_t abort = start + timeout;
|
||||
|
||||
if ((pin < 0) || (pin > 29)) {
|
||||
if (pin > 29) {
|
||||
DEBUGCORE("ERROR: Illegal pin in pulseIn (%d)\n", pin);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -24,40 +24,42 @@
|
||||
extern "C" uint8_t shiftIn(pin_size_t dataPin, pin_size_t clockPin, BitOrder bitOrder) {
|
||||
uint8_t value = 0;
|
||||
uint8_t i;
|
||||
if ((dataPin < 0) || (dataPin > 29)) {
|
||||
if (dataPin > 29) {
|
||||
DEBUGCORE("ERROR: Illegal dataPin in shiftIn (%d)\n", dataPin);
|
||||
return 0;
|
||||
}
|
||||
if ((clockPin < 0) || (clockPin > 29)) {
|
||||
if (clockPin > 29) {
|
||||
DEBUGCORE("ERROR: Illegal clockPin in shiftIn (%d)\n", clockPin);
|
||||
return 0;
|
||||
}
|
||||
for (i = 0; i < 8; ++i) {
|
||||
digitalWrite(clockPin, HIGH);
|
||||
if (bitOrder == LSBFIRST)
|
||||
if (bitOrder == LSBFIRST) {
|
||||
value |= digitalRead(dataPin) << i;
|
||||
else
|
||||
} else {
|
||||
value |= digitalRead(dataPin) << (7 - i);
|
||||
digitalWrite(clockPin, LOW);
|
||||
}
|
||||
digitalWrite(clockPin, LOW);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
extern "C" void shiftOut(pin_size_t dataPin, pin_size_t clockPin, BitOrder bitOrder, uint8_t val) {
|
||||
uint8_t i;
|
||||
if ((dataPin < 0) || (dataPin > 29)) {
|
||||
if (dataPin > 29) {
|
||||
DEBUGCORE("ERROR: Illegal dataPin in shiftOut (%d)\n", dataPin);
|
||||
return;
|
||||
}
|
||||
if ((clockPin < 0) || (clockPin > 29)) {
|
||||
if (clockPin > 29) {
|
||||
DEBUGCORE("ERROR: Illegal clockPin in shiftOut (%d)\n", clockPin);
|
||||
return;
|
||||
}
|
||||
for (i = 0; i < 8; i++) {
|
||||
if (bitOrder == LSBFIRST)
|
||||
if (bitOrder == LSBFIRST) {
|
||||
digitalWrite(dataPin, !!(val & (1 << i)));
|
||||
else
|
||||
} else {
|
||||
digitalWrite(dataPin, !!(val & (1 << (7 - i))));
|
||||
}
|
||||
|
||||
digitalWrite(clockPin, HIGH);
|
||||
digitalWrite(clockPin, LOW);
|
||||
|
||||
@@ -32,17 +32,19 @@ I2SClass::I2SClass() {
|
||||
}
|
||||
|
||||
bool I2SClass::setBCLK(pin_size_t pin) {
|
||||
if (_running || (pin < 0) || (pin > 28)) {
|
||||
if (_running || (pin > 28)) {
|
||||
return false;
|
||||
}
|
||||
_pinBCLK = pin;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool I2SClass::setDOUT(pin_size_t pin) {
|
||||
if (_running || (pin < 0) || (pin > 29)) {
|
||||
if (_running || (pin > 29)) {
|
||||
return false;
|
||||
}
|
||||
_pinDOUT = pin;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool I2SClass::begin(long sampleRate) {
|
||||
|
||||
@@ -73,13 +73,13 @@ void SPIClassRP2040::adjustBuffer(const void *s, void *d, size_t cnt, bool by16)
|
||||
} else if (!by16) {
|
||||
const uint8_t *src = (const uint8_t *)s;
|
||||
uint8_t *dst = (uint8_t *)d;
|
||||
for (auto i = 0; i < cnt; i++) {
|
||||
for (size_t i = 0; i < cnt; i++) {
|
||||
*(dst++) = reverseByte( *(src++) );
|
||||
}
|
||||
} else { /* by16 */
|
||||
const uint16_t *src = (const uint16_t *)s;
|
||||
uint16_t *dst = (uint16_t *)d;
|
||||
for (auto i = 0; i < cnt; i++) {
|
||||
for (size_t i = 0; i < cnt; i++) {
|
||||
*(dst++) = reverse16Bit( *(src++) );
|
||||
}
|
||||
}
|
||||
@@ -114,7 +114,7 @@ uint16_t SPIClassRP2040::transfer16(uint16_t data) {
|
||||
void SPIClassRP2040::transfer(void *buf, size_t count) {
|
||||
DEBUGSPI("SPI::transfer(%p, %d)\n", buf, count);
|
||||
uint8_t *buff = reinterpret_cast<uint8_t *>(buf);
|
||||
for (auto i = 0; i < count; i++) {
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
*buff = transfer(*buff);
|
||||
*buff = (_spis.getBitOrder() == MSBFIRST) ? *buff : reverseByte(*buff);
|
||||
buff++;
|
||||
|
||||
@@ -146,7 +146,7 @@ void TwoWire::onIRQ() {
|
||||
}
|
||||
if (_i2c->hw->intr_stat & (1<<2)) {
|
||||
// RX_FULL
|
||||
if (_slaveStartDet && (_buffLen < sizeof(_buff))) {
|
||||
if (_slaveStartDet && (_buffLen < (int)sizeof(_buff))) {
|
||||
_buff[_buffLen++] = _i2c->hw->data_cmd & 0xff;
|
||||
} else {
|
||||
_i2c->hw->data_cmd;
|
||||
@@ -179,7 +179,6 @@ size_t TwoWire::requestFrom(uint8_t address, size_t quantity, bool stopBit) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t byteRead = 0;
|
||||
_buffLen = i2c_read_blocking_until(_i2c, address, _buff, quantity, !stopBit, make_timeout_time_ms(50));
|
||||
_buffOff = 0;
|
||||
return _buffLen;
|
||||
@@ -279,7 +278,7 @@ size_t TwoWire::write(uint8_t ucData) {
|
||||
|
||||
if (_slave) {
|
||||
// Wait for a spot in the TX FIFO
|
||||
while (0 == _i2c->hw->status & (1<<1)) { /* noop wait */ }
|
||||
while (0 == (_i2c->hw->status & (1<<1))) { /* noop wait */ }
|
||||
_i2c->hw->data_cmd = ucData;
|
||||
return 1;
|
||||
} else {
|
||||
|
||||
@@ -18,7 +18,6 @@ void setup() {
|
||||
|
||||
void loop() {
|
||||
time_t now;
|
||||
struct tm *info;
|
||||
char buff[80];
|
||||
|
||||
time(&now);
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
# Code formatting rules for Arduino examples, taken from:
|
||||
#
|
||||
# https://github.com/arduino/Arduino/blob/master/build/shared/examples_formatter.conf
|
||||
#
|
||||
|
||||
mode=c
|
||||
lineend=linux
|
||||
style=allman
|
||||
|
||||
# 4 spaces indentation
|
||||
indent=spaces=4
|
||||
|
||||
# also indent macros
|
||||
#indent-preprocessor
|
||||
|
||||
# indent classes, switches (and cases), comments starting at column 1
|
||||
indent-col1-comments
|
||||
|
||||
# put a space around operators
|
||||
pad-oper
|
||||
|
||||
# put a space after if/for/while
|
||||
pad-header
|
||||
|
||||
# if you like one-liners, keep them
|
||||
keep-one-line-statements
|
||||
|
||||
attach-closing-while
|
||||
unpad-paren
|
||||
pad-oper
|
||||
remove-comment-prefix
|
||||
add-braces
|
||||
@@ -0,0 +1,44 @@
|
||||
# Code formatting rules for Arduino examples, taken from:
|
||||
#
|
||||
# https://github.com/arduino/Arduino/blob/master/build/shared/examples_formatter.conf
|
||||
#
|
||||
|
||||
mode=c
|
||||
lineend=linux
|
||||
|
||||
# 2 spaces indentation
|
||||
indent=spaces=2
|
||||
|
||||
# also indent macros
|
||||
#indent-preprocessor
|
||||
|
||||
# indent classes, switches (and cases), comments starting at column 1
|
||||
indent-classes
|
||||
indent-switches
|
||||
indent-cases
|
||||
indent-col1-comments
|
||||
|
||||
# put a space around operators
|
||||
pad-oper
|
||||
|
||||
# put a space after if/for/while
|
||||
pad-header
|
||||
|
||||
# if you like one-liners, keep them
|
||||
keep-one-line-statements
|
||||
add-braces
|
||||
|
||||
style=java
|
||||
attach-namespaces
|
||||
attach-classes
|
||||
attach-inlines
|
||||
attach-extern-c
|
||||
indent-modifiers
|
||||
indent-namespaces
|
||||
indent-labels
|
||||
#indent-preproc-block
|
||||
#indent-preproc-define
|
||||
#indent-preproc-cond
|
||||
unpad-paren
|
||||
add-braces
|
||||
remove-comment-prefix
|
||||
Executable
+22
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
cache_dir=$(mktemp -d)
|
||||
|
||||
source "$TRAVIS_BUILD_DIR"/tests/common.sh
|
||||
|
||||
if [ -z "$BUILD_PARITY" ]; then
|
||||
mod=1
|
||||
rem=0
|
||||
elif [ "$BUILD_PARITY" = "even" ]; then
|
||||
mod=2
|
||||
rem=0
|
||||
elif [ "$BUILD_PARITY" = "odd" ]; then
|
||||
mod=2
|
||||
rem=1
|
||||
fi
|
||||
|
||||
install_arduino nodebug
|
||||
build_sketches_with_arduino "$mod" "$rem"
|
||||
|
||||
rm -rf "$cache_dir"
|
||||
|
||||
Executable
+14
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# CI job which checks that boards.txt and package_esp8266com_index.template.json are up to date
|
||||
|
||||
set -ev
|
||||
|
||||
cd $TRAVIS_BUILD_DIR
|
||||
|
||||
tools/boards.txt.py --boardsgen --ldgen --packagegen --docgen
|
||||
|
||||
git diff --exit-code -- boards.txt \
|
||||
doc/boards.rst \
|
||||
tools/sdk/ld/
|
||||
git diff --exit-code -w -- package/package_esp8266com_index.template.json
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# CI job to run the documentation build
|
||||
|
||||
set -ev
|
||||
|
||||
cd $TRAVIS_BUILD_DIR/doc
|
||||
|
||||
SPHINXOPTS="-W" make html
|
||||
Executable
+16
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# CI job which builds the boards manager package
|
||||
|
||||
set -ev
|
||||
|
||||
export PKG_URL=https://github.com/esp8266/Arduino/releases/download/$TRAVIS_TAG/esp8266-$TRAVIS_TAG.zip
|
||||
export DOC_URL=https://arduino-esp8266.readthedocs.io/en/$TRAVIS_TAG/
|
||||
|
||||
if [ -z "$CI_GITHUB_API_KEY" ]; then
|
||||
echo "Github API key not set. Skip building the package."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
cd $TRAVIS_BUILD_DIR/package
|
||||
./build_boards_manager_package.sh
|
||||
Executable
+23
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# CI job for running tests on the host
|
||||
|
||||
set -ev
|
||||
|
||||
cd $TRAVIS_BUILD_DIR/tests/host
|
||||
|
||||
|
||||
make -j2 FORCE32=0 ssl
|
||||
for i in ../../libraries/ESP8266WiFi/examples/WiFiClient/WiFiClient \
|
||||
../../libraries/ESP8266WiFi/examples/BearSSL_Validation/BearSSL_Validation \
|
||||
../../libraries/ESP8266WebServer/examples/HelloServer/HelloServer \
|
||||
../../libraries/SD/examples/Files/Files \
|
||||
../../libraries/LittleFS/examples/LittleFS_Timestamp/LittleFS_Timestamp \
|
||||
../../libraries/LittleFS/examples/SpeedTest/SpeedTest ; do
|
||||
make -j2 D=1 FORCE32=0 $i
|
||||
valgrind --leak-check=full --track-origins=yes --error-limit=no --show-leak-kinds=all --error-exitcode=999 bin/$(basename $i)/$(basename $i) -1
|
||||
done
|
||||
|
||||
make -j2 CI
|
||||
|
||||
make clean-objects
|
||||
Executable
+24
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -ev
|
||||
|
||||
fail=0
|
||||
for i in $(cat "$TRAVIS_BUILD_DIR/package/package_esp8266com_index.template.json" | jq '.packages[0]."tools" | .[] | .systems[] | "\(.url) \(.checksum)"' | sort -u | sed 's/ /@/'); do
|
||||
url=$(echo $i | sed 's/@/ /' | cut -f2 -d\" | cut -f1 -d' ')
|
||||
sha=$(echo $i | sed 's/@/ /' | cut -f2 -d\" | cut -f2 -d' ' | cut -f2 -d:)
|
||||
echo "INFO: Checking $url"
|
||||
rm -f file.bin
|
||||
wget --quiet -O file.bin $url
|
||||
calc=$(sha256sum file.bin | cut -f1 -d" ")
|
||||
if [ "$sha" != "$calc" ]; then
|
||||
echo "ERROR: Download failed or SHA mismatch for $url"
|
||||
echo "ERROR: Expected $sha"
|
||||
echo "ERROR: Received $calc"
|
||||
fail=1
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $fail -ne 0 ]; then
|
||||
echo ERROR: Package file integrity check failed
|
||||
exit 1
|
||||
fi
|
||||
Executable
+15
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# CI job for checking examples style
|
||||
|
||||
set -ev
|
||||
|
||||
org=$(cd ${0%/*}; pwd)
|
||||
${org}/../restyle.sh
|
||||
|
||||
# Revert changes which astyle might have done to the submodules,
|
||||
# as we don't want to fail the build because of the 3rd party libraries
|
||||
git --version || true
|
||||
git submodule foreach --recursive 'git reset --hard'
|
||||
|
||||
git diff --exit-code -- $TRAVIS_BUILD_DIR
|
||||
Executable
+255
@@ -0,0 +1,255 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# return 1 if this test should not be built in CI (for other archs, not needed, etc.)
|
||||
function skip_ino()
|
||||
{
|
||||
local ino=$1
|
||||
local skiplist=""
|
||||
# Add items to the following list with "\n" netween them to skip running. No spaces, tabs, etc. allowed
|
||||
read -d '' skiplist << EOL || true
|
||||
/#attic/
|
||||
/AvrAdcLogger/
|
||||
/BackwardCompatibility/
|
||||
/examplesV1/
|
||||
/ExFatFormatter/
|
||||
/ExFatLogger/
|
||||
/ExFatUnicodeTest/
|
||||
/RtcTimestampTest/
|
||||
/SoftwareSpi/
|
||||
/STM32Test/
|
||||
/TeensyRtcTimestamp/
|
||||
/TeensySdioDemo/
|
||||
/UserChipSelectFunction/
|
||||
/UserSPIDriver/
|
||||
/Adafruit_TinyUSB_Arduino/
|
||||
EOL
|
||||
echo $ino | grep -q -F "$skiplist"
|
||||
echo $(( 1 - $? ))
|
||||
}
|
||||
|
||||
function print_size_info()
|
||||
{
|
||||
elf_file=$1
|
||||
|
||||
if [ -z "$elf_file" ]; then
|
||||
printf "sketch data rodata bss text dram flash\n"
|
||||
return 0
|
||||
fi
|
||||
|
||||
elf_name=$(basename $elf_file)
|
||||
sketch_name="${elf_name%.*}"
|
||||
# echo $sketch_name
|
||||
arm-none-eabi-size --format=sysv $elf_file | sed s/irom0.text/irom0text/g > size.txt
|
||||
declare -A segments
|
||||
for seg in data rodata bss text irom0text; do
|
||||
segments[$seg]=$(grep ^.$seg size.txt | awk '{sum += $2} END {print sum}')
|
||||
done
|
||||
|
||||
total_ram=$((${segments[data]} + ${segments[rodata]} + ${segments[bss]}))
|
||||
total_flash=$((${segments[data]} + ${segments[rodata]} + ${segments[text]}))
|
||||
|
||||
printf "%-28s %-8d %-8d %-8d %-8d %-8d %-8d %-8d\n" $sketch_name ${segments[data]} ${segments[rodata]} ${segments[bss]} ${segments[text]} $total_ram $total_flash
|
||||
return 0
|
||||
}
|
||||
|
||||
function build_sketches()
|
||||
{
|
||||
set +e
|
||||
local arduino=$1
|
||||
local srcpath=$2
|
||||
local build_arg=$3
|
||||
local build_dir=build.tmp
|
||||
local build_mod=$4
|
||||
local build_rem=$5
|
||||
mkdir -p $build_dir
|
||||
local build_cmd="python3 tools/build.py -b generic -v -w all -v -k --build_cache $cache_dir -p ./$build_dir $build_arg "
|
||||
if [ "$WINDOWS" = "1" ]; then
|
||||
# Paths to the arduino builder need to be / referenced, not our native ones
|
||||
build_cmd=$(echo $build_cmd --ide_path $arduino | sed 's/ \/c\// \//g' ) # replace '/c/' with '/'
|
||||
fi
|
||||
local sketches=$(find $srcpath -name *.ino | sort)
|
||||
print_size_info >size.log
|
||||
export ARDUINO_IDE_PATH=$arduino
|
||||
local testcnt=0
|
||||
for sketch in $sketches; do
|
||||
testcnt=$(( ($testcnt + 1) % $build_mod ))
|
||||
if [ $testcnt -ne $build_rem ]; then
|
||||
continue # Not ours to do
|
||||
fi
|
||||
|
||||
if [ -e $cache_dir/core/*.a ]; then
|
||||
# We need to preserve the build.options.json file and replace the last .ino
|
||||
# with this sketch's ino file, or builder will throw everything away.
|
||||
jq '."sketchLocation" = "'$sketch'"' $build_dir/build.options.json > $build_dir/build.options.json.tmp
|
||||
mv $build_dir/build.options.json.tmp $build_dir/build.options.json
|
||||
# Set the time of the cached core.a file to the future so the GIT header
|
||||
# we regen won't cause the builder to throw it out and rebuild from scratch.
|
||||
touch -d 'now + 1 day' $cache_dir/core/*.a
|
||||
fi
|
||||
|
||||
# Clear out the last built sketch, map, elf, bin files, but leave the compiled
|
||||
# objects in the core and libraries available for use so we don't need to rebuild
|
||||
# them each sketch.
|
||||
rm -rf $build_dir/sketch $build_dir/*.bin $build_dir/*.map $build_dir/*.elf
|
||||
|
||||
local sketchdir=$(dirname $sketch)
|
||||
local sketchdirname=$(basename $sketchdir)
|
||||
local sketchname=$(basename $sketch)
|
||||
if [[ "${sketchdirname}.ino" != "$sketchname" ]]; then
|
||||
echo "Skipping $sketch, because it is not the main sketch file";
|
||||
continue
|
||||
fi;
|
||||
if [[ -f "$sketchdir/.test.skip" ]]; then
|
||||
echo -e "\n ------------ Skipping $sketch ------------ \n";
|
||||
continue
|
||||
fi
|
||||
if [[ $(skip_ino $sketch) = 1 ]]; then
|
||||
echo -e "\n ------------ Skipping $sketch ------------ \n";
|
||||
continue
|
||||
fi
|
||||
echo -e "\n ------------ Building $sketch ------------ \n";
|
||||
# $arduino --verify $sketch;
|
||||
if [ "$WINDOWS" == "1" ]; then
|
||||
sketch=$(echo $sketch | sed 's/^\/c//')
|
||||
# MINGW will try to be helpful and silently convert args that look like paths to point to a spot inside the MinGW dir. This breaks everything.
|
||||
# http://www.mingw.org/wiki/Posix_path_conversion
|
||||
# https://stackoverflow.com/questions/7250130/how-to-stop-mingw-and-msys-from-mangling-path-names-given-at-the-command-line#34386471
|
||||
export MSYS2_ARG_CONV_EXC="*"
|
||||
export MSYS_NO_PATHCONV=1
|
||||
fi
|
||||
echo "$build_cmd $sketch"
|
||||
time ($build_cmd $sketch >build.log)
|
||||
local result=$?
|
||||
if [ $result -ne 0 ]; then
|
||||
echo "Build failed ($1)"
|
||||
echo "Build log:"
|
||||
cat build.log
|
||||
set -e
|
||||
return $result
|
||||
else
|
||||
local warns=$( grep -c warning: build.log )
|
||||
if [ $warns -ne 0 ]; then
|
||||
echo "Warnings detected, log follows:"
|
||||
cat build.log
|
||||
fi
|
||||
fi
|
||||
rm build.log
|
||||
print_size_info $build_dir/*.elf >>size.log
|
||||
done
|
||||
set -e
|
||||
}
|
||||
|
||||
function install_libraries()
|
||||
{
|
||||
mkdir -p $HOME/Arduino/libraries
|
||||
pushd $HOME/Arduino/libraries
|
||||
|
||||
# install ArduinoJson library
|
||||
{ test -r ArduinoJson-v6.11.0.zip || curl --output ArduinoJson-v6.11.0.zip -L https://github.com/bblanchon/ArduinoJson/releases/download/v6.11.0/ArduinoJson-v6.11.0.zip; } && unzip -q ArduinoJson-v6.11.0.zip
|
||||
|
||||
popd
|
||||
}
|
||||
|
||||
function install_ide()
|
||||
{
|
||||
local idever='nightly'
|
||||
local ideurl='https://www.arduino.cc/download.php?f=/arduino-nightly'
|
||||
|
||||
#local idever='1.8.10'
|
||||
#local ideurl="https://downloads.arduino.cc/arduino-$idever"
|
||||
|
||||
echo "using Arduino IDE distribution ${idever}"
|
||||
|
||||
local ide_path=$1
|
||||
local core_path=$2
|
||||
local debug=$3
|
||||
mkdir -p ${core_path}/tools/dist
|
||||
if [ "$WINDOWS" = "1" ]; then
|
||||
test -r ${core_path}/tools/dist/arduino-windows.zip || curl --output ${core_path}/tools/dist/arduino-windows.zip -L "${ideurl}-windows.zip"
|
||||
unzip -q ${core_path}/tools/dist/arduino-windows.zip
|
||||
mv arduino-${idever} arduino-distrib
|
||||
elif [ "$MACOSX" = "1" ]; then
|
||||
# MACOS only has next-to-obsolete Python2 installed. Install Python 3 from python.org
|
||||
wget -q https://www.python.org/ftp/python/3.7.4/python-3.7.4-macosx10.9.pkg
|
||||
sudo installer -pkg python-3.7.4-macosx10.9.pkg -target /
|
||||
# Install the Python3 certificates, because SSL connections fail w/o them and of course they aren't installed by default.
|
||||
( cd "/Applications/Python 3.7/" && sudo "./Install Certificates.command" )
|
||||
# Hack to place arduino-builder in the same spot as sane OSes
|
||||
test -r ${core_path}/tools/dist/arduino-macos.zip || wget -q -O ${core_path}/tools/dist/arduino-macos.zip "${ideurl}-macosx.zip"
|
||||
unzip -q ${core_path}/tools/dist/arduino-macos.zip
|
||||
mv Arduino.app arduino-distrib
|
||||
mv arduino-distrib/Contents/Java/* arduino-distrib/.
|
||||
else
|
||||
test -r ${core_path}/tools/dist/arduino-linux.tar.xz || wget -q -O ${core_path}/tools/dist/arduino-linux.tar.xz "${ideurl}-linux64.tar.xz"
|
||||
tar xf ${core_path}/tools/dist/arduino-linux.tar.xz
|
||||
mv arduino-${idever} arduino-distrib
|
||||
fi
|
||||
mv arduino-distrib $ide_path
|
||||
cd $ide_path/hardware
|
||||
mkdir pico
|
||||
cd pico
|
||||
if [ "$WINDOWS" = "1" ]; then
|
||||
cp -a $core_path rp2040
|
||||
else
|
||||
ln -s $core_path rp2040
|
||||
fi
|
||||
local debug_flags=""
|
||||
if [ "$debug" = "debug" ]; then
|
||||
debug_flags="-DDEBUG_RP2040_WIRE -DDEBUG_RP2040_SPI -DDEBUG_RP2040_CORE -DDEBUG_RP2040_PORT=Serial"
|
||||
fi
|
||||
# Set custom warnings for all builds (i.e. could add -Wextra at some point)
|
||||
echo "compiler.c.extra_flags=-Wall -Wextra -Werror -Wno-ignored-qualifiers $debug_flags" > rp2040/platform.local.txt
|
||||
echo "compiler.cpp.extra_flags=-Wall -Wextra -Werror -Wno-ignored-qualifiers $debug_flags" >> rp2040/platform.local.txt
|
||||
echo -e "\n----platform.local.txt----"
|
||||
cat rp2040/platform.local.txt
|
||||
echo -e "\n----\n"
|
||||
cd rp2040/tools
|
||||
python3 get.py -q
|
||||
if [ "$WINDOWS" = "1" ]; then
|
||||
# Because the symlinks don't work well under Win32, we need to add the path to this copy, not the original...
|
||||
relbin=$(realpath $PWD/../system/arm-none-eabi/bin)
|
||||
export PATH="$ide_path:$relbin:$PATH"
|
||||
else
|
||||
export PATH="$ide_path:$core_path/system/arm-none-eabi/bin:$PATH"
|
||||
fi
|
||||
}
|
||||
|
||||
function install_arduino()
|
||||
{
|
||||
local debug=$1
|
||||
# Install Arduino IDE and required libraries
|
||||
echo -e "travis_fold:start:sketch_test_env_prepare"
|
||||
cd $TRAVIS_BUILD_DIR
|
||||
install_ide $HOME/arduino_ide $TRAVIS_BUILD_DIR $debug
|
||||
cd $TRAVIS_BUILD_DIR
|
||||
install_libraries
|
||||
echo -e "travis_fold:end:sketch_test_env_prepare"
|
||||
}
|
||||
|
||||
function build_sketches_with_arduino()
|
||||
{
|
||||
local build_mod=$1
|
||||
local build_rem=$2
|
||||
|
||||
# Compile sketches
|
||||
echo -e "travis_fold:start:sketch_test"
|
||||
build_sketches $HOME/arduino_ide $TRAVIS_BUILD_DIR/libraries "-l $HOME/Arduino/libraries" $build_mod $build_rem
|
||||
echo -e "travis_fold:end:sketch_test"
|
||||
|
||||
# Generate size report
|
||||
echo -e "travis_fold:start:size_report"
|
||||
cat size.log
|
||||
echo -e "travis_fold:end:size_report"
|
||||
}
|
||||
|
||||
|
||||
set -e
|
||||
|
||||
if [ -z "$TRAVIS_BUILD_DIR" ]; then
|
||||
echo "TRAVIS_BUILD_DIR is not set, trying to guess:"
|
||||
pushd $(dirname $0)/../ > /dev/null
|
||||
TRAVIS_BUILD_DIR=$PWD
|
||||
popd > /dev/null
|
||||
echo "TRAVIS_BUILD_DIR=$TRAVIS_BUILD_DIR"
|
||||
fi
|
||||
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
cache_dir=$(mktemp -d)
|
||||
|
||||
source "$TRAVIS_BUILD_DIR"/tests/common.sh
|
||||
|
||||
if [ "$BUILD_PARITY" = "even" ]; then
|
||||
mod=2
|
||||
rem=0
|
||||
elif [ "$BUILD_PARITY" = "odd" ]; then
|
||||
mod=2
|
||||
rem=1
|
||||
fi
|
||||
|
||||
install_arduino debug
|
||||
build_sketches_with_arduino "$mod" "$rem" lm2f
|
||||
|
||||
rm -rf "$cache_dir"
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
org=$(cd ${0%/*}; pwd)
|
||||
cd ${org}/..
|
||||
pwd
|
||||
test -d cores/esp8266
|
||||
test -d libraries
|
||||
|
||||
# in a near future, restyle-all.sh will be renamed to restyle.sh
|
||||
# and will be checked against CI
|
||||
|
||||
for d in libraries; do
|
||||
find $d -name "*.ino" -exec \
|
||||
astyle \
|
||||
--suffix=none \
|
||||
--options=${org}/astyle_examples.conf {} \;
|
||||
done
|
||||
Executable
+50
@@ -0,0 +1,50 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
org=$(cd ${0%/*}; pwd)
|
||||
cd ${org}/..
|
||||
pwd
|
||||
test -d cores/esp8266
|
||||
test -d libraries
|
||||
|
||||
# should be: all="cores/esp8266 libraries"
|
||||
|
||||
all="
|
||||
libraries/ESP8266mDNS
|
||||
libraries/Wire
|
||||
libraries/lwIP*
|
||||
cores/esp8266/Lwip*
|
||||
cores/esp8266/debug*
|
||||
cores/esp8266/core_esp8266_si2c.cpp
|
||||
cores/esp8266/StreamString.*
|
||||
cores/esp8266/StreamSend.*
|
||||
libraries/Netdump
|
||||
"
|
||||
|
||||
# core
|
||||
|
||||
for d in $all; do
|
||||
if [ -d "$d" ]; then
|
||||
echo "-------- directory $d:"
|
||||
for e in c cpp h; do
|
||||
find $d -name "*.$e" -exec \
|
||||
astyle \
|
||||
--suffix=none \
|
||||
--options=${org}/astyle_core.conf {} \;
|
||||
done
|
||||
else
|
||||
echo "-------- file $d:"
|
||||
astyle --suffix=none --options=${org}/astyle_core.conf "$d"
|
||||
fi
|
||||
done
|
||||
|
||||
# examples
|
||||
|
||||
for d in libraries; do
|
||||
echo "-------- examples in $d:"
|
||||
find $d -name "*.ino" -exec \
|
||||
astyle \
|
||||
--suffix=none \
|
||||
--options=${org}/astyle_examples.conf {} \;
|
||||
done
|
||||
Executable
+126
@@ -0,0 +1,126 @@
|
||||
#!/bin/sh
|
||||
|
||||
# temporary directory
|
||||
|
||||
[ -z "${TMPCI}" ] && TMPCI=/tmp/ci
|
||||
|
||||
##################
|
||||
|
||||
set -e
|
||||
|
||||
TMPDIR=${TMPCI%/*}
|
||||
CIDIR=${TMPCI##*/}
|
||||
|
||||
mkdir -p ${TMPDIR}
|
||||
|
||||
# set root directory into $ESP
|
||||
ESP="$(cd ${0%/*}/..; pwd)"
|
||||
branch=$(git rev-parse --abbrev-ref HEAD)
|
||||
|
||||
echo ""
|
||||
echo " -- CI directory: ${TMPCI} --"
|
||||
echo ""
|
||||
echo "Ensure your changes are committed in current branch ${branch}"
|
||||
echo ""
|
||||
echo "press return to run 'git diff'"
|
||||
read junk
|
||||
git diff
|
||||
echo "press return to run CI, or ^C"
|
||||
read junk
|
||||
|
||||
# clone or update this repository into ${TMPDIR}/${CIDIR}
|
||||
if [ -d ${TMPCI} ]; then
|
||||
echo ""
|
||||
echo " -- updating CI directory in ${TMPCI} --"
|
||||
echo ""
|
||||
(cd ${TMPCI}; git checkout master; git branch -D ${branch} || true; git checkout -b ${branch}; git pull origin ${branch})
|
||||
else
|
||||
echo ""
|
||||
echo " -- installing CI directory in ${TMPCI} --"
|
||||
echo ""
|
||||
(cd ${TMPDIR}; git clone ${ESP} ${CIDIR})
|
||||
fi
|
||||
|
||||
cd ${TMPCI}
|
||||
if [ "$branch" != "$branch" ]; then
|
||||
echo "branch ${cibranch} in ${TMPCI} not matching branch ${branch} in ${ESP}"
|
||||
exit 1
|
||||
fi
|
||||
rm -rf arduino_ide arduino-nightly Arduino/libraries/ArduinoJson
|
||||
|
||||
while true; do
|
||||
|
||||
cat << EOF
|
||||
Which build?
|
||||
1. main
|
||||
2. main + IPv6
|
||||
4. debug even
|
||||
5. debug odd
|
||||
6. platformio
|
||||
7. package
|
||||
8. host
|
||||
9. style
|
||||
EOF
|
||||
|
||||
read answer
|
||||
|
||||
BUILD_TYPE=""
|
||||
case "$answer" in
|
||||
1) BUILD_TYPE=build;;
|
||||
2) BUILD_TYPE=build6;;
|
||||
4) BUILD_TYPE=debug_even;;
|
||||
5) BUILD_TYPE=debug_odd;;
|
||||
6) BUILD_TYPE=platformio;;
|
||||
7) BUILD_TYPE=package;;
|
||||
8) BUILD_TYPE=host;;
|
||||
9) BUILD_TYPE=style;;
|
||||
esac
|
||||
test -z "$BUILD_TYPE" || break
|
||||
done
|
||||
|
||||
|
||||
git submodule update --init
|
||||
(cd pico-sdk && git submodule update --init)
|
||||
(cd pico-extras && git submodule update --init)
|
||||
|
||||
export HOME="${TMPCI}"
|
||||
export TRAVIS_BUILD_DIR="${TMPCI}"
|
||||
export BUILD_TYPE="$BUILD_TYPE"
|
||||
|
||||
if [ "$BUILD_TYPE" = "build" ]; then
|
||||
tests/build.sh
|
||||
elif [ "$BUILD_TYPE" = "build_even" ]; then
|
||||
BUILD_PARITY=even tests/build.sh
|
||||
elif [ "$BUILD_TYPE" = "build_odd" ]; then
|
||||
BUILD_PARITY=odd tests/build.sh
|
||||
|
||||
elif [ "$BUILD_TYPE" = "debug_even" ]; then
|
||||
BUILD_PARITY=even tests/debug.sh
|
||||
elif [ "$BUILD_TYPE" = "debug_odd" ]; then
|
||||
BUILD_PARITY=odd tests/debug.sh
|
||||
|
||||
elif [ "$BUILD_TYPE" = "build6" ]; then
|
||||
tests/build6.sh
|
||||
elif [ "$BUILD_TYPE" = "build6_even" ]; then
|
||||
BUILD_PARITY=even tests/build6.sh
|
||||
elif [ "$BUILD_TYPE" = "build6_odd" ]; then
|
||||
BUILD_PARITY=odd tests/build6.sh
|
||||
|
||||
elif [ "$BUILD_TYPE" = "platformio" ]; then
|
||||
tests/platformio.sh
|
||||
elif [ "$BUILD_TYPE" = "platformio_even" ]; then
|
||||
BUILD_PARITY=even tests/platformio.sh
|
||||
elif [ "$BUILD_TYPE" = "platformio_odd" ]; then
|
||||
BUILD_PARITY=odd tests/platformio.sh
|
||||
|
||||
elif [ "$BUILD_TYPE" = host ]; then
|
||||
tests/ci/host_test.sh
|
||||
|
||||
elif [ "$BUILD_TYPE" = style ]; then
|
||||
tests/ci/install_astyle.sh
|
||||
|
||||
else
|
||||
echo "BUILD_TYPE not set or invalid"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Executable
+160
@@ -0,0 +1,160 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# build.py — build a sketch using arduino-builder
|
||||
#
|
||||
# Wrapper script around arduino-builder which accepts some ESP8266-specific
|
||||
# options and translates them into FQBN
|
||||
#
|
||||
# Copyright © 2016 Ivan Grokhotkov
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
#
|
||||
|
||||
from __future__ import print_function
|
||||
import sys
|
||||
import os
|
||||
import argparse
|
||||
import platform
|
||||
import subprocess
|
||||
import tempfile
|
||||
import shutil
|
||||
|
||||
|
||||
# Arduino-builder needs forward-slash paths for passed in params or it cannot
|
||||
# launch the needed toolset.
|
||||
def windowsize_paths(l):
|
||||
"""Convert forward-slash paths to backslash paths referenced from C:"""
|
||||
out = []
|
||||
for i in l:
|
||||
if i.startswith('/'):
|
||||
i = 'C:' + i
|
||||
out += [i.replace('/', '\\')]
|
||||
return out
|
||||
|
||||
def compile(tmp_dir, sketch, cache, tools_dir, hardware_dir, ide_path, f, args):
|
||||
cmd = []
|
||||
cmd += [ide_path + '/arduino-builder']
|
||||
cmd += ['-compile', '-logger=human']
|
||||
cmd += ['-build-path', tmp_dir]
|
||||
cmd += ['-tools', ide_path + '/tools-builder']
|
||||
if cache != "":
|
||||
cmd += ['-build-cache', cache ]
|
||||
if args.library_path:
|
||||
for lib_dir in args.library_path:
|
||||
cmd += ['-libraries', lib_dir]
|
||||
cmd += ['-hardware', ide_path + '/hardware']
|
||||
if args.hardware_dir:
|
||||
for hw_dir in args.hardware_dir:
|
||||
cmd += ['-hardware', hw_dir]
|
||||
else:
|
||||
cmd += ['-hardware', hardware_dir]
|
||||
# Debug=Serial,DebugLevel=Core____
|
||||
fqbn = '-fqbn=pico:rp2040:rpipico:' \
|
||||
'flash=2097152_65536,' \
|
||||
'freq={freq},' \
|
||||
'dbgport={dbgport},' \
|
||||
'dbglvl={dbglvl},' \
|
||||
'usbstack={usbstack}'.format(**vars(args))
|
||||
cmd += [fqbn]
|
||||
cmd += ['-built-in-libraries', ide_path + '/libraries']
|
||||
cmd += ['-ide-version=10607']
|
||||
cmd += ['-warnings={warnings}'.format(**vars(args))]
|
||||
if args.verbose:
|
||||
cmd += ['-verbose']
|
||||
cmd += [sketch]
|
||||
|
||||
if platform.system() == "Windows":
|
||||
cmd = windowsize_paths(cmd)
|
||||
|
||||
if args.verbose:
|
||||
print('Building: ' + " ".join(cmd), file=f)
|
||||
|
||||
p = subprocess.Popen(cmd, stdout=f, stderr=subprocess.STDOUT)
|
||||
p.wait()
|
||||
return p.returncode
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser(description='Sketch build helper')
|
||||
parser.add_argument('-v', '--verbose', help='Enable verbose output',
|
||||
action='store_true')
|
||||
parser.add_argument('-i', '--ide_path', help='Arduino IDE path')
|
||||
parser.add_argument('-p', '--build_path', help='Build directory')
|
||||
parser.add_argument('-l', '--library_path', help='Additional library path',
|
||||
action='append')
|
||||
parser.add_argument('-d', '--hardware_dir', help='Additional hardware path',
|
||||
action='append')
|
||||
parser.add_argument('-b', '--board_name', help='Board name', default='generic')
|
||||
parser.add_argument('-f', '--freq', help='CPU frequency', default=133,
|
||||
choices=[50, 125, 133], type=int)
|
||||
parser.add_argument('-w', '--warnings', help='Compilation warnings level',
|
||||
default='none', choices=['none', 'all', 'more'])
|
||||
parser.add_argument('-o', '--output_binary', help='File name for output binary')
|
||||
parser.add_argument('-k', '--keep', action='store_true',
|
||||
help='Don\'t delete temporary build directory')
|
||||
parser.add_argument('--dbgport', help='Debug port', default='Disabled',
|
||||
choices=['Disabled', 'Serial', 'Serial1'])
|
||||
parser.add_argument('--dbglvl', help='Debug level', default='None',
|
||||
choices=['None', 'All'])
|
||||
parser.add_argument('--usbstack', help='USB stack', default='picosdk',
|
||||
choices=['picosdk', 'tinyusb'])
|
||||
parser.add_argument('--build_cache', help='Build directory to cache core.a', default='')
|
||||
parser.add_argument('sketch_path', help='Sketch file path')
|
||||
return parser.parse_args()
|
||||
|
||||
def main():
|
||||
args = parse_args()
|
||||
|
||||
ide_path = args.ide_path
|
||||
if not ide_path:
|
||||
ide_path = os.environ.get('ARDUINO_IDE_PATH')
|
||||
if not ide_path:
|
||||
print("Please specify Arduino IDE path via --ide_path option"
|
||||
"or ARDUINO_IDE_PATH environment variable.", file=sys.stderr)
|
||||
return 2
|
||||
|
||||
sketch_path = args.sketch_path
|
||||
tmp_dir = args.build_path
|
||||
created_tmp_dir = False
|
||||
if not tmp_dir:
|
||||
tmp_dir = tempfile.mkdtemp()
|
||||
created_tmp_dir = True
|
||||
|
||||
tools_dir = os.path.dirname(os.path.realpath(__file__)) + '/../tools'
|
||||
# this is not the correct hardware folder to add.
|
||||
hardware_dir = os.path.dirname(os.path.realpath(__file__)) + '/../cores'
|
||||
|
||||
output_name = tmp_dir + '/' + os.path.basename(sketch_path) + '.bin'
|
||||
|
||||
if args.verbose:
|
||||
print("Sketch: ", sketch_path)
|
||||
print("Build dir: ", tmp_dir)
|
||||
print("Cache dir: ", args.build_cache)
|
||||
print("Output: ", output_name)
|
||||
|
||||
if args.verbose:
|
||||
f = sys.stdout
|
||||
else:
|
||||
f = open(tmp_dir + '/build.log', 'w')
|
||||
|
||||
res = compile(tmp_dir, sketch_path, args.build_cache, tools_dir, hardware_dir, ide_path, f, args)
|
||||
if res != 0:
|
||||
return res
|
||||
|
||||
if args.output_binary is not None:
|
||||
shutil.copy(output_name, args.output_binary)
|
||||
|
||||
if created_tmp_dir and not args.keep:
|
||||
shutil.rmtree(tmp_dir, ignore_errors=True)
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
Reference in New Issue
Block a user