1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-12 01:53:07 +03:00
Commit Graph

4045 Commits

Author SHA1 Message Date
1a381477ec Updated HWDT one missed ICACHE_RAM_ATTR (#8018) 2021-05-06 10:45:55 +02:00
bc816c657b Updated HWDT to use IRAM_ATTR instead of ICACHE_RAM_ATTR. (#8013) 2021-05-02 14:58:54 +02:00
5704bf2102 minor host fix found while compiling arduinoJson (#8009) 2021-04-29 23:46:41 +02:00
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
457692101a Move prototype for enablePhaseLockedWaveform linker magic into header that's included by default instead of particular internal core header. (#7996) 2021-04-22 14:02:54 -07:00
cfbbd6f22d enableWiFiAtBootTime() should be declared in ESP8266WiFi.h (#7993) 2021-04-18 22:17:14 +02:00
b933e3d283 WiFi off a boot: document a linker error when user wants to use wifi without including ESP8266WiFi.h (#7990) 2021-04-18 00:15:42 -07:00
ae359cc5f6 EspSoftwareSerial 6.12.2: Inlining push() functions that must be in IRAM for calling from ISRs (#7986) 2021-04-18 00:04:17 -07:00
41de4115fd Resolve "PWM-locked" / "phase-locked" waveform merge leftover in Servo lib (#7978)
Library was overlooked in "PWM-locked" / "phase-locked" waveform mode merge.
2021-04-17 13:43:02 -07:00
209e467120 doc: analogRead must not be called to frequently with WiFi is on (#7981) 2021-04-14 19:40:11 +02:00
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
da6ec83b5f Hardware WDT Stack Dump Tool (#7010)
* 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
2021-04-08 01:35:49 +02:00
0049090e48 comments in ClientContext::connect() (#7961)
* add comment
2021-04-05 15:09:27 +02:00
bde6ab1df2 Merge pull request #6117 from PurpleAir/master
Improve timeout in Updater.
2021-04-04 22:21:10 -04:00
57fbd69a93 Merge branch 'master' into master 2021-04-04 15:43:19 -06:00
d013aadb96 Merge pull request #7953 from dok-net/hwserial
Sanitizing HW serial's uart.cpp just a little more.
2021-04-04 17:17:57 -04:00
eb1966b6a9 Merge branch 'master' into hwserial 2021-04-04 17:06:27 -04:00
0593cbdc00 Merge branch 'master' into master 2021-04-04 23:02:43 +02:00
cd7d137774 Per review. 2021-04-04 19:36:38 +02:00
1c57b3408c fix WiFiClient::write(from flash or iram) (#7951)
* fix WiFiClient::write(flash or iram)

* fix emulation on host
2021-04-04 11:31:45 +02:00
2e214843db Minor code cleanup. 2021-03-31 15:33:57 +02:00
5ac64ffa27 Merge pull request #7949 from dok-net/hwserial
HW Serial swap and pin setting work only on a few pins
2021-03-28 19:48:18 -03:00
8430a09aae Adapt MockUART.cpp 2021-03-28 22:31:52 +02:00
2cf76ba784 HW Serial swap and pin setting work only on a few pins, return false on failure. 2021-03-28 22:31:52 +02:00
eedb009c6d Bug-fix release 6.12.1: a documentation error was reported by a user; dropped bit-patterns that masked the stop-bit fixed. (#7938) 2021-03-28 13:23:37 -07:00
c1118dfce3 Stream::Send fixes: doc + StreamConstPtr byte-by-byte + missing SSL availableForWrite (#7935)
* StreamConstPtr: fix doc + reading flash space byte-by-byte
* add missing availableForWrite wrapper in wificlient-ssl
* WiFiClientSecure-ctx: add missing availableForWrite()
2021-03-25 16:00:41 +01:00
0a4fcdf090 Merge pull request #7940 from mcspr/wifi-evt-ssid
Fix WiFi events with 32byte wide SSIDs
2021-03-24 21:52:54 -03:00
3ff573103b Fix WiFi events with 32byte wide SSIDs 2021-03-25 02:38:25 +03:00
fdc295dfae Fix typo in EEPROM debug message (#7934)
Fix #7933
2021-03-22 08:05:33 -07:00
edcbdbea45 Update Root Certificate (#7932)
The root certificate used in the example to connect to api.github.com has expired.
A new certificate was issued on March 3, 2021 and should be valid for a year.
2021-03-21 13:35:11 -07:00
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
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 444002180b
2021-03-21 14:40:25 +01:00
1b922edad1 Added broadcastIP method to WiFiSTA class (#7899) 2021-03-16 08:01:04 -07:00
2406fe8fb8 Adds the method setSSLVersions() also to WiFiClientSecure in order to use that new feature. (#7925)
Co-authored-by: Manuel Domínguez Dorado <manuel.dominguez@enzinatec.com>
2021-03-15 13:21:53 -07:00
7475ba7ff3 Add setSSLVersion call to SSL object (#7920)
* Add setSSLVersion call to SSL object

Allow users to only allow specific TLS versions for connections with an
additional call in their app, similar to the setCiphers call.

Fixes #7918

* Add SSL level options to WiFiServerSecure
2021-03-15 12:22:06 -07:00
dcdd4313cb Clean up ICACHE_RAM_ATTR in VM PR (#7924) 2021-03-15 03:00:39 -07:00
55cee059fe EspSoftwareSerial minor release 6.12.0 completes adaptation to new Stream::send() (#7923) 2021-03-15 02:24:25 -07:00
48e1ccbff8 Added ESP32 compatible methods for setting/getting sleep mode (#7901) 2021-03-14 20:48:54 -07:00
9d82ebe6f7 Add example for using ESP.rebootIntoUartDownloadMode() (#7897) 2021-03-14 20:36:06 -07:00
47b8947e72 ESP8266WebServer: Add variadic template version of collectHeaders() (#7296)
* More user-friendly, less RODATA usage.

eg. `webServer.collectHeaders(F("Content-Type"), F("Origin"));`

In this example, less about 20 bytes than the traditional way.
2021-03-14 19:55:25 -07:00
8ffe41b7df Enable 128K virtual memory via external SPI SRAM (#6994)
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().
2021-03-14 18:44:02 -07:00
c720c0d9e8 Stream::send() (#6979) 2021-03-14 17:36:20 -07:00
4cc1472821 [BREAKING] base64::encode() compat with esp32: no newlines by default (#7910) 2021-03-14 17:24:33 -07:00
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
6743a65987 Minor EspSoftwareSerial release 6.11.7, for deprecated ICACHE_RAM_ATTR in upcoming ESP8266 Arduino core 3.0.0. (#7922) 2021-03-14 16:15:37 -07:00
49a09279eb Merge pull request #6280 from aerlon/wifi_mesh_update_2.2
WiFi Mesh Update 2.2
2021-03-14 18:11:32 -03:00
7fbf620ab6 Merge branch 'master' into wifi_mesh_update_2.2 2021-03-14 16:41:13 -03:00
444002180b OOM debug: warn about String reallocation (#7908)
* OOM debug: warn about String reallocation

* threshold set to 128 bytes, +defines

* warn only when capacity had already reached the threshold
2021-03-14 07:57:23 +01:00
e07542d701 Fix link to ESP8266 NonOS SDK (#7914) 2021-03-11 07:24:24 -08:00
e99df4fe1a Add I2S class support (#7874)
Fixes #427

Adds a basic I2S class based off of the Arduino-SAMD core.  The raw
i2s_xxx functions are still a better  way to use I2S due to their
flexibility, but this will allow basic Arduino sketches to work.
2021-03-07 08:14:07 -08:00