Commit Graph

1920 Commits

Author SHA1 Message Date
Johny Mattsson a2ba49e36b Switch to IDF-provided VFS and standard `io` module.
The IDF-provided VFS resolves several issues:

 - The IDF components having a different view of the (virtual) file system
   compared to the Lua environment.

 - RTOS task/thread safety. Our legacy VFS was only ever safe to use
   from the LVM thread, which limited its usability. Upgrading it
   would have effectively required a reimplementation of the IDF VFS,
   which would have been a bigger task with larger on-going maintenance
   issues.

 - We're no longer needing to maintain our own SPIFFS component.

 - We're no longer needing to maintain our own FATFS component.

 - The legacy of the 8266's lack of standard C interface to the file system
   is no longer holding us back, meaning that we can use the standard
   Lua `io` module rather than the cobbled-together swiss army knife
   also known as the file module.

Of course, the downside is that we'll either have to declare a backwards
breakage in regard to the file module, or provide a Lua shim for the old
functions, where applicable.

Also included is some necessary integer type fixups in unrelated code,
which apparently had depended on some non-standard types in either the
SPIFFS or FATFS headers.

A memory leak issue in the sdmmc module was also found and fixed while
said module got switched over to the Espressif VFS.

Module documentation has been updated to match the new reality (and I
discovered in some places it wasn't even matching the old reality).
2021-10-20 21:49:11 +11:00
Marcel Stör 32f66e3db5 Attempt to address IDF certificate issue
Details https://github.com/espressif/esp-idf/issues/7631
2021-10-06 21:30:45 +02:00
Marcel Stör 389c119a8b
Add http.put (#3462)
Replaces setpostdata() with setbody().
2021-10-05 13:33:27 +11:00
Johny Mattsson ea968de6f8 Fixup LROT_MASKs for all modules.
Search-and-replace considered harmful. I completely missed the need to
explicitly declare "fast" tag functions (__xyz) in the mask field to
LROT_BEGIN()/LROT_END() when I brought over the 5.1+5.3 support.
Without those flags set properly, the LVM doesn't even bother going
looking for those methods, which in this case led to garbage collection
not calling the __gc functions, among other horrible things.

Mea culpa.
2021-09-16 17:53:35 +10:00
Johny Mattsson 5e52a9e200 Added heaptrace module. 2021-09-16 13:54:55 +10:00
Johny Mattsson b84138595d Add eth.set_ip() functionality.
Effectively the esp_netif version of the recent tcpip_adapter based
support added on dev-esp32 in fa6fd1a41b.
2021-09-09 19:07:51 +10:00
Johny Mattsson 37f682dd70 More ethernet module fixes. 2021-09-09 19:05:48 +10:00
Johny Mattsson 8c69b15591 Lock build runner version. 2021-09-09 17:43:17 +10:00
Johny Mattsson 6f31db5a8a Fix compile issue if ethernet support disabled. 2021-09-01 14:19:04 +10:00
Johny Mattsson 961d996a63 Name luac.cross artifacts better.
They don't need the target in there as the byte code is agnostic, but
it's marginally cleaner than letting the different builds overwrite the
artifacts.
2021-08-30 18:35:48 +10:00
Johny Mattsson 8f83693262 Announce Lua config options with version.
To make it possible to find the right build cross compiler to use with
any given firmware.
2021-08-30 17:55:45 +10:00
Johny Mattsson 4c21bd6b9a Fixed surplus newlines on output with Lua 5.1. 2021-08-30 17:54:23 +10:00
Johny Mattsson ba36857c50 Backwards compatibility for embedded LFS startup on 5.3 2021-08-30 17:37:35 +10:00
Johny Mattsson c6a2e99650 Make LFS flash sig config specific.
Loading an LFS from a different int/float combo build is bad, so let's not
allow it in the first place.
2021-08-30 16:51:48 +10:00
Johny Mattsson d66473aeeb Fix broken LFS loading in Lua 5.3.
Do not [lua_]assert() on things which have a side effect...
2021-08-30 16:49:23 +10:00
Johny Mattsson 185855b69a Brought over node.setonerror() functionality.
Now properly triggering restart on non-interactive errors.
2021-08-26 11:33:42 +10:00
Johny Mattsson dee19e2777 Fix broken embedded LFS image with 64bit values.
The marshalling code wasn't taking into account the changing size of
the TValue struct.
2021-08-25 18:59:15 +10:00
Johny Mattsson 0690a7d181 Make bit module handle 32/64bit integer configs. 2021-08-25 18:58:53 +10:00
Johny Mattsson cd585ae91c Support stripping debug info in Lua 5.1 luac_cross 2021-08-25 13:48:04 +10:00
Johny Mattsson dba57fa0ea Merge branch 'dev-esp32-idf4-lua53' into dev-esp32-idf4 2021-08-24 10:42:43 +10:00
Johny Mattsson 8e5ce49d19 Update to latest IDF master. 2021-08-24 10:24:49 +10:00
Johny Mattsson ba74e770a6 Disabled fail-fast on builds.
I want to see what the full damage is, thank you :)
2021-08-24 10:16:36 +10:00
Johny Mattsson dc27e9f7cf Updated modules to comply with __ ordering in rom tables. 2021-08-24 09:56:20 +10:00
Johny Mattsson 93140a89a5 Swap to luaL_pcallx for C module callbacks.
Bring on that stacktracey goodness!
2021-08-24 00:11:31 +10:00
Johny Mattsson 46f5079a63 Fixed panic handling on REPL input.
The Lua debug module is mandatory now.
2021-08-23 23:32:13 +10:00
Johny Mattsson fbef7feae1 Discard old console driver.
The IDF provides all we need these days, and the old driver was just
needlessly conflicting with the IDF settings and setup.

This also simplifies our uart input path as we no longer need to
duplicate the raw byte handling for when "run_input" is false.
2021-08-23 23:00:54 +10:00
Johny Mattsson 3af14a367b Rework modules handling to support ESP32-S2/S3 too. 2021-08-22 21:25:24 +10:00
Johny Mattsson e52e0a8e84 Pulled in the 5.1+5.3 docs from the esp8266 branch.
With minor modifications to drop ESP8266 specific information not
applicable to the ESP32 series. Further corrections welcome.
2021-08-22 19:25:39 +10:00
Johny Mattsson 17df207a5f Port Terry's Lua 5.1 + 5.3 work from the esp8266 branch.
Changes have been kept to a minimum, but a serious chunk of work was
needed to move from 8266isms to IDFisms.

Some things got refactored into components/lua/common, in particular
the LFS location awareness.

As part of this work I also evicted our partition table manipulation
code, as with the current IDF it kept breaking checksums and rendering
things unbootable, which is the opposite of helpful (which was the
original intent behind it).

The uart module got relocated from base_nodemcu to the modules component
properly, after I worked out how to force its inclusion using Kconfig alone.
2021-08-22 02:03:05 +10:00
Marcel Stör 3a6961ccc7
Update RTD MkDocs (#3457)
* Modernize docs

* Remove old style hacks

* Add comment
2021-08-16 15:27:56 +10:00
Johny Mattsson f123d46209 Add ESP32C3 support/coexistence.
The uzlib and parts of Lua had to be switched over to use the
C standard int types, as their custom typedefs conflicted with
RISC-V toolchain provided typedefs.

UART console driver updated to do less direct register meddling
and use the IDF uart driver interface for setup. Still using our
own ISR rather than the default driver ISR. Down the line we
might want to investigate whether the IDF ISR would be a better
fit.

Lua C modules have been split into common and ESP32/ESP32-S
specific ones. In the future there might also be ESP32-C3
specific modules, which would go into components/modules-esp32c3
at that point.

Our old automatic fixup of flash size has been discarded as it
interferes with the checksumming done by the ROM loader and
results in unbootable systems. The IDF has already taken on
this work via the ESPTOOL_FLASHSIZE_DETECT option, which handles
this situation properly.
2021-08-11 17:32:47 +10:00
Marcel Stör 9647cc2185 Replace CI badge 2021-08-04 12:24:49 +02:00
Johny Mattsson 7b028d5c5d Cleanup warnings for luac_cross. 2021-08-04 12:42:43 +10:00
Johny Mattsson aea83da7df Switching to github workflow integration. 2021-07-29 17:38:34 +10:00
Johny Mattsson bc7b923646 Code cleanup to sort out warnings.
I2S constants have changed; docs updated.
2021-07-29 13:47:45 +10:00
Johny Mattsson dff32e8902 WiFi module updates.
- Added support for WPA3
- Evicted left-over broken WiFi auto-reconnect
- Updated docs
2021-07-28 19:09:19 +10:00
Johny Mattsson bce134b510 Fixed incorrect event data in wifi.sta.on('got_ip') 2021-07-28 16:21:24 +10:00
Johny Mattsson 758291693c Support building without IPv6 enabled. 2021-07-28 16:21:16 +10:00
Johny Mattsson c8e1c44c0e Sort out task posting behaviour. 2021-07-26 15:36:57 +10:00
Johny Mattsson 06a0e3dc23 idf4: part 3.2 - fix bug in updated eth module
Updated docs to reflect new WiFi station connect behaviour.
2021-07-22 16:46:57 +10:00
Johny Mattsson 54a41149ea idf4: part 3.1 - sorting out the linker specifics
Now boots to the Lua prompt, and modules are included and findable.
2021-07-21 20:46:42 +10:00
Johny Mattsson bcaf98f8f0 idf4: part 2.2 - obligatory missed API call
Plus addressing some warnings.
2021-07-21 12:30:51 +10:00
Johny Mattsson d2f8121e22 idf4: part 2.2 - update wifi & eth modules to new APIs
Only compile-tested so far.

Of note is that the WiFi auto-connect (flag) functionality has been removed
from the IDF, and as a follow-on so has the "auto" field in the wifi config.

On the Ethernet side, support for the TLK110 PHY seems to have been removed,
but on the other hand there is now new support for several others.
2021-07-20 18:18:21 +10:00
Johny Mattsson 62b3d06020 idf4: part 2.1 - uplift to new esp_event system events
Some parts dry-coded in the disabled modules; to be fixed when sorting out
the deprecated/removed APIs used in said modules.

Still untested beyond compile/linking.
2021-07-19 17:23:38 +10:00
Johny Mattsson 379a8eb844 idf4: updated build docs to note new ./install.sh step 2021-07-15 16:44:40 +10:00
Johny Mattsson 6d243a0995 idf4: temporarily commenting out broken parts 2021-07-15 16:32:09 +10:00
Johny Mattsson 16ef39e255 idf4: overhaul to new build system, part 1 of 3
Yet to come:
  - part 2: dealing with deprecated and removed APIs
  - part 3: making it actually work again
2021-07-15 16:27:03 +10:00
serg3295 8e0e0cb31c
Fix ledc, otaupgrade, pulsecnt, sdmmc, sjson, touch docs (#3436)
ledc.md - formatting, add object name
otaupgrade.md - formatting, add 'Syntax' section
pulsecnt.md - formatting, fix syntax pulsecnt.create, add object name
sdmmc.md - fix typos
sjson.md - formatting, add `Parameters` section
touch.md - formatting, add object name, fix Returns in tp:read()
2021-05-23 16:29:01 +02:00
serg3295 39dc2e050f
Fix bit, bthci, can, encoder, eth, i2s docs (#3432)
* Fix bit, bthci, can, encoder, eth, i2s docs

* Fix bit, mqtt, qrcodegen, sigma-delta, sodium, time docs.

* Add object name in http.md
2021-05-19 21:02:49 +02:00
serg3295 1927b22c17
Fix adc, i2c, file, tmr docs (#3428) 2021-04-27 22:30:46 +02:00