Commit Graph

111 Commits

Author SHA1 Message Date
Paul Sokolovsky 1e06e81b3d windows: Propagate MICROPY_PY_OS_DUPTERM handling from unix port. 2015-12-28 01:30:58 +02:00
stijn 1aa4599ddd windows/msvc: Nicer handling of asserts and 'invalid' parameters
The default bahaviour for debug builds is to show dialog boxes for asserts
and invalid parameter handling. This is not so nice in general and causes
the Appveyor debug builds to hang because the io\file_seek.py test passes
a closed file descriptor to lseek. Disable this behaviour by printing
assert messages to the output instead of showing the dialog, and by
disabling 'invalid' parameter handling which causes the affected functions
to just return an error and set errno appropriately.
2015-12-26 22:14:16 +00:00
stijn a5aa03acaf windows: Better handling of Ctrl-C
This builds upon the changes made in 2195046365. Using signal() does not
produce reliable results so SetConsoleCtrlHandler is used, and the handler
is installed only once during initialization instead of removing it in
mp_hal_set_interrupt_char when it is not strictly needed anymore, since
removing it might lead to Ctrl-C events being missed because they are
fired on a seperate thread which might only become alive after the handler
was removed.
2015-12-21 20:51:27 +02:00
stijn da199e4407 windows: Add Appveyor CI builds for msvc port.
Appveyor is like Travis, but for Windows builds. The appveyor.yml configuration
will build the msvc port in all configuration/platform conbinations,
and run the tests for each of those.
2015-12-18 21:49:35 +00:00
stijn c5f52b845b msvc: Add dirent.h/.c implementation
This fixes the build after adding directory iteration in d874702
2015-12-18 22:10:51 +02:00
Paul Sokolovsky 2195046365 windows/windows_mphal: Add basic support for raising KeyboardInterrupt.
Compiles with mingw32, tested to work erratically under Wine due to
not fully implemented emulation in it.
2015-12-18 01:12:59 +02:00
Paul Sokolovsky 5efd3f0dca windows: Make keyboard_interrupt_obj available, it's standard feature. 2015-12-18 01:07:27 +02:00
stijn 951fc7e993 msvc: Use new modmachine infrastructure per changes in f925165 2015-12-15 00:13:21 +02:00
Dave Hylands f925165942 unix: Move modmachine into unix directory
This leaves behind the common functionality in extmod/machine_mem.c
which can be used by all ports.
2015-12-13 01:21:36 +02:00
Paul Sokolovsky a6eff059b9 unix: Rename "_os" module to "uos" for consistency with baremetal ports. 2015-12-12 00:04:35 +02:00
stijn 967ceba5b7 msvc: Use different output directories depending on build type
This allows multiple versions (e.g. Debug/Release, x86/x64) of micropython.exe
to co-exist instead and also solves potential problems where msbuild does not
completely rebuild the output and/or pdb files when switching between builds,
which in turn can cause linker errors in dependent projects.

By default exe/map/... files go in windows/build/$(Configuration)$(Platform)

After each build micropython.exe is still copied from the above directory to
the windows directory though, as that is consistent with the other ports and
the test runner by default uses that location as well.

Also rename env.props -> path.props which is a clearer name,
and add ample documentation in the affected build files.

(also see discussion in #1538)
2015-12-11 23:42:30 +02:00
stijn 3baf6b5319 windows/py: Support 64bit mingw-w64 builds
- add mp_int_t/mp_uint_t typedefs in mpconfigport.h
- fix integer suffixes/formatting in mpconfig.h and mpz.h
- use MICROPY_NLR_SETJMP=1 in Makefile since the current nlrx64.S
  implementation causes segfaults in gc_free()
- update README
2015-11-24 17:34:14 +02:00
stijn a58fa27c24 windows: Cleanup makefile
The BSD stuff is a copy from the unix makefile but at least there it
makes some sense, a windows makefile on BSD doesn't.
The -lmman flag is probably for mmap functions but there is no other build
support for it on windows so just that flag won't cut it anyway.
2015-11-24 17:34:14 +02:00
stijn 5be60d6929 windows: Define ssize_t and use renamed mphal header
This fixes the build after changes in [66fd3e4] and [3a6b3d2]
2015-11-14 02:06:55 +02:00
stijn b1dbbd32eb windows: Allow specifying the python executable to use for msvc builds
This defaults to 'python' but can be now overridden if needed
2015-11-10 17:37:09 +02:00
omtinez 1b9d161f94 Fix project file for Visual Studio 2015 2015-11-10 17:36:08 +02:00
stijn c76fe77f42 windows: Update build instructions in the README
- use correct 'mingw-w64' package name
- small grammar fixes
- modify Cygwin build instructions to use that same compiler as well: the
  original mingw is stuck at gcc v4.7 and does not seem to be updated anymore
- make it clear thet uPy also builds using Visual Studio versions > 2013
2015-11-02 23:23:09 +00:00
Paul Sokolovsky aeadf7607d windows/README: Deprecate mingw32, suggest using mingw64.
Ubuntu's mingw32 has gcc 4.2.1, which is rather old and has incorrect
non-initialized variable analysis which produces warnings, which
per MicroPython default settings get turned into errors.
2015-11-01 01:05:33 +03:00
Damien George 731f359292 all: Add py/mphal.h and use it in all ports.
py/mphal.h contains declarations for generic mp_hal_XXX functions, such
as stdio and delay/ticks, which ports should provide definitions for.  A
port will also provide mphalport.h with further HAL declarations.
2015-10-31 19:14:30 +03:00
stijn bd9f850e85 windows: Use write() instead of fwrite() to avoid out-of-order output.
This fixes the basics/exception_chain.py test, also see #1500 for more
info and [4300c7d] where the same change was done for the other ports.
2015-10-31 14:10:13 +03:00
omtinez 3510499a9e windows: Call _set_output_format() only on Visual Studio versions 2013 or lower.
Since VS2015, float formatting is C standard compliant by default:
https://msdn.microsoft.com/en-us/library/bb531344(v=vs.140).aspx
2015-10-30 11:37:58 +03:00
stijn f3e46d0c52 windows: Rename "time" module to "utime" for consistency with others. 2015-10-26 11:42:10 +00:00
stijn dc93f25bb8 windows: Erase pre-calc'd number of chars instead of clearing whole line. 2015-10-26 11:35:16 +00:00
stijn ca9eb81d0b windows: Add usleep() implementation for msvc port
Also make sleep.c self-contained by moving initialization code,
instead of having part of the code in init.c, and add a header file
to accomodate this.
msec_sleep() now uses the usleep() implementation as well.
2015-10-25 15:42:19 +03:00
stijn 1c55310bcc windows: Do not use wildcards when looking for sources in directories containing optional features
Fixes issues like #1532
2015-10-25 15:33:49 +03:00
Damien George f961456b29 lib/mp-readline: Add n_chars argument to mp_hal_erase_line_from_cursor.
If VT100 support is not available then a given implementation of
mp_hal_erase_line_from_cursor might need to know the number of characters
to erase.

This patch does not change generated code when VT100 is supported, since
compiler can optimise away the argument.
2015-10-20 13:27:14 +01:00
Paul Sokolovsky e0f5df579b all: Make netutils.h available to all ports by default.
Generally, ports should inherit INC from py.mk, append to it, not
overwrite it. TODO: Likely should do the same for other vars too.
2015-10-19 18:32:42 +03:00
stijn 941040e9e8 windows: Make mpconfigport.h up-to-date with the unix port 2015-09-23 07:10:00 -07:00
stijn dcbe936c50 windows/msvc: Exclude modjni from build. 2015-09-22 11:07:03 +01:00
stijn 3179d23cee windows: Make unistd.h more posix compatible
- add SEEK_XXX definitions, this fixes missing definition in py/stream.c
- move R_OK from realpath.c and add W_OK/F_OK defintions
- move STDXXX_FILENO definitions from mpconfigport for consistency
2015-08-14 12:04:23 +02:00
Paul Sokolovsky 9724a0538b windows/README: Add notes on running under Wine.
After enabling line editing support on Windows console, this is no longer
trivial.
2015-06-04 19:29:51 +03:00
stijn 87ad80edf9 windows: Implement the mp_hal_xxx functions and enable mp-readline 2015-06-04 19:22:13 +03:00
Damien George 4a10214be2 unix: Factor out stdio and ctrl-C code to unix_mphal.c file. 2015-05-27 15:52:35 +01:00
stijn 861670ba2a py: Implement mp_format_float for doubles and use where appropriate
This allows using (almost) the same code for printing floats everywhere,
removes the dependency on sprintf and uses just snprintf and
applies an msvc-specific fix for snprintf in a single place so
nan/inf are now printed correctly.
2015-05-17 21:47:11 +01:00
stijn a09757f104 windows: Enable some recently added features in mpconfigport.h 2015-05-13 16:26:16 +01:00
stijn a62c106974 msvc: Allow overriding of build options with custom file
- by default look for a user.props in the msvc directory, which is more convenient
  than the built-in way of looking for such file in the user's home directory
- make git ignore the file
2015-04-30 10:14:59 +02:00
Damien George 95f53461c2 py: Replace py-version.sh with makeversionhdr.py, written in Python.
Also rename py-version.h to mpversion.h for consistency with mpconfig.h.
2015-04-28 23:52:36 +01:00
stijn c52f1258a8 msvc: Update genhdr script to emit MicroPython version numbers 2015-04-22 12:07:30 +02:00
Damien George feff00e1a5 Add .gitattributes file to force text line endings to LF.
Some files are excluded, otherwise a whole lot of files need converting.
2015-04-16 22:23:56 +01:00
Damien George 7f9d1d6ab9 py: Overhaul and simplify printf/pfenv mechanism.
Previous to this patch the printing mechanism was a bit of a tangled
mess.  This patch attempts to consolidate printing into one interface.

All (non-debug) printing now uses the mp_print* family of functions,
mainly mp_printf.  All these functions take an mp_print_t structure as
their first argument, and this structure defines the printing backend
through the "print_strn" function of said structure.

Printing from the uPy core can reach the platform-defined print code via
two paths: either through mp_sys_stdout_obj (defined pert port) in
conjunction with mp_stream_write; or through the mp_plat_print structure
which uses the MP_PLAT_PRINT_STRN macro to define how string are printed
on the platform.  The former is only used when MICROPY_PY_IO is defined.

With this new scheme printing is generally more efficient (less layers
to go through, less arguments to pass), and, given an mp_print_t*
structure, one can call mp_print_str for efficiency instead of
mp_printf("%s", ...).  Code size is also reduced by around 200 bytes on
Thumb2 archs.
2015-04-16 14:30:16 +00:00
stijn 28fa84b445 py: Add optional support for descriptors' __get__ and __set__ methods.
Disabled by default.  Enabled on unix and windows ports.
2015-03-26 23:55:14 +00:00
Damien George 42e0c59308 py: Add MICROPY_COMP_{DOUBLE,TRIPLE}_TUPLE_ASSIGN config options.
These allow to fine-tune the compiler to select whether it optimises
tuple assignments of the form a, b = c, d and a, b, c = d, e, f.
Sensible defaults are provided.
2015-03-14 13:11:35 +00:00
Damien George d891452a73 py: Add MICROPY_MALLOC_USES_ALLOCATED_SIZE to allow simpler malloc API. 2015-03-03 21:23:13 +00:00
Damien George 5b76e3b75e windows: Enable MICROPY_STACK_CHECK. 2015-01-12 15:34:53 +00:00
Damien George ddd1e18801 py: Add config option MICROPY_COMP_MODULE_CONST for module consts.
Compiler optimises lookup of module.CONST when enabled (an existing
feature).  Disabled by default; enabled for unix, windows, stmhal.
Costs about 100 bytes ROM on stmhal.
2015-01-10 14:07:24 +00:00
Damien George a9a0862078 windows: Enable MICROPY_PY_MICROPYTHON_MEM_INFO. 2015-01-09 20:30:26 +00:00
stijn afd6c8e1d2 Remove obsolete bss-related code/build features
GC for unix/windows builds doesn't make use of the bss section anymore,
so we do not need the (sometimes complicated) build features and code related to it
2015-01-08 15:29:44 +01:00
stijn 51af362e31 msvc: Define no-op MP_LIKELY/UNLIKELY since there's no __builtin_expect 2015-01-04 13:29:02 +02:00
stijn ffc96a901a msvc: Use single build target for dealing with generated files
Remove some duplication in the code for generating
qstrdefs.generated.h and py-version.h
2015-01-02 16:55:02 +01:00
stijn 8dec62a1a4 msvc: Define main build/include directories in a single location
- Use a single file env.props for defining the main directories used when building.
  env.props resolves the base directory and defines overridable output directories,
  and is used by all other build files.
- Fix the build currently failing, basically because the preprocessing command for generating
  qstrdefs uses different include directories than the build itself does.
  (specifically, qstrdefs.h uses #include "py/mpconfig.h" since the fixes for #1022
  in 51dfcb4, so we need to use the base directory as include directory, not the py dir itself).
  So define a single variable containing the include directories instead and use it where needed.
2015-01-02 16:52:07 +01:00