Remove platform dependent code, update travis to attempt precompiled builds for all platforms
This commit is contained in:
parent
f7c1f61cbf
commit
bdca75cd87
4 changed files with 16 additions and 74 deletions
29
.travis.yml
29
.travis.yml
|
@ -10,16 +10,10 @@ cache:
|
|||
- ~/.arduino15/packages/
|
||||
jobs:
|
||||
include:
|
||||
- env:
|
||||
- ARCH="cortex-m0plus"
|
||||
- CORE="adafruit:samd"
|
||||
- BOARD="adafruit:samd:adafruit_feather_m0"
|
||||
- DEPLOY=1
|
||||
- env:
|
||||
- ARCH="cortex-m0plus"
|
||||
- CORE="arduino:samd"
|
||||
- BOARD="arduino:samd:mzero_bl"
|
||||
- DEPLOY=0
|
||||
- stage: "Feather M0"
|
||||
env: BOARD_NAME="FeatherM0" ARCH="cortex-m0plus" CORE="adafruit:samd" BOARD="adafruit:samd:adafruit_feather_m0"
|
||||
- stage: "Arduino Zero"
|
||||
env: BOARD_NAME="ArduinoZero" ARCH="cortex-m0plus" CORE="arduino:samd" BOARD="arduino:samd:mzero_bl"
|
||||
|
||||
before_install:
|
||||
- curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR=/usr/bin sudo sh
|
||||
|
@ -27,9 +21,11 @@ before_install:
|
|||
- arduino-cli core install arduino:samd -v
|
||||
- arduino-cli core install adafruit:samd -v --additional-urls $ADDITIONAL_URLS
|
||||
- mkdir -p $HOME/Arduino/libraries
|
||||
- rm -rf $HOME/Arduino/libraries/EthernetLarge
|
||||
- git clone https://github.com/OPEnSLab-OSU/EthernetLarge.git $HOME/Arduino/libraries/EthernetLarge
|
||||
install:
|
||||
- ln -s $PWD $HOME/Arduino/libraries/.
|
||||
- echo "dot_a_linkage=true" >> library.properties
|
||||
script:
|
||||
- arduino-cli compile --verbose --warnings all --fqbn $BOARD $PWD/examples/EthernetHTTPS
|
||||
- arduino-cli compile --verbose --warnings all --fqbn $BOARD $PWD/examples/EthernetMultiHTTPS
|
||||
|
@ -40,13 +36,14 @@ before_deploy:
|
|||
- rm -rf .git
|
||||
- find src/ -iname "*.c" -delete
|
||||
- find src/ -iname "*.cpp" -delete
|
||||
- zip -r SSLClient.zip .
|
||||
- zip -r SSLClient-$BOARD_NAME.zip .
|
||||
deploy:
|
||||
provider: releases
|
||||
api_key: $GITHUB_TOKEN
|
||||
file: "SSLClient.zip"
|
||||
file: "SSLClient-$BOARD_NAME.zip"
|
||||
skip_cleanup: true
|
||||
on:
|
||||
tags: true
|
||||
branch: master
|
||||
condition: $DEPLOY = 1
|
||||
draft: true
|
||||
overwrite: true
|
||||
# on:
|
||||
# tags: true
|
||||
# branch: master
|
||||
|
|
|
@ -8,4 +8,3 @@ category=Communication
|
|||
url=https://github.com/OPEnSLab-OSU/SSLClient
|
||||
architectures=samd,tivac
|
||||
includes=SSLClient.h
|
||||
dot_a_linkage=true
|
||||
|
|
|
@ -20,37 +20,6 @@
|
|||
|
||||
#include "SSLClient.h"
|
||||
|
||||
#if defined(ARDUINO_ARCH_SAMD)
|
||||
// system reset definitions
|
||||
static constexpr auto SYSRESETREQ = (1<<2);
|
||||
static constexpr auto VECTKEY = (0x05fa0000UL);
|
||||
static constexpr auto VECTKEY_MASK = (0x0000ffffUL);
|
||||
/** Trigger a software reset. Only use if in unrecoverable state */
|
||||
[[ noreturn ]] static void RESET() {
|
||||
(*(uint32_t*)0xe000ed0cUL)=((*(uint32_t*)0xe000ed0cUL)&VECTKEY_MASK)|VECTKEY|SYSRESETREQ;
|
||||
while(1) { }
|
||||
}
|
||||
|
||||
#ifdef __arm__
|
||||
// should use uinstd.h to define sbrk but Due causes a conflict
|
||||
extern "C" char* sbrk(int incr);
|
||||
#else // __ARM__
|
||||
extern char *__brkval;
|
||||
#endif // __arm__
|
||||
|
||||
/** Get the free memory availible in bytes (stack - heap) */
|
||||
static int freeMemory() {
|
||||
char top;
|
||||
#ifdef __arm__
|
||||
return &top - reinterpret_cast<char*>(sbrk(0));
|
||||
#elif defined(CORE_TEENSY) || (ARDUINO > 103 && ARDUINO != 151)
|
||||
return &top - __brkval;
|
||||
#else // __arm__
|
||||
return __brkval ? &top - __brkval : &top - __malloc_heap_start;
|
||||
#endif // __arm__
|
||||
}
|
||||
#endif // ARDUINO_ARCH_SAMD
|
||||
|
||||
/* see SSLClient.h */
|
||||
SSLClient::SSLClient( Client& client,
|
||||
const br_x509_trust_anchor *trust_anchors,
|
||||
|
@ -567,31 +536,6 @@ unsigned SSLClient::m_update_engine() {
|
|||
// do we have the record you're looking for?
|
||||
const auto avail = get_arduino_client().available();
|
||||
if (avail > 0) {
|
||||
#if defined(ARDUINO_ARCH_SAMD)
|
||||
int mem = freeMemory();
|
||||
// check for a stack overflow
|
||||
// if the stack overflows we basically have to crash, and
|
||||
// hope the user is ok with that
|
||||
// since all memory is garbage we can't trust the cpu to
|
||||
// execute anything properly
|
||||
if (mem > 32 * 1024) {
|
||||
// software reset
|
||||
RESET();
|
||||
}
|
||||
// debug info
|
||||
m_info("Memory: ", func_name);
|
||||
m_info(mem, func_name);
|
||||
// free memory check
|
||||
// BearSSL takes up so much memory on the stack it tends
|
||||
// to overflow if there isn't at least 7000 bytes available
|
||||
// when it starts
|
||||
if(mem < 7000) {
|
||||
m_error("Out of memory! Decrease the number of sessions or the size of m_iobuf", func_name);
|
||||
setWriteError(SSL_OUT_OF_MEMORY);
|
||||
stop();
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
// I suppose so!
|
||||
int rlen = get_arduino_client().read(buf, avail < len ? avail : len);
|
||||
if (rlen <= 0) {
|
||||
|
|
|
@ -47,8 +47,8 @@
|
|||
* substantially more efficient than 32-bit multiplications that yield
|
||||
* 64-bit results. This is typically the case on low-end ARM Cortex M
|
||||
* systems (M0, M0+, M1, and arguably M3 and M4 as well).
|
||||
*/
|
||||
#define BR_LOMUL 1
|
||||
*/
|
||||
|
||||
/*
|
||||
* When BR_SLOW_MUL is enabled, multiplications are assumed to be
|
||||
|
@ -177,7 +177,9 @@
|
|||
* Note: if BR_LOMUL is not explicitly enabled or disabled, then
|
||||
* enabling BR_ARMEL_CORTEXM_GCC also enables BR_LOMUL.
|
||||
*/
|
||||
#if defined(__arm__) && defined(__thumb__)
|
||||
#define BR_ARMEL_CORTEXM_GCC 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
* When BR_AES_X86NI is enabled, the AES implementation using the x86 "NI"
|
||||
|
|
Loading…
Reference in a new issue