Commit Graph

47 Commits

Author SHA1 Message Date
Philip Gladstone a01aada0ff Improved startup performance and measurement tools. (#3171)
* Don't adjust the clock until after we deal with rtctime...
* Switched to using START_OPTION_CPU_FREQ_MAX instead.
* Use setfield and add caching of the startup option
* Put the startupcounts warning into a warning box
2020-11-07 16:23:43 +01:00
Lukáš Voborský 336013ab9e Fixing bug in `file.readline` when line length exceeds 128 chars 2020-11-07 16:23:43 +01:00
Philip Gladstone f527ad86e4 Fix problem reading files a multiple of 128 bytes long (#3280) 2020-11-07 16:23:43 +01:00
Terry Ellison 1f2e5bba4a
Implement panic call handling for all modules (#3163) 2020-06-16 08:19:55 +01:00
Terry Ellison bbeb09b695 Squashed updates do get Lua51 and Lua53 working (#3075)
-  Lots of minor but nasty bugfixes to get all tests to run clean
-  core lua and test suite fixes to allow luac -F to run cleanly against test suite
-  next tranch to get LFS working
-  luac.cross -a options plus fixes from feedback
-  UART fixes and lua.c merge
-  commit of wip prior to rebaselining against current dev
-  more tweaks
2020-06-09 22:26:52 +02:00
Nathaniel Wesley Filardo a7f8564424 file: raise error on .on() with non-function/nil
Seems more polite than quietly accepting other types as nil.
2020-06-09 22:26:52 +02:00
Terry Ellison 6d81dd6c0a Rebased against current dev 2020-06-09 22:26:06 +02:00
Johny Mattsson f7a545b951
Evict c_types.h, tidy up a other c_prefixes. (#2841) 2019-07-23 14:22:38 +10:00
Johny Mattsson 526d21dab4 Major cleanup - c_whatever is finally history. (#2838)
The PR removed the bulk of non-newlib headers from the NodeMCU source base.  
app/libc has now been cut down to the bare minimum overrides to shadow the 
corresponding functions in the SDK's libc. The old c_xyz.h headerfiles have been 
nuked in favour of the standard <xyz.h> headers, with a few exceptions over in 
sdk-overrides. Again, shipping a libc.a without headers is a terrible thing to do. We're 
still living on a prayer that libc was configured the same was as a default-configured
xtensa gcc toolchain assumes it is. That part I cannot do anything about, unfortunately, 
but it's no worse than it has been before.

This enables our source files to compile successfully using the standard header files, 
and use the typical malloc()/calloc()/realloc()/free(), the strwhatever()s and 
memwhatever()s. These end up, through macro and linker magic, mapped to the 
appropriate SDK or ROM functions.
2019-07-22 00:58:21 +03:00
Arnim Läuger bc7ffb3eb8 fix unref default file descriptor while still in use (#2818) 2019-07-05 07:55:54 +02:00
Terry Ellison d6980ad802
SDK 3.0 tranche3 (#2761)
Force libpp.a into iRAM, and backout redundant IRAM_DATA_ATTR changes
2019-05-19 14:38:23 +01:00
Terry Ellison 1990f95740
Updated ROTables 1st tranch (#2742)
Updated ROTables
2019-05-08 14:08:20 +03:00
Terry Ellison e0f3dbed41
Fix 2749 + restore correct user_modules.h (#2750) 2019-05-07 18:49:16 +03:00
Terry Ellison bc61528db7
1st Tranch of SDK 3.0 follow up changes (#2732)
1st Tranche of SDK 3.0 follow up changes
2019-05-01 18:29:11 +01:00
Terry Ellison c3e24436f2
Lua string optimisation in file.c + get/put contents methods (#2717)
* Lua string optimisation in file.c + get/put contents methods

* Doc fix: move putcontents() into correct alphabetic order slot in list of static methods
2019-04-11 22:17:00 +01:00
sergio d77666c0e8 trailing spaces cleanup (#2659) 2019-02-17 18:26:29 +00:00
Carsten Elton Sørensen bb9a5977d3 Calling vol:umount() would fail (#2558)
The volume returned by file.mount() could not be unmounted, because vol:umount() would fail with a cryptic error about the uncallable nature of the volume userdata object. This was due to the wrong metatable name being used for setting up the volume structure. The correct name, as registered elsewhere in file.c, is now used, and vol:umount() is callable.
2018-11-16 21:37:18 +01:00
Nathaniel Wesley Filardo fd12be9966 file: list now takes optional pattern for filtering (#2452)
Thanks to @TerryE for many useful suggestions
2018-08-10 16:38:48 +01:00
dnc40085 cbcb1b1a9f Fixed lack of nil return in file.read() when EOF is reached 2018-05-18 22:08:42 -07:00
Carlos Bastos Filho 442e3e2e6c
Update file.c
Buffer size of funtion readline is wrong  (Line 480)
Should be FILE_READ_CHUNK = 1024 bytes instead 256 bytes
2017-12-19 15:32:23 -02:00
Arnim Läuger fc887e9f9f Fix memory leak in file_stat(). (#1871)
* Change vfs_stat() api to pre-allocated buffer for stat info.
* Change vfs_readdir() api to stat buffer as well. vfs_item api removed.
2017-03-29 13:58:40 +02:00
Arnim Läuger 305d7c4672 Add file.stat() to query file/directory attributes. (#1724)
* add file.stat()

* set default time/date to 1970-01-01
use lua_setfield
2017-01-17 21:54:23 +01:00
Arnim Läuger c70dc7497e Handle error condition in file.read() (#1599)
* handle error condition in file.read()

* simplify loop initialization
2016-11-19 10:36:00 -05:00
Arnim Läuger a0e2e0ca37 Implement object model for files (#1532) 2016-11-08 21:02:51 +01:00
Arnim Läuger 9db07783f4 Remove luaL_buffer from file_g_read() (#1541)
* remove luaL_buffer from file_g_read()
- avoid memory leak when function gets terminated by lua_error
- skip scanning for end_char when reading until EOF
* attempt to free memory in any case
2016-10-28 17:32:12 +03: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
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
TerryE 1e49d03dbc Limit file.open() names to 31 char max C string format. See #1112 2016-03-04 01:46:35 +00: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
Johny Mattsson 1fd98d9f86 Add file.fscfg() command for fs location + size. 2016-02-18 12:52:40 +11:00
jfollas d4ae67d0b4 Changed filename length error handling per TerryE's suggestion 2016-02-13 18:58:04 -05:00
jfollas 44786a22ff Added file.exists() method to save the need to use file.list() for checking file existence 2016-02-13 17:37:04 -05: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
Johny Mattsson 4e8ef87d03 Reworked module registration, removed modules.h
Module creation & registration now made a lot simpler. In essence,
each module file is now self-contained and only needs a

  NODEMCU_MODULE(MYNAME, "myname", myname_map, luaopen_myname);

line to both be automatically recognised by the Lua initialization
as well as honor the LUA_USE_MODULES_MYNAME #define.
2015-12-16 16:09:16 +11:00
TerryE b773290b8c Major cleanup of module registration pass 2.
carrying on Johny's edits as per my comments on #810
2015-12-16 11:21:40 +11:00
Johny Mattsson 6b6456be47 Major cleanup of module registration.
As per #810 & #796, only LUA_OPTIMIZE_MEMORY=2 & MIN_OPT_LEVEL=2 are
supported when building. This commit effects that limitation.

With this change modules/auxmods.h no longer needs to be updated for
every new module, nor do module writers need to cater for a hypothetical
LUA_OPTIMIZE_MEMORY < 2 scenario.
2015-12-12 15:03:40 +11:00
Johny Mattsson 4a47813e20 Reduced SPIFFS cache, freeing ~0.5k RAM.
Also made the cache on/off configurable via user_config.h. Uncached writes
are not a very good idea, but for read-only deployments a further ~0.5k RAM
can be gained by disabling the cache.

Tweaked the file.read() workhorse to read large chunks at a time rather
than use getc(), to compensate for potential unavailability of cache.
2015-07-31 18:15:18 +10:00
Johny Mattsson 8d68ad7e15 Updated SPIFFS to 0.3.2, plus alignment fix. 2015-07-17 13:40:55 +10:00
funshine 9c0c960e84 json port from cjson. not work yet 2015-03-16 09:00:33 +08:00
funshine 81ea8d9597 add math, add file.fsinfo(), update spiffs. 2015-03-10 01:12:36 +08:00
Ezekiel-DA c869eddb8a Update file.c
Made file.seek() return nil on error / EOF, as specified in documentation, instead of returning true.
2015-02-25 14:34:07 -05:00
funshine 2d711bbc0d update spiffs to 0.2.2, add file.rename api 2015-02-11 21:20:54 +08:00
funshine 971c4b569b fix net.socket:send(), fix file.read() when 0xFF reached 2015-01-08 16:03:21 +08:00
funshine b65fb02cc5 add file.format() to rebuild fs system, get more ram back 2015-01-07 15:57:17 +08:00
HuangRui c04f2578ec Updated SDK to v0.9.5 and optimized memory. 2015-01-05 10:09:51 +08:00
funshine 2553795b1e add file.read() api, read(n) will read n byte. 2014-12-31 13:53:26 +08:00
funshine cdd13b1af3 source file first commit, folder structure refact 2014-12-22 19:35:05 +08:00