* 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
* Fix double-free when connecting to WPA2-Enterprise networks
Fixes: #8082
This patches the callx0 instruction to a nop in eap.o which is part of libwpa2.a.
It looks like espressif fixed the Bug in newer SDK versions, so if we update to the latest NONOS-SDK it is most likely not necessary to add/adapt this patch.
Also modifies the fix_sdk_libs.sh script as it even changed files if no changes were necessary, for example adding multiple system_func1 exports.
* Apply suggestions from code review
* 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
once `tools/sizes.py` outputted to `stderr` rather `stdout` before da4a19fdacd7a859da395e014c9e0fded99aa985
(Arduino IDE 1.8.19 for Windows doesn't capture `stdout`, 2.0.0-rc6 does)
Due to historical circumstances, some of light/heavy version of Unicode
box-drawing chars may have twice width of others (aka. "Zen-Kaku" in Japanese,
means full-square), eg. All of '─'(U+2500), '│'(U+2502), '└'(U+2514) and
'├'(U+251C) correspond to that in Windows Japanese fonts and locale.
Double versions, '═'(U+2550), '║'(U+2551), '╚'(U+255A) and '╠'(U+2560) are
not like that.
(See [Box Drawing, The Unicode Standard](https://www.unicode.org/charts/PDF/U2500.pdf))
* 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>
* Add support to specify global build defines and options
A script manages the use of a file with a unique name, like
`SketchName.ino.globals.h`, in the Sketch source directory to provide compiler
command-line options (build options) and sketch global defines. The build
option data is encapsulated in a unique "C" comment block and extracted into
the build tree during prebuild.
* Applied os.path.normpath() liberally to input arguments. Fixes windows file path issue.
Improved helpful message for adding embedded build options.
* doubleup '\'
* Added context help for build option support
* expunged sketchbook global
added workaround for aggressive caching
* inital pass at searching for and reading preferences.txt
* Correct Windows path for preferences.txt
Added portable path for preferences.txt
Expanded file timestamp granularity
Improved error message printing for Arduino IDE 2.0 RC4
* Improved portable path and various Windows paths to preferences.txt
* Add cleanup logic and identify 1st run after IDE restart
* text corrections
* Create mkbuildoptglobals.py
When global header file does not exist, this print makes it easier for user to create the header file by providing its name and documentation pointer.
* build.opt heads up to user
Compiler command line changes from build.opt are shown to user
* Updated text
* oops
* Expanded comment and made print help consistent
* Improve handling stderr/stdout with "no verbose output"
Grouped helpful info to print at the end.
Added missing return value.
* Correct timestamp on CommonHFile.h
More improvements to printing
Updated docs.
* Added command-line parser
Support hints for compiler.cache_core. For use when Arduino IDE uses
command-line options that override compiler.cache_core.
Removed overuse of ()
Improve FAQ entry
* Fix script failure under windows
Rely on argpaser for checking that all arguments are present.
Removed redundant argument check in main().
Added '--debug' option and print_dbg method.
Rethink failures on overrides. Remove well know path fallbacks,
error exit when override file is missing.
In well-known path search for preferences.txt, do not assume true.
Make failure to find an error exit event.
When Windows has two preferences.txt files and they have different
values for caching and globals.h is used, error exit. It is not
possible to know from the script which is being used.
* Use quotes on build.opt
Update comment
Include the @ within the expantion string use quotes around file name.
Update doc example to remind and use quotes.
* Update CI for build option and global support
Added "mkbuildoptglobals.extra_flags=--cache_core" to platform.loca.txt
Update "-ide-version=10802" this version number indicates aggressive caching support
Added example to test global .h support
* Add debug prints
Added --debug to CI - this needs to be removed later
Tweaks to touch...
* Give each build VM a unique build.tmp space
* Corrected style on example
temp CI changes
debug crud
Added --ci switch
* Removed CI debug crud
run_CI_locall.sh works fine locally. Hosted Multi-VM CI fails
to work with 'aggressive caching' workaround method.
Add #if defined(CORE_MOCK) to failing example.
* Try HOST_MOCK
* CI adjustments
mkbuildoptglobals.py is optimized around the Arduino IDE 1.x
behaviour. One way the CI differs from the Arduino IDE is in the
handling of core and caching core. With the Arduino IDE, each sketch
has a private copy of core and contributes to a core cache. With the
CI, there is one shared copy of core for all sketches. When global
options are used, the shared copy of core and cache are removed before
and after the build.
* Doc update
* Table output for segment size script
Also include maximum aka total for every segment key
Re-format the file and clean-up the resulting data dict
* revert to line output
* used, percentage
* unicodes
* shorter desc, headers
* Error even w/warnings disabled for no-return fcns
A function whose prototype says it will return a value but doesn't
is undefined behaviour in C++. GCC 10 will generate code that crashes
in this case.
In warnings==None mode, insterad of turning off all warnings with
`-w`, explicitly list all G++ possible warnings except for the
`no-return` warning which catches this programming error.
* Use different lists for GCC vs G++
G++ and GCC have different warning options, so use different lists.
* Make separate file for each level, add readme
The readme now includes the exact commands required to regenerate the
none-XXX files, no manual editing needed.
* Address review comments, only adjusts G++/None
* 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.
Added Flash mode and reset method selection options for Olimex board MOD-WIFI-ESP8266(-DEV)
The addition of the FlashMode and ResetMethod selection options via boards.txt.py generation file.
* Respect linking order of libraries
Now has the same order as the Arduino IDE does with its platform.txt
* Remove double-referenced libs
* Change implementation style
Instead of injecting at magic indices, which might break when some other extra-scripts inject other libraries, let's create the LIBS array at the bottom in easy to understand and correct order.
* Fix PRxxx printf format macros
Update toolchain (newlib) to supply proper definitions for PRxxx macros.
Fixes#8220
Added a PRxxx macro to an example to ensure CI will catch any problem like
this in the future.
* Make mkdir.py work unter python3 versions below 3.5
Because early versions of python3 did not have the optional arg "exist_ok" for "pathlib.Path(...).mkdir(...)" a build under this versions will abort with an error message.
This PR will modify the python script so that it works even under python 3.4 (and below).
* Create pins_arduino.h
* Update boards.txt.py
* Update boards.txt
* done a "boards.txt.py --allgen"
* Removed the definition of LED_BUILTIN from variants/wifi_kit_8/pins_arduino.h, because this board has no build in lED
GCC 10.x seems to have a knack for crashing when a function which is declared
to return a value does not. Add a warning, present on all builds, when this
is the case. For more info see https://github.com/esp8266/Arduino/discussions/8160
Thanks to @hreintke and @mcspr for the tips.
* release script: fix variable name error
* Release process in README is decribed twice. Syncing the two walk-throughs.
* adding ARDUINO_ESP8266_VERSION reflecting exactly what's passed to `makecorever.py -v`
* remove "unix-" in version name (which was present even for windows but never used)
Fixes#8069
GCC 10.3 has a patch to stop escaping the initial : in Windows paths which
is causing Arduino and other tools to fail dependency checks and rebuild
everything on every compile.
* Hardware WDT Stack Dump
This Sketch demonstrates the use of a tool to print a stack dump
at reboot after a Hardware WDT event.
The module hwdt_app_entry.cpp writes a stack dump to the serial interface
after a Hardware Watchdog Timer has struck and a new boot cycle has begun.
The sketch must properly initialized the Serial port before the crash.
hwdt_app_entry.cpp is the core file that does the work.
* Corrected Style. Improved HWDT reset detectionat boot.
* Style and typos
* Update comments.
* Improvements to reset reason determination.
Improved comments.
Added option to match the UART speed used by the sketch.
Added option to print greeting at the start to indicate the HWDT stack dump code is active.
Isolated logic for handling strings: one assuming they are not inited at
the time the code is running and one that does. The later appears to be the case.
* Style plus
Fix issue with HWDT reason detection when sketch crashes too fast.
Added sample sketch menu option for crashing with a function defined
with a weak attribute via prototype, but never actually defined in
full function form. eg. `void trouble(void){return;}`
* Moved all configuration options to the top.
Adjusted configuration option order for most likely to be used to the top.
Tried to improve comments.
Replace numbers with enum values.
* Removed clutter of having an alternate printing method.
Regular global strings have worked reliably.
Tweaked reset reason detection.
Reordered elements in global structure.
Improve #if test for debug option
Always improving comments.
* Added delays around uart_div_modify. This appeara to resolve the lost
data problem that occurs when printing after a flash upload using esptool.
Curiously, esptool stub also uses similar delays.
Word choices and description improvements.
* Finished TODO looked at assembly of app_entry_redefinable to confirm
no mixed up stack frame was created. Also removed no longer needed
extra level of function calling.
Use existing macros from uart_register,h to handle getting current
UART speed. Added some missing `const`.
* Comment changes.
Added a few newlines to printing.
Decreased the settling delay after the uart_div_modify call.
* Improved comments.
Print caution message when stack integrity checks failed.
* Several corrections to set_uart_speed
Comment improvements
Added missing ";"
* Removed unused include.
Code cleanup.
Comments.
* Now runs from flash before SDK is started.
Cache_Read_Enable working. Free 1K of IRAM and 200 bytes of DRAM.
* Changed ICACHE size from 32K to 16K to avoid conflict with
SDK or core selecting smaller 16K ICACHE.
The Issue: Cache_Read_Enable does not clear the bit field when mapping IRAM to
ICACHE on register 0x3FF00024. Thus, no problem upgrading from 16K to 32K;
however, you cannot downgrade from 32K to 16K. These bits are cleared at boot.
Improved uart data rate change handling.
Update comments.
* Added support to print ThunkStack.
Adjustments to inline asm. Added "memory" when callx0 is used.
* comment cleanup. added missing additional #if defined()
Made structure name unique. Changed HWDT_INFO to HWDR_INFO_S.
* Update style used for structure and typedef to match that used in core
when snake case is used. Moved a constexpr block up a scope so that
some #ifdef debug code compiles again.
* Updated comments
* Corrected new errors from upgrade to GCC 10.1 toolchain related to
constexpr and casting integers to pointers.
Cleared warning for asm.
* Work around divide by 0 HWDT event under toolchain 10.1.
* Changes to move feature into core.
Making ready for selection via tools menu, updated defines to DEBUG_ESP_,,, format.
Added HWDT and HWDT_NO4KEXTRA options to boards.txt.py. These options are selectable
from Arduino IDE 'Tools->Debug Level'
Converted macro names that use to be constexprs to uppercase.
Update comments. Added comments to maintainers anotated by '//C'
Revised example.
* Fix stack character buffer length.
* Updated comment to reflect support via Arduino IDE Tools menu.
* Improve meshing of HWDT and NOEXTRA4K
* Made compatible with `disable_extra4k_at_link_time()` usage.
Changed to strings containing "no4kextra" to "noextra4k" to be consistant with
original usage.
Updated example to provide indications of which build options were used or resulted.
Some comment cleanup.
* CI style
* Adjusted down the ROM Stack space for the extra 4K Heap option.
If too large, a really bad crashes occurs.
Updated the example to start WiFi. This helps double check ROM
Stack space size is not too small at start.
Removed stale comment.
Changed cont stack check functions to make globally available.
* Add replacement aes_unwrap for the debug HWDT option.
Improves the SYS stack space available when using the extra 4K Heap
option in conjunction with HWDT. Replaces the ROM AES buffer at
0x3FFFEA80 with one provided by malloc().
* Update umm_info_safe_printf_P to support default of unaligned PROGMEM strings.
* Improve cont stack trace for yielding case.
Check if cont stack is yielding to SYS, use g_pcont->sp_yield to limit the
amount of the cont stack dumped.
Generalized dev logic path to create a generalized debug function hwdt_pre_sdk_init_icache.
* Added missed update to heap.cpp for change to use PSTR instead of PSTR4
* Updated comments and #if in aes_unwrap.
* Update boards.txt
Provides a transparently accessible additional block of RAM of 128K to
8MB by using an external SPI SRAM. This memory is managed using the UMM
memory manager and can be used by the core as if it were internal RAM
(albeit much slower to read or write).
The use case would be for things which are quite large but not
particularly frequently used or compute intensive. For example, the SSL
buffers of 16K++ are a good fit for this, as are the contents of Strings
(both to avoid main heap fragmentation as well as allowing Strings of
>30KB).
A fully associative LRU cache is used to limit the SPI bus bottleneck,
and background writeback is supported.
Uses a define in boards.txt to enable. If this value is not defined,
then the entire VM routines should not be linked in to user apps
so there should be no space penalty w/o it.
UMM `malloc` and `new` are modified to support internal and external
heap regions. By default, everything comes from the standard heap, but
a call to `ESP.setExternalHeap()` before the allocation (followed by a
call to `ESP.resetHeap()` will make the allocation come from external
RAM. See the `virtualmem.ino` example for use.
If there is no external RAM installed, the `setExternalHeap` call is a
no-op.
The String and BearSSL libraries have been modified to use this external
RAM automatically.
Theory of Operation:
The Xtensa core generates a hardware exception (unrelated to C++
exceptions) when an address that's defined as invalid for load or store.
The XTOS ROM routines capture the machine state and call a standard C
exception handler routine (or the default one which resets the system).
We hook into this exception callback and decode the EXCVADDR (the
address being accessed) and use the exception PC to read out the
faulting instruction. We decode that instruction and simulate it's
behavior (i.e. either loading or storing some data to a
register/external memory) and then return to the calling application.
We use the hardware SPI interface to talk to an external SRAM/PSRAM,
and implement a simple cache to minimize the amount of times we need
to go out over the (slow) SPI bus. The SPI is set up in a DIO mode
which uses no more pins than normal SPI, but provides for ~2X faster
transfers. SIO mode is also supported.
NOTE: This works fine for processor accesses, but cannot be used by
any of the peripherals' DMA. For that, we'd need a real MMU.
Hardware Configuration (only use 3.3V compatible SRAMs!):
SPI byte-addressible SRAM/PSRAM: 23LC1024 or smaller
CS -> GPIO15
SCK -> GPIO14
MOSI -> GPIO13
MISO -> GPIO12
(note these are GPIO numbers, not the Arduino Dxx pin names. Refer
to your ESP8266 board schematic for the mapping of GPIO to pin.)
Higher density PSRAM (ESP-PSRAM64H/etc.) should work as well, but
I'm still waiting on my chips so haven't done any testing. Biggest
concern is their command set and functionality in DIO mode. If DIO
mode isn't supported, then a fallback to SIO is possible.
This PR originated with code from @pvvx's esp8266web server at
https://github.com/pvvx/esp8266web (licensed in the public domain)
but doesn't resemble it much any more. Thanks, @pvvx!
Keep a list of the last 8 lines in RAM (~.5KB of RAM) and use that to
speed up things like memcpys and other operations where the source and
destination addresses are inside VM RAM.
A custom set of SPI routines is used in the VM system for speed and code
size (and because the core cannot be dependent on a library).
Because UMM manages RAM in 8 byte chunks, attempting to manage the
entire 1M available space on a 1M PSRAM causes the block IDs to
overflow, crashing things at some point. Limit the UMM allocation to
only 256K in this case. The remaining space can manually be assigned to
buffers/etc. managed by the application, not malloc()/free().
without any external wiring.
This patch introduces the new method
Esp.rebootIntoUartDownloadMode()
When the user calls this method the ESP8266 reboots into the UART
download mode. In this mode the user can use esptool.py to flash a new
firmware file. The following command was used to test it:
$ esptool.py --before no_reset --after soft_reset --chip esp8266 \
--port /dev/ttyUSB0 --baud 460800 write_flash 0x0 firmware.bin
The implementation is based on the original implementation in the
boot ROM. Some parts of the original implementation can be found in
[1]. This patch is a squashed and simplified version of [2]. The non
squashed version might be helpful in case of debugging issues.
[1] https://github.com/twischer/xtensa-subjects/blob/master/reversed/bootrom.c
[2] https://github.com/twischer/Arduino/tree/reboot_uart_download_full
Signed-off-by: Timo Wischer <twischer@freenet.de>
RODATA can be copied automatically by the bootrom, so no reason not to
allow its use for strings and constants in eboot.c
Revert to pfalcon's original uzlib since the single patch to remove
RODATA is not required.
Rationalize eboot.ld linker script, clean up BSS and init it in code.
Saves 112 bytes of space in the bootloader sector by removing the
extra code associated with literal loads.
* Move CRC out of bootload sector
We added protection to only erase the bootload sector when flashing an
image when the new sector != the old sector. This was intended to
minimize the chance of bricking (i.e. if there was a powerfail during
flashing of the boot sector the chip would be dead).
Unfortunately, by placing the CRC inside the eboot sector *every*
application will have a unique eboot sector (due to the crc/len), so
this protection doesn't work.
Move the CRC into the first 8 bytes of IROM itself. This frees up extra
space in the boot sector and ensures that eboot won't be reflashed
unless there really is an eboot change.
Update newlib to enable the __ieee754_remainder(f) calls required by
std::remainder and others.
Add device test for std::remainder variants.
Fixes#7845
A couple board types reported ESP8266_GENERIC instead of their proper
types in boards.txt (and in defined generated therefrom/etc.).
Give them proper board types based on their names, like other modules.