Paul Sokolovsky
99061d1dcb
extmod/modbtree: Switch to accepting stream object instead of filename.
Requires "embedded" BerkeleyDB BTree implementation.
8 years ago
Paul Sokolovsky
0dfe849413
py/py.mk: Extra switches to build "embedded" BerkeleyDB BTree lib.
8 years ago
Paul Sokolovsky
2ec943284a
lib/berkeley-db-1.xx: Switch to "embedded" branch.
It allows to access files via a virtual method tables and thus can integrate
with MicroPython's stream objects.
8 years ago
Dave Hylands
460bceca39
stmhal: Make SPI NSS pin definition optional.
Some boards (like the GHI Electronics G30 Dev Board) don't use
NSS at all and rather just use GPIO chip selects.
8 years ago
Matt Brejza
afd4909a0f
stmhal: fixing malloc when used with external libraries
8 years ago
stijn
37b143ce9e
mpy-cross: Fix mingw and msys2 compilation
When compiling with msys2's gcc there's no need to apply the binary fmode
so adjust the Makefile to reflect that.
When compiling with mingw we need to include malloc.h since there is no
alloca.h, and the 64bit detection in mpconfigport.h needs some adjustment.
8 years ago
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.
8 years ago
Paul Sokolovsky
58d9d85a56
lib/abort_.c: Add prototype to make coverage build happy.
8 years ago
Paul Sokolovsky
ba2c503541
esp8266/mpconfigport.h: Include sys/types.h for POSIX types definitions.
As required for related functions in stream.h.
8 years ago
Paul Sokolovsky
50fea19416
esp8266/axtls_helpers: Remove abort_(), now in lib/embed/.
8 years ago
Paul Sokolovsky
c8b80e4740
lib/embed/abort_: Implementation of abort_() function raising uPy exception.
Helpful when porting existing C libraries to MicroPython. abort()ing in
embedded environment isn't a good idea, so when compiling such library,
-Dabort=abort_ option can be given to redirect standard abort() to this
"safe" version.
8 years ago
Paul Sokolovsky
4f1b0292db
py/stream: Add adapter methods with POSIX-compatible signatures.
Previoussly such read() and write() methods were used by modussl_axtls,
move to py/stream for reuse.
8 years ago
Paul Sokolovsky
abd5a57ea1
tests/io/bytesio_ext: Test for .seek()/.flush() on BytesIO.
8 years ago
Paul Sokolovsky
3990b1715d
py/objstringio: Implement MP_STREAM_SEEK ioctl and add seek() method.
8 years ago
Paul Sokolovsky
f039ac5bd7
py/objstringio: Add MP_STREAM_FLUSH ioctl and flush() method.
No-op for this object.
8 years ago
Paul Sokolovsky
64da62ec2e
unix/file: Use generic stream flush() method.
8 years ago
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.
8 years ago
Paul Sokolovsky
01816068c8
unix/file: fdfile_ioctl(): Fix argument to check_fd_is_open().
8 years ago
Paul Sokolovsky
a60b0263ba
py/stream: Implement generic flush() method, in terms of C-level ioctl.
8 years ago
Paul Sokolovsky
ade36806c8
unix/file: ioctl(): Check that file is open before operations.
8 years ago
Paul Sokolovsky
8fac939889
unix/file: Implement MP_STREAM_FLUSH ioctl.
8 years ago
Paul Sokolovsky
6ead9f6f3d
tests/run-tests: Make "regex'ed .exp" facility available to device tests.
Required to pass bytes_compare3.py (opptional warnings) on devices.
8 years ago
Paul Sokolovsky
f2f761c0c3
py/stream: Stream module works with errno's, so should include mperrno.h.
8 years ago
Paul Sokolovsky
243f8988be
unix/mpconfigport.h: Include stdio.h by default.
This allows to use printf() in a any source file with unix port, for quick
debugging.
8 years ago
Paul Sokolovsky
d1771bbae0
tests/unicode_subscr.py: Detailed test for subscripting unicode strings.
8 years ago
Paul Sokolovsky
ed1c194ebf
py/objstrunicode: str_index_to_ptr: Implement positive indexing properly.
Order out-of-bounds check, completion check, and increment in the right way.
8 years ago
Paul Sokolovsky
6af90b2972
py/objstrunicode: str_index_to_ptr: Should handle bytes too.
There's single str_index_to_ptr() function, called for both bytes and
unicode objects, so should handle each properly.
8 years ago
Paul Sokolovsky
16f324641f
py/stream.h: Remove dated comment of POSIX-specificity of EAGAIN.
We have adopted POSIX-compatible error numbers as MicroPython's native.
8 years ago
Paul Sokolovsky
1a7e28d8b7
py/stream.h: Move mp_stream_write_adaptor() inside ifdef block.
8 years ago
Paul Sokolovsky
5a38694f55
tests/extmod/btree1: Close database at the end of test.
8 years ago
Paul Sokolovsky
25df419c67
extmod/modbtree: Check __bt_open() return value for error.
8 years ago
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.
8 years ago
Paul Sokolovsky
2dd21d9a68
extmod/modwebrepl: Use mp_stream_close() method.
8 years ago
Paul Sokolovsky
614deb82c7
examples/http_client*: Be sure to close socket.
Otherwise, on bare-metal/RTOS systems can lead to resource leaks.
8 years ago
Paul Sokolovsky
a53e0e59f3
extmod/modussl_axtls: Use mp_stream_close() method.
8 years ago
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.
8 years ago
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).
8 years ago
Paul Sokolovsky
4d4cfc2ee6
examples/embedding: Add README.
9 years ago
Paul Sokolovsky
1e77e25675
examples/embedding: Example for embedding MicroPython in an app.
9 years ago
Paul Sokolovsky
e47c2ec64a
wundows/README: Typo fix.
8 years ago
stijn
9bdb82ef6b
mpy-cross: Use binary file translation mode for creating mpy files on windows
This is a fix for https://github.com/micropython/micropython/issues/2209 :
by default a file created using open() uses text translation mode so writing
\n to it will result in the file having \r\n. This is obviously problematic
for binary .mpy files, so provide functions for setting the open mode
and use binary mode in mpy-cross' main().
8 years ago
Paul Sokolovsky
43473372e6
lib/utils/stdout_helpers: Move from minimal/uart_extra.c for reuse.
8 years ago
Paul Sokolovsky
b652ee705b
tests/bytes_compare: Rework test for bytes <-> str comparison.
This may produce a warning, depending on MicroPython configuration.
8 years ago
Paul Sokolovsky
40214b9e26
esp8266: Enable MICROPY_PY_STR_BYTES_CMP_WARN.
8 years ago
Paul Sokolovsky
918851e836
unix: Enable MICROPY_PY_STR_BYTES_CMP_WARN.
Also, fix a warning text (remove "duplicate" BytesWarning).
8 years ago
Paul Sokolovsky
a1b442bc07
py/mpconfig.h: Fix description for MICROPY_PY_STR_BYTES_CMP_WARN.
8 years ago
Paul Sokolovsky
707cae7494
py/obj: Issue a warning when str and bytes objects are compared.
Something like:
if foo == "bar":
will be always false if foo is b"bar". In CPython, warning is issued if
interpreter is started as "python3 -b". In MicroPython,
MICROPY_PY_STR_BYTES_CMP_WARN setting controls it.
8 years ago
Dave Hylands
26b7d8a7be
py: Fix nlrthumb.c when DEBUG=1 is defined
8 years ago
Paul Sokolovsky
43963a8d97
minimal: Disable MICROPY_GC_ALLOC_THRESHOLD.
8 years ago
Paul Sokolovsky
68815901d4
unix: Disable MICROPY_GC_ALLOC_THRESHOLD for minimal build.
8 years ago