Browse Source

Merge branch 'master' of github.com:micropython/micropython

pull/512/merge
Damien George 11 years ago
parent
commit
0ae21a81f7
  1. 4
      py/builtinimport.c
  2. 4
      py/nlrx86.S
  3. 4
      py/objfun.c
  4. 1
      unix/file.c
  5. 6
      unix/main.c
  6. 23
      windows/Makefile
  7. 10
      windows/README
  8. 4
      windows/mpconfigport.h
  9. 13
      windows/mpconfigport.mk

4
py/builtinimport.c

@ -3,6 +3,10 @@
#include <stdio.h>
#include <string.h>
#include <assert.h>
#ifdef __MINGW32__
// For alloca()
#include <malloc.h>
#endif
#include "nlr.h"
#include "misc.h"

4
py/nlrx86.S

@ -61,7 +61,11 @@ nlr_jump:
#endif
mov nlr_top, %edx # load nlr_top
test %edx, %edx # check for nlr_top being NULL
#ifdef _WIN32
je _nlr_jump_fail # fail if nlr_top is NULL
#else
je nlr_jump_fail # fail if nlr_top is NULL
#endif
mov 4(%esp), %eax # load return value
mov %eax, 4(%edx) # store return value
mov (%edx), %eax # load prev nlr_top

4
py/objfun.c

@ -2,6 +2,10 @@
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#ifdef __MINGW32__
// For alloca()
#include <malloc.h>
#endif
#include "nlr.h"
#include "misc.h"

1
unix/file.c

@ -1,3 +1,4 @@
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>

6
unix/main.c

@ -250,7 +250,9 @@ int usage(char **argv) {
mp_obj_t mem_info(void) {
printf("mem: total=%d, current=%d, peak=%d\n", m_get_total_bytes_allocated(), m_get_current_bytes_allocated(), m_get_peak_bytes_allocated());
#if MICROPY_ENABLE_GC
gc_dump_info();
#endif
return mp_const_none;
}
@ -392,7 +394,11 @@ int main(int argc, char **argv) {
return usage(argv);
}
} else {
#ifdef __MINGW32__
char *basedir = _fullpath(NULL, argv[a], _MAX_PATH);
#else
char *basedir = realpath(argv[a], NULL);
#endif
if (basedir == NULL) {
fprintf(stderr, "%s: can't open file '%s': [Errno %d] ", argv[0], argv[1], errno);
perror("");

23
windows/Makefile

@ -1,4 +1,5 @@
include ../py/mkenv.mk
-include mpconfigport.mk
# define main target
PROG = micropython.exe
@ -14,14 +15,15 @@ INC += -I$(PY_SRC)
INC += -I$(BUILD)
# compiler settings
CFLAGS = $(INC) -Wall -Werror -ansi -std=gnu99 -DUNIX
LDFLAGS = -lm
CFLAGS = $(INC) -Wall -Werror -ansi -std=gnu99 -DUNIX $(CFLAGS_MOD) $(COPT)
LDFLAGS = $(LDFLAGS_MOD) -lm
# Debugging/Optimization
ifdef DEBUG
CFLAGS += -O0 -g
CFLAGS += -g
COPT = -O0
else
CFLAGS += -Os #-DNDEBUG
COPT = -Os #-DNDEBUG
endif
# source files
@ -30,11 +32,16 @@ SRC_C = \
unix/file.c \
OBJ = $(PY_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
LIB = -lreadline
LIB += -lws2_32
LIB += -lmman
ifeq ($(MICROPY_USE_READLINE),1)
CFLAGS_MOD += -DMICROPY_USE_READLINE=1
LDFLAGS_MOD += -lreadline
# the following is needed for BSD
#LIB += -ltermcap
#LDFLAGS_MOD += -ltermcap
endif
LIB += -lws2_32
#LIB += -lmman
include ../py/mkrules.mk

10
windows/README

@ -0,0 +1,10 @@
This is experimental, community-supported Windows port of MicroPython.
It is based on Unix port, and expected to remain so.
To cross-compile under Debian/Ubuntu Linux system:
sudo apt-get install mingw32 mingw32-binutils mingw32-runtime
make CC=i586-mingw32msvc-gcc
The port requires additional testing, debugging, and patches. Please
consider to contribute.

4
windows/mpconfigport.h

@ -2,10 +2,10 @@
// Linking with GNU readline causes binary to be licensed under GPL
#ifndef MICROPY_USE_READLINE
#define MICROPY_USE_READLINE (1)
#define MICROPY_USE_READLINE (0)
#endif
#define MICROPY_EMIT_X64 (1)
#define MICROPY_EMIT_X64 (0)
#define MICROPY_EMIT_THUMB (0)
#define MICROPY_EMIT_INLINE_THUMB (0)
#define MICROPY_MEM_STATS (1)

13
windows/mpconfigport.mk

@ -0,0 +1,13 @@
# Enable/disable modules and 3rd-party libs to be included in interpreter
# Build 32-bit binaries on a 64-bit host
MICROPY_FORCE_32BIT = 0
# Linking with GNU readline causes binary to be licensed under GPL
MICROPY_USE_READLINE = 0
# Subset of CPython time module
MICROPY_MOD_TIME = 1
# ffi module requires libffi (libffi-dev Debian package)
MICROPY_MOD_FFI = 0
Loading…
Cancel
Save