platformio

This commit is contained in:
iranl
2024-04-23 20:38:15 +02:00
parent 3d211c64b4
commit d50520aac7
13 changed files with 170 additions and 1639 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,53 +1,79 @@
name: Build using Github Actions name: Build using Github Actions
on: [push, pull_request] on: [push, pull_request]
jobs: jobs:
build-source: build:
name: Checkout source code and build name: Checkout source code and build
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v4
with: with:
submodules: recursive submodules: recursive
- name: Install dependencies - uses: actions/cache@v4
run: |
sudo apt-get update
sudo apt-get install -y python3-serial cmake
- name: Install Arduino IDE
run: |
curl -L https://downloads.arduino.cc/arduino-1.8.19-linux64.tar.xz -o /tmp/arduino-ide.tar.xz
tar -xf /tmp/arduino-ide.tar.xz --directory ~/
cd ~/arduino*
./install.sh
./arduino --pref "boardsmanager.additional.urls=https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json" --save-prefs
./arduino --install-boards esp32:esp32:2.0.15
- name: Install Arduino CMake Toolchain
uses: actions/checkout@v2
with: with:
repository: technyon/Arduino-CMake-Toolchain path: |
path: arduino-toolchain ~/.cache/pip
- name: Build ~/.platformio/.cache
run: | key: ${{ runner.os }}-pio
mkdir -p build - uses: actions/setup-python@v5
cd build
touch file_opts
cmake -D CMAKE_TOOLCHAIN_FILE=../arduino-toolchain/Arduino-toolchain.cmake ..
echo "# Espressif ESP32 Partition Table" > partitions.csv
echo "# Name, Type, SubType, Offset, Size, Flags" >> partitions.csv
echo "nvs, data, nvs, 0x9000, 0x5000," >> partitions.csv
echo "otadata, data, ota, 0xe000, 0x2000," >> partitions.csv
echo "app0, app, ota_0, 0x10000, 0x1E0000," >> partitions.csv
echo "app1, app, ota_1, 0x1F0000,0x1E0000," >> partitions.csv
echo "spiffs, data, spiffs, 0x3D0000,0x30000," >> partitions.csv
make
- name: Upload artifacts
run: |
mkdir release
cp build/nuki_hub.bin release/
cp build/nuki_hub.partitions.bin release/
cp $(find ~/.arduino15/packages/esp32/ | grep boot_app0.bin) release/
echo "esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size detect 0xe000 boot_app0.bin 0x1000 bootloader_dio_80m.bin 0x10000 nuki_hub.bin 0x8000 nuki_hub.partitions.bin" > release/flash.sh
- uses: actions/upload-artifact@v3
with: with:
name: release-assets python-version: '3.9'
path: release/ - name: Install PlatformIO Core
run: pip install --upgrade platformio
- name: Install ESPTool
run: pip install --upgrade esptool
- name: Build PlatformIO Project esp32dev
run: |
pio run --environment esp32dev
mkdir -p release/esp32dev
cp .pio/build/esp32dev/firmware.bin release/esp32dev/nuki_hub.bin
cp .pio/build/esp32dev/partitions.bin release/esp32dev/nuki_hub.partitions.bin
cp .pio/build/esp32dev/bootloader.bin release/esp32dev/bootloader.bin
esptool.py --chip esp32 merge_bin -o release/esp32dev/nuki_hub_esp32.bin --flash_mode dio --flash_freq keep --flash_size keep 0x1000 release/esp32dev/bootloader.bin 0x10000 release/esp32dev/nuki_hub.bin 0x8000 release/esp32dev/nuki_hub.partitions.bin
echo "esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq keep --flash_size detect 0x1000 bootloader.bin 0x10000 nuki_hub.bin 0x8000 nuki_hub.partitions.bin" > release/esp32dev/flash.sh
- name: Build PlatformIO Project esp32-s3
run: |
pio run --environment esp32-s3
mkdir -p release/esp32-s3
cp .pio/build/esp32-s3/firmware.bin release/esp32-s3/nuki_hub.bin
cp .pio/build/esp32-s3/partitions.bin release/esp32-s3/nuki_hub.partitions.bin
cp .pio/build/esp32-s3/bootloader.bin release/esp32-s3/bootloader.bin
esptool.py --chip esp32s3 merge_bin -o release/esp32-s3/nuki_hub_esp32s3.bin --flash_mode dio --flash_freq keep --flash_size keep 0x0 release/esp32-s3/bootloader.bin 0x10000 release/esp32-s3/nuki_hub.bin 0x8000 release/esp32-s3/nuki_hub.partitions.bin
echo "esptool.py --chip esp32s3 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq keep --flash_size detect 0x0 bootloader.bin 0x10000 nuki_hub.bin 0x8000 nuki_hub.partitions.bin" > release/esp32-s3/flash.sh
- name: Build PlatformIO Project esp32-c3
run: |
pio run --environment esp32-c3
mkdir -p release/esp32-c3
cp .pio/build/esp32-c3/firmware.bin release/esp32-c3/nuki_hub.bin
cp .pio/build/esp32-c3/partitions.bin release/esp32-c3/nuki_hub.partitions.bin
cp .pio/build/esp32-c3/bootloader.bin release/esp32-c3/bootloader.bin
esptool.py --chip esp32c3 merge_bin -o release/esp32-c3/nuki_hub_esp32c3.bin --flash_mode dio --flash_freq keep --flash_size keep 0x0 release/esp32-c3/bootloader.bin 0x10000 release/esp32-c3/nuki_hub.bin 0x8000 release/esp32-c3/nuki_hub.partitions.bin
echo "esptool.py --chip esp32c3 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq keep --flash_size detect 0x0 bootloader.bin 0x10000 nuki_hub.bin 0x8000 nuki_hub.partitions.bin" > release/esp32-c3/flash.sh
- name: Build PlatformIO Project esp32solo1
run: |
pio run --environment esp32solo1
mkdir -p release/esp32solo1
cp .pio/build/esp32solo1/firmware.bin release/esp32solo1/nuki_hub.bin
cp .pio/build/esp32solo1/partitions.bin release/esp32solo1/nuki_hub.partitions.bin
cp .pio/build/esp32solo1/bootloader.bin release/esp32solo1/bootloader.bin
esptool.py --chip esp32 merge_bin -o release/esp32solo1/nuki_hub_esp32solo1.bin --flash_mode dio --flash_freq keep --flash_size keep 0x1000 release/esp32solo1/bootloader.bin 0x10000 release/esp32solo1/nuki_hub.bin 0x8000 release/esp32solo1/nuki_hub.partitions.bin
echo "esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq keep --flash_size detect 0x1000 bootloader.bin 0x10000 nuki_hub.bin 0x8000 nuki_hub.partitions.bin" > release/esp32solo1/flash.sh
- name: Upload Artifact esp32dev
uses: actions/upload-artifact@v4
with:
name: esp32dev-assets
path: release/esp32dev
- name: Upload Artifact esp32-s3
uses: actions/upload-artifact@v4
with:
name: esp32-s3-assets
path: release/esp32-s3
- name: Upload Artifact esp32-c3
uses: actions/upload-artifact@v4
with:
name: esp32-c3-assets
path: release/esp32-c3
- name: Upload Artifact esp32solo1
uses: actions/upload-artifact@v4
with:
name: esp32solo1-assets
path: release/esp32solo1

View File

@@ -131,56 +131,56 @@ private:
{ {
s.concat(description); s.concat(description);
s.concat(": "); s.concat(": ");
s.concat(isRedacted(key) ? redact(preferences->getChar(key)) : String(preferences->getChar(key))); s.concat(isRedacted(key) ? redact((const int32_t)preferences->getChar(key)) : String(preferences->getChar(key)));
s.concat("\n"); s.concat("\n");
} }
const void appendPreferenceUInt8(Preferences *preferences, String& s, const char* description, const char* key) const void appendPreferenceUInt8(Preferences *preferences, String& s, const char* description, const char* key)
{ {
s.concat(description); s.concat(description);
s.concat(": "); s.concat(": ");
s.concat(isRedacted(key) ? redact(preferences->getUChar(key)) : String(preferences->getUChar(key))); s.concat(isRedacted(key) ? redact((const uint32_t)preferences->getUChar(key)) : String(preferences->getUChar(key)));
s.concat("\n"); s.concat("\n");
} }
const void appendPreferenceInt16(Preferences *preferences, String& s, const char* description, const char* key) const void appendPreferenceInt16(Preferences *preferences, String& s, const char* description, const char* key)
{ {
s.concat(description); s.concat(description);
s.concat(": "); s.concat(": ");
s.concat(isRedacted(key) ? redact(preferences->getShort(key)) : String(preferences->getShort(key))); s.concat(isRedacted(key) ? redact((const int32_t)preferences->getShort(key)) : String(preferences->getShort(key)));
s.concat("\n"); s.concat("\n");
} }
const void appendPreferenceUInt16(Preferences *preferences, String& s, const char* description, const char* key) const void appendPreferenceUInt16(Preferences *preferences, String& s, const char* description, const char* key)
{ {
s.concat(description); s.concat(description);
s.concat(": "); s.concat(": ");
s.concat(isRedacted(key) ? redact(preferences->getUShort(key)) : String(preferences->getUShort(key))); s.concat(isRedacted(key) ? redact((const uint32_t)preferences->getUShort(key)) : String(preferences->getUShort(key)));
s.concat("\n"); s.concat("\n");
} }
const void appendPreferenceInt32(Preferences *preferences, String& s, const char* description, const char* key) const void appendPreferenceInt32(Preferences *preferences, String& s, const char* description, const char* key)
{ {
s.concat(description); s.concat(description);
s.concat(": "); s.concat(": ");
s.concat(isRedacted(key) ? redact(preferences->getInt(key)) : String(preferences->getInt(key))); s.concat(isRedacted(key) ? redact((const int32_t)preferences->getInt(key)) : String(preferences->getInt(key)));
s.concat("\n"); s.concat("\n");
} }
const void appendPreferenceUInt32(Preferences *preferences, String& s, const char* description, const char* key) const void appendPreferenceUInt32(Preferences *preferences, String& s, const char* description, const char* key)
{ {
s.concat(description); s.concat(description);
s.concat(": "); s.concat(": ");
s.concat(isRedacted(key) ? redact(preferences->getUInt(key)) : String(preferences->getUInt(key))); s.concat(isRedacted(key) ? redact((const uint32_t)preferences->getUInt(key)) : String(preferences->getUInt(key)));
s.concat("\n"); s.concat("\n");
} }
const void appendPreferenceInt64(Preferences *preferences, String& s, const char* description, const char* key) const void appendPreferenceInt64(Preferences *preferences, String& s, const char* description, const char* key)
{ {
s.concat(description); s.concat(description);
s.concat(": "); s.concat(": ");
s.concat(isRedacted(key) ? redact(preferences->getLong64(key)) : String(preferences->getLong64(key))); s.concat(isRedacted(key) ? redact((const int64_t)preferences->getLong64(key)) : String(preferences->getLong64(key)));
s.concat("\n"); s.concat("\n");
} }
const void appendPreferenceUInt64(Preferences *preferences, String& s, const char* description, const char* key) const void appendPreferenceUInt64(Preferences *preferences, String& s, const char* description, const char* key)
{ {
s.concat(description); s.concat(description);
s.concat(": "); s.concat(": ");
s.concat(isRedacted(key) ? redact(preferences->getULong64(key)) : String(preferences->getULong64(key))); s.concat(isRedacted(key) ? redact((const uint64_t)preferences->getULong64(key)) : String(preferences->getULong64(key)));
s.concat("\n"); s.concat("\n");
} }
const void appendPreferenceBool(Preferences *preferences, String& s, const char* description, const char* key) const void appendPreferenceBool(Preferences *preferences, String& s, const char* description, const char* key)
@@ -194,7 +194,7 @@ private:
{ {
s.concat(description); s.concat(description);
s.concat(": "); s.concat(": ");
s.concat(isRedacted(key) ? redact(preferences->getString(key)) : preferences->getString(key)); s.concat(isRedacted(key) ? redact((const String)preferences->getString(key)) : preferences->getString(key));
s.concat("\n"); s.concat("\n");
} }
@@ -254,4 +254,4 @@ public:
return s; return s;
} }
}; };

View File

@@ -15,7 +15,8 @@ Feel free to join us on Discord: https://discord.gg/feB9FnMY
## Supported devices ## Supported devices
<b>Supported ESP32 devices:</b> <b>Supported ESP32 devices:</b>
- All dual-core ESP32 models with WIFI and BLE which are supported by Arduino Core 2.0.15 should work, but builds are currently only provided for the ESP32 and not for the ESP32-S3 or ESP32-C3. - All dual-core ESP32 models with WIFI and BLE which are supported by Arduino Core 2.0.15 should work. Tested builds are provided for the ESP32 and ESP32-S3.
- Single-core ESP32 models with WIFI and BLE which are supported by Arduino Core 2.0.15 might work. Untested builds are provided for the ESP32-C3 and ESP32-Solo1.
- The ESP32-S2 has no BLE and as such can't run Nuki Hub. - The ESP32-S2 has no BLE and as such can't run Nuki Hub.
- The ESP32-C6 and ESP32-H2 are not supported by Arduino Core 2.0.15 as such can't run Nuki Hub (at this time). - The ESP32-C6 and ESP32-H2 are not supported by Arduino Core 2.0.15 as such can't run Nuki Hub (at this time).
@@ -46,8 +47,9 @@ Please go to "MQTT and Network Configuration" and select "Wi-Fi only" as the net
Flash the firmware to an ESP32. The easiest way to install is to use the web installer using a compatible browser like Chrome/Opera/Edge:<br> Flash the firmware to an ESP32. The easiest way to install is to use the web installer using a compatible browser like Chrome/Opera/Edge:<br>
https://technyon.github.io/nuki_hub/<br> https://technyon.github.io/nuki_hub/<br>
NOTE: Webflash is not available for the ESP32-Solo1<br>
<br> <br>
Alternatively download the latest release from https://github.com/technyon/nuki_hub/releases<br> Alternatively download the latest release for your ESP32 model from https://github.com/technyon/nuki_hub/releases<br>
Unpack the 7z archive and read the included readme.txt for installation instructions for either "Espressif Flash Download Tools" or "esptool". Unpack the 7z archive and read the included readme.txt for installation instructions for either "Espressif Flash Download Tools" or "esptool".
## Initial setup (Network and MQTT) ## Initial setup (Network and MQTT)
@@ -455,6 +457,7 @@ Reported as working are:
- [M5Stack ATOM Lite](https://shop.m5stack.com/products/atom-lite-esp32-development-kit) - [M5Stack ATOM Lite](https://shop.m5stack.com/products/atom-lite-esp32-development-kit)
- ESP32-WROOM-32D (DEVKIT V4) - ESP32-WROOM-32D (DEVKIT V4)
- ESP32-WROOM-32E - ESP32-WROOM-32E
- ESP32-S3-WROOM-1
For more information check the related issue: https://github.com/technyon/nuki_hub/issues/39 For more information check the related issue: https://github.com/technyon/nuki_hub/issues/39

View File

@@ -332,7 +332,7 @@ void setup() {
Serial.begin(9600); Serial.begin(9600);
// start the Ethernet connection: // start the Ethernet connection:
if (Ethernet.begin(mac) == 0) { if (Ethernet.begin(mac) == 0) {
Serial.println("Failure to configure Ethernet using DHCP"); Serial.println("Failed to configure Ethernet using DHCP");
// no point in carrying on, so do nothing forevermore: // no point in carrying on, so do nothing forevermore:
for(;;) for(;;)
; ;

View File

@@ -1,5 +1,5 @@
name=Ethernet name=Ethernet
version=2.0.0 version=2.0.2
author=Various (see AUTHORS file for details) author=Various (see AUTHORS file for details)
maintainer=Arduino <info@arduino.cc> maintainer=Arduino <info@arduino.cc>
sentence=Enables network connection (local and Internet) using the Arduino Ethernet Board or Shield. sentence=Enables network connection (local and Internet) using the Arduino Ethernet Board or Shield.
@@ -7,4 +7,4 @@ paragraph=With this library you can use the Arduino Ethernet (shield or board) t
category=Communication category=Communication
url=https://www.arduino.cc/en/Reference/Ethernet url=https://www.arduino.cc/en/Reference/Ethernet
architectures=* architectures=*
includes=Ethernet.h includes=Ethernet.h

View File

@@ -32,6 +32,7 @@ void DhcpClass::reset_DHCP_lease()
memset(_dhcpDhcpServerIp, 0, sizeof(_dhcpDhcpServerIp)); memset(_dhcpDhcpServerIp, 0, sizeof(_dhcpDhcpServerIp));
memset(_dhcpDnsServerIp, 0, sizeof(_dhcpDnsServerIp)); memset(_dhcpDnsServerIp, 0, sizeof(_dhcpDnsServerIp));
} }
//return:0 on error, 1 if request is sent and response is received //return:0 on error, 1 if request is sent and response is received
int DhcpClass::request_DHCP_lease() int DhcpClass::request_DHCP_lease()
{ {
@@ -433,4 +434,4 @@ void DhcpClass::printByte(char * buf, uint8_t n )
char c = m - 16 * n; char c = m - 16 * n;
*str-- = c < 10 ? c + '0' : c + 'A' - 10; *str-- = c < 10 ? c + '0' : c + 'A' - 10;
} while(n); } while(n);
} }

View File

@@ -87,14 +87,10 @@ void EthernetClass::begin(uint8_t *mac, IPAddress ip, IPAddress dns, IPAddress g
W5100.setIPAddress(&ip[0]); W5100.setIPAddress(&ip[0]);
W5100.setGatewayIp(&gateway[0]); W5100.setGatewayIp(&gateway[0]);
W5100.setSubnetMask(&subnet[0]); W5100.setSubnetMask(&subnet[0]);
#elif ARDUINO > 106 || TEENSYDUINO > 121
W5100.setIPAddress(ip._address.bytes);
W5100.setGatewayIp(gateway._address.bytes);
W5100.setSubnetMask(subnet._address.bytes);
#else #else
W5100.setIPAddress(ip._address); W5100.setIPAddress(ip.raw_address());
W5100.setGatewayIp(gateway._address); W5100.setGatewayIp(gateway.raw_address());
W5100.setSubnetMask(subnet._address); W5100.setSubnetMask(subnet.raw_address());
#endif #endif
SPI.endTransaction(); SPI.endTransaction();
_dnsServerAddress = dns; _dnsServerAddress = dns;
@@ -244,4 +240,4 @@ void EthernetClass::setRetransmissionCount(uint8_t num)
EthernetClass Ethernet; EthernetClass Ethernet;

1
partitions.csv Normal file
View File

@@ -0,0 +1 @@
# Espressif ESP32 Partition Table
1 # Espressif ESP32 Partition Table # Name Type SubType Offset Size Flags nvs data nvs 0x9000 0x5000 otadata data ota 0xe000 0x2000 app0 app ota_0 0x10000 0x1E0000 app1 app ota_1 0x1F0000 0x1E0000 #spiffs data spiffs 0x3D0000 0x30000 spiffs data spiffs 0x3D0000 0x20000 coredump data coredump 0x3F0000 0x10000

64
platformio.ini Normal file
View File

@@ -0,0 +1,64 @@
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[platformio]
default_envs = esp32dev
src_dir = .
[env]
platform = espressif32
framework = arduino
build_type = release
board_build.partitions = partitions.csv
build_flags =
-fexceptions
-DTLS_CA_MAX_SIZE=2200
-DTLS_CERT_MAX_SIZE=1500
-DTLS_KEY_MAX_SIZE=1800
-DESP_PLATFORM
-DESP32
-DARDUINO_ARCH_ESP32
-DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_NONE
-DCONFIG_NIMBLE_CPP_LOG_LEVEL=0
; -DDEBUG_SENSE_NUKI
; -DDEBUG_NUKI_COMMAND
; -DDEBUG_NUKI_CONNECT
; -DDEBUG_NUKI_COMMUNICATION
; -DDEBUG_NUKI_HEX_DATA
; -DDEBUG_NUKI_READABLE_DATA
lib_deps =
https://github.com/technyon/nuki_ble.git
bertmelis/espMqttClient@1.6.0
bblanchon/ArduinoJson@7.0.4
monitor_speed = 115200
monitor_filters =
esp32_exception_decoder
time
build_src_filter =
-<*>
+<*.cpp>
+<*.h>
+<networkDevices>
[env:esp32dev]
board = esp32dev
[env:esp32-c3]
board = esp32-c3-devkitc-02
[env:esp32solo1]
platform = https://github.com/tasmota/platform-espressif32/releases/download/2023.10.03/platform-espressif32-2023.10.03.zip
board = esp32-solo1
build_flags =
${env.build_flags}
-DFRAMEWORK_ARDUINO_SOLO1
[env:esp32-s3]
board = esp32-s3-devkitc-1

View File

@@ -10,6 +10,18 @@
{ "path": "nuki_hub.bin", "offset": 65536 }, { "path": "nuki_hub.bin", "offset": 65536 },
{ "path": "nuki_hub.partitions.bin", "offset": 32768 } { "path": "nuki_hub.partitions.bin", "offset": 32768 }
] ]
},
{
"chipFamily": "ESP32-S3",
"parts": [
{ "path": "nuki_hub_esp32s3.bin", "offset": 0 },
]
},
{
"chipFamily": "ESP32-C3",
"parts": [
{ "path": "nuki_hub_esp32c3.bin", "offset": 0 },
]
} }
] ]
} }

Binary file not shown.

Binary file not shown.