Commit Graph

415 Commits

Author SHA1 Message Date
Paul Sokolovsky 4a27ad040e esp8266/scripts/port_diag.py: Include esp.check_fw() call. 2016-08-04 00:43:58 +03:00
Paul Sokolovsky e33d2383d1 esp8266/modesp: Add check_fw() function to check integrity of the firmware.
Requires firmware generated by the latest makeimg.py (which stores size
and md5 of the firmware together with the firmware itself).
2016-08-04 00:29:19 +03:00
Paul Sokolovsky bf47b71b78 esp8266/makeimg.py: Append md5 hash to the generated binary.
md5 is calculated over the entire file, except first 4 bytes, which contain
flash parameters and may be changed by flashing tool or MicroPython flash
auto-config.
2016-08-04 00:21:05 +03:00
Paul Sokolovsky a621333a4c esp8266/makeimg.py: Store firmware size as last 4 bytes of padding area. 2016-08-04 00:19:09 +03:00
Paul Sokolovsky 0e4cae5212 esp8266: Make APA102 driver inclusion configurable. 2016-08-01 00:03:55 +03:00
Paul Sokolovsky 88d3cd582e esp8266/eagle.rom.addr.v6.ld: Add Enable_QMode symbol from SDK 2.0.0. 2016-08-01 00:01:49 +03:00
Paul Sokolovsky 4d22ade102 esp8266: Enable btree module. 2016-07-31 02:39:59 +03:00
Paul Sokolovsky 64ad838fde esp8266/esp_mphal: Implement libc's errno.
Using __errno() function, and redirect it to use mp_stream_errno from
stream module. This is pre-requisite for integrating with 3rd-party libs,
like BerkeleyDB.
2016-07-31 02:30:05 +03:00
Paul Sokolovsky 61e77a4e88 py/mpconfig.h: Add MICROPY_STREAMS_POSIX_API setting.
To filter out even prototypes of mp_stream_posix_*() functions, which
require POSIX types like ssize_t & off_t, which may be not available in
some ports.
2016-07-30 20:05:56 +03:00
Paul Sokolovsky ba2c503541 esp8266/mpconfigport.h: Include sys/types.h for POSIX types definitions.
As required for related functions in stream.h.
2016-07-30 17:46:36 +03:00
Paul Sokolovsky 50fea19416 esp8266/axtls_helpers: Remove abort_(), now in lib/embed/. 2016-07-30 00:36:28 +03:00
daniel-k aa4ada943a esp8266/modpybuart: Fix UART parity setting.
The configuration bits for the UART register were wrong and the parity
couldn't be enabled, because the exist_parity member hasn't been updated. I
took this ESP8266 register description (http://esp8266.ru/esp8266-uart-reg/)
as reference.

Verification has been done with a logic analyzer.
2016-07-27 21:05:45 +03:00
Paul Sokolovsky 0d221775f5 esp8266/_boot.py: Decrease GC alloc threshold to quarter of heap size.
The idea behind decrease is: bytecode and other static data is also kept on
heap, and can easily become half of heap, then setting threshold to half of
heap will have null effect - GC will happen on complete heap exhaustion like
before. But exactly in such config maintaining heap defragmented is very
important, so lower threshold to accommodate that.
2016-07-23 13:56:24 +03:00
Paul Sokolovsky c141584e1e esp8266/_boot.py: Set GC alloc threshold to half of heap size.
Should keep good chunk of heap unfragmented, if a user application allows
that at all.
2016-07-23 00:20:49 +03:00
Paul Sokolovsky 77f0cd8027 esp8266: dupterm_task_init() should be called before running _boot.py, etc.
Because they may use dupterm functionality (e.g. WebREPL running on boot).
2016-07-23 00:05:38 +03:00
Paul Sokolovsky 40214b9e26 esp8266: Enable MICROPY_PY_STR_BYTES_CMP_WARN. 2016-07-22 00:57:55 +03:00
Paul Sokolovsky 6aa7c805cc esp8266: Cache Xtensa-built libaxtls.a in local build dir.
Allows to build the library variant for other archs in parallel.
2016-07-16 04:56:23 +03:00
Paul Sokolovsky bcd0e9a7fa esp8266/moduos: Add rmdir() function. 2016-07-16 03:53:55 +03:00
Paul Sokolovsky be313ea215 esp8266: Select axTLS for SSL implementation, following recent refactor. 2016-07-13 01:59:41 +03:00
Paul Sokolovsky 380561836d esp8266/esp_mphal: Properly handle dupterm EOF after switching to readinto(). 2016-07-05 14:18:12 +03:00
Paul Sokolovsky a22b6ebff1 esp8266/esp_mphal: call_dupterm_read: Use readinto() method.
It's memory fragmentation hazard to allocate 1-char string each time by
calling read() method.
2016-07-04 21:34:40 +03:00
Paul Sokolovsky e07ef8f1a2 esp8266/main: Init recently added dupterm_arr_obj port state var. 2016-07-04 17:40:26 +03:00
Paul Sokolovsky 4cfe3e84b0 esp8266/README: Promote from "highly experimental" to "experimental". 2016-07-02 23:14:22 +03:00
Paul Sokolovsky b8f45166c6 esp8266: Switch webrepl to use frozen bytecode. 2016-07-02 22:45:31 +03:00
Paul Sokolovsky dec51e3519 esp8266: Switch webrepl_setup to use frozen bytecode. 2016-07-02 22:40:16 +03:00
Paul Sokolovsky 686367dcfc esp8266: Explicitly collect garbage in bootstrap scripts.
Leads to less fragmentation at teh time user code starts.
2016-07-02 19:22:55 +03:00
Radomir Dopieralski 35962eaab0 esp8266/modpybuart: allow setting baudrate and other params 2016-06-30 18:18:50 +02:00
Paul Sokolovsky d1b7ba5dc1 esp8266/websocket_helper.py: Fix typo in debug output. 2016-06-30 13:34:58 +03:00
Paul Sokolovsky 6907496016 esp8266/websocket_helper.py: Avoid extra string allocations. 2016-06-30 00:02:45 +03:00
Damien George 56845b6aff esp8266/README: Describe how to build mpy-cross. 2016-06-29 14:25:12 +01:00
Damien George db80c0ed46 esp8266: Enable frozen bytecode, with scripts in modules/ subdir.
To start with, the critical scripts _boot.py and flashbdev.py are frozen
to improve performance and reduce RAM consumption.

Saves about 1000 bytes of heap RAM for a bare boot with filesystem.
2016-06-29 13:59:19 +01:00
Robert HH eb7637ba2e esp8266/main.c: Clear the command line history when (re)booting.
Not clearing the command line history sometimes results in strange output
when going back after a reset.
2016-06-26 12:48:19 +01:00
Paul Sokolovsky 07209f8592 all: Rename mp_obj_type_t::stream_p to protocol.
It's now used for more than just stream protocol (e.g. pin protocol), so
don't use false names.
2016-06-18 18:44:57 +03:00
Robert HH 23067a1422 esp8266: Use RTC to set date & time stamps for files.
The time stamp is taken from the RTC for all newly generated
or changed files. RTC must be maintained separately.
The dummy time stamp of Jan 1, 2000 is set in vfs.stat() for the
root directory, avoiding invalid time values.
2016-06-16 19:31:58 +03:00
Paul Sokolovsky 236838a9fc esp8266/Makefile: Enable --verify option for esptool.py write_flash.
Based on my experience, there's rather non-zero chance to have an image be
flashed incorrectly. As --verify option is now works well in teh latest
esptool.py, enable it by default.
2016-06-12 18:50:24 +03:00
Paul Sokolovsky 9f8b788fe5 esp8266: Switch floating-point arith routines to BootROM. 2016-06-12 18:44:14 +03:00
puuu ee12581a35 esp8266: Let RTC work correctly after deepsleep.
By design, at wake up from deepsleep, the RTC timer will be reset, but
the data stored in RTC memory will not [1]. Therefore, we have to adjust
delta in RTC memory before going into deepsleep to get almost correct
time after waking up.

[1] http://bbs.espressif.com/viewtopic.php?t=1184#p4082
2016-06-06 10:51:12 +01:00
Mark 822e9ca8f3 esp8266/modnetwork: Use struct bss_info::ssid_len for ESSID length.
Instead of calling strlen(), which won't work if there're 32 chars in
returned ESSID. struct bss_info::ssid_len is not documented in SDK API
Guide, but is present in SDK headers since 1.4.0. Just in case, previous
code is left commented.
2016-06-04 22:02:01 +03:00
puuu cafdfb7af3 esp8266/modpybrtc: Handle RTC overflow.
ESP-SDK system_get_rtc_time() returns uint32 and therefore overflow
about every 7:45h.  Let's write the last state of system_get_rtc_time()
in RTC mem and use it to check for overflow. This commit require running
pyb_rtc_get_us_since_2000() at least once within 7 hours to avoid
overflow.
2016-06-03 14:37:49 +01:00
Damien George 927388e80e esp8266: Provide a dedicated variable to disable ets_loop_iter.
So ets_loop_iter is now only disabled when using machine.disable_irq.
2016-06-01 17:26:49 +01:00
Damien George 752e952096 esp8266/rtc: Set RTC user memory length to 0 on first boot.
So that RTC.memory() returns b'' on power up if it was never set.

Fixes issue #2138.
2016-06-01 11:33:04 +01:00
Robert HH 4f3fbf09cc esp8266/moduos.c: Add stat() to the module uos of esp8266.
This implementation makes use of vfs.stat() and therefore has the same
properties. Known issues for all ports: uos.stat(".") on the top level
returns the error code 22, EINVAL. The same happens with
uos.stat("dirname/") where dirname IS the name of a directory.
2016-05-31 23:00:38 +03:00
Paul Sokolovsky 15eb1ce52d esp8266: Enable MICROPY_PY_IO_FILEIO to get compliant text/binary streams. 2016-05-31 21:46:02 +03:00
Damien George 33168081f4 extmod/machine: Add MICROPY_PY_MACHINE_PULSE config for time_pulse_us.
Since not all ports that enable the machine module have the pin HAL
functions.
2016-05-31 14:25:19 +01:00
Damien George cff2b7a6e3 esp8266/modmachine: Add machine.time_pulse_us function. 2016-05-31 14:06:50 +01:00
Paul Sokolovsky 225562d915 esp8266/scripts/ntptime: Allow to override NTP server.
This is not part of public API, variable name may change, or it can be
replaced with a function.
2016-05-30 19:16:05 +03:00
Paul Sokolovsky 12401f337e esp8266/moduos: Add chdir() and getcwd() functions. 2016-05-29 19:44:24 +03:00
Damien George 602305b211 esp8266/uart: Properly initialise UART0 RXD pin in uart_config.
Tested and seems to work.  See #1995.
2016-05-29 10:30:27 +01:00
Damien George 6707fc94ae esp8266/modnetwork: Allow to press ctrl-C while scan() is running.
Ctrl-C will raise a KeyboardInterrupt and stop the scan (although it will
continue to run in the background, it won't report anything).  If
interrupted, and another scan() is started before the old one completes
in the background, then the second scan will fail with an OSError.
2016-05-29 09:53:04 +01:00
Damien George 84381fa0fc esp8266/modnetwork: Protect scan() callback against memory errors.
scan() allocates memory so may cause an exception to be raised.
2016-05-29 09:52:07 +01:00