Commit Graph

1969 Commits

Author SHA1 Message Date
Johny Mattsson b3e8eddf14 Sort out mapping of virtual <-> flash addresses.
The irom0_flash.bin file gets written to offset 0x40000 in flash. Said file
has the following layout

  | irom0 | text | data | rodata | chksum |

...so the previous approach of having a _flash_used_end symbol at the end of
the irom0 section no longer gives us an accurate view of how much of the flash
is used.
2016-06-24 15:40:48 +10:00
Johny Mattsson afbbeb4566 Replaced UART driver.
New driver is a three-way merger between Espressif's esp8266-rtos-sdk example
driver, Espressif's esp32-rtos-sdk not-example driver, and the previous
NodeMCU driver, plus some general clean-ups.

Basic interactivity is now available on the ESP32!
2016-06-23 18:23:04 +10:00
Johny Mattsson f9c65b945c Disabled -Wl,--gc-sections for SDK libs.
Running without interrupt vectors not considered all that useful...

Disabled flash-size-byte-setting and SPIFFS formatting on ESP32, for now
at least, as both of these appeared to corrupt the flash and prevent
subsequent boots.

Disabled UART init on ESP32 until the driver gets updated.

This now gets us to a banner on ESP32, but not yet a prompt.
2016-06-22 18:58:25 +10:00
Johny Mattsson fd9fa71541 Ensure ESP32 bins are created fresh.
Just appending to previously built bins was not a successful approach...
2016-06-21 19:16:35 +10:00
Johny Mattsson d33945b68b Moved sdk submodules for easier branch switching. 2016-06-21 18:06:04 +10:00
Johny Mattsson 4695eb3b12 Update TravisCI build instructions...
...to deal with the subdirs under bin/
2016-06-09 20:45:44 +10:00
Johny Mattsson 224788b642 Make NodeMCU compile and link for ESP32.
A fair bit of reshuffling with include paths and overrides was necessary, as
the two RTOS SDKs (ESP8266 and ESP32) don't have the same header structure
(or even libraries for that matter). Uses the xtensa-esp108-elf toolchain
to build.

Completely untested beyond linking, as I still can't flash the ESP32 module
I have :(  I'd be most surprised if it does anything useful at this point
considering I've spent almost no time on the linker script or UART setup.

Anything using espconn has been ifdef'd out since espconn is not (and
probably will not be) available. Notably this includes the entire net module
as well as coap, mqtt and enduser_setup.

Many (most?) hardware bus drivers and related modules are also ifdef'd
out for now due to hardware differences. Functions surrounding sleep,
rtc and RF modes have also been hit by the ifdef hammer. Grep'ing for
__ESP8266__ and/or FIXME is a quick way of finding these places. With
time I hope all of these will be reinstated.
2016-06-09 18:40:56 +10:00
Johny Mattsson 0df2eda6c0 Take two of Makefile cleanup.
There is no reason to even be rebuilding SDK lwIP - that was just a legacy
of the initial transition to the RTOS SDK.
2016-06-03 12:59:19 +10:00
Johny Mattsson e82e6e85b8 Cleaned up top-level Makefile.
Now doesn't recurse into the rtos-sdk for every subdir, does clean lwip, etc.
2016-06-03 12:43:14 +10:00
Johny Mattsson b8d9ad16d1 Fixed wrong macro usage. 2016-06-03 12:42:03 +10:00
Johny Mattsson a3b9ffe36a Bump nodemcu RTOS stack even higher for now. 2016-06-02 18:38:01 +10:00
Johny Mattsson af9df2ae98 Fixed output redirection regression (and improved it). 2016-06-02 18:29:00 +10:00
Johny Mattsson 860aa47dc1 Replacement system_set_os_print() function. 2016-06-02 15:49:56 +10:00
Johny Mattsson c378298000 Updated SNTP module for RTOS compatibility. 2016-06-01 17:14:08 +10:00
Johny Mattsson 740c06b48f Fix unwanted newlines in Lua output.
The old NodeMCU puts() did not do the standard newline, while the RTOS C
library one certainly does.
2016-06-01 14:15:13 +10:00
Johny Mattsson 61291bd87b Shunt tmr callbacks into the Lua RTOS task.
The os_timer callback is executed from task rtT, prio 14, so they preempt
the Lua environment whenever they fire. Ideally we should be using the
RTOS timers instead, which run at prio 2 and thus would be more suited
for our uses.
2016-06-01 13:44:57 +10:00
Johny Mattsson 239af986df Debug functions for tracking RTOS task usage.
Since configUSE_TRACE_FACILITY is not enabled :(
2016-05-31 18:46:59 +10:00
Johny Mattsson e15dfee13f Fixed missing args to printf.
Having the actual function prototype for the internal print() function
would be useful...
2016-05-31 18:42:48 +10:00
Johny Mattsson 75dbc59ba9 Fixes to task reimplementation to make UART work. 2016-05-31 13:56:47 +10:00
Johny Mattsson 56789592fa Boot to (nonresponsive) Lua prompt on RTOS!
Uart driver currently disabled as it's not (yet) compatible with RTOS.

Running Lua task with excessive stack to avoid smashing it; need to work out
what's using so much stack space.

Changed some flash reading functions to not attempt to drop an entire 4k
flash page onto the stack.

Ensure the task pump doesn't attempt to retrieve from uninitialised queues.
2016-05-30 17:56:33 +10:00
Johny Mattsson 97568e98d9 Wrap printf to avoid lots of unnecessary mallocs. 2016-05-30 14:15:29 +10:00
Johny Mattsson 4995bcb9d0 Rewrite of exception handler, take 2.
Turns out ets_printf() lied to me. When handed an aligned string in flash it
did 32bit loads on it instead of the expected 8bit loads, so just silencing
the exception was enough to give the appearance of it working.
2016-05-30 14:03:15 +10:00
Johny Mattsson 5eb7b53967 The SDK "flashchip" symbol changed from ptr to struct.
Dereferencing struct contents considered harmful...
2016-05-27 12:21:00 +10:00
Johny Mattsson e49f2bb13f Remove conflicting libc, rename c_xx and os_xx to xx.
c_strtod and c_getenv are kept since strtod doesn't appear in the SDK's libc,
and we want our own c_getenv to initialize the Lua main anyway.
2016-05-26 18:50:20 +10:00
Johny Mattsson 3a3e9ee0fd Removed left-over user exception bits. 2016-05-26 18:31:09 +10:00
Johny Mattsson 6f9c84d802 Shuffle all rodata back into IROM.
With a working exception handler all of the RTOS-SDK bits seem to be happy too.
So far.
2016-05-26 15:47:33 +10:00
Johny Mattsson 7f92bf64be Completely reworked user exception handler.
Incidentally now also a whole lot faster.
2016-05-26 15:19:20 +10:00
Johny Mattsson 5c39a1f664 Reimplemented the NodeMCU task interface on top of RTOS.
Not yet hooked up to an RTOS task, however.
2016-05-24 20:36:00 +10:00
Johny Mattsson f3e2a3afd9 Initial pass at switching to RTOS SDK.
This compiles, links, and starts the RTOS without crashing and burning.

Lua environment does not yet start due to the different task architecture.

Known pain points:

  - task implementation needs to be rewritten for RTOS (next up on my TODO)

  - secure espconn does not exist, all secure espconn stuff has been #if 0'd

  - lwip now built from within the RTOS SDK, but does not appear to include
    MDNS support. Investigation needed.

  - there is no access to FRC1 NMI, not sure if we ever actually used that
    however. Also #if 0'd out for now.

  - new timing constraints introduced by the RTOS, all use of ets_delay_us()
    and os_delay_us() needs to be reviewed (the tsl2561 driver in particular).

  - even more confusion with ets_ vs os_ vs c_ vs non-prefixed versions.
    In the long run everything should be switched to non-prefixed versions.

  - system_set_os_print() not available, needs to be reimplemented

  - all the RTOS rodata is loaded into RAM, as it apparently uses some
    constants while the flash isn't mapped, so our exception handler can't
    work its magic. This should be narrowed down to the minimum possible
    at some point.

  - with each task having its own stack in RTOS, we probably need change
    flash-page buffers from the stack to the heap in a bunch of places.
    A single, shared, page buffer *might* be possible if we limit ourselves
    to running NodeMCU in a single task.

  - there's a ton of junk in the sdk-overrides now; over time the core code
    should be updated to not need those shims
2016-05-24 16:05:02 +10:00
Marcel Stör afd974c5e9 Correct socket:send example, fixes #1303 2016-05-22 21:50:57 +02:00
Marcel Stör 498cc52ab3 Remove deploy section (#1300) 2016-05-21 17:45:33 +02:00
Arnim Läuger 2bb6e407a3 Initialize cb for unsubscribe and unref it upon socket deletion. (#1305)
Thank you.
2016-05-21 08:25:16 -04:00
Marcel Stör ab6c2c3924 Add small clarification for 'system restart' 2016-05-18 22:27:23 +02:00
Johny Mattsson 30d354c290 Rework ADC mode setting approach (#1285)
- Stop fighting against the SDK in terms of owning/writing the init_data block.
  NodeMCU included a default init_data block because originally the SDK did
  not, but by now it's not needed.

- Expose a way to reconfigure the ADC mode from Lua land. With most people
  using the cloud builder and not able to change the #define for byte 107
  this has been a pain point.

- Less confusion about which init_data has been used. Lua code can now simply
  state what mode it wants the ADC to be in, and not worry about the rest of
  the init_data complexities such as the init_data changing location due to
  flashing with wrong flash_size setting, or doing/not doing a chip-erase
  before loading new NodeMCU firmware.
2016-05-18 21:45:15 +02:00
Marcel Stör 9c9237ef5a Small syntax fix in UART documentation 2016-05-16 22:25:07 +02:00
devsaurus c0f1e028a6 fix link to net module 2016-05-15 17:08:45 +02:00
dnc40085 1b4234e2d3 Add details to WiFi module documentation (#1294)
Update descriptions of `wifi.setmode`, `wifi.sta.config` and `wifi.ap.config` to inform user of configuration persistence.
2016-05-14 23:04:20 +02:00
Marcel Stör e5cd17f08b State more explicitly that concurrent requests are not supported 2016-05-14 13:55:25 +02:00
dnc40085 1744372060 Updated tmr module and documentation
* Change upper limit for timer in `tmr_register` and `tmr_interval` to reflect new limit in SDK 1.5.3.
* Change documentation for `tmr.alarm()`, `tmr.interval()` and `tmr.register()` to match source.
* Improve error reporting to be more descriptive.
2016-05-14 00:17:04 +02:00
Marcel Stör 65c7e8e061 Use http://httpbin.org in examples 2016-05-13 23:31:29 +02:00
Philip Gladstone f0c1034308 Send a multicast response for QM query and other mDNS fixes
* Send a multicast response if it is a QM query
* Use the NSEC record in the style which mDNS demands
* Shuffle the code a bit and allow sending of A response...
* Made the A record work
* Now gets TTLs right and (I think) handles multiple questions
2016-05-12 14:37:46 +02:00
Johny Mattsson 8705b9e5a2 Merge pull request #1284 from pjsg/mqtt-fail
Fix bugs with mqtt connection error handling
2016-05-10 13:08:34 +10:00
philip 501ef9d566 Fix bugs with mqtt connection error handling 2016-05-09 22:04:23 -04:00
Thomas Soëte 0577c8af0f Finalize work on ws2812 module
* Fix bug on first write
	Pin is 'HIGH' at reset, so we need to pull it down and generate a
	reset.

* Move init code to flash section, not needed to be in iram.

* Remove pin choice in API

* Remove lock in ws2812_buffer_write

* Remove naked malloc

* Drop ws2812_writergb

* Drop support of ws2812.buffers to ws2812_writegrb should use ws2812.buffers:write

* Add support for <>3 colors per leds strips (RGBW)

* Remove ICACHE_FLASH_ATTR

* Add static const on _uartData to avoid initialization penalty
2016-05-09 07:21:50 +02:00
Marcel Stör 216c69f18b Update ISSUE_TEMPLATE.md 2016-05-02 21:39:05 +02:00
dnc40085 526f5457a2 Fixed some errors in wifi documentation (#1279)
Changed Parameters in `wifi.sta.status()` to match constants in source.

Fixed typo in example for `wifi.eventmon.register()`.
2016-05-02 13:57:18 +02:00
Thomas Mohaupt d906538edb Typo in link to GraphicsTest.lua (#1278)
Thank you.
2016-05-01 09:42:20 -04:00
Johny Mattsson 9a7a2c4dc3 Merge pull request #1184 from devsaurus/user-gnu11
Enable -std=gnu11 for user dir
2016-04-30 13:26:09 +10:00
devsaurus 8e11e895f5 move SPIRead to rom.h 2016-04-29 19:57:31 +02:00
Marcel Stör 8dbbe40fb8 Improve docs wrt to auto-connect vs connect, addresses #1273 2016-04-29 19:21:25 +02:00