Remove nonos-sdk-v2.2.0-28-g89920dc aka 3v0, since we have a real v3
Remove 3.0.0...3.0.4 to reduce overhead in maintaining a bunch or binary patches
Update our docs and menu opts to mention 'experimental' status
Old versions still remains in git history, so anyone wanting to play around with 3.0.x could still make use of that work
* fix panic not printing
* improve panic to accept 0 lineno
* always present detailed error message
* Added back lost edit
* For SDK v3.0+, adjust conditional build to remove duplicate call
to flashinit from user_init.
* Reslove flash address issues with SDK v3.0.0
Fix EEPROM vs RF_CAL flash address conflict. The EEPROM address and
RF_CAL address were the same.
Add support for Flash size: "Mapping defined by Hardware and Sketch"
Change at_partition_table static from dynamic to static.
* Cleanup and improve comments
* Improve flash size and partition error reporting/indication
Changed set_pll() to mmu_set_pll() and made available for debug builds
and other settings where required.
Provide more checks and feedback in the debug builds and
trim code for production.
* Now supports FLASH_MAP_SUPPORT with SDKs v3.0
RF_CAL and system_parameter always occupy the last 5
sectors of flash memory.
* cleanup and refactoring
comment cleanup
* Add more build issolation when including flash_hal.h
* Improve details for autoconfig fail.
* requested changes
## WPA2 Enterprise connections
References - merged PRs:
* https://github.com/esp8266/Arduino/pull/8529
* https://github.com/esp8266/Arduino/pull/8566 - these occurred with connect/disconnect with WPA-Enterprise
* https://github.com/esp8266/Arduino/pull/8736#issue-1470774550
The NON-OS SDK 3.0.x has breaking changes to the [`pvPortMalloc`](bf890b22e5/include/mem.h (L42)) function. They added a new `bool` argument for selecting a heap.
```cpp
void *pvPortMalloc (size_t sz, const char *, unsigned, bool);
```
To avoid breaking the build, I added a new thin wrapper function `sdk3_pvPortMalloc` to `heap.cpp`.
Edited new SDK LIBs to call `pvPortMalloc`'s replacement `sdk3_pvPortMalloc`.
They also added `pvPortZallocIram` and `pvPortCallocIram`, which are not a problem to support. Support added to `heap.cpp`.
Issues with WPA2 Enterprise in new SDKs:
* v3.0.0 and v3.0.1 - have the same memory leak and duplicate free bugs from before
* v3.0.2 through v3.0.5 - have the same memory leak; however, _no_ duplicate free crash.
* memory leak can be seen by cycling through setup, connect, disconnect, and clear setup - repeatedly.
Updated `wpa2_eap_patch.cpp` and binary patch scripts to handle v3.0.0 through v3.0.5.
Patched SDKs v3.0.0 through v3.0.5
## Duplicate Non-32-bit exception handler
Issue: At v3.0.0 and above `libmain.a` supplies a built-in exception handler (`load_non_32_wide_handler`) for non-32-bit access. Our non-32-bit access handler (`non32xfer_exception_handler`) overrides it.
Solution: Add "weak" attribute to symbol `load_non_32_wide_handler`. Adjust the build to default to the SDK's built-in non-32-bit handler. If there is a need to use our non-32-bit handler, make the selection from the Arduino IDE Tools menu `Non-32-Bit Access: "Byte/Word access to IRAM/PROGMEM (very slow)"`.
With SDKs v3.0.0 and above a "non-32-bit exception handler" is always present.
Previously, File::readString used a C-style string as an intermediate
buffer via the String += operator. This treats a NUL byte as a
terminator, making this function work incorrectly if the File contains
binary data.
This commit switches the function to use String::concat, which doesn't
treat NUL bytes any differently (and is a bit faster, because it doesn't
need to use strlen).
* Enable SPI_CS_SETUP for early ICACHE use
The SPI_CS_SETUP parameter has been observed set by RTOS SDK and NONOS SDK
as part of flash init/configuration. It may be necessary for some flash
chips to perform correctly with ICACHE hardware access. Turning on and
leaving it on should be okay.
* Cleanup comment
* Change umm_init to default to IRAM
Some flash chips (PUYA) have some unknown requirements for running with
early `Cache_Read_Enable`. They work fine after the SDK is started.
For now, change umm_init to default to IRAM.
Define UMM_INIT_USE_ICACHE to move to ICACHE and free up IRAM.
Added some experimental code that may indirectly support PUYA.
Note, until this issue is resolved, that HWDT Stack Dump is not
going to work with PUYA flash.
* typo
* Finalize fix for PUYA flash and preSDK use of Cache_Read_Enable.
This resolves the exception 0 issue with PUYA flash when using
flash/ICACHE for umm_init and/or using HWDT Stack Dump.
* sprinkle IPAddress(...).isSet() across our loops to avoid polling on a
stopped interface. status callback and netif_is_up **does not
guarantee and we could use the interface**!
* register *one* status callback per instance, e.g. when begin() is called
multiple times (also notice a subtle issue with schedule function when
instance is delete'ed)
* consistent LwipIntf callback signature. no need for rvalue, just pass
stdfunc as-is and let the compiler figure it out
Wire everything that relies on stack smashing detection to call
`__stack_chk_fail()` (aka what libssp / ssp / stack-protector uses)
Expose it in our debugging header
Rename overflow -> smashing, as these are different things we are trying
to detect (meaning, that we check for things writing there, not some
kind of `alloca` issue or the way `-fstack-check` would have worked)
ref. #8666
`-fstack-protector` continues to work as it always did
CONT replaces `abort()`, also moves its check to the loop wrapper to
avoid dumping otherwise useless SYS context memory
StackThunk replaces a similar `abort()` call
Create dedicated function for xPortGetFreeHeapSize() that only reports on DRAM.
NONOS SDK API system_get_free_heap_size() relies on xPortGetFreeHeapSize() for the free Heap size.
Possible breaking change for multiple Heap Sketches calling system_get_free_heap_size(); it will now always report free DRAM Heap size.
Update and export umm_free_heap_size_lw() to report the free Heap size of the current Heap.
Updated ESP.getFreeHeap() to use umm_free_heap_size_lw().
Updated build options to supply exported umm_free_heap_size_lw() via either UMM_STATS or UMM_INFO.
Improved build option support via the SketchName.ino.globals.h method for Heap options: UMM_INFO, UMM_INLINE_METRICS, UMM_STATS, UMM_STATS_FULL, UMM_BEST_FIT, and UMM_FIRST_FIT. While uncommon to change from the defaults, you can review umm_malloc_cfgport.h for more details, which may help reduce your Sketch's size in dire situations. Assuming you are willing to give up some functionality.
For debugging UMM_STATS_FULL can offer additional stats, like Heap low water mark (umm_free_heap_size_min()).
Amends #8507
I took the liberty to also do some refactoring; specifically, fixing signed vs. unsigned mismatch in len, using pointer object vs. the original manual malloc & free, try to have named constants for certain addresses and lengths, plus localize printing of u8 arrays.
The suggested test to have a 'dummy' verifier works just fine. (...how it actually works and gets the hash to compare with is a whole other question, though)
Another issue noticed while testing, in the underlying bearssl api there's an actual limit for hash length.
6105635531/inc/bearssl_rsa.h (L257)
* make WiFi/Ethernet interface compatible with Arduino Ethernet API
provide some minimaly adapted examples from legacy
* move ethernet compat globals to EthernetCompat.h
* LegacyEthernet: add UDP example
* adjust comments
Co-authored-by: Max Prokhorov <prokhorov.max@outlook.com>
Separate page handling logic and the actual writing. Make sure we place both unaligned src and dest into a buffer.
Fixes edge-case introduced for SPIFFS that exclusively works through unaligned flash write function.
This copies the behaviour of official RTOS port, but does not change the original spi_flash_write.
* Fix sending NACK, use helper function to fill pbuf
As noticed in https://github.com/esp8266/Arduino/pull/8582#issuecomment-1153331408
Plus, handle the case when `pbuf->len` is less than struct size
* Make sure to call SDK functions to start and stop DHCP server
As noticed in https://github.com/esp8266/Arduino/pull/8582#issuecomment-1153331408
Can't really use `server.begin()` and `server.end()` directly, only
default static IP is applied to the interface since DHCP server is
deemed 'running' (see `wifi_softap_dhcps_status()` return value)
* s
Co-authored-by: david gauchard <gauchard@laas.fr>
* Add FSTools with examples of how to convert between SPIFFS and LITTLEFS.
* Oops. Need to pass layout by reference in order to capture the correct address. Took a while to find that. There maybe a better way to store all these configs
* Update FSTools.cpp
fix ESP.h to Esp.h
* Fix unused variable i
* Parsed with restyle.sh. Compile with all errors.
* remove unused variable
* fix different sign complication error
* Fix indentation to spaces
Run test/restyle.sh
Remove commented code
Use #ifdef blocks for debugging. `DEBUG_ESP_CORE` and `DEBUG_ESP_PORT`
use `static constexpr layout` which saves ROM ~500B for unused vars
* Update FSTools.cpp
Add yield in between file copy
* works
* fixup! works
* back to callbacks
* names
* daisy chain
* seconds
* less inline
* fix dns setter
* might as well keep using initlist
/to d-a-v it has automatic storage, here it's the same stack based one
(just one less line for us)
* shift blame
* naming
* fix impl
* revert to ip4 dns
* merge fix
* restyle
* masking done wrong
* Patch eap.o memory leak
WiFi Enterprise option can leak up to 3 allocations per connect/disconnect
cycle: anonymous Identity, password, and some unidentified allocation.
This solution patches eap.o from libwpa2 to call a special 2 part
wrapper instead of vPortFree for cleanup.
Corrected typos and adjusted tabs in script.
Added script eval_fix_sdks.sh to aid in evaluating similarity between
patch sections of .o files being patched across different SDKs.
* Add some dev debug code and improve comments
* Patch eap.o memory leak
WiFi Enterprise option can leak up to 3 allocations per connect/disconnect
cycle: anonymous Identity, password, and some unidentified allocation.
This solution patches eap.o from libwpa2 to call a special 2 part
wrapper instead of vPortFree for cleanup.
Corrected typos and adjusted tabs in script.
Added script eval_fix_sdks.sh to aid in evaluating similarity between
patch sections of .o files being patched across different SDKs.
* Add some dev debug code and improve comments
* Initialize SoftAP DhcpServer object on demand
Remove dependency on global ctor, and just construct the object when
someone asks us to do it. Only dependency right now is netif_git, which
is expected to be initialized by the lwip code some time before
dhcps_start happens.
Removing ip_info from begin(), since we never reference later on.
Also removing the specific check for netif id and simplify the ctors.
Update tests and recover old nonos-sdk dhcps functions that were not implemented.
* nonos helpers have a separate header
* wifi ap needs this anyway, simplify sketch includes
* missing example
* existing name :/
* trying to fix header dependency
* restyle
* not a c header
* no need to init
* move dhcp server getter to WiFi
more... arduino'ish? we ahve object as namespace, plus everything else
related to softAP is there
redundant includes, redundant mock impl (out-of-scope here to fix)
* ...move things back, still expose as WiFi method
* review fix
* include -nonos header in wifi lib though
* no more lwip include
* style
* need mock dhcpserver instance
* Define lwIP's s32/u32 to int
s32/u32 were previously defined as long,
but long can be 64 bits in host mode,
so this commit reduces valgrind complaints and increase coherency.
* some lads like to use `unsigned long` for 32 bits IPv4 addresses
* fix lwIP's `sys_now()` return type
* fix C declarations
* merge upstream (lwip2) update on sys_now() definition
* matching lwIP api (2/2)
Co-authored-by: Max Prokhorov <prokhorov.max@outlook.com>
The _hash and _verify functionality of the Updater class are pretty much entwined. But it might be useful to calculate the hash, even without a signature present in the image itself. This change permits that by allowing a zero-length signature.
For reference, one possible use case is where the expected hash is provided separately to the uploaded image. Another is to provide generic post-upload validation of the image: the hash function permits a convenient way of inspecting the complete image against arbitrary conditions; this is particularly useful after HTTP client OTA updates.
(It's fair that reading the whole image back out of flash is not very efficient, but that's not the concern of this PR.)
* Test: fixing itoa implementation, clean-up of tests and test runner
Update itoa to be the same as newlib, fixing edgecase of abs(INT_MIN)
Update WString.cpp:toString() integer conversions to use noniso funcs
Remove legacy gcc versions from Makefile and allow overrides
Don't fallback to c11 and c++11, source cannot support that
* CXX and CC are make predefined values, assuming ?= does not work (?)
Restore the pre-3.0.0 behaviour when we could assign numeric values to
the string object. After introducing operator =(char), everything was
converted to char instead of the expected 'stringification' of the
number (built-in int, long, unsigned int, unsigned long, long long,
unsigned long long, float and double)
Add toString() that handles conversions, re-use it through out the class
Fix#8430
Isolate NULL/panic test of _context to dev debug assert macro.
Use abort instead of panic for case of caller providing non-heap address pointer.
Added debug print.
Improved get_unpoisoned_check_neighbors to print file/line when available.
* Heap init code improvements and updates
Moved secondary heap init code to flash.
External -24 IRAM, +32 IROM
IRAM -76 IRAM, +64 IROM
General updates to umm_init call path and DEFINES to better align with
upstream. Name changes: UMM_INIT_HEAP with UMM_CHECK_INITIALIZED,
umm_init_stage_2 with _umm_init_heap, and umm_init_common with umm_init_heap.
Add file umm_cfgport.h to hold port-specific values. Stay focused
on heap initialization only move-related defines.
Improved comments.
Created a wrapper function for running pre-SDK code from flash.
Updated hwdt_app_entry to use it.
Update umm_init with option to run from ICACHE.
Added build define UMM_INIT_USE_ICACHE to move umm_init call path to flash.
When used frees up 160 bytes of IRAM at a cost of 208 bytes of IROM
Defaults to no change, umm_init call path will be in IRAM.
* Changed default to use IROM for umm_init() and option to revert back to UMM_INIT_USE_IRAM.
This avoids the null termination requirement of both String::substring and String::lastIndexOf by using APIs that don't require it. So we can stop writing to the buffer inside of const functions.
I also changed wbuffer to make it non const.
* Fix VM Address mask
Adjust VM Address mask to allow up to 8M Byte parts.
Allow for free heap size values over 64K
ESP.getHeapStats(, uint32_t,)
uint32_t getMaxFreeBlockSize();
* Fix example
* Update MockEsp.cpp for uint32_t on EspClass::getMaxFreeBlockSize()
* Added comment about heap size limitation and static_assert to verify.
Updated boards.txt to show correct External memory size and Heap size.
Upstream umm_malloc at git hash id 4dac43c3be7a7470dd669323021ba238081da18e
processed all project files with the style program uncrustify.
This PR updates our ported version of umm_malloc processed with "uncrustify".
This should make subsequent merges of upstream into this port easier.
This also makes the style more consistant through umm_malloc.
* StreamConstPtr: prevent from passing a temporary String instance
* unconditionally allow progmem chars
* missing virtual destructor in Stream
(warning: deleting object of abstract class type 'Stream' which has non-virtual destructor will cause undefined behavior [-Wdelete-non-virtual-dtor])
Extracted fix from upstream for umm_blocks() - On allocations that were too
large, umm_blocks() could return an incorrectly truncated value when the result
is cast to uint16_t.