Damien George
6d3c5e4301
Add ARRAY_SIZE macro, and use it where possible.
2014-04-26 10:47:29 +01:00
Damien George
d139c489ba
Merge branch 'master' of github.com:micropython/micropython
2014-04-26 10:31:58 +01:00
Damien George
6cebe24b7d
bare-arm: Disable more stuff to reduce binary size.
2014-04-26 10:31:38 +01:00
Damien George
107c9fb235
py: Make collections module configurable, enabled by default.
2014-04-26 10:31:15 +01:00
Paul Sokolovsky
e14d096cb7
objstr: Optimize .rstrip() by scanning string from end.
2014-04-26 06:48:31 +03:00
Paul Sokolovsky
881078403e
objstr: Implement .lstrip() & .rstrip().
...
Share code with .strip(). TODO: optimize .rstrip().
2014-04-26 06:20:08 +03:00
Paul Sokolovsky
12a9cfed76
modsocket: Make .send() support arbitrary objects with buffer interface.
...
This is CPython-compliant (except that CPython doesn't support buffer
protocol for str).
2014-04-26 05:54:22 +03:00
Paul Sokolovsky
45fb143ba6
streams: Make .write() support arbitrary objects with buffer interface.
...
This in particular fixes writing str vs bytes.
2014-04-26 05:54:16 +03:00
Damien George
1463c1fa82
py: Add MICROPY_ENABLE_DOC_STRING, disabled by default.
...
Also add a few STATIC's to some compile functions that should have them.
Addresses issue #521 .
2014-04-25 23:52:57 +01:00
Damien George
c492cf1f44
Merge branch 'master' of github.com:micropython/micropython
2014-04-25 23:45:52 +01:00
Damien George
daab651c5c
py, gc: Zero out newly allocated blocks in the GC.
...
Also add some more debugging output to gc_dump_alloc_table().
Now that newly allocated heap is always zero'd, maybe we just make this
a policy for the uPy API to keep it simple (ie any new implementation of
memory allocation must zero all allocations). This follows the D
language philosophy.
Before this patch, a previously used memory block which had pointers in
it may still retain those pointers if the new user of that block does
not actually use the entire block. Eg, if I want 5 blocks worth of
heap, I actually get 8 (round up to nearest 4). Then I never use the
last 3, so they keep their old values, which may be pointers pointing to
the heap, hence preventing GC.
In rare (or maybe not that rare) cases, this leads to long, unintentional
"linked lists" within the GC'd heap, filling it up completely. It's
pretty rare, because you have to reuse exactly that memory which is part
of this "linked list", and reuse it in just the right way.
This should fix issue #522 , and might have something to do with
issue #510 .
2014-04-25 23:37:55 +01:00
Paul Sokolovsky
755565d2cb
py: Support instance __call__ method.
2014-04-25 21:17:42 +03:00
Damien George
410f30772f
py, gc: Fix old gc_realloc for case when NULL is passed in as ptr.
2014-04-25 11:44:53 +00:00
Damien George
5be40afb4c
Merge pull request #515 from errordeveloper/qemu
...
Qemu
2014-04-24 22:24:00 +01:00
Damien George
c0dc7c3dfa
py, vm: Fix recent bug where state is freed too early.
2014-04-24 15:42:05 +01:00
Damien George
d5e8482c4a
py, vm: Free heap-allocated state if it was allocated on the heap.
2014-04-24 13:52:06 +01:00
Damien George
978939156d
Merge pull request #519 from pfalcon/exc-no-ptr-to-field
...
objexcept: Don't store args tuple within exception object.
2014-04-24 11:14:18 +01:00
Damien George
1cbb99d1db
Merge pull request #518 from pfalcon/vm-trace
...
vm: Add rudimentary bytecode execution tracing capability.
2014-04-24 11:06:10 +01:00
Paul Sokolovsky
1c1d902cd3
Makefile: Allow to override "super optimization" options used for some files.
...
To help with debugging issue like #510 for example.
2014-04-24 02:59:43 +03:00
Paul Sokolovsky
6c94abe347
windows/README: Use CROSS_COMPILE instead of CC to cover other tools too.
...
Suggested by @lurch.
2014-04-23 20:45:53 +03:00
Paul Sokolovsky
1acf22f17b
objexcept: Don't store args tuple within exception object.
...
To avoid pointer-to-field GC problem.
2014-04-23 04:07:00 +03:00
Paul Sokolovsky
c5e32c6995
vm: Add rudimentary bytecode execution tracing capability.
2014-04-23 03:46:00 +03:00
Paul Sokolovsky
4c6b375960
showbc: MAKE_CLOSURE*: Update for new closed-over encoding.
2014-04-23 03:23:39 +03:00
Paul Sokolovsky
5e3e2d00ea
emitglue: Typo fix in var name.
2014-04-23 03:23:32 +03:00
Paul Sokolovsky
20e9ed3916
builtinimport: If there was error compiling imported module, raise exception.
2014-04-22 02:53:20 +03:00
Paul Sokolovsky
fa6f0506c1
unix: Workaround MP_OBJ_NEW_SMALL_INT() 64-bit issues.
2014-04-22 00:16:46 +03:00
Paul Sokolovsky
5d3a830171
modsocket: Clean up OSError-like exception a bit.
...
Some BSD socket functions don't return error numbers in errno namespace, but
rather in other error namespaces. CPython resolves this by using OSError
subclasses for them. We don't do that so far, so there's ambiguity here.
2014-04-22 00:02:51 +03:00
Paul Sokolovsky
acb13886fc
unix: OSError's args[0] should be errno numeric value.
...
Well, Python3 also defines an attribute for that, but that's bloat.
2014-04-22 00:02:51 +03:00
Paul Sokolovsky
dec31bb872
objexcept: Add mp_obj_new_exception_arg1() convenience function.
2014-04-22 00:02:51 +03:00
Paul Sokolovsky
b418b6fb0d
modffi: Don't use OSError for clearly unrelated errors.
2014-04-22 00:02:51 +03:00
Paul Sokolovsky
88972b0d94
modffi: Describe typecodes where they differ from used by struct module.
...
Exact behavior of typecodes may be not yet enforced.
2014-04-22 00:02:51 +03:00
Ilya Dmitrichenko
6820937892
travis: should test building qemu-arm as well.
2014-04-21 21:10:15 +01:00
Ilya Dmitrichenko
b554bc5691
qemu-arm: update makefile ( d553be5
).
2014-04-21 21:08:15 +01:00
Ilya Dmitrichenko
2face99cfe
qemu-arm: more generic port name.
2014-04-21 21:04:04 +01:00
Ilya Dmitrichenko
ee857853d6
cortex-m3-qemu: refactor the port.
...
Switch from CodeSourcery to ARM GCC and clean-up some stale files,
also copy `main.c` and `mpconfigport.h` from bare-arm.
2014-04-21 21:04:04 +01:00
Ilya Dmitrichenko
5130b81eec
cortex-m3-qemu: a working port
2014-04-21 21:04:04 +01:00
Damien George
ca045d97b9
tools: Update pyboard.py to work with latest changes to RTC.
2014-04-21 20:18:37 +01:00
Damien George
5ea69859c9
stmhal: Update help text.
2014-04-21 20:18:22 +01:00
Damien George
350cb6bf20
stmhal: Fix bug with pin GPIO reading.
2014-04-21 20:18:06 +01:00
Damien George
ef255e47c1
stmhal, usrsw: Wrap usrsw.c in #if, for when switch is not available.
2014-04-21 18:31:40 +01:00
Damien George
b97c2f4c14
stmhal, accel: Add TODO comment.
2014-04-21 18:30:38 +01:00
Damien George
46e1f26615
stmhal, usrsw: Update comments for new switch API.
2014-04-21 18:28:23 +01:00
Damien George
6125ba4a7f
stmhal: Make switch a class, to follow suit of all other modules.
...
Instead of pyb.switch() as a function, it's more consistent (with
respect to all the other modules and peripherals) to have
pyb.Switch() create a switch object. This then generalises to having
multiple switches. Call the object to get its state. Use sw.callback
to set the callback function for when the switch is pressed.
2014-04-21 18:23:50 +01:00
Damien George
af797f476f
stmhal, servo: Rename calibrate method to calibration.
...
It should be a noun, since it supports getting and setting depending on
the number of arguments given.
2014-04-21 18:21:07 +01:00
Damien George
6691c9e655
stmhal, timer: Remove obsolete global variable.
2014-04-21 18:19:50 +01:00
Damien George
7fdfa93700
stmhal: Add Timer class: simple TIM control, incl callback on IRQ.
...
Simple but functional timer control. More sophistication will
eventually be added, or for now just use direct register access :)
Also added pyb.freq() function to get MCU clock frequencies.
2014-04-21 16:48:16 +01:00
Damien George
e5f8a77db6
py: Add 'align' and 'data' meta-instructions to inline assembler.
2014-04-21 13:33:15 +01:00
Damien George
764af4b7c5
stmhal: Make DAC dynamically allocate instances; rename dma->write_timed.
2014-04-21 13:06:19 +01:00
Damien George
83407ad082
stmhal: Clean up rtc.c a bit.
2014-04-21 12:45:59 +01:00
Damien George
7533700393
stmhal: Rename USART to UART.
...
It's really a UART because there is no external clock line (and hence no
synchronous ability, at least in the implementation of this module).
USART should be reserved for a module that has "S"ynchronous capabilities.
Also, UART is shorter and easier to type :)
2014-04-21 12:03:09 +01:00