Commit Graph

502 Commits

Author SHA1 Message Date
Paul Sokolovsky
8bc3fc20fe esp8266: Rename "machine" module implementation to use contemporary naming.
Previously they used historical "pyb" affix causing confusion and
inconsistency (there's no "pyb" module in modern ports; but people
took esp8266 port as an example, and "pyb" naming kept proliferating,
while other people complained that source structure is not clear).
2016-11-06 01:30:19 +03:00
Damien George
7bb0f7b0f6 drivers: Add "from micropython import const" when const is used.
Following best-practice use of the const feature, to make it compatible
with Python.
2016-11-03 12:41:11 +11:00
ernitron
e5f06559e6 esp8266/modules: Fix negative temperature in ds18x20 driver. 2016-11-02 22:58:49 +11:00
Paul Sokolovsky
5fae914326 esp8266/etshal.h: Adjust size of MD5_CTX structure.
Size 64 was incorrect and will lead to stack corruption. Size 88 was
verified empirically. Also, allow to skip defining it if MD5_CTX
preprocessor macro is already defined (to avoid header conflict).
2016-11-02 02:16:35 +03:00
Paul Sokolovsky
2ec70dc812 esp8266/etshal.h: Add prototypes for SPIRead/SPIWrite/SPIEraseSector. 2016-11-02 02:16:20 +03:00
Paul Sokolovsky
a6c9060d81 esp8266/main: Bump heap size to 36K.
ESP8266 SDK2.0 fixes (at least, I can't reproduce it) an infamous bug
with crash during scan. 36K seams to be a safe value based on a download
test (test_dl.py), over 1GB was downloaded. More testing is needed, but
let's have other people participate by committing it now.
2016-11-02 00:22:43 +03:00
puuu
b97c17e125 esp8266/modnetwork.c: Allows AP reconnection without WiFi credentials
There is no automatic reconnect after wlan.active(False);
wlan.active(True). This commit provide the possibility to run
wlan.connect() without parameter, to reconnect to the previously
connected AP.

resolve #2493
2016-11-01 06:59:41 +03:00
Paul Sokolovsky
eddcf0a5de esp8266/scripts/port_diag: Add descriptions for esf_buf types. 2016-11-01 06:56:10 +03:00
Paul Sokolovsky
e377f3cb40 esp8266/modnetwork: config(): Fix copy-paste error in setting "mac". 2016-10-31 00:30:26 +03:00
Paul Sokolovsky
64c6bdb8ee esp8266/modutime: Consistently convert to MP_ROM_QSTR/MP_ROM_PTR. 2016-10-29 18:48:04 +03:00
Paul Sokolovsky
d86cac4b82 extmod/utime_mphal: Implement ticks_add(), add to all maintained ports. 2016-10-29 17:30:05 +03:00
Radomir Dopieralski
984a867341 esp8266/scripts: Make neopixel/apa102 handle 4bpp LEDs with common code.
The NeoPixel class now handles 4 bytes-per-pixel LEDs (extra byte is
intensity) and arbitrary byte ordering.  APA102 class is now derived from
NeoPixel to reduce code size and support fill() operation.
2016-10-25 14:21:07 +11:00
Paul Sokolovsky
2550d7dfd2 esp8266: Add support for building firmware version for 512K modules.
To build, "make 512k".

Disabled are FatFs support (no space for filesystem), Python functionality
related to files, btree module, and recently enabled features. With all
this, there's only one free FlashROM page.
2016-10-25 00:43:11 +03:00
Paul Sokolovsky
e6af94d13b esp8266/modesp: Add flash_user_start() function.
As we're looking towards adding OTA support, calculation of a FlashROM
area which can be used for filesystem (etc.) may become complex, so
introduce C function for that. So far it just hardcodes current value,
0x90000. In the future the function may be extended (and renamed) to
return the size of area too.
2016-10-24 16:52:15 +03:00
Paul Sokolovsky
b6c22c42ab esp8266/etshal.h: Add few more ESP8266 vendor lib prototypes. 2016-10-23 16:43:07 +03:00
Paul Sokolovsky
1b76614d41 esp8266/Makefile: deploy: Remove deprecated line. 2016-10-22 18:56:43 +03:00
Damien George
4ebdb1f2b2 py: Be more specific with MP_DECLARE_CONST_FUN_OBJ macros.
In order to have more fine-grained control over how builtin functions are
constructed, the MP_DECLARE_CONST_FUN_OBJ macros are made more specific,
with suffix of _0, _1, _2, _3, _VAR, _VAR_BETEEN or _KW.  These names now
match the MP_DEFINE_CONST_FUN_OBJ macros.
2016-10-21 16:26:01 +11:00
Paul Sokolovsky
b440307b4a py/py.mk: Automatically add frozen.c to source list if FROZEN_DIR is defined.
Now frozen modules generation handled fully by py.mk and available for reuse
by any port.
2016-10-21 01:08:43 +03:00
Paul Sokolovsky
3f251efb9b esp8266/modules/webrepl: Enforce only one concurrent WebREPL connection.
Concurrent WebREPL connections were never supported, now actually check
for this.
2016-10-20 16:50:38 +03:00
Paul Sokolovsky
204222653e esp8266/main: Mark nlr_jump_fail() as MP_FASTCODE.
It's probably not strictly needed so far, but serves as an example of
MP_FASTCODE use and may be helpful in the future.
2016-10-19 00:21:14 +03:00
Paul Sokolovsky
9514d847fe esp8266: Add MP_FASTCODE modifier to put a function to iRAM.
It can be used in the following manner:

void MP_FASTCODE(foo)(int arg) { ... }
2016-10-19 00:20:10 +03:00
Paul Sokolovsky
462748de0c esp8266/esp8266.ld: Move main.o to iROM. 2016-10-19 00:12:54 +03:00
Paul Sokolovsky
e7e0d91be8 esp8266/esp8266.ld: Move modmachine.o to iROM. 2016-10-19 00:04:30 +03:00
Paul Sokolovsky
6566e3f6a8 esp8266/esp8266.ld: Move help.o to iROM. 2016-10-19 00:01:14 +03:00
Paul Sokolovsky
20d0271863 esp8266/esp_init_data: Auto-initialize system params with vendor SDK 2.0.0.
SDK 2.0.0 goes into boot loop if a firmware is programmed over erased flash,
causing problems with user experience. This change implements behavior
similar to older SDKs': if clean flash is detected, default system
parameters are used.
2016-10-18 15:18:07 +03:00
Paul Sokolovsky
4d45f286eb esp8266/Makefile: Use latest esptool.py flash size auto-detection. 2016-10-18 00:06:59 +03:00
Paul Sokolovsky
799ccdc789 esp8266, stmhal, unix: MAKE_FROZEN is consistently defined in mkenv.mk. 2016-10-16 10:49:36 +03:00
Paul Sokolovsky
a97284423e extmod/utime_mphal: Factor out implementations in terms of mp_hal_* for reuse.
As long as a port implement mp_hal_sleep_ms(), mp_hal_ticks_ms(), etc.
functions, it can just use standard implementations of utime.sleel_ms(),
utime.ticks_ms(), etc. Python-level functions.
2016-10-14 20:14:01 +03:00
Damien George
ed878275b0 esp8266: Enable micropython.alloc_emergency_exception_buf(). 2016-10-14 01:27:53 +11:00
Damien George
af8d791bd0 esp8266: Enable importing of precompiled .mpy files. 2016-10-12 11:03:58 +11:00
Damien George
11fc6553e8 esp8266: Enable sys.{stdin,stdout,stderr}.buffer for raw serial access. 2016-10-12 11:03:58 +11:00
Radomir Dopieralski
db4e009217 esp8266/mpconfigport: Enable MICROPY_PY_BUILTINS_SLICE_ATTRS 2016-10-11 12:22:36 +02:00
Paul Sokolovsky
3b3612c65b esp8266: Make neopixel support configurable.
To save iRAM.
2016-10-09 00:56:46 +03:00
Damien George
23a568240d esp8266: Use mp_raise_OSError helper function. 2016-10-07 14:00:51 +11:00
dmanso
0363e1d7b5 esp8266: Add FLASH_MODE,FLASH_SIZE options for make deploy target.
Added options to make deploy so it can be used for ESP8266 boards with
other flash configurations.  For example NodeMCU DEVKIT V1.0 can now use:

    $ make FLASH_MODE=dio FLASH_SIZE=32m deploy
2016-10-07 13:18:48 +11:00
Damien George
056da75a8a esp8266: Make PY_UHASHLIB_SHA1 config depend on PY_USSL and SSL_AXTLS.
SHA1 can only be supported if ussl module is compiled in, and it uses
axtls.
2016-10-06 12:28:28 +11:00
puuu
bcf60b43ee esp8266/modpybrtc.c: Implement machine.RTC.alarm_left()
Implementation of machine.RTC.alarm_left(), like described in the
documentation.
2016-10-05 12:20:30 +11:00
Paul Sokolovsky
161e9f4115 esp8266/main: Put /lib before / in sys.path.
upip will use first non-empty component in sys.path as an install path
(if MICROPYPATH envvar is not set, like it will be for baremetal targets).
2016-10-05 00:02:51 +03:00
Paul Sokolovsky
52784bf595 esp8266/modmachine: idle(): Return number of CPU cycles spent idling.
Useful to better understand esp8266 inner workings and compare behavior
in different cases.
2016-10-04 21:20:47 +03:00
Damien George
b932b2dd1f extmod/machine_spi: Use delay_half, not baudrate, for internal timing.
The delay_half parameter must be specified by the port to set up the
timing of the software SPI.  This allows the port to adjust the timing
value to better suit its timing characteristics, as well as provide a
more accurate printing of the baudrate.
2016-10-04 13:43:02 +11:00
Damien George
bd87375202 esp8266/moduos: Move stat/statvfs funcs to sit within #if VFS guard. 2016-10-03 21:48:32 +11:00
Damien George
d434ce3fca extmod/machine_spi: Factor out software SPI code from esp8266 to extmod. 2016-10-03 16:43:44 +11:00
Damien George
5bb28c7f10 extmod/machine_spi: Simplify SPI xfer function to only take one buf len.
There is no need to take src_len and dest_len arguments.  The case of
reading-only with a single output byte (originally src_len=1, dest_len>1)
is now handled by using the output buffer as the input buffer, and using
memset to fill the output byte into this buffer.  This simplifies the
implementations of the spi_transfer protocol function.
2016-10-03 12:39:31 +11:00
Paul Sokolovsky
6ab2c5e6cc lib/interrupt_char: Factor out typical Ctrl+C handling from esp8266 port.
Utility functions for keyboard interrupt handling, to be reused across
(baremetal) ports.
2016-09-29 10:15:38 -07:00
Alex March
4fb72fe624 esp8266: Add uos.statvfs() to get filesystem status. 2016-09-27 13:49:05 +10:00
Damien George
93c4a6a3f7 all: Remove 'name' member from mp_obj_module_t struct.
One can instead lookup __name__ in the modules dict to get the value.
2016-09-22 00:23:16 +10:00
Damien George
34e0198436 esp8266: Extend system microsecond counter to 64-bits; use in ticks_ms.
So now ticks_ms can count up to the full 30 bits.  Fixes issue #2412.
2016-09-20 14:28:17 +10:00
Paul Sokolovsky
4b3f1d712b esp8266/esp_mphal: Add tentative change to mp_hal_stdin_rx_chr() to wait IRQ.
Instead of busy-looping waiting for UART input. Not enabled by default,
needs more testing.
2016-09-19 00:23:38 +03:00
Paul Sokolovsky
3fe047f08f esp8266/ets_alt_task: ets_post: Should return 0 on success, !0 - failure. 2016-09-18 23:01:58 +03:00
Paul Sokolovsky
f28efa1971 py: Move frozen modules rules from esp8266 port for reuse across ports.
A port now just needs to define FROZEN_DIR var and add $(BUILD)/frozen.c
to SRC_C to support frozen modules.
2016-09-17 21:00:40 +03:00