Commit Graph

5579 Commits

Author SHA1 Message Date
Damien George a649d72606 py/makeqstrdata: Add special case to handle \n qstr. 2016-04-14 15:22:36 +01:00
Damien George 2243d68345 py/makeqstrdata: Reinstate Python2 compatibility. 2016-04-14 14:37:04 +01:00
Damien George 49bb04ee64 py/makeqstrdata: Fix rendering of qstrs that have non-printable ASCII.
The qstr data needs to be turned into a proper C string so non-ASCII
chars must be properly escaped according to C rules.
2016-04-14 14:20:25 +01:00
Damien George 0c1de1cdee py: Simplify "and" action within parser by making ident-rules explicit.
Most grammar rules can optimise to the identity if they only have a single
argument, saving a lot of RAM building the parse tree.  Previous to this
patch, whether a given grammar rule could be optimised was defined (mostly
implicitly) by a complicated set of logic rules.  With this patch the
definition is always specified explicitly by using "and_ident" in the rule
definition in the grammar.  This simplifies the logic of the parser,
making it a bit smaller and faster.  RAM usage in unaffected.
2016-04-14 13:49:23 +01:00
Paul Sokolovsky 0a400a6333 esp8266: Switch integer arith routines to BootROM. 2016-04-14 15:06:07 +03:00
Damien George df3b1741b6 esp8266: Separate 1-wire timing funcs from Python module to save iRAM.
esponewire.c contains low-level timing-critical functions that go in
iRAM.  modonewire.c contains Python wrapper code.
2016-04-14 12:44:26 +01:00
Damien George 674bf1bc81 esp8266: Add hard IRQ callbacks for pin change on GPIO0-15. 2016-04-14 12:44:26 +01:00
Damien George d9d408135d esp8266: Add dummy entries for non-existing pins to simplify pin logic.
Now pins can be easily looked up in the table using the pin number as the
index and vice versa.
2016-04-14 12:43:25 +01:00
Damien George a9a732af1f esp8266: Remove pin_id field from C pin object.
This field is the same as phys_port and not needed.
2016-04-14 12:43:25 +01:00
Paul Sokolovsky 44ab5c3ef1 extmod/modlwip: Start adding debug output. 2016-04-14 01:15:52 +03:00
Paul Sokolovsky fef0d9818a extmod/modlwip: lwip_tcp_receive(): Properly handle EOF for non-blocking sock. 2016-04-14 00:59:09 +03:00
Damien George f30b6f0af5 py/makeqstrdata: Add more names for escaped chars and esc non-printable.
Non-printable characters are escaped as 0xXX, where XX are the hex
digits of the character value.
2016-04-13 22:12:39 +01:00
Paul Sokolovsky 59a4fee516 extmod/modwebsocket: Another case to propagate EOF. 2016-04-13 22:17:09 +03:00
Damien George 733db525e2 stmhal: Add Makefile option FROZEN_MPY_DIR to support frozen bytecode. 2016-04-13 16:07:47 +01:00
Damien George f9448ddc2c minimal: Add example of frozen persistent bytecode (.mpy file).
frozentest.py is frozen into the binary as frozen bytecode.  The .mpy
file is included so that there is no dependency on the cross compiler.
2016-04-13 16:07:47 +01:00
Damien George 0a2e9650f5 py: Add ability to have frozen persistent bytecode from .mpy files.
The config variable MICROPY_MODULE_FROZEN is now made of two separate
parts: MICROPY_MODULE_FROZEN_STR and MICROPY_MODULE_FROZEN_MPY.  This
allows to have none, either or both of frozen strings and frozen mpy
files (aka frozen bytecode).
2016-04-13 16:07:47 +01:00
Damien George 0699c6bf9e tools: Add mpy-tool.py, to work with .mpy files.
Currently it can freeze .mpy files.
2016-04-13 16:05:43 +01:00
Damien George 594fa73411 py/makeqstrdata: Factor out some code to functions that can be reused. 2016-04-13 16:05:43 +01:00
Damien George ed0c11236f py/emitglue: Make mp_raw_code_t* arguments constant pointers. 2016-04-13 16:05:43 +01:00
Damien George 6d24dc23b8 py/emitglue: Move typedef of mp_raw_code_t from .c to .h file.
It's needed by frozen bytecode.
2016-04-13 16:05:43 +01:00
Damien George c2a519bab9 tests: Skip async tests for native emitter. 2016-04-13 15:56:42 +01:00
Damien George 7f7e247545 tests: Add .exp files for async tests, so they can run with Python 3.4. 2016-04-13 15:56:15 +01:00
Damien George 6eb17c31a9 ports: Disable async/await on bare-arm, minimal, pic16bit, cc3200.
It costs 1188 bytes of code on Thumb 2 archs.
2016-04-13 15:31:30 +01:00
Damien George c33df193bf tests: Add 6 tests for async await/for/with. 2016-04-13 15:27:06 +01:00
Damien George eacbd7aeba py: Fix constant folding and inline-asm to work with new async grammar. 2016-04-13 15:26:39 +01:00
pohmelie 81ebba7e02 py: add async/await/async for/async with syntax
They are sugar for marking function as generator, "yield from"
and pep492 python "semantically equivalents" respectively.

@dpgeorge was the original author of this patch, but @pohmelie made
changes to implement `async for` and `async with`.
2016-04-13 15:26:38 +01:00
Paul Sokolovsky 959ed931a4 esp8266/esp_mphal: call_dupterm_read(): Fix order of deactivating on EOF.
First deactivate, then print diagnostic message.
2016-04-13 16:35:50 +03:00
Paul Sokolovsky 19e3c9d53a esp8266/esp_mphal: Don't swallow exceptions in dupterm's read()/write().
The idea is that if dupterm object can handle exceptions, it will handle
them itself. Otherwise, object state can be compromised and it's better
to terminate dupterm session. For example, disconnected socket will keep
throwing exceptions and dump messages about that.
2016-04-13 16:34:17 +03:00
Paul Sokolovsky 54ea253f56 extmod/moduos_dupterm: Don't swallow exceptions in dupterm's read()/write().
The idea is that if dupterm object can handle exceptions, it will handle
them itself. Otherwise, object state can be compromised and it's better
to terminate dupterm session. For example, disconnected socket will keep
throwing exceptions and dump messages about that.
2016-04-13 16:34:11 +03:00
Paul Sokolovsky 47442d9f52 lib/utils/printf: Rework overriding printer of DEBUG_printf().
By default it uses mp_plat_print, but a port may override it to another
value with MICROPY_DEBUG_PRINTER_DEST.
2016-04-13 11:53:12 +03:00
Peter Hinch 22cbcd55f0 stmhal: Properly handle RTS/CTS flow control for buf/unbuf transfers.
Fixes issues #1912 and #1913.  UART documentation is also updated.
2016-04-13 08:42:32 +01:00
Damien George 3177ef544f esp8266: In callback helpers, pop nlr_buf on successful call.
nlr_pop must be called if no exception was raised.

Also, return value of these callback helpers is made void because ther
is (currently) no use for it.
2016-04-13 00:01:28 +01:00
Paul Sokolovsky b67d098841 py/modbuiltins: __repl_print__: Add comment about setting "_" special var. 2016-04-13 00:59:41 +03:00
Damien George eec8a94f04 extmod/machine_i2c: Implement I2C memory reading/writing. 2016-04-12 15:52:17 +01:00
Damien George 9314b2df4f extmod/machine_i2c: Fix I2C reading by sending ack/nack at end of byte. 2016-04-12 15:46:13 +01:00
Damien George 73bc0c24ab drivers: Add SSD1306 OLED driver, with I2C and SPI interfaces. 2016-04-12 14:06:54 +01:00
Damien George e813ea1070 esp8266: Enable framebuf module. 2016-04-12 14:06:54 +01:00
Damien George a525493e40 esp8266: Switch from using custom I2C driver to generic extmod one. 2016-04-12 14:06:54 +01:00
Damien George ac63ca7bc5 esp8266: Implement basic C-level pin HAL. 2016-04-12 14:06:54 +01:00
Damien George 1a65ff1b72 esp8266: Protect modpyb.h header file from multiple inclusions.
Also include py/obj.h so the header is self contained.
2016-04-12 14:06:54 +01:00
Damien George 67a327cb9b stmhal: Enable framebuf module. 2016-04-12 14:06:54 +01:00
Damien George e4f963a351 stmhal: Use new generic I2C object in machine module. 2016-04-12 14:06:54 +01:00
Damien George 69a1aaf654 stmhal: Implement basic C-level pin HAL. 2016-04-12 14:06:54 +01:00
Damien George d083712224 extmod: Add generic machine.I2C class, with bit-bang I2C.
Should work on any machine that provides the correct pin functions.
2016-04-12 14:06:54 +01:00
Damien George 53ad681ed1 extmod: Add initial framebuf module. 2016-04-12 14:06:53 +01:00
Damien George 3a37426b29 esp8266/scripts/inisetup.py: Use "-" in AP ESSID instead of space. 2016-04-12 00:47:21 +03:00
Paul Sokolovsky 260b839483 esp8266/scripts/inisetup.py: Set WPA/WPA2 AP mode with a predefined password. 2016-04-12 00:46:04 +03:00
Paul Sokolovsky 40f5ecd3a8 esp8266: Add Python modules for initial configuration.
Main entry point is _boot.py which checks whether FAT FS in flash mountable,
and if so, mounts it. Otherwise, it checks if flash is empty, and if so,
performs initial module setup: makes FAT FS, configures default AP name,
etc. As a last option, if flash is not empty, and could not be mounted,
it means filesystem corruption, and warning message with instructions is
printed in an infinite loop.
2016-04-12 00:37:04 +03:00
Paul Sokolovsky 2f5935269b esp8266/scripts/main.py: Remove stale file. 2016-04-12 00:35:13 +03:00
Paul Sokolovsky 54b89665fc esp8266/modnetwork: .config(): Add "password" param (W/O). 2016-04-12 00:18:40 +03:00