javascript: Fix Emscripten async load, and to compile with modern clang.
parent
7d675f3a17
commit
ea2fcdd338
|
@ -14,7 +14,12 @@ INC += -I$(TOP)
|
|||
INC += -I$(BUILD)
|
||||
|
||||
CPP = clang -E
|
||||
CFLAGS = -m32 $(INC) -Wall -Werror -std=c99 $(COPT)
|
||||
|
||||
ifdef EMSCRIPTEN
|
||||
CPP += -isystem $(EMSCRIPTEN)/system/include/libc -cxx-isystem $(EMSCRIPTEN)/system/include/libcxx
|
||||
endif
|
||||
|
||||
CFLAGS = -m32 -Wall -Werror $(INC) -std=c99 $(COPT)
|
||||
LDFLAGS = -m32 -Wl,-Map=$@.map,--cref -Wl,--gc-sections
|
||||
|
||||
CFLAGS += -O0 -DNDEBUG
|
||||
|
@ -46,8 +51,7 @@ all: $(BUILD)/micropython.js
|
|||
$(BUILD)/micropython.js: $(OBJ) library.js wrapper.js
|
||||
$(ECHO) "LINK $(BUILD)/firmware.js"
|
||||
$(Q)emcc $(LDFLAGS) -o $(BUILD)/firmware.js $(OBJ) $(JSFLAGS)
|
||||
cat $(BUILD)/firmware.js > $@
|
||||
cat wrapper.js >> $@
|
||||
cat wrapper.js $(BUILD)/firmware.js > $@
|
||||
|
||||
min: $(BUILD)/micropython.js
|
||||
uglifyjs $< -c -o $(BUILD)/micropython.min.js
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include "library.h"
|
||||
#include "mphalport.h"
|
||||
|
||||
void mp_hal_stdout_tx_strn(const char *str, mp_uint_t len) {
|
||||
void mp_hal_stdout_tx_strn(const char *str, size_t len) {
|
||||
mp_js_write(str, len);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "lib/utils/interrupt_char.h"
|
||||
|
||||
#define mp_hal_stdin_rx_chr() (0)
|
||||
void mp_hal_stdout_tx_strn(const char *str, mp_uint_t len);
|
||||
void mp_hal_stdout_tx_strn(const char *str, size_t len);
|
||||
|
||||
void mp_hal_delay_ms(mp_uint_t ms);
|
||||
void mp_hal_delay_us(mp_uint_t us);
|
||||
|
|
|
@ -24,12 +24,16 @@
|
|||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
var Module = {};
|
||||
|
||||
var mainProgram = function()
|
||||
{
|
||||
mp_js_init = Module.cwrap('mp_js_init', 'null', ['number']);
|
||||
mp_js_do_str = Module.cwrap('mp_js_do_str', 'null', ['string']);
|
||||
mp_js_init_repl = Module.cwrap('mp_js_init_repl', 'null', ['null']);
|
||||
mp_js_process_char = Module.cwrap('mp_js_process_char', 'number', ['number']);
|
||||
|
||||
var MP_JS_EPOCH = (new Date()).getTime();
|
||||
MP_JS_EPOCH = (new Date()).getTime();
|
||||
|
||||
if (typeof window === 'undefined' && require.main === module) {
|
||||
var fs = require('fs');
|
||||
|
@ -68,3 +72,6 @@ if (typeof window === 'undefined' && require.main === module) {
|
|||
mp_js_do_str(contents);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Module["onRuntimeInitialized"] = mainProgram;
|
Loading…
Reference in New Issue