1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-21 10:26:06 +03:00

496 Commits

Author SHA1 Message Date
Max Prokhorov
b7c1cfbc45
DHCP custom option (#8582)
* 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
2022-06-08 23:19:59 +02:00
M Hightower
9e2103f27e
Patch eap.o memory leak (#8566)
* 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
2022-06-02 23:48:28 +02:00
Flole998
f5ef02d643
Fix double-free when connecting to WPA2-Enterprise networks (#8529)
* 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
2022-06-02 11:38:28 +02:00
Max Prokhorov
502d9469fa
Initialize SoftAP DhcpServer object on demand (#8546)
* 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
2022-06-01 22:46:04 +02:00
Maximilian Gerhardt
c1144c5740
Move _GNU_SOURCE from CCFLAGS to CPPDEFINES (#8579)
Makes _GNU_SOURCE visible in VSCode Intellisense and other IDEs.

Co-authored-by: Ivan Kravets <me@ikravets.com>
2022-05-28 21:17:33 +03:00
Ivan Kravets
35c2ae1cbb
Improve support for hand-written asm source files (#8583) 2022-05-28 20:56:13 +03:00
Takayuki 'January June' Suwa
48b60f4651
tools/sizes.py: Restore to the prior behavior regarding output destination (#8572)
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)
2022-05-17 17:24:36 +03:00
Takayuki 'January June' Suwa
fd9af97e00
tools/sizes.py: Change Unicode box-drawing chars to that of double version (#8573)
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))
2022-05-17 16:48:30 +03:00
M Hightower
5311c0d20a
Fix utf-8 encoding (#8565)
* Fix utf-8 encoding

Issue posted to commit
d1d4212e8b (r73517358)

* Added python source code encoding

* for touch operations open/create file in binary mode
2022-05-15 22:19:39 +02:00
david gauchard
80c0570620
Define lwIP's s32/u32 to int (#8560)
* 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>
2022-05-15 21:55:56 +02:00
M Hightower
d1d4212e8b
Add support for global build defines and options (#8504)
* 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
2022-05-12 17:14:17 +02:00
Max Prokhorov
da4a19fdac
Table output for segment size script (#8551)
* 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
2022-05-11 23:25:39 +02:00
Earle F. Philhower, III
a736a95655
Fix minor typo in generated comment (#8503) 2022-03-05 08:19:17 -08:00
Earle F. Philhower, III
46190b61f1
Error even w/warnings disabled for no-return fcns (#8495)
* 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
2022-03-04 02:10:57 +03:00
david gauchard
f60defc3d3
flash-size agnostic builds (#6690)
* flash: mapping definition by sketch at runtime depending on flash chip size and user configuration
2022-02-10 18:25:18 +01:00
M Hightower
9fcf14f81f
Fix VM Address mask (#8440)
* 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.
2022-01-12 01:35:46 +03:00
david gauchard
4c07113ff5
lwIP: v2.1.3 + dhcp fixes (#8319)
* lwIP: v2.1.3
* interface set as default when gw is valid
2022-01-06 12:38:36 +01:00
Earle F. Philhower, III
55ef3e7397
GCC 10.3 Bugfix 1 (#8393)
Fixes a hard-to-track bug in GCC 10.x.
https://github.com/earlephilhower/newlib-xtensa/issues/19
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102115

GCC 10.3 had an issue with addressing constant integer literals which would
result in crazy offsets being used and random crashes in production.
Update with an upstream GCC 11 bugfix by @jjsuwa-sys3175
https://github.com/earlephilhower/esp-quick-toolchain/pull/31
https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=dcb2873cd32b263643bfd9d1298b35d6cd028f0a
2021-12-03 02:24:12 +03:00
david gauchard
986dd4209d
enable nonosdk-2.2.x version 19-03-13 for Arduino IDE per #7965 (#8363) 2021-11-05 23:49:59 +01:00
Stanimir-Petev
3f5a76cc26
MOD-WIFI-ESP8266(-DEV) update (#8297)
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.
2021-10-31 13:30:38 -07:00
Maximilian Gerhardt
f7951e6842
Respect linking order of libraries for PlatformIO (#8263)
* 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.
2021-09-01 08:43:49 -07:00
Earle F. Philhower, III
cfb6d50844
Fix PRxxx printf format macros (#8222)
* 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.
2021-07-26 21:41:08 +02:00
david gauchard
69f8cd6934
Certificate and public keys automatic updater (#8218) 2021-07-17 16:29:46 -07:00
gneiss15
95c6fbb054
Make mkdir.py work under python3 versions below 3.5 (#8194)
* 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).
2021-07-09 12:09:33 +02:00
gneiss15
7ba596a5fe
Add wifi kit 8 to boards (#8190)
* 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
2021-07-03 23:33:20 +02:00
Max Prokhorov
019fab4e02
pio: use CCFLAGS for -Werror (#8175)
Also adds some comments referencing SCons documentation
2021-06-25 18:38:46 -07:00
Earle F. Philhower, III
90b4c6f299
Add errors on invalid/missing function return type (#8165)
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.
2021-06-24 12:44:57 -07:00
david gauchard
e55dfc3a0e
Documentation: Arduino IDE specific options for esp82xx (#8154) 2021-06-21 17:03:14 -07:00
Silvano Cerza
78e63280ba
Add missing menu.UploadTool name definition (#8153) 2021-06-21 11:12:05 +02:00
david gauchard
2f37c967e1
gnu source: honoring libc requirements (#8147) 2021-06-20 10:31:50 -07:00
david gauchard
7f78278969
makecorever.py: restore ARDUINO_ESP8266_GIT_VER even without .git/ (#8138)
fixes #8134
2021-06-18 00:03:08 +02:00
david gauchard
52be27dfb5
Release process fix #2 (#8127)
* 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)
2021-06-17 00:51:15 +02:00
david gauchard
2897679060
Release process fix & major/minor/rev macro addition (#8126)
* update release process to the new CI
* generate ARDUINO_ESP8266_{MAJOR,MINOR,REVISION} in core_version.h
* makecorever: new option `-r` for release
2021-06-16 15:51:17 +02:00
Maximilian Gerhardt
ff041942e0
Remove include and lib folders removed since 3.0.0 core (#8125) 2021-06-15 21:19:49 +02:00
Earle F. Philhower, III
e8b411fafb
Update toolchain to gcc 10.3 w/patches (#8104)
* Update toolchain to gcc 10.3 w/patches

* Bump GIT version to clear GH CI cache
2021-06-06 12:41:06 -07:00
Earle F. Philhower, III
74d675cffa
Update to GCC 10.3 and toolchain rebuild (#8103)
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.
2021-06-05 15:27:58 -07:00
Earle F. Philhower, III
114a726798
Update toolchain to fix pgm_read_float_unaligned (#8091)
Update toolchain to fix pgm_read_float_unaligned
Fixes #8083
2021-06-04 17:06:16 +02:00
Valerii Koval
e5489cfd99
Synchronize PlatformIO build script (#8092) 2021-06-01 07:55:08 -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
bdd341c9ea
boards: wemos d1 clones: new entry with menus for flash mode and flash freq (#7989) 2021-05-15 11:04:09 -07:00
M Hightower
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
Earle F. Philhower, III
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
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
Earle F. Philhower, III
d3d49d5db4
Update mklittlefs executable (#7906)
Rebuild entire toolchain instead of manually hacking the tools JSON to
ensure repeatability.

New mklittlefs sets the new FS timestamp added in #7873
2021-03-04 11:29:38 +01:00
Foddis Gabriele
d41b4037cc
board manager: + Agrumino lemon v4 (#7883) 2021-02-19 08:21:16 -08:00
twischer
83f5f29cfd
Support to reboot into UART download mode (#7854)
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>
2021-02-17 08:25:52 -08:00
Earle F. Philhower, III
e4435fa306
Update board-specific defines (#7875)
Fixes #6805

Update the build.board for several boards which were originally added
with a generic type.
2021-02-14 14:42:50 +01:00
Earle F. Philhower, III
07b4c09b90
eboot: .RODATA, upstream uzlib, move CRC, save 112 bytes (#7844)
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.
2021-02-07 16:32:56 -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
c2393d05be
Fix improper GENERIC board IDs (#7839)
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.
2021-01-27 00:06:12 -08:00