Skip to content

Commit

Permalink
port: support ESP32 v3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
yoursunny committed Jun 6, 2024
1 parent f9485ba commit e6da059
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 24 deletions.
23 changes: 10 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,24 @@ jobs:
include:
- chip: ESP8266
core-url: https://arduino.esp8266.com/stable/package_esp8266com_index.json
core: esp8266:esp8266
fqbn: esp8266:esp8266:nodemcuv2
- chip: ESP32
core-url: https://espressif.github.io/arduino-esp32/package_esp32_index.json
core-version: '@2.0.17'
fqbn: esp32:esp32:esp32wrover
build-args: --build-property=build.partitions=default_ffat
core: esp32:esp32
fqbn: esp32:esp32:esp32wrover:PartitionScheme=noota_ffat
arduino-libs: NimBLE-Arduino
- chip: ESP32S2
core-url: https://espressif.github.io/arduino-esp32/package_esp32_index.json
core-version: '@2.0.17'
fqbn: esp32:esp32:adafruit_magtag29_esp32s2
build-args: --build-property=build.partitions=default_ffat
core: esp32:esp32@2.0.17
fqbn: esp32:esp32:adafruit_magtag29_esp32s2:PartitionScheme=noota_ffat
- chip: ESP32C3
core-url: https://espressif.github.io/arduino-esp32/package_esp32_index.json
core-version: '@2.0.17'
fqbn: esp32:esp32:esp32c3
build-args: --build-property=build.partitions=default_ffat
core: esp32:esp32
fqbn: esp32:esp32:esp32c3:PartitionScheme=noota_ffat
arduino-libs: NimBLE-Arduino
- chip: nRF52
core: adafruit:nrf52
fqbn: adafruit:nrf52:feather52832
core-url: https://adafruit.github.io/arduino-board-index/package_adafruit_index.json
pip-deps: adafruit-nrfutil
Expand All @@ -55,9 +54,7 @@ jobs:
key: cores-${{ steps.cores.outputs.d }}
- name: Install Arduino cores
run: |
FQBN=${{ matrix.fqbn }}
COREVER=${{ matrix.core-version }}
arduino-cli core install ${FQBN%:*}$COREVER --additional-urls "${{ matrix.core-url }}"
arduino-cli core install ${{ matrix.core }} --additional-urls "${{ matrix.core-url }}"
echo ${{ matrix.pip-deps }} | xargs -r pip install
echo ArduinoUnit ${{ matrix.arduino-libs }} | xargs -rn1 arduino-cli lib install
- uses: actions/checkout@v4
Expand All @@ -73,7 +70,7 @@ jobs:
NDNPH_VERSION: develop
- name: Compile examples
run: |
mk/ci-list.sh ${{ matrix.chip }} ${{ matrix.fqbn }} "${{ matrix.build-args }}" | bash
mk/ci-list.sh ${{ matrix.chip }} ${{ matrix.fqbn }} | bash
publish:
needs: [build]
runs-on: ubuntu-22.04
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

**esp8266ndn** library enables [Named Data Networking](https://named-data.net/) application development in Arduino environment. It supports [ESP8266](https://github.com/esp8266/Arduino), [ESP32, ESP32-S2, ESP32-C3](https://github.com/espressif/arduino-esp32), and [Adafruit nRF52](https://github.com/adafruit/Adafruit_nRF52_Arduino) microcontrollers.

Note: currently NDNph and esp8266ndn are compatible with ESP32 Arduino core v2.x; it is incompatible with ESP32 Arduino core v3.x at the moment.

* [Doxygen documentation](https://esp8266ndn.ndn.today/)
* [#esp8266ndn on Twitter](https://twitter.com/hashtag/esp8266ndn) for announcements
* [GitHub Issues](https://github.com/yoursunny/esp8266ndn) for bug reports and best-effort support
Expand Down
4 changes: 2 additions & 2 deletions examples/BlePingServer/.ci.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"ESP8266": [],
"ESP32": [
"",
"--build-property=compiler.cpp.extra_flags=-DDEMO_BLEPINGSERVER_DISABLE_NIMBLE=1"
"--build-property=build.defines=-DDEMO_BLEPINGSERVER_DISABLE_NIMBLE=1"
],
"ESP32S2": [],
"ESP32C3": [
"",
"--build-property=compiler.cpp.extra_flags=-DDEMO_BLEPINGSERVER_DISABLE_NIMBLE=1"
"--build-property=build.defines=-DDEMO_BLEPINGSERVER_DISABLE_NIMBLE=1"
]
}
5 changes: 2 additions & 3 deletions mk/ci-list.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,21 @@ set -euo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")"/..
CHIP=$1
FQBN=$2
BUILDARGS="$3"

echo 'set -euo pipefail'
for E in $(find ./examples -name '*.ino' -printf '%h\n'); do
if [[ -f $E/.ci.json ]]; then
cat $E/.ci.json
else
echo '{}'
fi | jq -r --arg chip $CHIP --arg fqbn $FQBN --arg sketch $E --arg buildArgs "$BUILDARGS" '
fi | jq -r --arg chip $CHIP --arg fqbn $FQBN --arg sketch $E '
.[$chip] // [""] | .[] |
[
"printf \"\\n----\\033[1;35m Build " +
($sketch | sub(".*/"; "")) + " in " + $fqbn +
(if .!="" then " with " + . else "" end) +
" \\033[0m----\\n\"",
"arduino-cli compile -b " + $fqbn + " --warnings more " + $sketch + " " + $buildArgs + " " + .
"arduino-cli compile -b " + $fqbn + " --warnings more " + $sketch + " " + .
] | .[]
'
done
2 changes: 1 addition & 1 deletion src/port/random.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#if defined(ARDUINO_ARCH_ESP8266)
#include <Arduino.h>
#elif defined(ARDUINO_ARCH_ESP32)
#include <esp_system.h>
#include <esp_random.h>
#elif defined(ARDUINO_ARCH_NRF52)
#include <Arduino.h>
#include <algorithm>
Expand Down
6 changes: 3 additions & 3 deletions src/transport/ble-server-transport.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class BleServerTransport : public BleServerTransportBase {

/** @brief Retrieve BLE address and address type. */
String getAddr() const {
return String(::BLEDevice::getAddress().toString().data()) + " (addr-type=public)";
return String(::BLEDevice::getAddress().toString().c_str()) + " (addr-type=public)";
}

private:
Expand Down Expand Up @@ -102,8 +102,8 @@ class BleServerTransport : public BleServerTransportBase {
if (chr != m_transport.m_cs) {
return;
}
std::string value = chr->getValue();
m_transport.handleReceive(reinterpret_cast<const uint8_t*>(value.data()), value.size(), 0);
auto value = chr->getValue();
m_transport.handleReceive(reinterpret_cast<const uint8_t*>(value.c_str()), value.length(), 0);
}

private:
Expand Down

0 comments on commit e6da059

Please sign in to comment.