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

4267 Commits

Author SHA1 Message Date
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
david gauchard
2904021cb9
CI: update arduino IDE url (#8563) 2022-05-12 12:55:03 +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
david gauchard
8d5dda02f6
emulation on host: fix for latest changes in DNSServer (#8559) 2022-05-10 20:31:12 +03:00
M Hightower
bcb5464167
Add DNS forwarder to DNSServer (#7237)
The key functions added are:

`bool enableForwarder(const String &domainName=emptyString, const IPAddress &dns=uint32_t)0)`

If specified, `enableForwarder` will update the `domainName` that is used to match DNS request to this AP's IP Address. A non-matching request will be forwarded to the DNS server specified by `dns`. 

Returns `true` on success.

Returns `false`, 
 * when forwarding `dns` is not set, or 
 * unable to allocate resources for managing the DNS forward function.

`void disableForwarder(const String &domainName=emptyString, bool freeResources=false)`

`disableForwarder` will stop forwarding DNS requests. If specified, updates the `domainName` that is matched for returning this AP's IP Address.
Optionally, resources used for the DNS forward function can be freed.
2022-05-08 14:04:34 +03:00
Max Prokhorov
1a49a0449b
WebServer: use String when working with Basic authentication (#8548)
Avoid blowing up user code when `$user:$password` string is longer than
127 bytes. Use String to both manage the memory and handle concatenation.

Also clean-up historical quicks such as
- `if(StringObject)` that is always true since we implemented SSO
- `authReq = "";` / `authReq = String();`, which will happen anyway
- `(String)...` casts that happen anyway, implicitly (and which is also not a 'cast' btw, we do init it)
2022-04-30 18:25:42 +03:00
M Hightower
f149d7b70e
Correction to run_CI_locall.sh (#8552)
`tests/ci/check_restyle.sh` does not exist; however, `tests/ci/style_check.sh` does.
Changed run_CI_locally.sh to run style_check.sh from ci directory.
2022-04-30 18:17:13 +03:00
Max Prokhorov
02c1a502ca
ci: make sure to kill gpg related processes (#8549)
Removing the directory while gpg-agent and dirmngr are running is not always possible, causing random errors during CI runs.
2022-04-21 22:05:55 +03:00
Earle F. Philhower, III
6c8c8cb2d6
Update to LittleFS 2.5 release (#8543) 2022-04-20 00:13:17 +03:00
Dirk O. Kaar
315bc77afe
EspSoftwareSerial release 6.16.1 (#8541) 2022-04-14 08:16:45 -07:00
Edd Inglis
f78c6332f0
Permit using the Updater _hash function, even if we don't have a signature appended to the image (#8507)
The _hash and _verify functionality of the Updater class are pretty much entwined. But it might be useful to calculate the hash, even without a signature present in the image itself. This change permits that by allowing a zero-length signature.

For reference, one possible use case is where the expected hash is provided separately to the uploaded image. Another is to provide generic post-upload validation of the image: the hash function permits a convenient way of inspecting the complete image against arbitrary conditions; this is particularly useful after HTTP client OTA updates.

(It's fair that reading the whole image back out of flash is not very efficient, but that's not the concern of this PR.)
2022-04-11 14:14:26 +03:00
Max Prokhorov
520233f73e
Test: fixing itoa implementation and clean-up of tests and test Makefile (#8531)
* Test: fixing itoa implementation, clean-up of tests and test runner

Update itoa to be the same as newlib, fixing edgecase of abs(INT_MIN)
Update WString.cpp:toString() integer conversions to use noniso funcs
Remove legacy gcc versions from Makefile and allow overrides
Don't fallback to c11 and c++11, source cannot support that

* CXX and CC are make predefined values, assuming ?= does not work (?)
2022-04-11 13:53:40 +03:00
Paulo Cabral Sanz
27827c8c6d
Delete operator=(Self&) when copy constructor is deleted (#8535) 2022-04-11 13:41:21 +03:00
Mike Bell
684156d211
ESP8266 Web Server: Fix missing implementation of send stream by reference (#8533) 2022-04-08 08:55:02 +03:00
Max Prokhorov
584d2f2392
WString: unify numeric conversion and fix assignments (#8526)
Restore the pre-3.0.0 behaviour when we could assign numeric values to
the string object. After introducing operator =(char), everything was
converted to char instead of the expected 'stringification' of the
number (built-in int, long, unsigned int, unsigned long, long long,
unsigned long long, float and double)

Add toString() that handles conversions, re-use it through out the class

Fix #8430
2022-04-05 15:31:24 +03:00
Earle F. Philhower, III
d205a63309
Update sessions example to show speed difference (#8528)
Fixes #8505
2022-04-04 10:48:29 +02:00
M Hightower
04fe1b9667
Fix OOM print handling of NULL file pointer (#8527) 2022-04-04 10:08:14 +02:00
M Hightower
fbedcc1b2f
Heap panic / abort cleanup (#8465)
Isolate NULL/panic test of _context to dev debug assert macro.

Use abort instead of panic for case of caller providing non-heap address pointer.
  Added debug print.
  Improved get_unpoisoned_check_neighbors to print file/line when available.
2022-04-01 00:10:50 +03:00
Max Prokhorov
a29eaffcf8
Fix commit hash for the clang-format changes (#8525)
GitHub PR rebase-merge of #8464 introduced a new commit, instead of using
the one from the PR tree. Point to that new one in the `master` branch.
(fixing 24c41524dc56c683d8926671bdd639d7411f2815 changes)
2022-03-31 23:18:52 +03:00
Paulo Cabral Sanz
32939c4334
Fix reuse for different URIs in HTTPClient::begin (#8466) 2022-03-30 10:35:46 +02:00
Earle F. Philhower, III
06e3c562ef
Properly quote paths for GCC warnings files (#8523)
Fixes issue identified by @jjsuwa-sys3175 in
46190b61f1 (r69649862)
2022-03-29 21:07:16 -07:00
Edd Inglis
732db59492
Catch a possible null-dereference (#8508) 2022-03-13 22:34:42 +01:00
Earle F. Philhower, III
a736a95655
Fix minor typo in generated comment (#8503) 2022-03-05 08:19:17 -08:00
Maxim Prokhorov
24c41524dc Add .git-blame-ignore-revs (#8464)
Ignore mass-reformatting commits
Include the clang-format, and the previous astyle

Based on the idea from black
https://black.readthedocs.io/en/stable/guides/introducing_black_to_your_project.html#avoiding-ruining-git-blame

To be used with git CLI when exploring some specific file history
```
$ git blame --ignore-revs-file .git-blame-ignore-revs -- file.cpp
```

Or, by modifying the config to apply globally
```
$ git config blame.ignoreRevsFile .git-blame-ignore-revs
```
(note that the by default config will apply only for the current repository)
2022-03-04 02:28:47 +03:00
Maxim Prokhorov
19b7a29720 Migrate from astyle to clang-format (#8464) 2022-03-04 02:28:47 +03: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
Max Prokhorov
ead5f94dd3
Correctly using fs:: namespace in SD & SDFS (#8493)
Remove `using namespace fs;` from SDFS.h
Fix everything that depended on it
2022-02-23 08:52:24 -08:00
Max Prokhorov
fd53a080ee
Add documentation entry about compiler warnings (#8492)
per #8421 and #8475
after checking HW, suggest to check SW as well by at least by enabling some or all compiler warnings
(and also note of the IDE weirdest defaults causing issues we expected to stay solved)
2022-02-22 13:42:26 +03:00
david gauchard
15e7d35d6e
emulation on host: minor updates (#8454)
* emulation on host: minor fixes
merge MockDigital.cpp and HostWiring.cpp

* emulation: share mockverbose between CI-on-host and emulation

* mock: add missing recently overridden method

* remove extern variable, use weak function
2022-02-20 16:27:52 +03:00
M Hightower
7356cd1ef1
Heap init code improvements and updates (#8458)
* Heap init code improvements and updates

Moved secondary heap init code to flash.
  External -24 IRAM, +32 IROM
  IRAM     -76 IRAM, +64 IROM

General updates to umm_init call path and DEFINES to better align with
upstream. Name changes: UMM_INIT_HEAP with UMM_CHECK_INITIALIZED,
umm_init_stage_2 with _umm_init_heap, and umm_init_common with umm_init_heap.

Add file umm_cfgport.h to hold port-specific values. Stay focused
on heap initialization only move-related defines.

Improved comments.

Created a wrapper function for running pre-SDK code from flash.
Updated hwdt_app_entry to use it.

Update umm_init with option to run from ICACHE.
Added build define UMM_INIT_USE_ICACHE to move umm_init call path to flash.
When used frees up 160 bytes of IRAM at a cost of 208 bytes of IROM

Defaults to no change, umm_init call path will be in IRAM.

* Changed default to use IROM for umm_init() and option to revert back to UMM_INIT_USE_IRAM.
2022-02-15 22:42:08 +01:00
NaincyKumariKnoldus
d7c3d7b797
Minor git install documentation fix (#8488) 2022-02-15 12:06:25 -08:00
M Hightower
e6fc76ab5f
Fix, calloc now fails on extra-large request. (#8482)
Added code to handle multiply overflow in calloc.
Added code to handle add overflow in umm_poison_*
2022-02-12 22:24:59 +01: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
Drzony
3027acaf11
Fix compilation of ArduinoOTA when no global MDNS is available (#8478) 2022-02-05 00:05:38 +01:00
Paulo Cabral Sanz
9f536e68f8
WString: avoid writing to const storage (#8463)
This avoids the null termination requirement of both String::substring and String::lastIndexOf by using APIs that don't require it. So we can stop writing to the buffer inside of const functions.

I also changed wbuffer to make it non const.
2022-01-28 15:51:45 +03:00
Earle F. Philhower, III
30b0450d2b
Move ESP8266SDFat library to master, not branch (#8460)
The existing ESP8266SdFat points to a working branch of the tree.
That branch is now merged to master, so move library to it.

There are no code changes,
2022-01-24 10:51:36 +01:00
Benedikt Eliasson
f4ef6fd7d8
fix Stream.read into buffer ignoring every second byte (#8452) (#8453) 2022-01-18 15:21:13 +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
Phill
378fcfcda4
Remove obsolete PWMRANGE in keywords.txt (#8447)
PWMRANGE was defined up until v2.7.4:

```
$ cd ~/Library/Arduino15/packages/esp8266/hardware/esp8266
$ grep -R "PWMRANGE" 2.7.4
2.7.4/keywords.txt:PWMRANGE	LITERAL1
2.7.4/tests/host/common/Arduino.h:#define PWMRANGE 1023
2.7.4/cores/esp8266/core_esp8266_wiring_pwm.cpp:static int32_t analogScale = PWMRANGE;
2.7.4/cores/esp8266/Arduino.h:#define PWMRANGE 1023
```

The define was removed in favour of the Arduino standard value of 255
but the keyword coloring was left behind:

```
$ cd ~/Library/Arduino15/packages/esp8266/hardware/esp8266
$ grep -R "PWMRANGE" 3.0.2
3.0.2/keywords.txt:PWMRANGE	LITERAL1
```

In the Arduino IDE, the coloring makes it look like PWMRANGE still
exists, when it doesn't, which is confusing.

Signed-off-by: Phill Kelley <pmk.57t49@lgosys.com>
2022-01-10 19:44:27 -08:00
Luc
2c5885e29d
Fix info.usedBytes calculation giving weird result (#8445) 2022-01-09 16:08:10 -08: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
david gauchard
a05a71fa9d
import getLocalTime() from esp32/Arduino (#8413)
* import getLocalTime() from esp32/Arduino
follows #8407
2022-01-04 22:20:20 +01:00
M Hightower
f26201e6a9
Sync umm_malloc style with upstream (#8426)
Upstream umm_malloc at git hash id 4dac43c3be7a7470dd669323021ba238081da18e
processed all project files with the style program uncrustify.

This PR updates our ported version of umm_malloc processed with "uncrustify".
This should make subsequent merges of upstream into this port easier.

This also makes the style more consistant through umm_malloc.
2022-01-03 22:36:03 +01:00
Juraj Andrássy
f401f08aba
WiFiServer - 'rename' available() to accept() (#8419)
* WiFiServer - 'rename' available() to accept()
* use server.accept() instead of available()
* WiFiServer.accept() and ArduinoWiFiServer class doc update
2022-01-03 14:32:02 +01:00
david gauchard
2f58f679ee
Emulation on host: updates (#8409)
* mock: +Hash, +scheduled functions
Co-authored-by: Max Prokhorov <prokhorov.max@outlook.com>
2022-01-03 14:23:45 +01:00
Juraj Andrássy
d0cc3a80f8
WiFiServer - don't inherit from Server class (#8418)
* WiFiServer - don't inherit from Server class
2022-01-03 14:06:31 +01:00
david gauchard
dde2c769db
StreamConstPtr: disallow passing a String temporary (#8410)
* StreamConstPtr: prevent from passing a temporary String instance
* unconditionally allow progmem chars
* missing virtual destructor in Stream
(warning: deleting object of abstract class type 'Stream' which has non-virtual destructor will cause undefined behavior [-Wdelete-non-virtual-dtor])
2022-01-03 13:42:27 +01:00
david gauchard
e3c79de7c9
httpClient: prevent empty user-agent in header (#8411) 2022-01-03 12:09:31 +01:00
M Hightower
e5a214e6f1
Fix umm_blocks() (#8429)
Extracted fix from upstream for umm_blocks() - On allocations that were too
large, umm_blocks() could return an incorrectly truncated value when the result
is cast to uint16_t.
2022-01-03 11:44:17 +01:00
Earle F. Philhower, III
b5f3d1d6d5
Remove Python installation from OTA doc (#8417)
Fixes #8416

We install now a private Python and use it for OTA calls, so users do not need to manually install anything.
2021-12-20 14:49:45 +01:00