mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[python] Update to MicroPython 1.9.4
This commit is contained in:
committed by
EmilieNumworks
parent
caff93cda0
commit
73250e727a
108
python/Makefile
108
python/Makefile
@@ -1,34 +1,14 @@
|
||||
SFLAGS += -Ipython/src
|
||||
SFLAGS += -Ipython/port
|
||||
|
||||
# Native code emition is actually not needed
|
||||
# It's only for the @micropython.native decorator
|
||||
# which, to be honest, we don't really need
|
||||
|
||||
#BUILD = python/build
|
||||
|
||||
# How to write this makefile
|
||||
# // Copy PY_O_BASENAME from py.mk and add those to objs
|
||||
# // Add special-case optimizations
|
||||
|
||||
|
||||
# We don't care about emitting multiple archs at once
|
||||
# so we'll just build one emitnative.o
|
||||
#emitnx64.o \
|
||||
emitnx86.o \
|
||||
emitnthumb.o \
|
||||
emitnarm.o \
|
||||
emitnxtensa.o \
|
||||
emitinlinextensa.o \
|
||||
|
||||
|
||||
|
||||
# FIXME: Use customized optimization level for some files
|
||||
|
||||
|
||||
# How to maintain this Makefile
|
||||
# - Copy PY_CORE_O_BASENAME from py.mk into py_objs
|
||||
# - Copy select PY_EXTMOD_O_BASENAME from py.mk into extmod_objs
|
||||
# - Edit special-case workarounds below as needed
|
||||
|
||||
py_objs = $(addprefix python/src/py/,\
|
||||
mpstate.o \
|
||||
nlr.o \
|
||||
nlrx86.o \
|
||||
nlrx64.o \
|
||||
nlrthumb.o \
|
||||
@@ -36,6 +16,7 @@ py_objs = $(addprefix python/src/py/,\
|
||||
nlrsetjmp.o \
|
||||
malloc.o \
|
||||
gc.o \
|
||||
pystack.o \
|
||||
qstr.o \
|
||||
vstr.o \
|
||||
mpprint.o \
|
||||
@@ -50,11 +31,17 @@ py_objs = $(addprefix python/src/py/,\
|
||||
emitbc.o \
|
||||
asmbase.o \
|
||||
asmx64.o \
|
||||
emitnx64.o \
|
||||
asmx86.o \
|
||||
emitnx86.o \
|
||||
asmthumb.o \
|
||||
emitnthumb.o \
|
||||
emitinlinethumb.o \
|
||||
asmarm.o \
|
||||
emitnarm.o \
|
||||
asmxtensa.o \
|
||||
emitnxtensa.o \
|
||||
emitinlinextensa.o \
|
||||
formatfloat.o \
|
||||
parsenumbase.o \
|
||||
parsenum.o \
|
||||
@@ -64,6 +51,7 @@ py_objs = $(addprefix python/src/py/,\
|
||||
runtime_utils.o \
|
||||
scheduler.o \
|
||||
nativeglue.o \
|
||||
stackctrl.o \
|
||||
argcheck.o \
|
||||
warning.o \
|
||||
map.o \
|
||||
@@ -75,6 +63,7 @@ py_objs = $(addprefix python/src/py/,\
|
||||
objcell.o \
|
||||
objclosure.o \
|
||||
objcomplex.o \
|
||||
objdeque.o \
|
||||
objdict.o \
|
||||
objenumerate.o \
|
||||
objexcept.o \
|
||||
@@ -127,58 +116,15 @@ py_objs = $(addprefix python/src/py/,\
|
||||
vm.o \
|
||||
bc.o \
|
||||
showbc.o \
|
||||
repl.o \
|
||||
smallint.o \
|
||||
frozenmod.o \
|
||||
)
|
||||
# repl.o \
|
||||
|
||||
py_objs += python/src/py/emitnative.o
|
||||
python/src/py/emitnative.o: CFLAGS += -DN_THUMB
|
||||
|
||||
|
||||
extmod_objs += $(addprefix python/src/extmod/,\
|
||||
modurandom.o \
|
||||
)
|
||||
|
||||
# In order to change the name of the micropython module 'urandom' to 'random'
|
||||
# (without altering micropython files), we redefined the macro MP_QSTR_urandom
|
||||
# by DMP_QSTR_random.
|
||||
python/src/py/objmodule.o: SFLAGS += -DMP_QSTR_urandom="MP_QSTR_random"
|
||||
python/src/extmod/modurandom.o: SFLAGS += -DMP_QSTR_urandom="MP_QSTR_random"
|
||||
|
||||
#extmod_objs += $(addprefix python/src/extmod/,\
|
||||
moductypes.o \
|
||||
modujson.o \
|
||||
modure.o \
|
||||
moduzlib.o \
|
||||
moduheapq.o \
|
||||
modutimeq.o \
|
||||
moduhashlib.o \
|
||||
modubinascii.o \
|
||||
virtpin.o \
|
||||
machine_mem.o \
|
||||
machine_pinbase.o \
|
||||
machine_signal.o \
|
||||
machine_pulse.o \
|
||||
machine_i2c.o \
|
||||
machine_spi.o \
|
||||
modussl_axtls.o \
|
||||
modussl_mbedtls.o \
|
||||
modurandom.o \
|
||||
moduselect.o \
|
||||
modwebsocket.o \
|
||||
modwebrepl.o \
|
||||
modframebuf.o \
|
||||
vfs.o \
|
||||
vfs_reader.o \
|
||||
vfs_fat.o \
|
||||
vfs_fat_diskio.o \
|
||||
vfs_fat_file.o \
|
||||
vfs_fat_misc.o \
|
||||
utime_mphal.o \
|
||||
uos_dupterm.o \
|
||||
)
|
||||
|
||||
port_objs += $(addprefix python/port/,\
|
||||
port.o \
|
||||
builtins.o\
|
||||
@@ -186,21 +132,35 @@ port_objs += $(addprefix python/port/,\
|
||||
modkandinsky.o \
|
||||
modkandinsky_impl.o \
|
||||
mphalport.o \
|
||||
stackctrl.o \
|
||||
)
|
||||
|
||||
# Reduce optimization for the emscripten platform.
|
||||
# With optimization, register and stack variables might be held in a JavaScript
|
||||
# local variable, which breaks garbage collection. Indeed, these JavaScript
|
||||
# Workarounds
|
||||
|
||||
# Rename urandom to random
|
||||
# In order to change the name of the micropython module 'urandom' to 'random'
|
||||
# (without altering micropython files), we redefined the macro MP_QSTR_urandom
|
||||
# by DMP_QSTR_random.
|
||||
python/src/py/objmodule.o: SFLAGS += -DMP_QSTR_urandom="MP_QSTR_random"
|
||||
python/src/extmod/modurandom.o: SFLAGS += -DMP_QSTR_urandom="MP_QSTR_random"
|
||||
|
||||
# Handle upward-growing stack
|
||||
# Some platforms such as emscripten have a stack that grows up. We've rewritten
|
||||
# the stack control file to handle this case.
|
||||
py_objs := $(filter-out python/src/py/stackctrl.o, $(py_objs))
|
||||
port_objs += python/port/stackctrl.o
|
||||
|
||||
# Fix the GC on emscripten
|
||||
# With optimizations, register and stack variables might be held in a JavaScript
|
||||
# local variables, which breaks garbage collection. Indeed, these JavaScript
|
||||
# variables cannot be marked as root during garbage collection, which means that
|
||||
# the heap objects they depend on will likely be destroyed. When the Python
|
||||
# computing resumes, if necessary heap objects have been destroyed, the Python
|
||||
# program crashes.
|
||||
|
||||
ifeq ($(PLATFORM),emscripten)
|
||||
$(py_objs): SFLAGS := $(subst -Os,-O0,$(SFLAGS))
|
||||
endif
|
||||
|
||||
|
||||
# QSTR generation
|
||||
|
||||
generated_headers += $(addprefix python/port/genhdr/, qstrdefs.generated.h)
|
||||
|
||||
Reference in New Issue
Block a user