summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2014-10-26stmhal: Change SPI phase spec to 0,1 to match standard conventions.Damien George
Was 1 or 2, now 0 or 1 (respectively). 0 means sample MISO on first edge, 1 means sample on second edge. Addresses issue #936.
2014-10-26py: Fix memoryview referencing so it retains ptr to original buffer.Damien George
This way, if original parent object is GC'd, the memoryview still points to the underlying buffer data so that buffer is not GC'd.
2014-10-26unix/windows: Disable sigaction on windows port.Damien George
2014-10-26py: Fix VM dispatch following a pending exception check.Damien George
2014-10-25changed file paths to new namesSebastian Plamauer
2014-10-25py: Add mp_pending_exception global variable, for VM soft interrupt.Damien George
This allows to implement KeyboardInterrupt on unix, and a much safer ctrl-C in stmhal port. First ctrl-C is a soft one, with hope that VM will notice it; second ctrl-C is a hard one that kills anything (for both unix and stmhal). One needs to check for a pending exception in the VM only for jump opcodes. Others can't produce an infinite loop (infinite recursion is caught by stack check).
2014-10-25stmhal: Change USB PID when in CDC+HID mode.Damien George
This gets CDC+HID working on Windows, since it needs a different PID for a different USB configuration. Thanks to tmbinc and dhylands.
2014-10-25tests: Add test for compile builtin.Damien George
2014-10-25py: Implement compile builtin, enabled only on unix port.Damien George
This should be pretty compliant with CPython, except perhaps for some corner cases to do with globals/locals context. Addresses issue #879.
2014-10-25py: Factor out mp_obj_is_package() function.Paul Sokolovsky
2014-10-25py: mp_builtin___import__(): Add const to arg type.Paul Sokolovsky
2014-10-25py: Compress load-int, load-fast, store-fast, unop, binop bytecodes.Damien George
There is a lot potential in compress bytecodes and make more use of the coding space. This patch introduces "multi" bytecodes which have their argument included in the bytecode (by addition). UNARY_OP and BINARY_OP now no longer take a 1 byte argument for the opcode. Rather, the opcode is included in the first byte itself. LOAD_FAST_[0,1,2] and STORE_FAST_[0,1,2] are removed in favour of their multi versions, which can take an argument between 0 and 15 inclusive. The majority of LOAD_FAST/STORE_FAST codes fit in this range and so this saves a byte for each of these. LOAD_CONST_SMALL_INT_MULTI is used to load small ints between -16 and 47 inclusive. Such ints are quite common and now only need 1 byte to store, and now have much faster decoding. In all this patch saves about 2% RAM for typically bytecode (1.8% on 64-bit test, 2.5% on pyboard test). It also reduces the binary size (because bytecodes are simplified) and doesn't harm performance.
2014-10-25py: Store bytecode arg names in bytecode (were in own array).Damien George
This saves a lot of RAM for 2 reasons: 1. For functions that don't have default values, var args or var kw args (which is a large number of functions in the general case), the mp_obj_fun_bc_t type now fits in 1 GC block (previously needed 2 because of the extra pointer to point to the arg_names array). So this saves 16 bytes per function (32 bytes on 64-bit machines). 2. Combining separate memory regions generally saves RAM because the unused bytes at the end of the GC block are saved for 1 of the blocks (since that block doesn't exist on its own anymore). So generally this saves 8 bytes per function. Tested by importing lots of modules: - 64-bit Linux gave about an 8% RAM saving for 86k of used RAM. - pyboard gave about a 6% RAM saving for 31k of used RAM.
2014-10-25unix: Allow -X heapsize= option take numbers with K & M suffixes.Paul Sokolovsky
For kilobytes and megabytes respectively.
2014-10-25stmhal: Change fresh boot.py and main.py to use \r\n newlines.Damien George
This is so it's compatible with Windows.
2014-10-25stmhal: Fill in USB class/subclass/proto for CDC+HID device.Damien George
Also change HID device from keyboard to mouse (should have been mouse all along).
2014-10-25USB CDC ACM: populate bFunction{Class,SubClass,Protocol} in the interface ↵Felix Domke
association descriptor
2014-10-24py: Improve memory usage debugging; better GC AT dumping.Damien George
In unix port, mem_info(1) now prints pretty GC alloc table.
2014-10-24py: Fix debug-printing of bytecode line numbers.Damien George
Also move the raw bytecode printing code from emitglue to mp_bytecode_print.
2014-10-24py: Use mp_uint_t where appropriate in stream functions.Damien George
2014-10-24stmhal: Use stream's readinto.Damien George
2014-10-23stmhal: Fix pin af definition: TIM2_CH1_ETR -> TIM2_CH1/TIM2_ETR.Damien George
2014-10-23stream: Add optional 2nd "length" arg to .readinto() - extension to CPython.Paul Sokolovsky
While extension to file.readinto() definition of CPython, the additional arg is similar to what in CPython available in socket.recv_into().
2014-10-23stmhal: Use OSError with POSIX error code for HAL errors.Damien George
Addresses issue #921.
2014-10-23py: Properly free string parse-node; add assertion to gc_free.Damien George
2014-10-23py: Add builtin memoryview object (mostly using array code).Damien George
2014-10-23py: Use MP_OBJ_NULL instead of NULL in a few places.Damien George
2014-10-23py: Clean up edge cases of malloc/realloc/free.Damien George
2014-10-22extmod: Add uheapq module.Damien George
2014-10-22py: Fix smallint modulo with negative arguments.Damien George
Addresses issue #927.
2014-10-22tools, pydfu: Some fixes to support Python 3.Damien George
2014-10-22Add pydfu.py to the micropython tree. Use dfu_util bgy defaultDave Hylands
You can do: make USE_PYDFU=1 deploy to use pydfu.py
2014-10-22py: Remove unused and unneeded SystemError exception.Damien George
It's purpose is for internal errors that are not catastrophic (ie not as bad as RuntimeError). Since we don't use it, we don't need it.
2014-10-22stmhal: Add MMA_INT/PB2 to available pins on PYBV10.Damien George
This allows you to register ExtInt on the MMA interrupt pin.
2014-10-22Fixed TIM2_CH1 definition.Dave Hylands
TIM2_CH1_ETR is really bundling 2 functions to the same pin: TIM2_CH1 (where its used as a channel) TIM2_ETR (where iss used as an external trigger). I fixed most of these a while back, but it looks like I missed this one.
2014-10-22stmhal: Don't return SystemExit value from parse_compile_execute.Damien George
There is no need, since we don't (currently) use the value.
2014-10-22Add pyb.hard_reset, and make sys.exit() or raise SystemExit do a soft reset.Dave Hylands
2014-10-22stmhal: Change cc3k.recv to only make 1 call to underlying recv().Damien George
Also make cc3k.send and cc3k.recv independent functions (not wrapped by stream write/read). Also make wiznet5k.recv more memory efficient. This might address issue #920.
2014-10-21stmhal: Overhaul UART class to use read/write, and improve it.v1.3.4Damien George
UART object now uses a stream-like interface: read, readall, readline, readinto, readchar, write, writechar. Timeouts are configured when the UART object is initialised, using timeout and timeout_char keyword args. The object includes optional read buffering, using interrupts. You can set the buffer size dynamically using read_buf_len keyword arg. A size of 0 disables buffering.
2014-10-21py: Make mp_const_empty_bytes globally available.Damien George
2014-10-21Merge pull request #922 from swegener/for-upstreamDamien George
stmhal: Set entry point for ELF binary debugging
2014-10-21Use mode/encoding kwargs in io and unicode testsstijn
mode argument is used to assert it works encoding argument is used to make sure CPython uses the correct encoding as it does not automatically use utf-8
2014-10-21Implement kwargs for builtin open() and _io.FileIOstijn
This makes open() and _io.FileIO() more CPython compliant. The mode kwarg is fully iplemented. The encoding kwarg is allowed but not implemented; mainly to allow the tests to specify encoding for CPython, see #874
2014-10-21stmhal: Set entry point for ELF binary debuggingSven Wegener
When loading the ELF binary to the board with a debugger, the debugger needs to know at which point to start executing the code. Currently the entry point defaults to the start of the .text section. Signed-off-by: Sven Wegener <sven.wegener@stealer.net>
2014-10-20stmhal: Add retry to SD card init.Damien George
This fixed an issue with a certain SD card sometimes not initialising first time round. See issue #822 for related, and thanks to @iabdalkader for the idea.
2014-10-19examples: Update conwaylife to work with new LCD API.Damien George
2014-10-19py: Partially fix viper multi-comparison; add test for it.Damien George
2014-10-19tools, pyboard.py: Allow exec argument to be bytes or str.Damien George
2014-10-18unix, stmhal: Implement file.readinto() method.Paul Sokolovsky
Also, usocket.readinto(). Known issue is that .readinto() should be available only for binary files, but micropython uses single method table for both binary and text files.
2014-10-17unix: Make -c option parse input script as a file, as per CPython.Damien George
Addresses issue #915.