* Backport from ESP32
* Use new library layout (.../src)
* Cleanup test case.
* C++ style cast required.
* Whitespace
* Inlining via header has better baseline ROM footprint.
* Reordered functions for better code-compare to master
* Reduces ROM footprint some more.
* Avoid unnecessary parameter passing - refactoring, same generated footprint.
* Reformat example sources
* Add comcat(char*, len) to Sting
Fixes#5061
Adds a concat(const char *data, int len) method which allows arbitrary
sequences of data (including ones w/embedded \0s) to be appended to a
String. May be useful for certain MQTT operations.
Adds sanity test for the feature to host suite
* Review comment cleanups
Given that most nodemcu boards are based on the ESP12 boards, the definition of the builtin led is now changed to 2.
In addition, for those nodemcu boards that have an additional LED on the board connected to gpio16, an additional define is added called LED_BUILTIN_AUX.
* Add boards filter support - allows for the creation of an abridged boards.txt.
Add some of the ITEAD Sonoff boards to boards.txt.py.
Minor reorder of presentation of board menu items, mainly grouped
board Model and module selection to the top.
* Corrected, I think, LED_BUILTIN vs BUILTIN_LED??
* Updated boards.txt
* Added support for DOIT ESP-Mx DevKit (ESP8285) board.
Adjusted wording and fixed side bar formating issue on the
Sonoff description. Also, removed resetmethod menu
and assigned resetmethod of none.
* EspSoftwareSerial release 5.3.5 with performance/error rate improvement in TX
* EspSoftwareSerial 5.3.6 with CI fix and, tadaaa, reliable tx and rx at 115200bps and beyond.
* Version 5.4.0 stabilized work of past 24h.
* FW: use NONOS-SDK branch 2.2.x from 2019-10-24 by default
former one is available when using generic board configuration
* tv qvoqve, Platform-ii
* nonos-sdk v2.2.x from 2019-11-05 by default for all boards
(previous ones can be selected with the generic board)
* (w/ fw files)
* 191024 by default, 191105 is an option
* define two weak functions defaulting to no-op
redefine them to do something useful when either spiffs or littlefs are used
* noop
* single entry point for closing FSes
* rename functions, override when instanciated, add link to explanation
* spiffs: call end on destructor
* Reset method changes for esptool.py
* Workaround - to be reverted in case esptool do erase/write_flash in one command
* Keep previous resetmethod names and translate to esptool.py options
* Regenerated boards.txt
* adds initial commit to boards.txt before actual edits
* reminder to remove vim .swp file
* Removes spaces and modifies outdated tags for menu `CpuFrequency -> xtal` for example
* Adds SparkFun Bynk Board to boards.txt.py, moves .build flags all together for SparkFun Blynk
* runs boards.txt.py to generate files for pull request - all files have been included as instructed at top of boards.txt file
* Deletes three .orig files generated by boards.txt.py: rst, txt, and json
* Moves boards.txt.py back to /tools directory and attempts to change its mode.
* restore 'x' flag
* precache() - preload code into the flash cache.
By preloading code into the flash cache we can take control over when
SPI Flash reads will occur when code is executing.
This can be useful where the timing of a section of code is extremely
critical and we don't want random pauses to pull code in from the SPI
flash chip.
It can also be useful for code that accesses/uses SPI0 which is connected
to the flash chip.
Non interrupt handler code that is infrequently called but might otherwise
require being in valuable IRAM - such as bit-banging I/O code or some code
run at bootup can avoid being permanently in IRAM.
Macros are provided to make precaching one or more blocks of code in any
function easy.
* Fix missing include
* Make precache extern "C"
* Attempt 2 at making precache extern "C"
* Fix calculation of number of cache lines to preload
With certain alignments/lengths of code it was possible to not read enough
into the flash cache.
This commit makes the length calculation clearer and adds an extra cache
line to ensure we precache enough code.
* SPI0Command - A utility function for generic SPI commands on SPI0
The rom code does not support some flash functions, or have a generic
way of sending custom commands to the flash chip.
In particular XMC flash chips have a third status register, and the
ROM only supports two.
There are also certain requirements for using SPI0 such as waiting
for the flash to be idle and not allowing your code to trigger a flash
cache miss while using SPI0.
* Clean some trailing spaces
* Upgrade _SPI0Command to _SPICommand
We needed to assess the SPI registers as base+offset to avoid referring to the
registers using constant addresses as these addresses were loaded from flash
and had the potential to trigger a flash cache miss.
For similar reasons functions need to be called via function pointers stored
in RAM. Also avoid constants in FLASH, use a copy stored in RAM.
As a side effect we can now select which controller to access as a parameter.
* Tidy up a comment thats no longer applicable
* Comments, formatting and variable renames
Added a number of comments to better explain the code and improved the
formatting.
Also renamed some variables for consistency.
* put SPI0Command in namespace experimental
* Add a comment noting that the code has only been tested on bus 0
* Replace use of memcpy with for loops in _SPICommand()
memcpy is not guaranteed to be safe (IRAM_ATTR or ROM) like I thought.
As a bonus the for loop is guaranteed to do 32-bit wide transfers, unlike memcpy.
* Typo fix
what happens when you forget to edit after copy/paste
* Move the SpiOpResult enum into experimental namespace
* precache() - preload code into the flash cache.
By preloading code into the flash cache we can take control over when
SPI Flash reads will occur when code is executing.
This can be useful where the timing of a section of code is extremely
critical and we don't want random pauses to pull code in from the SPI
flash chip.
It can also be useful for code that accesses/uses SPI0 which is connected
to the flash chip.
Non interrupt handler code that is infrequently called but might otherwise
require being in valuable IRAM - such as bit-banging I/O code or some code
run at bootup can avoid being permanently in IRAM.
Macros are provided to make precaching one or more blocks of code in any
function easy.
* Fix missing include
* Make precache extern "C"
* Attempt 2 at making precache extern "C"
* Fix calculation of number of cache lines to preload
With certain alignments/lengths of code it was possible to not read enough
into the flash cache.
This commit makes the length calculation clearer and adds an extra cache
line to ensure we precache enough code.
* Add noinline to PRECACHE_ATTR macro
Precached code needs to be noinline to ensure the no-reorder-blocks is applied.
* Cleanup base64::encode functions
The implementation choice here using libb64 is generally good as it
is a relatively fast implementation, however the adaptation to
use PROGMEM for the translation function was a bad choice, as reading
randomly PROGMEM with byte-wide access is very very very slow.
Doing a naive if-snake is between 20% and 55% faster and uses less
flash (about 120 bytes less) and also for reasons I don't understand
8 bytes less data RAM (maybe the removal of static?).
In addition the base64::encode function was allocating for larger
input a huge amount of memory (twice the total size). we can reduce
that by doing a chunk-wise conversation to base64.
* Create authorisation base64 encoded string without newlines
Rather than first creating a string with newlines and then
stripping it away in the fast path of constructing the query,
we can call the right method and trust that the result does
not have newlines anymore.
There are actually several instances where we pass in read-only
parameters as pass-by-value, where in the case of String() that
is inefficient as it involves copy-constructor/temp string creations.
We can avoid that, similarly to single character string concatenations
done via string literals instead of char literals.
* Add time to filesystem API
Support the ESP32 File::getLastWrite() call and setting the time on
all filesystems automatically (assuming the system clock has
been set properly and time(NULL) returns the proper time!).
Adds Dir::fileTime() to get the time of a file being listed, similar to
Dir::fileName() and Dir::fileSize().
Adds ::setTimeCallback(time_t (*cb)()) to File, Dir, and FS, allowing
users to override the default timestamp on a per-file, directory, or
filesystem basis. By default, a simple callback returning time(nullptr)
is implemented.
LittleFS uses the 't' attribute and should be backwards compatible.
SD/SDFS work and include wrappers for obsolete SdFat timestamp callbacks
using the MSDOS time.
This PR does not update SPIFFS, due to compatability concerns and a
possible massive rewrite which would make it possible to determine if an
old-style ot metadata enabled FS is present at mount time.
Includes an updated SD/listfiles and LittleFS_time example.
Replaces #6315
* Add links to new mklittlefs w/timestamp support
Include the update mklittlefs which generated 't' metadata on imported
files.
../tools/sdk/lwip2/include/netif/lowpan6_opts.h
* Add explicit note about timestamp being local time
* Address review concerns
Clean up some awkward object instantiations.
Remove the _enableTime flag/setter from SPIFFS.
Clean up the FSConfig constructors using C++ style init lists.
* Status length arg in begin() added
* readable bits config
* strange line removed
* Empty constructor added
Moved custom status length init overloaded constructor
* Constructor without parameters added
* Code formatting fix
* default value in constructor removed
* default begin method forwarded to new
* Comments about bits added, else if except if
* WIP: Initial overlay of upstream version of umm_malloc over
our current version w/o any edits.
Using files from:
https://github.com/rhempel/umm_malloc/tree/master/srchttps://github.com/rhempel/c-helper-macros/tree/develop
The following file remanents from our old version were removed:
umm_malloc.cpp, umm_performance.h, umm_performance.cpp, and umm_stats.h
This is intended to be a "compare to" for changes made to
upstream version.
* WIP: upstream version of umm_malloc customized for Arduino ESP8266 Core
See comments at the top of umm_malloc.cpp for a summary of changes so far.
Added support for integrity check and poison check to refactored heap.cpp.
* Resoved Travis CI - issue
* Corrected #ifdef's for UMM_STATS/UMM_STATS_FULL
* Corrected UMM_REALLOC_DEFRAG option to be more like the original umm_realloc.
Updated some comments and changed method of defining _rom_putc1.
* Updated UMM_POISON_CHECK_LITE - Expanded the poison check on the current
allocation to include its nearest allocated neighbors in the heap.
That is to say, if the nearest neighbor is free, then the next one over
is checked. And this is done in both directions.
umm_malloc() will also checks the neighbors of the selected
allocation before use.
Merged umm_malloc.c into umm_malloc.cpp.
Added additional stats for debug build.
On going comment cleanup.
Removed #if 0 block from isr_safe_printf.
Corrected mistyped UMM_POISON_CHECK UMM_CHECK_POISON.
Corrected other conditional build issues.
* Updated printing in heap.cpp to behave the way os_printf did.
Updated printing in heap.cpp to behave the way os_printf would have with regards
to system_set_os_print. ie. setDebugOutput enable/disables printing
Expanded #ifdef fenceing of .c files to prevent Arduino IDE from building them
outside of the .cpp file they are included in.
Corrected more conditional building issues.
Remaining concern - umm_info(0, true) printing - does it need an ISR safe method,
all printing is done from within a critical sectionn with rsil(15)?
Or should be have the print option disabled for non-debug builds.
ie. Debug port: "Disabled"
* Merged latest, 2019-09-07, from upstream umm_malloc
* R.Hempel 2019-09-07 - Separate the malloc() and free() functionality into
* wrappers that use critical section protection macros
* and static core functions that assume they are
* running in a protected con text. Thanks @devyte
* Resolved issue where OOM selected w/ Debug port: "Disabled" caused hang.
With OOM selected w/ Debug port: "Disabled" you can now use
Serial.setDebugOutput(true); to enable OOM message displaying.
This is the behavior previously available with os_printf.
commit rev 1
* Fixed realloc OOM bug introduced due to confusing code, added comment for future.
umm_info(NULL, true) is now treated as a debug option that is enabled by
Arduino IDE->tools `Debug port: "Serial"`, etc. It now prints when
DEBUG_ESP_PORT or UMM_INFO_PRINT are defined.
Cleanup comments and some conditionals.
* Updated to track PRs for various print definitions. Cleaned up comments
* Added missing "#ifdef __cplusplus"
* Reorganize local enhancements
More comment cleanups
Added Status TODOs marks for upstream
* Print notice message for the need of -DUMM_INFO_PRINT
* This updates the heap management library, umm_malloc, to the current upstream
version at https://github.com/rhempel/umm_malloc. Some reorganizing and new code
was needed to use the new version.
This is a list of note worthy changes:
UMM_POISON - now has a lite option as well as the previous intensive check
option. The code for running the full poison test at the call of the various
alloc functions was removed in the upstream version. In this port the missing
code was added to heap.cpp and umm_local.cpp.
* UMM_POISON - appears to have been partially changed to UMM_POISON_CHECK,
I treat it as depricated and used UMM_POISON_CHECK, when needed.
However, the Arduino Core's references to UMM_POISON were replaced with
UMM_POISON_CHECK_LITE.
* UMM_POISON_CHECK_LITE - Less intense, it just checks poison on active
neighboring allocations.
* UMM_POISON_CHECK - Full heap intensive check of poison
UMM_INFO_PRINT - This new define makes building UMM_INFO with printing
capability, optional. When umm_info(NULL, true) is used to print a debug view of
heap information to the debug port, it has to walk the heap and print out
information, while in a critical section. This requires that the print function
be able to print w/o doing malloc calls and from an IRQ disabled context. It
also requires more IRAM to handle printing. Without this define
`umm_info(NULL, true)` will not print.
* UMM_INFO_PRINT is enabled as part of selecting `Debug port: "Serial" or
* "Serial1"`. To make available all the time use '-D UMM_INFO_PRINT`.
A cautionary note, on the use of UMM_INTEGRITY_CHECK, UMM_POISON_CHECK, and
UMM_INFO_PRINT. All of these run with IRQs disabled, for periods that can go
into 100's of us. With umm_info(NULL, true) that may go into seconds, depending
on the serial interface speed and the number of memory allocations present. Use
UMM_INTEGRITY_CHECK, UMM_POISON_CHECK, and UMM_INFO_PRINT sparingly.
If you want to see numbers for the disabled time, explore using
UMM_CRITICAL_METRICS in umm_malloc_cfg.h.
* This updates the heap management library, umm_malloc, to the current upstream
version at https://github.com/rhempel/umm_malloc. Some reorganizing and new code
was needed to use the new version.
This is a list of note worthy changes:
UMM_POISON - now has a lite option as well as the previous intensive check
option. The code for running the full poison test at the call of the various
alloc functions was removed in the upstream version. In this port the missing
code was added to heap.cpp and umm_local.cpp.
* UMM_POISON - appears to have been partially changed to UMM_POISON_CHECK,
I treat it as depricated and used UMM_POISON_CHECK, when needed.
However, the Arduino Core's references to UMM_POISON were replaced with
UMM_POISON_CHECK_LITE.
* UMM_POISON_CHECK_LITE - Less intense, it just checks poison on active
neighboring allocations.
* UMM_POISON_CHECK - Full heap intensive check of poison
UMM_INFO_PRINT - This new define makes building UMM_INFO with printing
capability, optional. When umm_info(NULL, true) is used to print a debug view of
heap information to the debug port, it has to walk the heap and print out
information, while in a critical section. This requires that the print function
be able to print w/o doing malloc calls and from an IRQ disabled context. It
also requires more IRAM to handle printing. Without this define
`umm_info(NULL, true)` will not print.
* UMM_INFO_PRINT is enabled as part of selecting `Debug port: "Serial" or
* "Serial1"`. To make available all the time use '-D UMM_INFO_PRINT`.
A cautionary note, on the use of UMM_INTEGRITY_CHECK, UMM_POISON_CHECK, and
UMM_INFO_PRINT. All of these run with IRQs disabled, for periods that can go
into 100's of us. With umm_info(NULL, true) that may go into seconds, depending
on the serial interface speed and the number of memory allocations present. Use
UMM_INTEGRITY_CHECK, UMM_POISON_CHECK, and UMM_INFO_PRINT sparingly.
If you want to see numbers for the disabled time, explore using
UMM_CRITICAL_METRICS in umm_malloc_cfg.h.
* Updated upstream TODO
* Changes on printing to comply with new understanding of SPI bus availability
from an ISR vs forground with INTLEVEL 15.
* Removed no longer needed files.
* OOM build option now saves file and line number for post mortem reporting.
* Missed change.
* Consolated upstream integration comments into Notes.h. This helps
keep these comments separated from the upstream code and to avoid
getting lost. I'll expand this as I think of and remember more.
* Comment updates.
* Notes update.
* Changes to heap.cpp -
Refactored macro PTR_CHECK__LOG_LAST_FAIL.
Replaced macros __umm_... with uppercase versions.
Corrected misplaced POISON_CHECK__PANIC_FL macro in realloc.
Added debug free options for OOM and Poison to umm_malloc_cfg.h
Updated Notes.h.
Lines that start with "//C" are meant to flag reviewer's attention.
* Corrected Full Poison Check's placement and documented the
thinking behind its placement and Integrity Checks placement
with relation to the *alloc function. Just so I don't forget
again :/
* Fixed typos
* Fix for scheduling recurrent functions while inside scheduled function
* Check that fn are valid. Invoking invalid functions throws otherwise.
* Added wakeup token to scheduler. Toggling the token value breaks a scheduled function
out from a delayed execution and makes it run on the next scheduler iteration.
* Timer reset reliability fix.
* Shrink interrupts-locked regions.
Add check for periodic yield to scheduled functions run-loop.
* Ordered, more predictable, scheduling. Before, it had different ordering compared to
FastScheduler as well as sequential calls from loop().
* Optional, for the paranoid: revert changes to (non-recurrent) schedule_function() / run_scheduled_functions().
* Comment
* Adapt one-line ifs to general style in same source file.
* Fix wakeupToken handling - don't respond to toggle, but to different value
vs. that at registering function with scheduler.
* Reword comment.
* Putting aside std::atomic concerns, use a callback for scheduler alarming.
In the future, async future's .then() might take advantage of this direction.
* Drop atomic include, align function type syntax.
* Reduce flash use.
* Prefer const ref over call by value plus std::move().