Commit Graph

39 Commits

Author SHA1 Message Date
Arnim Läuger 101eb201ab add map ids for flash sizes 32m-c2, 64m, 128m in user_rf_cal_sector_set() (#1529) 2016-10-13 16:51:48 +09:00
Jim Paris 407eaa45ac Replace hardcoded init data with generated data from SDK
The esp_init_data_default.bin is now extracted from the SDK (and its
patch file, if present), and the contents are automatically embedded
into user_main.o.
2016-10-04 13:11:34 -04:00
Johny Mattsson 088d2c3820 Reimplemented esp_init_data_default.
To work around the pesky "rf_cal[0] !=0x05" hang when booting on a chip
which doesn't have esp_init_data written to it.

It is no longer possible to do the writing of the esp_init_data_default
from within nodemcu_init(), as the SDK now hangs long before it gets
there.  As such, I've had to reimplement this in our user_start_trampoline
and get it all done before the SDK has a chance to look for the init data.
It's unfortunate that we have to spend IRAM on this, but I see no better
alternative at this point.
2016-10-04 12:04:09 +11:00
Johny Mattsson 90c6e86872 Fix start-up race between UART & start_lua. (#1522)
Input during startup (especially while doing initial filesystem format)
ran the risk of filling up the task queue, preventing the start_lua task
from being queued, and hence NodeMCU would not start up that time.
2016-10-03 10:19:20 +02:00
Arnim Läuger ecf8bd98d6 Add FatFs and SD card support (#1397)
* Add FatFs
* enable BUILD_FATFS for all-module build
* push vfs into rest of firmware
* align maximum filename length
* increase timeout for acmd41 during card initialization
* switch from DOS to Unix path semantics chdrive() is substituted by chdir()
* update to fatfs R.012a incl. patches 1-6
* add callback for rtc provisioning in file
* update docs
2016-09-05 20:17:13 +02:00
Yury Popov be263dacde Set espconn's secure buffer size once at initialization (#1466)
Fixes #1457
2016-09-04 22:45:46 +02:00
Marcel Stör aa5fd1445d Change 'formatting file system' message (#1413) 2016-07-24 14:39:42 +02:00
Arnim Läuger 84c005e85c Update to SDK 1.5.4.1 (#1390) 2016-07-22 23:18:47 +02:00
Philip Gladstone af39a0bc25 Upgrade to latest SPIFFS and add building of file systems (#1226)
Fixes #1164 and thus also #1150, #1149, #1147 and #898.

* Move to latest version of SPIFFS
* Add SPIFFS porting layer for NodeMCU
* Add option to delete output if it doesn't fit
* Change FLASHSIZE to be in bits by default: default 4mb 32mb
* Add SPIFFS_MAX_FILESYSTEM_SIZE override
* Add notes on SPIFFS_FIXED_LOCATION
* Add 1M boundary
* Include the current version of the LICENSE
2016-06-05 23:10:58 +02:00
dnc40085 4a1775c2e8 Fixed bug where default hostname is not set on boot when in SoftAP mode (#1341) 2016-06-05 13:38:12 +02:00
dnc40085 2fdaa9b171 Moved call to set default wifi hostname (#1317)
Moved call from `luaopen_wifi (wifi.c)` to `user_rf_pre_init
(user_main.c)`
Note: This change adds ~440 us to boot time
2016-05-27 13:25:42 +02:00
Philip Gladstone 2dacec156a Ensure that load_store exceptions trigger the exception handler (#1307)
Chain unhandled load_store exceptions to SDK exception handler
2016-05-27 12:14:02 +10: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
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 8bc2e8aa19 Enable -std=gnu11 for user dir 2016-03-24 00:06:09 +01:00
philip 84487d300b Remove unusedcode 2016-03-20 12:54:16 -04:00
TerryE 46ea2aa42e Make the wifi.smart functions options and remove wofs and upgrade
AFAIK no one uses the wifi.startsmart() and wifi.stopsmart().  Removing
them frees up an extra 20-25K of Flash to use as filesystem.  So I have
added a new config define WIFI_SMART_ENABLE which is enabled by default
so the default functionality is the same, but if this is commented out
then this code is omitted.

I have also removed wofs and upgrade from this build as we no longer
support these.
2016-02-26 17:23:38 +00:00
TerryE 49733f6f6d Add New Tasking I/F and rework GPIO, UART, etc to support it
As with the last commit this rolls up the follwowing, but include the various
review comments on the PR.

-   **Documentation changes**. I've added the taks FAQ as a stub new Extension
developer FAQ, and split the old FAQ into a Lua Developer FAQ and a Hardware
FAQ.

-   **Tasking I/F**.  New `app/task/Makefile`, `app/task/task.c`,
`app/include/task/task.h` and `app/Makefile` as per previous commit.  Cascade
changes to `app/driver/uart.c`, `app/include/driver/uart.h`,
`app/user/user_main.c` and `app/modules/node.c`

-   **GPIO Rework** to `app/modules/gpio.c` and `pin_map.[hc]`, `platform.[hc]`
in `app/platform`

-   **Other Optimisations** Move the `platform_*_exists()` from
`app/platform/common.c` to static inline declarations in `platform.h` as
this generates faster, smaller code. Move lgc.a routines out of iram0.
2016-02-17 17:13:17 +00:00
Johny Mattsson a6c0873a28 Upgrade to SDK 1.5.0 + Espressif's Open LWIP 1.5.0.
Removed earlier TCP port randomisation fix - the new SDK has its own fix
even though Espressif told me they wouldn't fix it. Yay?
2015-12-23 11:17:05 +11:00
Terry Ellison 32b2911263 Merge pull request #746 from DiUS/vdd33
Remove adc.readvdd33() limitation.
2015-12-01 23:37:53 +00:00
Johny Mattsson 1e3c231630 Fix esp_init_data_default inconsistencies.
Make ADC vs readvdd33 option user_config.h configurable for the init data,
and made readvdd33 the default.
2015-11-12 12:57:07 +11:00
Johny Mattsson f82415f6b9 Fix to do TCP port number randomization at boot.
This addresses the issue where a server would otherwise reject a valid
connection attempt from a rebooted node, due to the server thinking that
packet belonged to a recently closed session. By starting off the local
TCP port numbers at random* points each boot the risk of port reuse
across a reboot is significantly reduced.

*) As random as can be had via the lower 12 bits of the ccounter.
2015-11-05 14:40:57 +11:00
Jonathan karras 66e65bd3c1 Add #DEFINE to user_config.h to enable easier bit rate selection. 2015-10-31 19:47:11 -06:00
Johny Mattsson bf8ed500bf Moved node.key() & node.led() support into node module.
It was piggybacking on the Lua readline timer which no longer exists.

Also cleaned up injection of Lua commands via CoAP & node.input().
2015-10-12 13:26:05 +11:00
Johny Mattsson fe6289a6c2 Switch Lua input to event driven instead of polled.
The Lua input timer has been the thorn in the side which prevents a lot of
potential sleeping, unnecessarily.
2015-10-12 13:26:05 +11:00
Johny Mattsson 8bdde6e28d Sorted out linker scripts & options.
Now boots to Lua prompt, but promptly reboots itself before input.
2015-10-12 13:26:04 +11:00
Johny Mattsson cc220d9201 Moved TEXT_SECTION_ATTR macro to its own header. 2015-10-12 13:26:04 +11:00
Johny Mattsson dd38a0a0e6 Imported reworked rtctime support. 2015-07-10 16:16:25 +10:00
Johny Mattsson 2187424928 Imported RTC+sleep timekeeping from an internal DiUS project.
Added Lua module rtctime to interface with it.

This keeps as accurate time as is possible on the ESP8266, including across
deep sleeps (provided rtctime.dsleep() is used rather than node.dsleep()).
Intended to be used together with NTP for high accuracy time keeping. The
API is via rtctime.{get,set}timeofday(), working from Unix epoch.

Note that 160MHz CPU clock is not currently supported by the rtctime code,
as it is only aware of the 52MHz boot clock and the regular 80Mhz default
clock.

See rtctime.h for detailed info on how this all works.
2015-07-10 15:12:31 +10:00
Johny Mattsson b0f9788a6d Move constants to ROM. Frees up 16k+ of RAM.
Accessing 8bit and 16bit constants from ROM rather than RAM comes with a
performance cost, as these loads go through the load/store exception
vector. Any performance critical constants can be forced back into RAM
as RAM_CONST_ATTR.

The entry point has changed from call_user_start() to user_start_trampoline()
in order for the exception handler to be installed early enough.
2015-06-23 15:41:14 +10:00
Johny Mattsson 0c924e56c6 Support for loading sub-32 wide data from irom. 2015-06-23 15:41:14 +10:00
funshine 1c2ee75a00 fix mqtt, do a format when wrong flash size is detected 2015-04-03 00:51:02 +08:00
HuangRui 5c84359b5c ROM flash size can changed with detected size, fixed #283. 2015-03-16 05:40:43 +08:00
funshine 9b472a465b move nodemcu init stage after user_init(), rebuild bin 2015-01-23 13:25:54 +08:00
HuangRui 3c6ebea059 Use safe flash options. 2015-01-06 19:32:17 +08:00
funshine 7e51c5d67e replace SPIWrite with flash_write 2015-01-05 23:57:07 +08:00
funshine ff6e5e9924 build pre-build bin, auto save flash init data 2015-01-05 21:56:55 +08:00
HuangRui 715ff5b7aa NodeMCU firmware can auto detect flash size now. 2014-12-31 02:47:44 +08:00
funshine cdd13b1af3 source file first commit, folder structure refact 2014-12-22 19:35:05 +08:00