change compilation verbosity options; fix mpy-cross

This commit is contained in:
Dan Halbert 2023-08-12 11:08:59 -04:00
parent 8a89a3d425
commit 1b19ed4c39
7 changed files with 39 additions and 32 deletions

View File

@ -38,14 +38,15 @@
#endif
#endif
#define MICROPY_EMIT_X64 (1)
#define MICROPY_EMIT_X86 (1)
#define MICROPY_EMIT_THUMB (1)
#define MICROPY_EMIT_INLINE_THUMB (1)
#define MICROPY_EMIT_ARM (1)
#define MICROPY_EMIT_XTENSA (1)
#define MICROPY_EMIT_INLINE_XTENSA (1)
#define MICROPY_EMIT_XTENSAWIN (1)
//CIRCUITPY: native emitters not supported
#define MICROPY_EMIT_X64 (!CIRCUITPY)
#define MICROPY_EMIT_X86 (!CIRCUITPY)
#define MICROPY_EMIT_THUMB (!CIRCUITPY)
#define MICROPY_EMIT_INLINE_THUMB (!CIRCUITPY)
#define MICROPY_EMIT_ARM (!CIRCUITPY)
#define MICROPY_EMIT_XTENSA (!CIRCUITPY)
#define MICROPY_EMIT_INLINE_XTENSA (!CIRCUITPY)
#define MICROPY_EMIT_XTENSAWIN (!CIRCUITPY)
#define MICROPY_DYNAMIC_COMPILER (1)
#define MICROPY_COMP_CONST_FOLDING (1)

View File

@ -60,6 +60,8 @@ ifdef STATIC_BUILD
LDFLAGS += -static -static-libgcc -static-libstdc++
endif
CFLAGS += -DCIRCUITPY=1
# source files
SRC_C += \
main.c \

View File

@ -74,7 +74,7 @@ static inline bool emit_inline_thumb_allow_float(emit_inline_asm_t *emit) {
#endif
STATIC void emit_inline_thumb_error_msg(emit_inline_asm_t *emit, mp_rom_error_text_t msg) {
STATIC void emit_inline_thumb_error_msg(emit_inline_asm_t *emit, const compressed_string_t *msg) {
*emit->error_slot = mp_obj_new_exception_msg(&mp_type_SyntaxError, msg);
}

View File

@ -13,29 +13,31 @@ THIS_MAKEFILE := $(lastword $(MAKEFILE_LIST))
TOP := $(patsubst %/py/mkenv.mk,%,$(THIS_MAKEFILE))
# Turn on increased build verbosity by defining BUILD_VERBOSE in your main
# Makefile or in your environment. You can also use V=1 on the make command
# line.
# Makefile or in your environment. You can also use V="steps commands rules" or any combination thereof
# on the make command line.
ifeq ("$(origin V)", "command line")
BUILD_VERBOSE=$(V)
endif
ifndef BUILD_VERBOSE
$(info Use make V={1,2,3} or set BUILD_VERBOSE similarly in your environment to increase build verbosity.)
BUILD_VERBOSE = 0
endif
ifeq ($(BUILD_VERBOSE),0)
Q = @
STEPECHO = @:
else ifeq ($(BUILD_VERBOSE),1)
Q = @
STEPECHO = @echo
else
# BUILD_VERBOSE not 0 or 1
Q =
STEPECHO = @echo
$(info - Verbosity options: any combination of "steps commands rules", as `make V=...` or env var BUILD_VERBOSE)
BUILD_VERBOSE = ""
endif
ifeq ($(BUILD_VERBOSE),3)
ifneq ($(filter steps,$(BUILD_VERBOSE)),)
STEPECHO = @echo
else
STEPECHO = @:
endif
ifneq ($(filter commands,$(BUILD_VERBOSE)),)
Q =
else
Q = @
endif
ifneq ($(filter rules,$(BUILD_VERBOSE)),)
# This clever shell redefinition will print out the makefile line that is causing an action.
# Note that -j can cause the order to be confusing.
# https://www.cmcrossroads.com/article/tracing-rule-execution-gnu-make

View File

@ -75,7 +75,8 @@ $(Q)$(CXX) $(CXXFLAGS) -c -MD -o $@ $<
$(RM) -f $(@:.o=.d)
endef
vpath %.c . $(TOP) $(USER_C_MODULES) $(DEVICES_MODULES)
# frozen.c and frozen_mpy.c are created in $(BUILD), so add it to the vpath as well.
vpath %.c . $(TOP) $(USER_C_MODULES) $(DEVICES_MODULES) $(BUILD)
$(BUILD)/%.o: %.c
$(call compile_c)
@ -84,7 +85,7 @@ $(BUILD)/%.o: %.cpp
$(call compile_cxx)
$(BUILD)/%.pp: %.c
$(ECHO) "PreProcess $<"
$(STEPECHO) "PreProcess $<"
$(Q)$(CPP) $(CFLAGS) -Wp,-C,-dD,-dI -o $@ $<
# The following rule uses | to create an order only prerequisite. Order only
@ -108,12 +109,12 @@ $(HEADER_BUILD)/qstr.i.last: $(SRC_QSTR) $(QSTR_GLOBAL_DEPENDENCIES) | $(QSTR_GL
$(Q)$(PYTHON) $(PY_SRC)/makeqstrdefs.py pp $(CPP) output $(HEADER_BUILD)/qstr.i.last cflags $(QSTR_GEN_CFLAGS) cxxflags $(QSTR_GEN_CXXFLAGS) sources $^ dependencies $(QSTR_GLOBAL_DEPENDENCIES) changed_sources $?
$(HEADER_BUILD)/qstr.split: $(HEADER_BUILD)/qstr.i.last
$(ECHO) "GEN $@"
$(STEPECHO) "GEN $@"
$(Q)$(PYTHON) $(PY_SRC)/makeqstrdefs.py split qstr $< $(HEADER_BUILD)/qstr _
$(Q)$(TOUCH) $@
$(QSTR_DEFS_COLLECTED): $(HEADER_BUILD)/qstr.split
$(ECHO) "GEN $@"
$(STEPECHO) "GEN $@"
$(Q)$(PYTHON) $(PY_SRC)/makeqstrdefs.py cat qstr _ $(HEADER_BUILD)/qstr $@
# Module definitions via MP_REGISTER_MODULE.

View File

@ -55,8 +55,8 @@ typedef struct _mp_obj_gen_instance_t {
// mp_const_none: Not-running, no exception.
// MP_OBJ_NULL: Running, no exception.
// other: Not running, pending exception.
mp_obj_t pend_exc;
bool coroutine_generator;
mp_obj_t pend_exc;
mp_code_state_t code_state;
} mp_obj_gen_instance_t;
@ -126,7 +126,6 @@ STATIC mp_obj_t native_gen_wrap_call(mp_obj_t self_in, size_t n_args, size_t n_k
mp_obj_gen_instance_native_t *o = mp_obj_malloc_var(mp_obj_gen_instance_native_t, byte, n_state * sizeof(mp_obj_t), &mp_type_gen_instance);
// Parse the input arguments and set up the code state
o->coroutine_generator = self->coroutine_generator;
o->pend_exc = mp_const_none;
o->code_state.fun_bc = self_fun;
o->code_state.ip = prelude_ptr;

View File

@ -259,6 +259,8 @@ $(HEADER_BUILD)/$(TRANSLATION).mo: $(TOP)/locale/$(TRANSLATION).po | $(HEADER_BU
# translations-*.c is generated as a side-effect of building compressed_translations.generated.h
# Specifying both in a single rule actually causes the rule to be run twice!
# This alternative makes it run just once.
# Another alternative is "grouped targets" (`a b &: c`), available in GNU make 4.3 and later.
# TODO: use grouped targets when we expect GNU make >= 4.3 is pervasive.
$(PY_BUILD)/translations-$(TRANSLATION).c: $(HEADER_BUILD)/compressed_translations.generated.h
@true
@ -271,7 +273,7 @@ PY_CORE_O += $(PY_BUILD)/translations-$(TRANSLATION).o
# build a list of registered modules for py/objmodule.c.
$(HEADER_BUILD)/moduledefs.h: $(HEADER_BUILD)/moduledefs.collected
@$(ECHO) "GEN $@"
@$(STEPECHO) "GEN $@"
$(Q)$(PYTHON) $(PY_SRC)/makemoduledefs.py $< > $@
# Standard C functions like memset need to be compiled with special flags so