From 88bbe425db449c1648406a58896194cff36c386b Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 9 Apr 2018 13:31:44 -0500 Subject: [PATCH 1/4] Create genhdr/ directory in time --- ports/atmel-samd/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/atmel-samd/Makefile b/ports/atmel-samd/Makefile index 99c6231c88..d675e6f2d6 100644 --- a/ports/atmel-samd/Makefile +++ b/ports/atmel-samd/Makefile @@ -388,7 +388,7 @@ $(BUILD)/autogen_usb_descriptor.c $(BUILD)/genhdr/autogen_usb_descriptor.h: auto .INTERMEDIATE: autogen_usb_descriptor.intermediate autogen_usb_descriptor.intermediate: tools/gen_usb_descriptor.py Makefile - install -d $(BUILD) + install -d $(BUILD)/genhdr python3 tools/gen_usb_descriptor.py \ --manufacturer $(USB_MANUFACTURER)\ --product $(USB_PRODUCT)\ From 619b0ec1646eef0b7de5ef5c30c0b5a576b484fc Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Mon, 9 Apr 2018 15:58:33 -0700 Subject: [PATCH 2/4] Fix rom qstr pool length. --- tools/analyze_heap_dump.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tools/analyze_heap_dump.py b/tools/analyze_heap_dump.py index d5da884e48..55342ac693 100644 --- a/tools/analyze_heap_dump.py +++ b/tools/analyze_heap_dump.py @@ -56,8 +56,6 @@ SKIP_SYMBOLS = [".debug_ranges", ".debug_frame", ".debug_loc", ".comment", ".deb help="Draw the heap layout") @click.option("--draw-heap-ownership/--no-draw-heap-ownership", default=False, help="Draw the ownership graph of blocks on the heap") -@click.option("--draw-heap-ownership/--no-draw-heap-ownership", default=False, - help="Draw the ownership graph of blocks on the heap") @click.option("--analyze-snapshots", default="last", type=click.Choice(['all', 'last'])) def do_all_the_things(ram_filename, bin_filename, map_filename, print_block_contents, print_unknown_types, print_block_state, print_conflicting_symbols, @@ -352,7 +350,7 @@ def do_all_the_things(ram_filename, bin_filename, map_filename, print_block_cont else: rom_offset = pool_ptr - rom_start prev, total_prev_len, alloc, length = struct.unpack_from("= total_prev_len: offset = (qstr_index - total_prev_len) * 4 + 16 From 7dd1d6afcc16342fecc70f667ff8ba13b0ad4372 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Mon, 9 Apr 2018 15:57:16 -0700 Subject: [PATCH 3/4] Prevent a heap pointer from living on the stack longer than we need. --- lib/utils/pyexec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/utils/pyexec.c b/lib/utils/pyexec.c index f96deb9e1c..718c6828cc 100644 --- a/lib/utils/pyexec.c +++ b/lib/utils/pyexec.c @@ -90,6 +90,8 @@ STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input qstr source_name = lex->source_name; mp_parse_tree_t parse_tree = mp_parse(lex, input_kind); module_fun = mp_compile(&parse_tree, source_name, MP_EMIT_OPT_NONE, exec_flags & EXEC_FLAG_IS_REPL); + // Clear the parse tree because it has a heap pointer we don't need anymore. + *((uint32_t volatile*) &parse_tree.chunk) = 0; #else mp_raise_msg(&mp_type_RuntimeError, "script compilation not supported"); #endif From c5d2a0da0404468637553aa17430bab2b75ac0f7 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 9 Apr 2018 21:17:26 -0500 Subject: [PATCH 4/4] esp8266: Disable "strict aliasing" in compiler like in atmel-samd This caused a fatal compiler diagnostic after #750. This compiler flag is already specified in the atmel-samd builds, so it makes sense to do it here for the same reasons. --- ports/esp8266/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/esp8266/Makefile b/ports/esp8266/Makefile index 4a598b6291..06439a19ea 100644 --- a/ports/esp8266/Makefile +++ b/ports/esp8266/Makefile @@ -48,7 +48,7 @@ CFLAGS_XTENSA = -fsingle-precision-constant -Wdouble-promotion \ -Wl,-EL -mlongcalls -mtext-section-literals -mforce-l32 \ -DLWIP_OPEN_SRC -CFLAGS = $(INC) -Wall -Wpointer-arith -Werror -std=gnu99 -nostdlib -DUART_OS=$(UART_OS) \ +CFLAGS = $(INC) -Wall -Wpointer-arith -Werror -Wno-strict-aliasing -std=gnu99 -nostdlib -DUART_OS=$(UART_OS) \ $(CFLAGS_XTENSA) $(CFLAGS_MOD) $(COPT) $(CFLAGS_EXTRA) LDSCRIPT = esp8266.ld