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

544 Commits

Author SHA1 Message Date
f5142b883d Tools - upload.py exception handling fixes (#9186)
- don't check exc_info() in `finally`, it only works without `except` with just `try` and `finally`
  see https://docs.python.org/3/reference/compound_stmts.html#try
  after `except Exception as e:` block, `e` is already deleted

- handle a rare case when esptool code does not close 'erase_file'.
  printing paths may cause encoding issues, so just fall through silently

- simplify ordering of write_flash & erase_region arguments
  since we always end up in write_flash, prefer to think of it as argument pairs 'addr' + 'path'. actual binaries go first, erase 
  temporaries go last. construct write args beforehand and apply when finishing with the command line.

  both commands can appear multiple times, for manual or scripting cases, where multiple regions should be erased / written to
2025-05-30 01:08:31 +03:00
bc251382a6 Boards - fix & update Mercury (#9238)
* update Mercury Board

* fix

---------

Co-authored-by: Maxim Prokhorov <prokhorov.max@outlook.com>
2025-05-29 16:20:52 +03:00
2201770a20 Tools - makecorever.py fixed packaging & avoid needless overwrites (#9250)
update packaging script w/ new arguments

rewrite ci build pattern to only rewrite core_version.h once per job
restore behaviour from #6414 for other cases
2025-05-28 03:57:47 +03:00
4214e16671 Tools - makecorever.py explicit output argument (#9248)
* Tools - makecorever.py explicit output argument

Don't hide where the file is actually placed
Using pathlib instead of raw strings to simplify path ops
Plus, add stdout preview when output is missing

Clean-up git-describe <-> version availility checks

* typo

* fix unhandled exc in git cmd

* unused escape

* RELEASE using same values
2025-05-27 06:55:03 +03:00
30780cb8c9 Tools - get.py updates (#9247)
* Tools - get.py updates

Using pathlib for paths, assume relative paths from __file__.parent as PWD
Using argparse for arguments, expose previously uncustomizable bits.

Reading tarfile with transparent compression.
Drop previously untested .t{...} and .tar.{...}, just use "r:*"

Remove hard-coded dependency on 'platform' and allow to specify sys_name, sys_platform and bits.
Stub for DarwinARM, allow to fetch x86_64 packages in the meantime.

* missing mkdir_p
2025-05-27 02:26:22 +03:00
a5f18b5f91 Tools - none-cxxflags generator script & enable deprecation warnings (#9245)
* Tools - none-cxxflags generator script

GCC10 -> GCC (as in general, not specific to 10)
cpp -> cxx to be consistent with gcc terminology
grep exclude patterns in a separate file
exclude 'deprecated' warnings by default

* actually set warnings when compiling

--warnings=none is arduino-cli implicit default
2025-05-20 20:58:32 +03:00
606324ccf8 CI - Python deprecations (#9242)
py3.13 - https://docs.python.org/3/library/re.html#re.sub
> Deprecated since version 3.13: Passing count and flags as positional arguments is deprecated. In future Python versions they will be keyword-only parameters.

py3.12 - https://docs.python.org/3/library/tarfile.html#tarfile.TarFile.extraction_filter
> If extraction_filter is None (the default), calling an extraction method without a filter argument will raise a DeprecationWarning, and fall back to the fully_trusted filter, whose dangerous behavior matches previous versions of Python.
2025-05-20 19:18:27 +03:00
1a13ab95fb Stack thunk yield() fixes (#9224)
* Update bearssl builder

* Keep bssl stack pointer from confusing yield

implement stack_thunk_yield() which is called within bssl
stack overflow checks for cont would always fail otherwise
2025-01-24 10:17:51 +03:00
07feacec46 Update certs.h (#9182)
* Update certs.h

not_valid_{after,before} -> not_valid_{after,before}_utc

https://cryptography.io/en/latest/x509/reference/#cryptography.x509.Certificate.not_valid_before
> This property is deprecated and will be removed in a future version. Please switch to the timezone-aware variant not_valid_before_utc().

* fixup! Update certs.h
2024-07-31 03:58:18 +03:00
3a5157e3ba Mock - update func signatures for latest glibc (#9117)
glibc 2.38 includes strlcpy and strlcat, attempt to detect them before use
2024-07-31 02:24:41 +03:00
bd136f1c20 Boards - add Mercury 1.0 (#9166)
Co-authored-by: Gaurang Gupta <iotgupta@gmail.com>
2024-07-31 01:40:57 +03:00
1b6f815463 Sphinx syntax fixes (#9180)
get rid of warnings when converting python -> rst, force quit when they happen
fix code-blocks, always need extra line
fix invalid headers refs so they actually work
2024-07-31 01:28:46 +03:00
685f2c97ff decoder.py: allowing to use it live (#9108)
- avoid ctx repetition and hide some useless fw debug lines
- hide "DECODE IT"
- immediately print stack at closing marker
- check for tool executable at startup

live command line example
>  pyserial-miniterm /dev/ttyUSB0 115200 | \
        path/to/esp8266/Arduino/tools/decoder.py \
            --tool addr2line \
            --toolchain-path path/to/esp8266/Arduino/tools/xtensa-lx106-elf/bin \
            path/to/build.elf
2024-03-31 19:24:25 +03:00
eda4e0855f CONT stack overflow postmortem (#9083)
- check in cont_run() and cont_suspend() whether a1 is out of bounds
- in case a1 is broken, postmortem will still report proper context in
  proper stack boundaries

additionally
- as suggested in #9069, change stack smashing to a single line that
  does not mention any Exceptions
- reduce overall stack dump length when there are know garbage values i.e. cont stackguard
- decoder.py addr search regexp would no longer skip stack lines with '<'
- fix decoder.py parsing so it notices both stack smashing and alloc errors
2024-03-26 10:58:20 +03:00
c96dc26792 Generate TZ.h from zoneinfo (#9084)
* Generate TZ.h from zoneinfo

Using tzdata pypi package that ships zoneinfo blobs
Can't use raw data package from IANA, need it built first
Minor tweaks to Espurna script that generated .md

More data than the original, not limited to ZONE/...
Zoneinfo source can be overwritten using path args, if needed
(but, probably not needed, since it would always be preferable to pull the latest version)

Also, allow to override certain names and tz strings independent
of tzdata values (resolves #9007)
2024-02-11 18:51:35 +01:00
ed9e8ce9ba Sync with esp82xx-nonos-linklayer (#9078)
* Update lwip2 builder
* Rebuild lwip2 libs
2024-02-11 12:15:26 +01:00
0301465a3c elf2bin.py - Fix syntax warning (#9034) 2023-11-17 23:15:34 +01:00
d0f7293491 optionally move float emulation code into iram (#8958)
* optionally move float emulation code into iram
allows doing float operation in iram
suitable for libraries like AccelStepper when called from ISR
* proposed changes for pio from @mcspr
2023-11-12 23:53:39 +01:00
d3c102e717 Update documentation and arduino debug options (#8837)
* Update documentation

Describe how to improve Exception Decoder results.

Updated build option details.

* Added d-a-v's code. And updated description and debug macro.

* Update doc

Updated platform.txt - positioned -Os such that it can be overridden by `build.opt`.

Add suggestion of using `-Og` which may improve the Decoder's line number correlation
with the problem in the source code.

Untested adjustments to platformio-build.py

* Fixed code formatting

* Fixed example

Previously `-O3` in the example had no effect. It was overridden by later flags.
Reording the `-Os` allowed changing optimization to  work. Somehow this triggered
a new warning "Stream.h:50:7: warning: 'f.Stream::_startMillis' may be used
uninitialized in this function". Replaced `-O3` with `-Og`.

* Proposed "Debug port" menu change
Preserves a pathway for `build.opt` override.

* Update boards.txt.py and docs - WIP

* Improve organization of optimization content.
Use "Debug Optimization" for menu name.
The menu item defines the initial optimization.
platform.txt - optimization parameter can be overridden by build.opt.

* Add fallback value for build.debug_optim to platform.txt

* update text and undo changes to platformio-build.py

* tweak text

* Added ':orphan:' mark to a06-global-build-options.rst

* Update doc. Added link in page index to 'Improving Exception Decoder Results'

* Update text to reference PR#8868 improvements for leaf function.
2023-03-29 11:16:33 +02:00
ce9e72014b Update compiler toolchain to 3.2.0 (#8868)
* Update compiler toolchain to 3.2.0

Includes compiler updates from @jjsuwa-sys3175

* Manually update python3-via-env tools
2023-03-29 10:55:09 +02:00
734defb87d mkbuildoptglobals.py: assert python version (#8886)
Fix unused var causing warnings
Assert minimal supported version of python3
Python 3.7 in documentation
2023-03-17 11:10:14 +03:00
71a51b1113 Resolve Windows path problems (#8860)
Moved up os.makedirs for ./core/ directory.
Strange problem creating files with file paths with spaces.
Strange that "create file" would work when the path did not contain spaces and the last folder of the path hadn't been created.

Added try/except on main to commit print buffer on traceback for context.

Additional issues with diacritics and locale character encoding for shell vs source code.
build.opt is written with the same encoding as the shell; however, the data read from the Sketch.ino.global.h is UTF-8.

Tested on Windows 10 (en-US) with Arduino IDE 2.0.3 Under an
account with a diacritic character in the user ID path.

Needs testing on Japanese Windows
2023-02-22 20:46:25 +03:00
79dde219c5 Don't use -g++ or -gcc suffixes in command line arguments (#8829)
It may confuse some greedy parsers matching compiler either with a glob
or by iterating each argument and not stopping on the first one

ref. this library used by VSCode Arduino extension
ce12578557/src/ParserGcc.ts (L63-L68)

fix #8809
2023-01-26 14:20:17 +03:00
cf24024292 New handling of missing perferences.txt in mkbuildoptglobals (#8814)
* Only rely on `perferences.txt ` when requested
* Always assume shared `core.a` caching is in use
* Ignore the passed-in IDE version. Too often, the value is not correct
2023-01-22 11:19:38 +03:00
41c2be2068 Fix mkbuildoptglobals script not finding preferences.txt (#8812)
Also fixes os.utime usage on windows, as it does not accept file descriptors instead of file paths
2023-01-19 00:34:14 +03:00
39b41379ee Log all exceptions in upload.py (#8813)
Currently some exceptions cause a exit code 2, but without any relevant error message.

As an example, I had an issue with my USB drivers. But the only message I saw using the Arduino IDE was: uploading error: exit status 2. With this code change I could see a more specific Resource busy error message, which helped me identify the actual problem.
2023-01-18 05:16:48 +03:00
6033ed35d5 Use subprocess.run in elf2bin (#8799)
Properly handle Popen object, it takes care of everything we need to do like .communicate() and handle timeouts. Introduce a small timeout to run so we also know when that happens
Clean-up with pythonic path join and formatting through f"" strings
2023-01-15 00:59:33 +03:00
e1c4a6c8e6 Portable python fix for mkbuildopts (#8804)
see #8226
mentioned in #8803
2023-01-14 21:22:28 +03:00
66ecc33916 Move C++ constructor and destructor tables from .bss to .irom0 (flash) (#8737) 2023-01-05 17:33:00 +03:00
204d2c93a7 NONOS SDK clean-up (#8770)
Remove nonos-sdk-v2.2.0-28-g89920dc aka 3v0, since we have a real v3
Remove 3.0.0...3.0.4 to reduce overhead in maintaining a bunch or binary patches
Update our docs and menu opts to mention 'experimental' status

Old versions still remains in git history, so anyone wanting to play around with 3.0.x could still make use of that work
2023-01-03 01:40:53 +03:00
edfde6ba1a lwip2: cleanup logging and use newlib printf (#8769)
https://github.com/d-a-v/esp82xx-nonos-linklayer/pull/61
2022-12-21 11:35:23 +03:00
eda64f69a7 Stack decoder script (#8661)
* stack decoder
* +x
* cut here
* last alloc explain, line breaks
* capture
* print ctx line
* ...and dont ignore sp
* non-hyphenated arg for elf, toolchain path to bin/

either for when tools are already in PATH
or, using `pio pkg exec --package toolchain-xtensa python decoder.py ...`
(where package is a full version spec for pio registry)
2022-12-16 12:27:43 +01:00
4a0b66b017 Heap addendum to handle changes in NON-OS SDK 3.0.x (#8746)
## WPA2 Enterprise connections
References - merged PRs:
* https://github.com/esp8266/Arduino/pull/8529
* https://github.com/esp8266/Arduino/pull/8566 - these occurred with connect/disconnect with WPA-Enterprise
* https://github.com/esp8266/Arduino/pull/8736#issue-1470774550

The NON-OS SDK 3.0.x has breaking changes to the [`pvPortMalloc`](bf890b22e5/include/mem.h (L42)) function. They added a new `bool` argument for selecting a heap. 
```cpp
void *pvPortMalloc (size_t sz, const char *, unsigned, bool);
```

To avoid breaking the build, I added a new thin wrapper function `sdk3_pvPortMalloc` to `heap.cpp`. 
Edited new SDK LIBs to call `pvPortMalloc`'s replacement `sdk3_pvPortMalloc`.

They also added `pvPortZallocIram` and `pvPortCallocIram`, which are not a problem to support. Support added to `heap.cpp`.

Issues with WPA2 Enterprise in new SDKs:
* v3.0.0 and v3.0.1 - have the same memory leak and duplicate free bugs from before
* v3.0.2 through v3.0.5 - have the same memory leak; however, _no_ duplicate free crash.
* memory leak can be seen by cycling through setup, connect, disconnect, and clear setup - repeatedly.

Updated `wpa2_eap_patch.cpp` and binary patch scripts to handle v3.0.0 through v3.0.5.
Patched SDKs v3.0.0 through v3.0.5

## Duplicate Non-32-bit exception handler
Issue: At v3.0.0 and above `libmain.a` supplies a built-in exception handler (`load_non_32_wide_handler`) for non-32-bit access. Our non-32-bit access handler (`non32xfer_exception_handler`) overrides it. 

Solution: Add "weak" attribute to symbol `load_non_32_wide_handler`. Adjust the build to default to the SDK's built-in non-32-bit handler.  If there is a need to use our non-32-bit handler, make the selection from the Arduino IDE Tools menu `Non-32-Bit Access: "Byte/Word access to IRAM/PROGMEM (very slow)"`.

With SDKs v3.0.0 and above a "non-32-bit exception handler" is always present.
2022-12-16 11:11:19 +03:00
3c6253109d Fix CPPDEFINES loop (#8744)
Expect that (key, value) can be (key,)
2022-12-06 17:33:58 +03:00
93537f94a8 Added NONOS SDK 3.0.0 ~ 3.0.5 (again) (#8736)
* Added NONOS SDK 3.0.0 ~ 3.0.5

* Added user_pre_init

* rf_cal[0] !=0x05,is 0x00

* # Remove mem_manager.o from libmain.a to use custom heap implementation, and time.o to fix redefinition of time-related functions
# Rename `hostname` and `default_hostname` symbols

* user_rf_pre_init

* Add system_func1() called by system_restart_local()

* Add commit log text

* Fixed user_rf_pre_init

* Style

* pio sdks

Co-authored-by: TAiGA <>
Co-authored-by: Maxim Prokhorov <prokhorov.max@outlook.com>
2022-12-06 13:43:48 +03:00
fe451a814f Fix typo in section list (#8726)
For GCC LD scripts, using commas in a section expression
sometimes cause problems.
2022-11-23 12:33:56 -08:00
78444a5037 Add Wemos ESP-WROOM-02 board (#8664)
* add fixes from https://github.com/esp8266/Arduino/issues/6551#issuecomment-534737671
* add flashfreq_26 to the macro list
2022-11-01 01:38:35 +03:00
0aab6ecee2 Rework CI workflows (#8688)
- split workflows into separate files to trigger by path
  this should help out documentation and boards / eboot / pkg files
  updates, since those *wont* trigger usual build stuff anymore
- build*.sh whatever merged into just common.sh and build.sh
  trigger different parity builds, mod % rem and allow to set .ino list
  through the environment variable
- removes unnecessary temporary files, try to use more pipes
  move remaining ones into cache dir instead of PWD
- remove legacy TRAVIS env vars, use ESP8266_ARDUINO prefix for config
- remove Windows path workarounds
- hardware/ and ide/ directories are set through envionment
  do not force specific paths, simplify builds on local machine
- sketch list is set through environment. expicit paths for Windows and
  macOS builders. platformio also gets a real shuffled list instead of
  mod and rem magic numbers
- detect root of the repo through git cli, not base{name,dir} or relative paths
2022-10-31 11:13:40 -07:00
2360d1cff1 Consistent netif->status_callback (#8676)
https://github.com/d-a-v/esp82xx-nonos-linklayer/pull/62
2022-10-31 07:33:16 +03:00
a0c7a85649 Fix Updater non-zero _verify->length() once again (#8545)
Amends #8507
I took the liberty to also do some refactoring; specifically, fixing signed vs. unsigned mismatch in len, using pointer object vs. the original manual malloc & free, try to have named constants for certain addresses and lengths, plus localize printing of u8 arrays.

The suggested test to have a 'dummy' verifier works just fine. (...how it actually works and gets the hash to compare with is a whole other question, though)

Another issue noticed while testing, in the underlying bearssl api there's an actual limit for hash length.
6105635531/inc/bearssl_rsa.h (L257)
2022-09-13 15:57:42 +03:00
313b3c07ec Add debug support for build.opt (#8637)
Add support to have different build option comment blocks
for debug and production builds.

Updated example esp8266/HwdtStackDump to use build.opt
2022-08-04 21:33:24 +03:00
06f34ed566 Board ID as build flag (#8634)
* Board ID as build flag

When using IDE or `arduino-cli board list`, show full board name and FQBN
```
$ arduino-cli.exe board list
Port          Protocol Type              Board Name                FQBN                       Core
xxx.xxx.x.xxx network  Network Port      LOLIN(WEMOS) D1 R2 & mini esp8266com:esp8266:d1_mini esp8266com:esp8266
```
Also add `description` field to the mDNS response containing the
original `{build.board}` string value.

resolve #7759

* does not work with recent ide (?)

* fixup! does not work with recent ide (?)
2022-07-27 22:52:20 +02:00
8048ea52ca Rebuilt HAL w/latest toolchain and fixed configure (#8615)
Returns the library contents to the expected functions.
2022-06-24 15:24:56 +02:00
dc6b15e38a Update to toolchain 3.1.0-gcc10.3 (#8613)
* Update to toolchain 3.1.0-gcc10.3

* Update BearSSL with L32R minimized

See https://github.com/earlephilhower/esp-quick-toolchain/issues/36#issuecomment-1162363757
2022-06-22 07:52:15 +02:00
047f14b9db upload.py should not always fail (#8608)
07789808b9 (r76344981)
thx @jjsuwa-sys3175
2022-06-19 01:22:33 +03:00
07789808b9 Do not show python traceback when esptool fails (#8603)
Path separator already handled by python
Empty strings are false, implicitly checking for length
2022-06-15 02:39:16 +03:00
8bfc2e9eab Fix lwip2 ping (#8596)
fixes https://github.com/esp8266/Arduino/issues/8555
related to https://github.com/dancol90/ESP8266Ping/pull/42
2022-06-14 20:24:04 +03:00
760a6bc6c7 Update to latest BearSSL (#8600)
Minor SSL bug fix included.
2022-06-14 09:49:22 -07:00
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
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