Skip to content

Commit aba12ca

Browse files
Build debug information alongside non-debug builds.
We should then be able to use it in Chrome's Wasm/DWARF debug tooling to understand production issues. This results in a 12% size increase. Win ~2% back by minifying the JavaScript.
1 parent 4f26d7b commit aba12ca

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ build:
99
dist: build
1010
mkdir -p $(BUILD)/build
1111
cp -r $(SRC)/*.html $(SRC)/term.js src/examples $(BUILD)
12-
cp $(SRC)/build/firmware.js $(SRC)/build/simulator.js $(SRC)/build/firmware.wasm $(BUILD)/build/
12+
cp $(SRC)/build/firmware.js $(SRC)/build/simulator.js $(SRC)/build/*.wasm $(BUILD)/build/
1313

1414
watch: dist
1515
fswatch -o -e src/build src | while read _; do $(MAKE) dist; done

src/Makefile

+5-2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ COPT += -O3
4141
CFLAGS += -g
4242
else
4343
COPT += -O3 -DNDEBUG
44+
CFLAGS += -gseparate-dwarf
4445
endif
4546

4647
JSFLAGS += -s ASYNCIFY
@@ -52,6 +53,8 @@ JSFLAGS += -s EXPORTED_RUNTIME_METHODS="['ccall', 'cwrap']" --js-library jshal.j
5253

5354
ifdef DEBUG
5455
JSFLAGS += -g
56+
else
57+
JSFLAGS += -gseparate-dwarf
5558
endif
5659

5760
SRC_C += \
@@ -144,8 +147,8 @@ $(BUILD)/micropython.js: $(OBJ) jshal.js simulator-js
144147
$(Q)emcc $(LDFLAGS) -o $(BUILD)/firmware.js $(OBJ) $(JSFLAGS)
145148

146149
simulator-js:
147-
npx esbuild ./simulator.ts --bundle --outfile=$(BUILD)/simulator.js --loader:.svg=text
150+
npx esbuild ./simulator.ts --sourcemap --minify --bundle --outfile=$(BUILD)/simulator.js --loader:.svg=text --target=es2020
148151

149152
include $(TOP)/py/mkrules.mk
150153

151-
.PHONY: simulator-js
154+
.PHONY: simulator-js

0 commit comments

Comments
 (0)