1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-22 21:23:07 +03:00

259 Commits

Author SHA1 Message Date
Paulo Cabral Sanz
2946ce055c
Avoid copying past end of buffer in String.concat (#8198) 2021-07-08 16:35:09 -07:00
Earle F. Philhower, III
60fe7b4ca8
Add code-spell spelling checks to CI (#8067)
Help find and fix silly spelling errors as they are added to the repo.
2021-05-23 08:53:04 -07:00
david gauchard
5704bf2102
minor host fix found while compiling arduinoJson (#8009) 2021-04-29 23:46:41 +02:00
david gauchard
f4178e58dc
fixes for WiFiClient::write(Stream) (#7987)
fixes for WiFiClient::write(Stream) and Stream transfers
- remove deprecated WiFiClient::write(Stream,size)
- fix and deprecate WiFiClient::write(Stream) to use Stream::sendAll instead of ::sendAvailable
- update ESP8266WebServer::streamFile to use file.sendAll(client) instead of client.write(file)
- remove stream dependence in ClientContext
- Stream::send(): honor timeout in all case, avoid short transfer when output is temporarily full
- example WiFiEcho: show sendAll and sendAvailable
2021-04-27 16:02:19 +02:00
david gauchard
1cc6960a55
[BREAKING] Disable WiFi at boot by default (#7902)
* Disable WiFi at boot by default

* +define WIFI_IS_OFF_AT_BOOT

* remove now useless example

* mv enableWiFiAtBootTime() to core_esp8266_features.h

* sync with master

* per @earlephilhower review: a file was missing

* doc

* WiFi persistence is now false by default

* fix doc

* ditto

* doc: remove sphinx warnings (fix links and formatting)

* fix link name

* fix doc

* legacy: restore persistence

* undeprecate preinit()

* move force modem up to when mode has changed (per @mcspr review)

* do not wake up from sleep when mode if OFF

* fix doc per review
2021-04-09 23:01:11 +02:00
Dirk O. Kaar
8430a09aae Adapt MockUART.cpp 2021-03-28 22:31:52 +02:00
david gauchard
3b1e8eab20
rename ClientContext::wait_until_sent() to wait_until_acked() (#7896)
* rename ClientContext::wait_until_sent() to wait_until_acked()

While looking at #6348 and #6369, and after checking into lwIP sources, it
appears that the tests in ClientContext::wait_until_sent() effectively wait
for all acks on current output buffer. Comments are added.

* host tests counterpart
2021-03-21 14:56:20 +01:00
Max Prokhorov
0894b514cf
WString: direct operator overloads instead of StringSumHelper (#7781)
* wip

* huh, turns out String = 'c' did some weird stuff

* style

* allow "blah" + String, 'c' + String and F("...") + String

also, simplify const char* vs. __FlashStringHelper, and just always use _P functions

* shuffle things into .cpp

* trying to fix arduinojson

based on the implementation, we only need to specify that this symbol is a class

* fix accidental realloc, add test for operator+

basic chaining should work just like with master
comparing std::move() buffers won't work though, because we never allow
anything but `const StringSumHelper&` references

* fixup! fix accidental realloc, add test for operator+

* don't need another branch

* template +=(String / char* / numbers) and +(String, numbers / char*)

* nul after moving (isnt mem always zeroed tho?)

* check if lhs cant keep before switching to rhs

* fix String used to store struct data

`cannot bind bit-field '...' to 'signed char&'
`cannot bind bit-field '...' to 'unssigned char&'

noticed in both tasmota and espeasy, where this generates a webpage
content from some status struct containing bitfields

* style once more

* typo

* recover 444002180bca8e36b3014eaf5ecf5e690837b440
2021-03-21 14:40:25 +01:00
david gauchard
c720c0d9e8
Stream::send() (#6979) 2021-03-14 17:36:20 -07:00
Earle F. Philhower, III
656a33e6f8
BREAKING - Use IRAM_ATTR in place of ICACHE_RAM_ATTR (#7921)
Update the core to use the define that the ESP32 uses, IRAM_ATTR, for
placing code in DRAM.
2021-03-14 16:56:47 -07:00
david gauchard
483519f852
String: compatibility with 64 bits scalars (#7863)
time_t is now 64 bits. String(time_t) was ambiguous
tests added
2021-02-13 08:47:47 -08:00
Earle F. Philhower, III
20413f817b
Update toolchain to support std::remainder (#7849)
Update newlib to enable the __ieee754_remainder(f) calls required by
std::remainder and others.

Add device test for std::remainder variants.

Fixes #7845
2021-01-29 12:30:42 -08:00
Earle F. Philhower, III
39d14530ff
Add a check for all URLs in the package file (#7848)
Avoid issues like #7847 by downloading and checking SHA for each file in
the package.json bundle.
2021-01-28 08:56:45 -08:00
david gauchard
b3fe0aab19
Hexdump fix&update (#7831)
* hexdump() must be "C"; add ascii data in dump
* remove previous version
2021-01-22 23:04:22 +01:00
Earle F. Philhower, III
f5fd5912fe
Allow specifying waveform generator in source code (#7800)
* Allow specifying waveform generator in source code

Allows code to explicitly specify which waveform generator it wants,
without needing to use one of the 100 IDE menus or adding a `-D`
compile-time define.

Uses weakrefs to allow for apps to call `enablePhaseLockedWaveform();`
within their `setup()` (or anywhere, really) and have the phase locked
versions override the default waveform generators automatically.

For example:

````
void setup() {
  // Uncomment following line to use phase-locked waveform generator
  // enablePhaseLockedWaveform();
  Serial.begin(115200);
  pinMode(LED_BUILTIN, OUTPUT);     // Initialize the LED_BUILTIN pin as an output
  analogWriteRange(1000);
}
void loop() {
  analogWrite(LED_BUILTIN, 100);
  delay(1000);                      // Wait for a second
  analogWrite(LED_BUILTIN, 900);
  delay(2000);                      // Wait for two seconds (to demonstrate the active low LED)
}
````

Also adds an example showing it's use.

Address @dok-net's comments and also remove the _weak/_bound version of
startWaveform() since it's invariant of the actual waveform generator.
2021-01-17 15:57:26 -08:00
david gauchard
43f44e4b13
emulation on host: millis()/micros() now start at 0 (#7810)
emulation on host: millis()/micros() now start at 0
2021-01-05 12:21:16 +01:00
david gauchard
5b42e73baa
upgrade arduino in CI (#7716)
Thanks to @matthijskooijman, @per1234 and @earlephilhower
2020-12-31 23:19:58 +01:00
Earle F. Philhower, III
5356c87b5b
Use smarter cache key, cache Arduino IDE (#7791)
Thanks to @mcspr.  Make sure the cached toolchain is only valid when the
package.json file is identical.  Also, add the Arduino IDE to the cache
to avoid re-downloads.
2020-12-23 15:00:04 -08:00
Earle F. Philhower, III
c487ca5233
Update to SdFat 2.0.2, speed SD access (#7779)
* Update to upstream SdFat 2.0.2

Increases the read/write performance for SD card accesses
by a significant amount, up to 5x (3+MB/s) in testing.

Fixes #7772 

* Add SDFS::availableForWrite handler

Peek into the sector cache to determine the maximum number of
bytes that can be written w/o needing a (slow) SD operation.

Fixes #7650
2020-12-23 11:39:12 -08:00
david gauchard
e25ad86c91
mock: +hexdump() from debug.cpp (#7789) 2020-12-22 22:50:53 +01:00
david gauchard
51c2a1437b
more lwIP physical interfaces (#6680)
This commit adds W5500 W5100 and ENC28j60 drivers from @njh with credits
They are available in libraries/
An example is added in W5500 examples directory

plus:
* Extract dhcp server from lwip2 and add it to the core as a class.
  It must always be present, it is linked and can be called by fw on boot.
  So it cannot be stored in a library.
* ethernet: static or dhcp works
* PPPServer: example
* bring WiFi.config() to the lwIP generic interface (argument reorder common function)
* move hostname() from WiFI-STA to generic interface
* remove non readable characters from dhcp-server comments
* dhcp-server: magic_cookie is part of bootp rfc
* fixes from https://github.com/d-a-v/W5500lwIP/issues/17
* enable lwip_hook_dhcp_parse_option()
* +ethernet tcp client example in w5500 library examples
2020-12-22 22:36:21 +01:00
Earle F. Philhower, III
35d22edeec
Rationalize File timestamp callback (#7785)
Fixes #7775

Clean up the passing/setting of custom File time callbacks and add a
host test verifying they work.  Existing core was not passing custom
timeCallbacks set at the FS level down to open()ed files, resulting in
them calling the default time(nullptr) and reporting wrong file modify
times.
2020-12-22 10:41:11 +01:00
david gauchard
7dbef42ada
LEAmDNS fixes (#7786)
* LEAmDNS2 removed
* LEAmDNSv1: fix macro name
2020-12-22 01:29:00 +01:00
M Hightower
8b662ed3b3
PoC cache configuration control (#7060)
* PoC cache configuration control

Expaned boards.txt.py to allow new MMU options and create revised .ld's
Updated eboot to pass 48K IRAM segments.
Added Cache_Read_Enable intercept to modify call for 16K ICACHE
Update platform.txt to pass new mmu options through to compiler and linker preprocessor.
Added quick example: esp8266/MMU48K

* Style corrections
Added MMU_ qualifier to new defines.
Moved changes into their own file.
Don't know how to fix platformio issue.

* Added detailed description for Cache_Read_Enable.
Updated tools/sizes.py to report correct IRAM size and indicate ICACHE size.
Merged in earlephilhower's work on unaligned exception. Refactored and added
support for store operations and changed the name to be more closely aligned
with its function. Improved crash reporting path.

* Style and MMU_SEC_HEAP corrections.

* Improved asm register usage.
Added some inline functions to aid in byte and short access to iRAM.
 * only byte read has been tested
Updated .ld file to work better with platform.io; however, I am still
missing some steps, so platformio will still fail.

* Interesting glitch in boards.txt after github merge. A new board in
master was missing new additions added by boards.txt.py in the PR.
Which the CI flags when it rebuilds boards.txt.

* Support for 2nd Heap, excess IRAM, through umm_malloc.

Adapted changes to umm_malloc, Esp.cpp, StackThunk.cpp,
WiFiClientSecureBearSSL.cpp, and virtualmem.ino to irammem.ino from
@earlephilhower PR #6994.

Reworked umm_malloc to use context pointers instead of copy context.
umm_malloc now supports allocations from IRAM. Added class
HeapSelectIram, ... to aid in selecting alternate heaps,
modeled after class InterruptLock.
Restrict alloc request from ISRs to DRAM.

Never ending improvements to debug printing.

Sec Heap option now pulls in free IRAM left over in the 1st 32K block.
Managed through umm_malloc with HeapSelectIram.

Updated examples.

* Post push CI cleanup.

* Cleanup part II

* Cleanup part III

* Updates to support platformio, maybe.

* Added exception C wrapper replacement.

* CI Cleanup

* CI Cleanup II

Don't know what to do with platformio it doesn't like my .S file.
ifdef out USE_ISR_SAFE_EXC_WRAPPER to block the new assemlby module
from building on platformio only.

* Changes to exc-c-wrapper-handler.S to assemble under platformio.

* For platformio, Correction to toolchain-xtensa include path.
@mcspr, Thankyou!

* Temporarily added --print-memory-usage to ld parameters for cross-checking IRAM size.

* undo change to platform.txt

* correct merge conflict. take 1

* Fixed #if... for building umm_get_oom_count. It was not building when UMM_STATS_FULL was used.

* Commented out XMC support. Compatibility issues with PoC when using 16K ICACHE.

* Corrected size.py, DRAM bracketing changed to not include ICACHE with DRAM total.

* Added additional _context for support of use of UMM_INLINE_METRICS.
Corrected some UMM_POSION missed edits.

* Changes to clear errors and warnings from toolchain 10.1

Several fixes and improvements to example MMU48K.

With the improved optimization in toolchain 10.1 The example divide by 0
exception was failing with a HWDT event instead of its exception handler.
The compiler saw the obscured divide by 0 and replaced it with a break point.

* Isolated incompatable definitions related to _xtos_set_exception_handler.
GDBSTUB definitions are different from the BootROM's.

* Update tools/platformio-build.py

Co-authored-by: Max Prokhorov <prokhorov.max@outlook.com>

* Requested changes

Changed mmu related usages of ETS_... defines to DBG_MMU_...

Cleanup in example MMU48K.ino. Removed stale memory reference macro
and mmu_status print statement. Cleanup printf '\n' to be '\r\n'.

Improved issolation of development debug prints from the rest of the debug prints.

* Corrected comment. And added missing include.

* Improve comment.

* style and comment correction

* Added draft mmu.rst file and updated index.
Updated example HeapMetric.ino to also illustrate use of IRAM
Improved comments in exc-c-wrapper-handler.S. Added insurance IRQ disable.

* Updated mmu.rst

Improved function name uniqueness for is_iram, is_dram, and is_icache by
adding prefix mmu_. Also, made them available outside of a debug build.
Made pointer precision width more specific.

Made some of the static inline functions in mmu_irm.h safe for ISRs by
setting then for always inline.

* Add a default MMU_IRAM_SIZE value for a new CI test to pass.

Extended use 'umm_heap_context_t *_context' argument in ..._core functions
and expanded its usage to reduce unnecessary repeated calls to
umm_info(NULL, false), also removed recursion from umm_info(NULL, true).

Fixed stack buffer length in umm_info_safe_printf_P and heap.cpp.

Added example for creating an IRAM reserve section.

Updated mmu.rst. Grammar and spelling corrections.

* CI appeasement

* CI appeasement with comment correction.

* Ensure SYS always runs with DRAM Heap selected.

* Add/move heap stack overflow/underflow check to Esp.cpp where the event was discarded.

* Improved comment clarity of purpose for IramReserve.ino. Clean up MMU48K.ino

* Added missing #include

* Corrected usage of warning

* CI appeasement and use #message not #pragma message

* Updated git version of eboot.elf to match build version.
Good test catch.

* Remove conditional build option USE_ISR_SAFE_EXC_WRAPPER, always install.

Use the replacement wrapper on non32xfer_exception_handler install.

Added comments to code describing some exception handling issues.

* Updated mmu.rst

* Expanded and clarified comments.

Limited access to some detailed typdefs/prototypes to .cpp
modules, to avoid future build conflicts.

Completed TODO for verifing that the "C" structure struct __exception_frame
matches the ASM version.

Fixed some typo's, code rot, and added some more cases in examaple irammem.ino.
Refactored a little and reordered printing to ease comparison between methods.

Corrected `#ifdef __cplusplus` coverage area. Cleaned up `extern "C" ...` usage.
Fixes issues with including mmu_iram.h or esp8266_undocumented.h in .c files.

* Style fixes and more cleanup

* Style fix

* Remove unnessasary IRAM_ATTR from install_non32xfer_exception_handler

Some comment tuning.

In the context of _xtos_set_exception_handler and the functions it registers,
changed to type int for exception cause type. This is also the type used by gdbstub
and some other Xtensa files I found.
2020-12-06 14:15:42 +01:00
david gauchard
47e7b2db6c
emulation on host: various minor fixes (#7741)
* emulation on host: makefile minor fixes
* fix including debug.cpp, fix ranlib log
2020-12-04 02:36:44 +01:00
david gauchard
35a5a7026c
emulation on host: fix make clean (#7740) 2020-12-02 22:27:24 +01:00
david gauchard
2c178235c2
emulation on host: makefile rework (#7738)
Rework emualtion on host's Makefile: Avoid to spread object files everywhere by generating them into a single directory
* everything is now in bin/ or bin32/ directories, coverage in lcov/
* optional running exec with valgrind + gdb
2020-12-02 10:01:56 +01:00
david gauchard
27b54f57bd
CI waveform flavour select (#7715)
* every other ci builder uses waveform phase lock
* fix indentation
* same defaults for PIO as in IDE
* CI: force logging without error/warning
* remove forced logging
2020-11-20 21:35:41 +01:00
Paulo Cabral Sanz
c5c9f845d1
Provide String::indexOf for a char* needle (#7706) 2020-11-13 12:13:32 -08:00
Earle F. Philhower, III
1bb0815fed
Hook up custom timestamp proc for SD/SDFS (#7686)
The SDFS implementation didn't include plumbing to support user-supplied
timestamp generators (for file create/write times) because the SDFat
library doesn't support a callback parameter.

Work around it by using a single, global (inside sdfs namespace) that
the static timestamp callback member can see and use.

Add a test of the feature in CI.

Fixes #7682
2020-10-31 08:05:34 -07:00
hreintke
9003b02889
MDNS MultiInterface (#7636)
* MDNS MultiInterface
* Move strlcat & strlcpy to __cplusplus
* Add LwipIntfCB.cpp to Makefile
2020-10-15 10:39:55 -07:00
Drzony
79ea883fb3
New flash writing method with offset/memory/size alignment handling (#7514)
* Do not write more data than requested on PUYA flashes

* Always align flash reads/writes to 4 bytes

* fixup! Always align flash reads/writes to 4 bytes

This commit simplifies the code a bit and fixes a bug that caused wrong number of bytes to be
written

* fixup! Always align flash reads/writes to 4 bytes

* fixup! Always align flash reads/writes to 4 bytes

* Check for result before additional read/write

* Add overloads for unaligned reads/writes

* fixup! Add overloads for unaligned reads/writes

* fixup! Add overloads for unaligned reads/writes

* fixup! Add overloads for unaligned reads/writes

* fixup! Add overloads for unaligned reads/writes

* fixup! Add overloads for unaligned reads/writes

* fixup! Add overloads for unaligned reads/writes

* fixup! Add overloads for unaligned reads/writes

* Add tests for flashRead/flashWrite

* fixup! Add overloads for unaligned reads/writes

* fixup! Add tests for flashRead/flashWrite

* fixup! Add tests for flashRead/flashWrite

* fixup! Add overloads for unaligned reads/writes
2020-10-14 22:21:41 -07:00
Max Prokhorov
36b444dba3
Allow test framework to use cores/esp8266/Arduino.h directly (#7377)
* Allow test framework to use cores/esp8266/Arduino.h directly
* fix wps debugging
* some more missing debug.h
* Hunt down debug.h and roll-back
  TODO: rename it to something else... it is an internal header
* Move abs+round checks to test/device/test_sw
* Restore macros for C code
* fixup! Move abs+round checks to test/device/test_sw
* Fix bad c/p, actually try round with ints
* tweak c macros per review
* fix gcc-10 missing cerrno include
2020-10-06 16:18:00 +02:00
Earle F. Philhower, III
85ba53a249
Remove stray axtls refs, deprecated compat funcs (#7626)
Remove the axTLS compatability functions from WiFiClient/ServerSecure,
device tests for axTLS, and any document refs to axTLS.
2020-10-02 21:39:36 -07:00
Max Prokhorov
cc042b99d1
WString: c_str() returns null pointer after move (#7611)
* (test) WString: c_str() returns null pointer

target = std::move(source) does not reset buffer pointer back to the sso

* wstring: correctly do move invalidation & copy

based on the #7553 without isSSO -> isHeap rename and inline optimizations
additionally, remove useless pre-c++11 preprocessor checks

Co-authored-by: Takayuki 'January June' Suwa <jjsuwa@sys3175.com>
2020-09-27 08:11:52 -07:00
Labor-Et-Ars
a3281fe2f3
LEA mDNS v2 (#7540)
* LEAmDNSv2
2020-09-25 11:12:39 +02:00
david gauchard
40eb5747e4
sntp: use one time source and fix unsynchronized sntp time stamp (#7595)
* sntp: use one time source and fix unsynchronized sntp time stamp
* show subsecond synchro between time() and gettimeofday()
2020-09-12 18:22:38 +02:00
Valerii Koval
22a197eea1
Properly replace toolchain in PlatformIO CI script (#7580) 2020-09-04 18:15:02 +03:00
Masanari Iida
cbb44b2cc9 Fix typos in tests
This patch fixes some spelling typos found in tests directory.
2020-09-01 23:37:14 +09:00
hreintke
be812d2a8d
Netump Initial commit (#7527) 2020-08-30 13:07:52 -07:00
Valerii Koval
b9db9440fe
Delete owner field (#7563) 2020-08-30 00:10:45 +03:00
Earle F. Philhower, III
c366f84520
Add CI test for eboot build (#7546)
Check that building the eboot.c block generates the same binary as
the verison checked into the repo.  Catches the case where a library
or eboot.c file is changed, but an updated eboot.elf isn't included
in a PR.

Can't do simple binary diff of the ELFs because paths and compile
times will change, so dump the two sections we care about.
2020-08-27 18:32:58 -07:00
david gauchard
e53aa87160
emulation-on-host makefile update, allowing to pass more options (#7552) 2020-08-26 15:40:54 +02:00
Earle F. Philhower, III
e2b8f6acfb
Update PIO CI to be less chatty, fix CI fail (#7530)
Remove get.py percent dump to shorten PIO output 99%.

Use latest release version of PIO, not bleeding edge, to fix
failures introduced in devel (non-release) PIO versions.
Thanks, @mcspr, for noticing this!
2020-08-16 11:41:42 -07:00
david gauchard
e0fedc577b
avoid circular #include dependence for PolledTimeout (#7356)
* move features to features.h

* fix std:: dependencies

* fix emulation on host

* api explanation
2020-08-15 15:24:35 -04:00
david gauchard
79fc0b3b4a
CI: on host: force 64 bit mode like make -j2 CI implicitly does (#7513)
It allows to run CI tests on computers having gcc-multilib installed
2020-08-07 17:17:29 +02:00
Earle F. Philhower, III
a8e35a579c
Add valgrind mocked test to CI (#7501)
Run valgrind on host mock example runs to catch more bugs in CI.  These
tests would have caught the problem in #7464 before users did.

Add a list of some randomly picked examples to run, and add an option to
run the loop exactly once in the host mock routine, so the test will
actually exit under valgrind.
2020-08-03 19:00:51 -07:00
Earle F. Philhower, III
3bd24587e1
Transition from TravisCI to GitHub CI (#7444)
Convert the continuous integration process to use GitHub's internal
CI cloud.  Allows us to run up to 20 jobs in parallel, speeding up
CI immensely.  Keep a short Travis-CI run, too, just for sanity and backup.

Uses new keys and secret when publishing a release to
esp8266.github.io.
2020-07-14 22:02:47 -07:00
david gauchard
af1bc71a9e
remove lwip-v1.4 specific code (#7436)
* remove lwip-v1.4 specific code

* ditto

* ditto

* fix ip4_addr definition

* CI: change debug builds to use IPv6, remove regular IPv6 builds

* ditto

* split pio CI in four (because they last twice the time of the other builds)

* remove option from pio

* remove lwIP-1.4 from doc

* restore pio CI splitting

* fix CI debug6 script

* ditto
2020-07-09 09:59:49 -07:00
Earle F. Philhower, III
252cb1d968
Remove wget dump during CI (#7438)
Add -q quiet option to wget while downloading Arduino to minimize the
size of the output log.
2020-07-08 08:19:15 -07:00