Skip to content

Commit

Permalink
Merge remote-tracking branch 'arduino/master' into sync-upstream
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGELOG
#	README.md
#	arduino/cores/esp32/wiring_digital.h
#	arduino/libraries/WiFi/src/WiFi.cpp
#	arduino/libraries/WiFi/src/WiFi.h
#	arduino/libraries/WiFi/src/WiFiClient.cpp
#	combine.py
#	data/roots.pem
#	main/CommandHandler.cpp
#	main/sketch.ino.cpp
#	sdkconfig
  • Loading branch information
hathach committed Dec 19, 2023
2 parents b1145b4 + feca160 commit 338408f
Show file tree
Hide file tree
Showing 376 changed files with 81,800 additions and 127 deletions.
82 changes: 82 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Changelog

## Adafruit firmware

Adafruit's Arduino NINA-W102 firmware 1.7.7 - 2023.09.20

* Change to use adafruit/certificates repo for roots.pem
Expand Down Expand Up @@ -61,6 +65,84 @@ Adafruit's Arduino NINA-W102 firmware 1.2.2 - 2019.02.28

* First official Adafruit release

## Arduino firmware

Arduino NINA-W102 firmware 1.5.0 - 2022.07.09

* Add BSD-like sockets APIs (on command range 0x70 -> 0x7f)
* Fix ADC readings range (fuill scale range is now ~2.7V)

Arduino NINA-W102 firmware 1.4.8 - 2021.07.29

* Fix issue due to repeated status()/connected() call (#73)

Arduino NINA-W102 firmware 1.4.7 - 2021.06.18

Functionally identical with 1.4.6, except version number.

This release was made necessary because bad arguments were used with the FirmwareUploader tool
on Arduino Cloud for updating NINA-FWs (effectively deleting all certificates except the one
fetched by the tool). Now all Cloud-Connected NINA-FWs need to be updated once more which is
only possible by incrementing the firmware version number.

Arduino NINA-W102 firmware 1.4.6 - 2021.06.09

* Add a new root certificate list including detailed instructions how to update it (#71)

Arduino NINA-W102 firmware 1.4.5 - 2021.05.05

* Adding support for Arduino RP2040 Nano Connect (#67)
* Added ISRG Root X1 for LetsEncrypt (#68)

Arduino NINA-W102 firmware 1.4.4 - 2021.04.13

* Adding support for Arduino RP2040 Nano Connect (#64)

Arduino NINA-W102 firmware 1.4.3 - 2021.01.29

* Do not immediately close connection after 1 failed write (#62)

Arduino NINA-W102 firmware 1.4.2 - 2021.01.28

Port BearSSL + crypto integration to NINA (#57). This allows to offload BearSSL for Arduino IoT Cloud applications to the nina module, drastically saving on flash/RAM.

Arduino NINA-W102 firmware 1.4.1 - 2020.08.17

* Direct download of OTA binary to Nina storage and verifying both CRC and length (#53)

Arduino NINA-W102 firmware 1.4.0 - 2020.07.13

* Adding API which allows to utilize the nina file system as an external storage module for the host CPU (#32)
* Fixing bug leading to packet corruption in situation of high UDP traffic (#49)
* Fixing bug leading to missing packets and connection drop (#50)

Arduino NINA-W102 firmware 1.3.0 - 2019.12.23

* Fixed channel's assignement for WiFi.beginAP(...)
* Fixed set host name API begin connecting to AP
* Updated to IDF v3.3.1
* Added WPA2 Enterprise support (PEAP/MSCHAPv2 + EAP-TLS)

Arduino NINA-W102 firmware 1.2.4 - 2019.06.14

* Disabled CONFIG_LWIP_DHCP_DOES_ARP_CHECK
* Added small delay to WiFiUDP.parsePacket() allow other tasks to run
* Updated to esp-idf v3.3 branch

Arduino NINA-W102 firmware 1.2.3 - 2018.04.09

* Added reason code command to retrieve the disconnect reason code
* WiFiSSLClient: enable SNI via mbedtls_ssl_set_hostname when using hostname

Arduino NINA-W102 firmware 1.2.2 - 2018.03.26

* Changed connections to use WIFI_FAST_SCAN instead of WIFI_ALL_CHANNEL_SCAN
* Changed ASSOC_FAIL error handling, to now try to re-connect
* Added phy_init partition with u-blox recommended phy init data and use
* Fixed socket connections hanging when WiFi is disconnected
* Fixed issues where DNS server could be reset to 0.0.0.0 on WiFi re-connections
* Updated to use esp-idf 3.1.3

Arduino NINA-W102 firmware 1.2.1 - 2018.11.16

* Fixed factory SSL certificates being incorrectly parsed due to OOM caused by Bluetooth inclusion
Expand Down
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ CIRCUITPYTHON_UF2 := circuitpython.uf2

EXTRA_COMPONENT_DIRS := $(PWD)/arduino

CPPFLAGS += -DARDUINO

ifeq ($(RELEASE),1)
CFLAGS += -DNDEBUG -DCONFIG_FREERTOS_ASSERT_DISABLE -Os -DLOG_LOCAL_LEVEL=0
CPPFLAGS += -DNDEBUG -Os
Expand All @@ -22,6 +24,11 @@ CFLAGS += -DUNO_WIFI_REV2
CPPFLAGS += -DUNO_WIFI_REV2
endif

ifeq ($(NANO_RP2040_CONNECT),1)
CFLAGS += -DNANO_RP2040_CONNECT
CPPFLAGS += -DNANO_RP2040_CONNECT
endif

include $(IDF_PATH)/make/project.mk

load-passthrough:
Expand Down
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,33 @@ original Arduino firmware repository.
to load this binary file onto your board.
a. If you do not know how to do this, [we have an excellent guide on the Adafruit Learning System for upgrading your ESP32's firmware](https://learn.adafruit.com/upgrading-esp32-firmware)

## Packaging
The `make` command produces a bunch of binary files that must be flashed at very precise locations, making `esptool` commandline quite complicated.
Instead, once the firmware has been compiled, you can invoke `combine.py` script to produce a monolithic binary that can be flashed at 0x0.
```
make
python combine.py
```
This produces `NINA_W102.bin-{version}` file (a different name can be specified as parameter). To flash this file you can use https://learn.adafruit.com/upgrading-esp32-firmware

## Build a new certificate list (based on the Google Android root CA list)
```bash
git clone https://android.googlesource.com/platform/system/ca-certificates
cp nina-fw/tools/nina-fw-create-roots.sh ca-certificates/files
cd ca-certificates/files
./nina-fw-create-roots.sh
cp roots.pem ../../nina-fw/data/roots.pem
```

## Check certificate list against URL list
```bash
cd tools
./sslcheck.sh -c ../data/roots.pem -l url_lists/url_list_moz.com.txt -e
```

## License

Copyright (c) 2018 Arduino SA. All rights reserved.
Copyright (c) 2018-2019 Arduino SA. All rights reserved.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
Expand Down
4 changes: 2 additions & 2 deletions arduino/component.mk
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
COMPONENT_ADD_INCLUDEDIRS := cores/esp32 libraries/SPIS/src libraries/WiFi/src
COMPONENT_ADD_INCLUDEDIRS := cores/esp32 libraries/SPIS/src libraries/WiFi/src libraries/Wire/src libraries/ArduinoECCX08/src libraries/ArduinoBearSSL/src

COMPONENT_SRCDIRS := cores/esp32 libraries/SPIS/src libraries/WiFi/src
COMPONENT_SRCDIRS := cores/esp32 libraries/SPIS/src libraries/WiFi/src libraries/Wire/src libraries/ArduinoECCX08/src libraries/ArduinoBearSSL/src libraries/ArduinoBearSSL/src/bearssl libraries/ArduinoBearSSL/src/utility
11 changes: 11 additions & 0 deletions arduino/cores/esp32/Arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@
#include <string.h>
#include <math.h>

typedef bool boolean;
typedef uint8_t byte;
typedef uint16_t word;

#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define abs(x) ((x)>0?(x):-(x))


#ifdef __cplusplus
extern "C"{
#endif // __cplusplus
Expand All @@ -42,7 +51,9 @@ void loop(void);
#endif

#ifdef __cplusplus
#include "Stream.h"
#include "WMath.h"
#include "WString.h"
#endif
#include "delay.h"

Expand Down
45 changes: 45 additions & 0 deletions arduino/cores/esp32/Client.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
Client.h - Base class that provides Client
Copyright (c) 2011 Adrian McEwen. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

#ifndef client_h
#define client_h
#include "Print.h"
#include "Stream.h"
#include "IPAddress.h"

class Client : public Stream {

public:
virtual int connect(IPAddress ip, uint16_t port) =0;
virtual int connect(const char *host, uint16_t port) =0;
virtual size_t write(uint8_t) =0;
virtual size_t write(const uint8_t *buf, size_t size) =0;
virtual int available() = 0;
virtual int read() = 0;
virtual int read(uint8_t *buf, size_t size) = 0;
virtual int peek() = 0;
virtual void flush() = 0;
virtual void stop() = 0;
virtual uint8_t connected() = 0;
virtual operator bool() = 0;
protected:
uint8_t* rawIPAddress(IPAddress& addr) { return addr.raw_address(); };
};

#endif
103 changes: 103 additions & 0 deletions arduino/cores/esp32/IPAddress.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
/*
IPAddress.cpp - Base class that provides IPAddress
Copyright (c) 2011 Adrian McEwen. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

#include <Arduino.h>
#include <IPAddress.h>

IPAddress::IPAddress()
{
_address.dword = 0;
}

IPAddress::IPAddress(uint8_t first_octet, uint8_t second_octet, uint8_t third_octet, uint8_t fourth_octet)
{
_address.bytes[0] = first_octet;
_address.bytes[1] = second_octet;
_address.bytes[2] = third_octet;
_address.bytes[3] = fourth_octet;
}

IPAddress::IPAddress(uint32_t address)
{
_address.dword = address;
}

IPAddress::IPAddress(const uint8_t *address)
{
memcpy(_address.bytes, address, sizeof(_address.bytes));
}

bool IPAddress::fromString(const char *address)
{
// TODO: add support for "a", "a.b", "a.b.c" formats

uint16_t acc = 0; // Accumulator
uint8_t dots = 0;

while (*address)
{
char c = *address++;
if (c >= '0' && c <= '9')
{
acc = acc * 10 + (c - '0');
if (acc > 255) {
// Value out of [0..255] range
return false;
}
}
else if (c == '.')
{
if (dots == 3) {
// Too much dots (there must be 3 dots)
return false;
}
_address.bytes[dots++] = acc;
acc = 0;
}
else
{
// Invalid char
return false;
}
}

if (dots != 3) {
// Too few dots (there must be 3 dots)
return false;
}
_address.bytes[3] = acc;
return true;
}

IPAddress& IPAddress::operator=(const uint8_t *address)
{
memcpy(_address.bytes, address, sizeof(_address.bytes));
return *this;
}

IPAddress& IPAddress::operator=(uint32_t address)
{
_address.dword = address;
return *this;
}

bool IPAddress::operator==(const uint8_t* addr) const
{
return memcmp(addr, _address.bytes, sizeof(_address.bytes)) == 0;
}
Loading

0 comments on commit 338408f

Please sign in to comment.