Commit Graph

217 Commits

Author SHA1 Message Date
Paul Sokolovsky
81fd5685fc esp8266: Move pyb.hard_reset() to machine.reset(). 2016-04-05 00:20:25 +03:00
Paul Sokolovsky
69256ac0b1 esp8266: Bump heap size to 24k. 2016-04-03 19:55:45 +03:00
Paul Sokolovsky
debbaac1bd esp8266: Update flashing instructions in README. 2016-04-03 16:04:18 +03:00
Paul Sokolovsky
919b70b7ec esp8266: Switch back to flashing combined firmware (single file).
With gap between segments minimized, there's not much padding to flash,
so no big speed overhead.
2016-04-03 15:48:46 +03:00
Paul Sokolovsky
8d2bcaf3cd esp8266: Minimize gap between Inst/DataRAM segments and FlashROM segment.
With .rodata being in FlashROM now, gap can be much smaller now. InstRAM
can be max 32K, and with segment headers, that already makes it more than
32K. Then there's some .data still, and the next Flash page boundary is
0x9000. That figure should be more or less future-proof.

TODO: Refactor makeimg to take FlashROM segment offset from file name.
2016-04-03 15:45:14 +03:00
Paul Sokolovsky
9698a60591 esp8266/ets_alt_task: Comment out debug output. 2016-04-03 01:04:01 +03:00
Paul Sokolovsky
fcd6862597 esp8266: Bump iROM size to 512k.
Needed for frozen scripts, and for future growth of binary.
2016-04-03 00:57:27 +03:00
Paul Sokolovsky
ef0c5db2ed esp8266: Move .rodata where it belongs with -mforce-l32 help. 2016-04-03 00:51:51 +03:00
Paul Sokolovsky
333a63efaa esp8266/README: Add link to docs. 2016-04-03 00:01:31 +03:00
Damien George
a0cb4eda9a esp8266: Use VM_HOOK to call ets_loop_iter within the VM.
Starting with a divisor of 10, pystone_lowmem gives a score of 256.
2016-04-02 01:34:32 +03:00
Damien George
6a051a8e0b esp8266/uart: Get ctrl-C working now that event-based REPL is disabled. 2016-04-01 14:53:01 +03:00
Damien George
fb6cc96951 esp8266/uart: Comment out old, unused rx buffering code.
This was originally used for non-event based REPL processing.  Then it
was unused when event-based processing was activated.  But now that event
based is disabled, and non-event based is back, there has been new ring
buffer code to process the chars.
2016-04-01 14:30:47 +03:00
Paul Sokolovsky
fc4c43a72e esp8266: Switch to non event-driven REPL to support paste mode. 2016-04-01 14:22:28 +03:00
Paul Sokolovsky
785cf9a61f esp8266: Support dedicated REPL loop (aka pull-style).
Event-driven loop (push-style) is still supported and default (controlled
by MICROPY_REPL_EVENT_DRIVEN setting, as expected).

Dedicated loop worked even without adding ets_loop_iter(), though that
needs to be revisited later.
2016-04-01 14:02:36 +03:00
Paul Sokolovsky
777232c9a5 esp8266: Disallow recursive calls to REPL.
Before this change, if REPL blocked executing some code, it was possible
to still input new statememts and excuting them, all leading to weird,
and portentially dangerous interaction.

TODO: Current implementation may have issues processing input accumulated
while REPL was blocked.
2016-04-01 12:53:50 +03:00
Paul Sokolovsky
5531437941 esp8266: Move PHY mode constants from modesp to modnetwork. 2016-04-01 12:10:11 +03:00
Damien George
4b597a1c1a esp8266: Reset term_obj on reboot.
Also, term_obj can be NULL if socket enables REPL duplication signalling
before os.dupterm is called, so it should be checked.
2016-03-31 19:56:52 +03:00
Paul Sokolovsky
98af891610 esp8266: Implement input part of dupterm handling.
The idea is following: underlying interrupt-driven or push-style data source
signals that more data is available for dupterm processing via call to
mp_hal_signal_dupterm_input(). This triggers a task which pumps data between
actual dupterm object (which may perform additional processing on data from
low-level data source) and input ring buffer.
2016-03-31 19:49:55 +03:00
Paul Sokolovsky
61fa7c8152 esp8266: Switch back to accumulating input data via ring buffer.
But now it's generic ring buffer implemented via ringbuf.h, and is intended
for any type of input, including dupterm's, not just UART. The general
process work like this: an interrupt-driven input source puts data into
input_buf, and then signals new data available via call to
mp_hal_signal_input().
2016-03-30 18:50:38 +03:00
Paul Sokolovsky
2e75a17bab esp8266: Fix issue when current repl line was garbage-collected.
Reference it from root pointers section.
2016-03-30 18:13:03 +03:00
Damien George
9475cc59e6 esp8266: Support synchronous wifi scanning.
That is: aps = if0.scan()

TODO: make sure that returned list has tuple with values in "standard"
order (whatever that standard is).
2016-03-30 11:35:03 +03:00
Paul Sokolovsky
d88250c06e esp8266: Reduce heap size for now to avoid random segfaults on WiFi connect. 2016-03-29 21:14:41 +03:00
Paul Sokolovsky
c4506ed869 esp8266: Let esp8266 "os" messages go to standard (REPL) UART.
That's definitely helpful for debugging.
2016-03-29 21:10:10 +03:00
Paul Sokolovsky
402a743821 esp8266/esp_mphal: Add support for debug UART-only output.
Helpful when debugging dupterm support (because otherwise all output is
spooled to dupterm too).

To use:

mp_printf(&mp_debug_print, "...");
2016-03-29 11:48:43 +03:00
Paul Sokolovsky
8fc5e56a6a esp8266: Enable uos.dupterm() method. 2016-03-29 11:41:23 +03:00
Paul Sokolovsky
c961889e34 esp8266: Add basic support for duplicating REPL output. 2016-03-29 11:13:32 +03:00
Damien George
6ca17c1922 esp8266: Implement os.urandom function.
Uses what is suspected to be a hardware random number generator.
2016-03-29 10:29:57 +03:00
Paul Sokolovsky
b4070ee8a4 esp8266: Allow to build without FatFs support again. 2016-03-28 21:35:41 +03:00
Paul Sokolovsky
2f02302e22 esp8266: Support importing modules from filesystem. 2016-03-28 18:39:34 +03:00
Damien George
71d40f132d esp8266: Zero out fs_user_mount state on (soft) reset.
Otherwise device stays mounted on soft reset and leads to corruption
(since block device object is now gone).
2016-03-28 13:28:41 +03:00
Paul Sokolovsky
9edd736ee6 esp8266/moduos: Add os.remove(), proxying to VFS object. 2016-03-28 12:50:07 +03:00
Paul Sokolovsky
e8e116e7fc esp8266/moduos: Factor out VFS method proxy helper. 2016-03-28 12:44:36 +03:00
Paul Sokolovsky
8b08a0d9ed esp8266/moduos: Add listdir() proxy for MP_STATE_PORT(fs_user_mount)[0].
I.e. os.listdir(...) will redirect to
MP_STATE_PORT(fs_user_mount)[0].listdir(...).
2016-03-28 12:29:47 +03:00
Damien George
61230e007d esp8266/moduos: Use mp_rom_map_elem_t for static const dictionary. 2016-03-28 12:08:36 +03:00
Paul Sokolovsky
b01a373adb esp8266: deploy: Use --flash_size=8m option to esptool.py.
Most esp8266 modules have at least 1MB (8Mbit) of flash. If not set, vendor
functions allow to access only first 512K.
2016-03-28 11:28:16 +03:00
Paul Sokolovsky
cd6194aefc esp8266/esp8266.ld: Put FatFs to FlashROM. 2016-03-27 17:15:25 +03:00
Paul Sokolovsky
374654f2b8 esp8266: Enable FatFs support. 2016-03-27 17:13:47 +03:00
Paul Sokolovsky
fe9bc0c573 esp8266/README: Update for the current status of the port. 2016-03-27 16:10:58 +03:00
Paul Sokolovsky
bbc65d4eda esp8266/modesp: flash_read(): Accept buffer to read to as a second argument. 2016-03-27 15:34:35 +03:00
Paul Sokolovsky
fd86bf5917 esp8266/modesp: flash_write(): Writes in multiples of 4 bytes. 2016-03-27 15:32:58 +03:00
Paul Sokolovsky
53302f1616 esp8266: Set up UART handling task soon into init process.
Otherwise, events may be posted to non-initialized task, which leads to
segfaults.
2016-03-27 14:33:17 +03:00
Paul Sokolovsky
935e021250 esp8266: Put modpybi2c.o to FlashROM. 2016-03-26 10:59:25 +02:00
Damien George
c33a76059f esp8266/tests: Add neopixel.py test. 2016-03-26 10:55:29 +02:00
Damien George
3962766be0 esp8266: Add esp.neopixel_write function to bit-bang WS2812 data. 2016-03-26 10:55:21 +02:00
Damien George
b62beadae0 esp8266: Link ADC class into machine module. 2016-03-26 00:41:37 +02:00
Paul Sokolovsky
f71c0699a5 esp8266: Put utils.o to FlashROM. 2016-03-26 00:39:51 +02:00
Paul Sokolovsky
9c7e3353e5 esp8266: Put lexerstr32.o into FlashROM. 2016-03-26 00:39:02 +02:00
Paul Sokolovsky
ba640bde55 esp8266/esppwm.c: Fix IRQ handler prototype. 2016-03-26 00:34:28 +02:00
Damien George
632d8efa05 esp8266: Add PWM support.
PWM implementation uses a timer and interrupts (FRC1), taken from
Espressif's/NodeMCU's implementation and adapted for our use.

8 channels are supported, on pins 0, 2, 4, 5, 12, 13, 14, 15.

Usage:

    import machine
    pwm0 = machine.PWM(machine.Pin(0))
    pwm0.freq(1000)
    pwm0.duty(500)

Frequency is shared (ie the same) for all channels.  Frequency is
between 1 and 1000.  Duty is between 0 and 1023.
2016-03-26 00:32:37 +02:00
Damien George
82b95f625e esp8266: Implement software SPI class.
Supports speeds up to 500k baud, polarity=0/1, phase=0/1, and using any
pins.  Only supports MSB output at the moment.
2016-03-25 23:28:13 +02:00