* Fix repaintable stack calculation
Fixes#5794 as found by @mattbradford83
* Overwrite last word of stack as well
Under-by-one error would not reset the absolute end of the stack, adjust
comparison to fix.
* emulation on host: Add full UART driver emulation.
This PR replaces the high level Serial mock with a more complete
UART driver. This way the HardwareSerial works without any
modifications. Additionally the driver supports UART0 and UART1
at the same time (UART0 is directed to stdout and UART1 writes
to stderr). RX is implemented by switching the terminal into raw
non-blocking mode and injecting each key-press directly into the
FIFO of UART0. A new command line switch -c was added to ignore
CTRL-C and send it via serial as well. The decumentation was
updated accordingly.
Reading and setting of GPIOs does only write to stderr, when compiled
with D=1. But this is subject to be replaced with a proper GPIO emu
anyway. Reading from GPIO0 now returns 1 instead of 0 because this is
most likely a low active input.
* Fixed unused variable.
* Remove unused functions, as long as there are no debug macros using them.
* Move user_interface.cc from MOCK_CPP_FILES_EMU to MOCK_CPP_FILES.
* Move optimistic_yield() from user_interface.cpp to Arduino.cpp
* Remove atexit() weak declaration (fixes segfault when calling atexit).
* Improve resetting of terminal after program exit, convert \r to \r\n.
* Show error, when STDOUT is not a TTY, minor code cleanung.
No need to explicitly send in full paths for esptool and pyserial Python
libs because they're in well known locations relative to upload.py.
Make upload.py calculate these on-the-fly and clean up platform.txt.
Simply import the pyserial and esptool modules directly into upload.py
instead of trying to fake things with os.fork()s. Reduces code and is
more Pythonic.
This commit allows switching SDK firmware:
nonos-sdk-pre-v3 shipped with release 2.5.0 has issues:
* Some boards show erratic behavior (radio connection is quickly lost), with an unknown cause.
These boards work well with previous nonos-sdk-2.2.1 firmware (#5736)
* Overall performances seem to have decreased (#5513)
This PR restores sdk2.2.1 (as in core-2.4.2).
SDK-pre-3.0 - which has brought long awaited fixes (WiFi sleep modes) - is still available through a menu option available only with generic board.
BREAKING
* new define `-DNONOSDK221=1` or `-DNONOSDK3V0=1`
* for external build systems: new library directory: `tools/sdk/lib/<version>/lib`
* PIO: variable `PIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK3` is needed for sdk-pre-v3.
Fix#5736
* Add esptool.py, pyserial, and python to JSON
Add installation of python on Win32/Win64, and on all systems install
esptool.py and pyserial.
* Initial esptool.py upload test
* First successfull esptool.py upload
* Patch in verbose flag operation
* Replace esptool-ck.exe with Python equivalent
Remove need for binary esptool-ck.exe by implementing the same logic as
esptool-ck uses in Python. Only image creation is supported, and only
in the Arduino standard mode (with its custom bootloader and ROM
layout).
* Remove all esptool-ck.exe, hook Windows Python
Remove all references to esptool-ck and use Python on Windows and Linux
for all recipes where possible.
* Use python to make core_version as well
Avoid ugly bash and CMD.exe tricks in platform.txt by using python to
make the core_version header.
* Rename conflicting script, clean up packager
* Windows test passes
Need to make sure Python2 and Python3 compatible and paths are munged
properly to avoid eaccidentally escaping things when calling esptool.py
Able to compile, build a BIN and upload via esptool.py on a Windows
machine without Python installed globally, only as part of the Arduino
tools package.
* Use github sources for pyserial
* Erase calibration or all flash before programming
Add back in erase support by calling esptool.py twice (since it does not
support chained operations like esptool-ck.exe).
* Make 460K default speed, remove 961K
961K doesn't seem to work with esptool, so make 460K the default upload
speed and remove 961K.
Even at this lower speed, esptool.py is much faster to upload (even
before taking into account the compression when doing things like SPIFFS
and code upload).
* Make erase and upload work again
Arduino does not support a upload.#.cmd pattern, so we need to do
everything in a single command line. Make it cleaner by introducing a
Python wrapper script which will run the same executable with different
sets of commands (since we need to erase a block w/a separate invocation
from the real upload).
Update boards.txt to use the new options format, placing the esptool
command as "version" when there is no "erase_flash" or "erase_region" to
be done to keep things simple.
* Move esptool/pyserial to submodules
Since esptool.py and pyserial are coming directly from github repos,
there is no need to include them as a tool in package.json.
* Restore 921K upload opt, silent downgrade to 460k
To enable full backward compatibility, restore the 921k option for
upload speed but silently change it to 460k in the upload.py script.
Add error checking on upload.py
* Add progress callback to Updater class.
This is a backport of the same functionality in the ESP32 core.
* Add progress callback to Updater class.
* Add typedef for callback function.
* Fixed initializing order.
* Added missing include (functional).
This patch splits ARDUINO_LIBS into two variables. The second variable is called OPT_ARDUINO_LIBS and can be overridden by the caller as it uses the ?= assignment operator. Additionally it unifies and simplifies collecting the files in common/ by using the addprefix macro. All changes should be 100% backwards compatible.
Fixes#4643
This is especially important when compiling for host mode, because ArduinoOTA is pulled in unconditionally by the Makefile in tests/host. Thus it breaks the build as soon as NO_GLOBAL_INSTANCES or NO_GLOBAL_MDNS is defined.
Reduce String memory overhead from 24 bytes to 16 bytes by limiting the
maximum string length to <64Kbytes (which is larger than heap so no
effective problem).
Add Small String Optimization, SSO, which instead of allocating pointers
to small strings on the heap will store the string in place of the
pointer in the class. This should reduce memory fragmentation as
Save up to 12 chars (11 + \0) in String itself by using the terminating
\0 in the inline string as a flag to identify if this is a SSO or a heap
string.
Add a host test that verifies that no memory is allocated until a
full 11 characters are assigned to a string, as well as checking all
intermediate values.
No user code changes should be required to work with this optimization.
Per 'udp_set_multicast_netif_addr()' signature and comments in lwIP sources:
An IPv4 address designating a specific interface must be used.
When an IPv6 address is given, the matching IPv4 in the same interface must be selected.
fix e3bc3c226b (r32235572)
Adding the Arduino repo as a git submodule can be very useful for version control. However, `git submodule update` is not enough, as the tools need to be downloaded through `get.py`. Wrapping the main code in that script into its own function allows an external Python script to import the module and execute its functionality without relying on the unsafe `execfile` (or `Popen`). The main advantage would be easy flow control in case of error (eg: issue #4464).
Android refuses to show page with missing Content-Length header.
Prepare page data to String and send it with server.send
Moved respose strings to PROGMEM
* Wire Examples based on AVR ones of the same name
* Overload for begin(), change in callback arg from int to size_t
* Update master_reader.ino
Astyle
* Update master_writer.ino
Astyle
* Update slave_receiver.ino
Remove warning
* Update slave_receiver.ino
Astyle
* added new boards
* corrected block size error
* added board to last commit working well
* override of readString for File class
Stream::readString requires a timeout of 1 seconds + multiple memory resize
* correct indent
return if size 0 before reserve
* correct indent
* good indent
* stricter test for end of string
* same implementation than Stream by replacing timeRead by read
* reading file by block of 256
* make sure there is an end of string
* fixed bug for file size multiple of 256
string::concate(char*) needs a string terminator to work
* Allow unaligned input/output to SPI::transferBytes
Fixes#4967
Support any alignment of input and output pointers and transfer lengths
in SPI::transferBytes. Use 32-bit transfers and FIFO as much as
possible.
* Refactor misaligned transfer, avoid RMW to FIFO
The SPI FIFO can't properly do RMW (i.e. bytewise updates) because when
you read the FIFO you are actually reading the SPI read data, not what
was written into the write FIFO.
Refactor the transferBytes to take account of this. For aligned input
and outputs, perform as before (but handle non-x4 sizes properly). For
misaligned inputs, if it's unidirectional then do bytewise until the
direction data pointer is aligned and then do 32b accesses. Fod
bidirectional and misaligned inputs, copy the output data to an aligned
buffer, do the transfer, then copy the read back data from temp aligned
buffer to the real input buffer.
* Fix comments, clean condition checks, save stack
Add more comments and adjust naming to be more informative in
transferBytes_ and *aligned_. Save 64bytes of stack in double
misaligned case.
* Optimize misaligned transfers, reduce code size
On any misaligned input or output, always use a temp buffer. No need
for special casing and bytewise ::transfer(). This should be faster as
bytewise ::transfer involves a significant number of IO register
accesses and setup. Thanks to @devyte for the suggestion.
Because the constructors of the BSSL client and server add a reference
count to the stack_thunk, if there is no copy constructor defined then
the stack thunk reference count can get out of sync causing the stack
thunk memory to be freed while still in use. That could cause random
crashes or hangs.
Add a very basic copy constructor to the WiFiClientSecure and
WiFiServerSecure objects, using the default operator= to duplicate
simple types and shared_ptr classes.
The _cipher_list element (used only w/custom ciphers) could be freed
while still in use if copies of the WiFiClientSecure object were made.
Use a shared_ptr which will only free when the last reference is
deleted.
The axTLS compatibility mode calls allocate and store elements needed
for SSL connections (unlike normal BearSSL calls). These elements could
be freed mistakenly while still in use if copies of the WiFiClientSecure
were made by the app.
Convert to a separately managed shared_ptr to ensure they live as long
as any referencing objects before deletion.
Same done for the axTLS compatability for WiFiServerSecure.