Commit Graph

702 Commits

Author SHA1 Message Date
Paul Sokolovsky
d83177b248 unix/mpconfigport_minimal.h: Allow to print a string within 1KB of heap.
By adjusting parser allocation policy.
2016-07-03 00:12:46 +03:00
Paul Sokolovsky
e965d2b82a unix/Makefile: Make "minimal" build be minimal again. 2016-07-03 00:10:58 +03:00
Paul Sokolovsky
43241ceaac unix: Enable btree module.
But disable it for coverage build, as its extra warninsg aren't compatible
with K&R C BerkeleyDB uses.
2016-07-02 15:26:07 +03:00
Damien George
df95f52583 py/modthread: Allow to properly set the stack limit of a thread.
We rely on the port setting and adjusting the stack size so there is
enough room to recover from hitting the stack limit.
2016-06-28 11:28:51 +01:00
Damien George
94d2919b77 unix/modtime: Release the GIL when sleeping. 2016-06-28 11:28:50 +01:00
Damien George
f443504f86 unix/mpthreadport: Suppress compiler warning about unused arguments. 2016-06-28 11:28:50 +01:00
Damien George
f1dbd2909e unix/gccollect: Provide declaration of exported function. 2016-06-28 11:28:50 +01:00
Damien George
c2508ac8bd unix/mpthreadport: Use SA_SIGINFO for GC signal handler.
SA_SIGINFO allows the signal handler to access more information about
the signal, especially useful in a threaded environment.  The extra
information is not currently used but it may prove useful in the future.
2016-06-28 11:28:49 +01:00
Damien George
dbd54e0b5b unix: Implement garbage collection with threading.
This patch allows any given thread to do a proper garbage collection and
scan all the pointers of all active threads.
2016-06-28 11:28:49 +01:00
Damien George
f1b6db2218 unix/file: If write syscall returns because of EINTR then try again.
As per PEP-475.
2016-06-28 11:28:49 +01:00
Damien George
801d1b3803 py/modthread: Implement lock object, for creating a mutex. 2016-06-28 11:28:49 +01:00
Damien George
707f98f207 py/modthread: Add stack_size() function. 2016-06-28 11:28:48 +01:00
Damien George
a791be936a unix: Add basic thread support using pthreads.
Has the ability to create new threads.
2016-06-28 11:28:48 +01:00
Damien George
330165a2cc py: Add MP_STATE_THREAD to hold state specific to a given thread. 2016-06-28 11:09:31 +01:00
Martin Müller
f2892bd77d unix: Fix Makefile to handle gc-sections linker flags on Mac OS.
The linker flag --gc-sections is not available on the linker used on
Mac OS X which results in an error when linking micropython on Mac OS X.
Therefore move this option to the LDFLAGS_ARCH variable on non Darwin
systems. According to http://stackoverflow.com/a/17710056 the equivalent
to --gc-sections is -dead_strip thus this option is used for the
LDFLAGS_ARCH on Darwin systems.
2016-06-27 22:31:55 +01:00
Paul Sokolovsky
e68811dbbf unix/modmachine: Enable time_pulse_us() function. 2016-06-19 00:21:17 +03:00
Paul Sokolovsky
ad229477c6 unix/modmachine: Include PinBase class. 2016-06-18 23:40:28 +03:00
Paul Sokolovsky
07209f8592 all: Rename mp_obj_type_t::stream_p to protocol.
It's now used for more than just stream protocol (e.g. pin protocol), so
don't use false names.
2016-06-18 18:44:57 +03:00
Paul Sokolovsky
cbffd0aadd unix: Disable FatFs VFS for normal build, keep enabled for coverage.
It's enabled mostly for unit testing, and we do that in full with coverage
build.
2016-06-18 00:58:57 +03:00
Paul Sokolovsky
7c8d76fad3 unix/alloc: Make coverage build and its overzealous warnings happy. 2016-06-18 00:36:13 +03:00
Paul Sokolovsky
c9598604c6 unix/alloc: Add option to use uPy's alloc-exec implementation even for libffi.
When built for Linux, libffi includes very bloated and workaround exec-alloc
implementation required to work around SELinux and other "sekuritee" features
which real people don't use. MicroPython has own alloc-exec implementation,
used to alloc memory for @micropython.native code. With this option enabled,
uPy's implementation will override libffi's. This saves 11K on x86_64 (and
that accounts for more than half of the libffi code size).

TODO: Possibly, we want to refactor this option to allow either use uPy's
implementation even for libffi, or allow to use libffi's implementation even
for uPy.
2016-06-18 00:18:01 +03:00
Paul Sokolovsky
9b43a7d1be unix/Makefile: libffi: Build with -Os.
Also try to use -fno-exceptions. Other options taken from libffi's configure
defaults.
2016-06-18 00:17:47 +03:00
Paul Sokolovsky
6f8880d0ab unix: Move "utime" module config to C level instead of make level. 2016-06-17 23:35:00 +03:00
Paul Sokolovsky
df453f0652 unix: Time to build with --gc-sections.
This actually saves "only" 6K for x86_64 build, as we're still more or less
careful to #ifdef unneeded code. But relying on --gc-sections in a "lazy"
manner would allow to make #ifdef'ing less pervasive (not suggested right
away, but an option for the future).
2016-06-17 02:38:20 +03:00
Paul Sokolovsky
acaa30b604 unix: Deprecate support for GNU Readline (MICROPY_USE_READLINE=2).
MicroPython own readline implementation is superior now by providing
automatic indentation and completion (completion for GNU Readline was
never implemented). MICROPY_USE_READLINE=2 also wasn't build for a long
time and probably broken.

If GNU Readline is still beneficial for some cases, it can be achieved
with external wrappers like "rlwrap" (there will be the same level of
functionality, as again, there never was deep integration, like completion
support).
2016-06-16 03:28:58 +03:00
Paul Sokolovsky
b5190f1df3 unix/mpconfigport_minimal.h: Clearly mark where user-define config ends.
TODO: Do the same for other config files.
2016-06-16 01:20:32 +03:00
Paul Sokolovsky
cd796f85af unix: Unbreak "minimal" target by disabling FatFs.
Was broken since introduction of FatFs support.
2016-06-16 00:03:24 +03:00
Paul Sokolovsky
0f5bf1aafe py/mpconfig.h: MP_NOINLINE is universally useful, move from unix port. 2016-06-15 23:52:00 +03:00
Robert HH
ee009d713a extmod/vfs_fat.c: Add vfs.stat().
The call to stat() returns a 10 element tuple consistent to the os.stat()
call. At the moment, the only relevant information returned are file
type and file size.
2016-05-31 13:03:12 +03:00
Paul Sokolovsky
4889b6ff9b unix/Makefile: "make axtls": Automatically fetch submodules if missing.
Try to emulate "you can build without reading instructions" behavior as far
as possible.
2016-05-28 21:03:48 +03:00
Paul Sokolovsky
6055d411a9 unix/mpconfigport.mk: Document MICROPY_STANDALONE make-level option.
Avoid using system libraries, use copies bundled with MicroPython as
submodules (currently affects only libffi, other dependencies either
already used as bundled-only (axtls), or can't be bundled (so far),
like libjni).
2016-05-28 20:38:14 +03:00
Paul Sokolovsky
f5d63bcd23 unix: Enable "ussl" module.
ussl was in testing mode for 8 months, and now enabled in other ports
(e.g. esp8266), so time for unix port to catch up.
2016-05-26 02:12:11 +03:00
Paul Sokolovsky
37f9761801 unix/Makefile: nanbox build is not compatible with modussl, disable. 2016-05-26 02:11:17 +03:00
Damien George
2133924e46 unix: Support frozen packages.
To use, put your directory structure with .py files in frozen/ and then:

    make FROZEN_MPY_DIR=frozen
2016-05-23 15:19:53 +01:00
Paul Sokolovsky
1b5abfcaae py/objstr: Implement str.center().
Disabled by default, enabled in unix port. Need for this method easily
pops up when working with text UI/reporting, and coding workalike
manually again and again counter-productive.
2016-05-22 00:13:44 +03:00
Paul Sokolovsky
b580958216 unix/unix_mphal: Implement mp_hal_ticks_us().
Similar to existing mp_hal_ticks_ms().
2016-05-21 02:16:35 +03:00
Paul Sokolovsky
92a342a011 unix/mpconfigport_coverage.h: Add dedicated config file for coverage build.
This allows to enable the options which aren't enabled in the normal unix
config (as unix port is no longer an enable-all port).
2016-05-18 00:58:32 +03:00
Damien George
1e024de7be unix: Add ability to include frozen bytecode in the build.
To use frozen bytecode make a subdirectory under the unix/ directory
(eg frozen/), put .py files there, then run:

    make FROZEN_MPY_DIR=frozen

Be sure to build from scratch.  The .py files will then be available for
importing.
2016-05-16 23:17:11 +01:00
Damien George
088127d91c unix: Enable uerrno module. 2016-05-10 23:30:39 +01:00
Pavol Rusnak
bc7ca7ca01 unix/mphalport: Add mp_hal_delay_us() for consistency with other ports. 2016-05-07 21:18:44 +03:00
Martin Müller
31fc81d3b8 unix/Makefile: Make install more compatible (BSD, etc.).
The current install command uses the flag -D which is specific to the
install command from GNU coreutils, but isn't available for the BSD
version. This solution uses the -d flag which should be commonly
available to create the target directory. Afterwards the target files
are installed to this directory seperately.
2016-04-28 21:45:27 +03:00
Paul Sokolovsky
270dd29320 unix: Make sure build dir exists before accessing it for freezing upip. 2016-04-19 11:41:40 +03:00
Jan Čapek
d76c65f599 py: Add rules for automated extraction of qstrs from sources.
- add template rule that converts a specified source file into a qstring file

- add special rule for generating a central header that contains all
  extracted/autogenerated strings - defined by QSTR_DEFS_COLLECTED
  variable. Each platform appends a list of sources that may contain
  qstrings into a new build variable: SRC_QSTR. Any autogenerated
  prerequisities are should be appened to SRC_QSTR_AUTO_DEPS variable.

- remove most qstrings from py/qstrdefs, keep only qstrings that
  contain special characters - these cannot be easily detected in the
  sources without additional annotations

- remove most manual qstrdefs, use qstrdef autogen for: py, cc3200,
  stmhal, teensy, unix, windows, pic16bit:

   - remove all micropython generic qstrdefs except for the special strings that contain special characters (e.g. /,+,<,> etc.)
   - remove all port specific qstrdefs except for special strings
   - append sources for qstr generation in platform makefiles (SRC_QSTR)
2016-04-16 13:18:09 +01:00
Paul Sokolovsky
9b0714b24c py: Declare help, input, open builtins in core.
These are *defined* per-port, but why redeclare them again and again.
2016-04-15 00:07:56 +03: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
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
Paul Sokolovsky
1a327c4fa3 unix: Build with MICROPY_PY_UHASHLIB_SHA1 if already building with axTLS. 2016-04-11 21:58:58 +03:00
pohmelie
b32b0d38fe unix: freedos strip and size names for binaries
After this you need only one path for build (path/to/djgpp/bin). Original patch made by @dhylands
2016-04-08 20:15:37 +03:00
Paul Sokolovsky
1b811b946e unix/modsocket: Use mp_const_empty_map instead of creating empty map. 2016-04-04 23:43:16 +03:00
pohmelie
cee888255b unix: djgpp errno.h have no ENOTSUP, so define it to Linux value. 2016-04-03 23:23:01 +03:00