diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index 89f9ac21f..4e6ff53c3 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -140,7 +140,7 @@ jobs: steps: - uses: numworks/setup-emscripten@v1 with: - sdk: 1.40.1-fastcomp + sdk: 1.40.1 - uses: actions/checkout@v2 with: submodules: 'recursive' diff --git a/build/toolchain.emscripten.mak b/build/toolchain.emscripten.mak index aa85bed50..14baf3a8f 100644 --- a/build/toolchain.emscripten.mak +++ b/build/toolchain.emscripten.mak @@ -26,4 +26,4 @@ EMSCRIPTEN_MODULARIZE ?= 1 LDFLAGS += -s MODULARIZE=$(EMSCRIPTEN_MODULARIZE) -s 'EXPORT_NAME="Epsilon"' --memory-init-file 0 SFLAGS += $(EMFLAGS) -LDFLAGS += $(EMFLAGS) -Oz -s EXPORTED_FUNCTIONS='["_main", "_IonSimulatorKeyboardKeyDown", "_IonSimulatorKeyboardKeyUp", "_IonSimulatorEventsPushEvent", "_IonSoftwareVersion", "_IonPatchLevel", "_IonDisplayForceRefresh"]' -s EXTRA_EXPORTED_RUNTIME_METHODS='["UTF8ToString"]' +LDFLAGS += $(EMFLAGS) -Oz -s EXPORTED_FUNCTIONS='["_main", "_IonSimulatorKeyboardKeyDown", "_IonSimulatorKeyboardKeyUp", "_IonSimulatorEventsPushEvent", "_IonSoftwareVersion", "_IonPatchLevel", "_IonDisplayForceRefresh"]' -s EXPORTED_RUNTIME_METHODS='["UTF8ToString"]' diff --git a/ion/src/device/n0110/flash.ld b/ion/src/device/n0110/flash.ld index 74e631b6e..0ae0e5910 100644 --- a/ion/src/device/n0110/flash.ld +++ b/ion/src/device/n0110/flash.ld @@ -244,7 +244,7 @@ SECTIONS { *(.rodata._ZL12KDColorWhite*) *(.rodata._ZL10KDColorRed*) *(.rodata._ZL12KDColorBlack*) - *(.rodata._ZN4CodeL15BackgroundColorEd*) + *(.rodata._ZN4CodeL15BackgroundColorE*) *(.rodata._ZN3Ion6Device3SWD6ConfigL4PinsE) *(.rodata._ZN3Ion6Device7Display6ConfigL8FSMCPinsE) *(.rodata._ZZN3Ion6Device7Display9initPanelEvE11calibration) diff --git a/ion/src/simulator/external/sdl/src/video/emscripten/SDL_emscriptenevents.c b/ion/src/simulator/external/sdl/src/video/emscripten/SDL_emscriptenevents.c index 64a399bde..66328af32 100644 --- a/ion/src/simulator/external/sdl/src/video/emscripten/SDL_emscriptenevents.c +++ b/ion/src/simulator/external/sdl/src/video/emscripten/SDL_emscriptenevents.c @@ -587,24 +587,13 @@ Emscripten_HandleResize(int eventType, const EmscriptenUiEvent *uiEvent, void *u double w = window_data->window->w; double h = window_data->window->h; - if(window_data->external_size) { - emscripten_get_element_css_size(window_data->canvas_id, &w, &h); - } - - emscripten_set_canvas_element_size(window_data->canvas_id, w * window_data->pixel_ratio, h * window_data->pixel_ratio); - - /* set_canvas_size unsets this */ - if (!window_data->external_size && window_data->pixel_ratio != 1.0f) { - emscripten_set_element_css_size(window_data->canvas_id, w, h); - } - if (force) { /* force the event to trigger, so pixel ratio changes can be handled */ window_data->window->w = 0; window_data->window->h = 0; } - SDL_SendWindowEvent(window_data->window, SDL_WINDOWEVENT_RESIZED, w, h); + SDL_SendWindowEvent(window_data->window, SDL_WINDOWEVENT_RESIZED, 320, 240); } } diff --git a/ion/src/simulator/external/sdl/src/video/emscripten/SDL_emscriptenvideo.c b/ion/src/simulator/external/sdl/src/video/emscripten/SDL_emscriptenvideo.c index e20d7a985..ad9b33cbc 100644 --- a/ion/src/simulator/external/sdl/src/video/emscripten/SDL_emscriptenvideo.c +++ b/ion/src/simulator/external/sdl/src/video/emscripten/SDL_emscriptenvideo.c @@ -197,38 +197,12 @@ Emscripten_CreateWindow(_THIS, SDL_Window * window) } wdata->canvas_id = SDL_strdup("#canvas"); + wdata->pixel_ratio = 320 / 240; - if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { - wdata->pixel_ratio = emscripten_get_device_pixel_ratio(); - } else { - wdata->pixel_ratio = 1.0f; - } + window->w = 320; + window->h = 240; - scaled_w = SDL_floor(window->w * wdata->pixel_ratio); - scaled_h = SDL_floor(window->h * wdata->pixel_ratio); - - /* set a fake size to check if there is any CSS sizing the canvas */ - emscripten_set_canvas_element_size(wdata->canvas_id, 1, 1); - emscripten_get_element_css_size(wdata->canvas_id, &css_w, &css_h); - - wdata->external_size = SDL_floor(css_w) != 1 || SDL_floor(css_h) != 1; - - if ((window->flags & SDL_WINDOW_RESIZABLE) && wdata->external_size) { - /* external css has resized us */ - scaled_w = css_w * wdata->pixel_ratio; - scaled_h = css_h * wdata->pixel_ratio; - - SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, css_w, css_h); - } - emscripten_set_canvas_element_size(wdata->canvas_id, scaled_w, scaled_h); - - /* if the size is not being controlled by css, we need to scale down for hidpi */ - if (!wdata->external_size) { - if (wdata->pixel_ratio != 1.0f) { - /*scale canvas down*/ - emscripten_set_element_css_size(wdata->canvas_id, window->w, window->h); - } - } + emscripten_set_canvas_element_size(wdata->canvas_id, 320, 240); #if SDL_VIDEO_OPENGL_EGL if (window->flags & SDL_WINDOW_OPENGL) { diff --git a/python/port/mpconfigport.h b/python/port/mpconfigport.h index 5f58a24a6..38e98145a 100644 --- a/python/port/mpconfigport.h +++ b/python/port/mpconfigport.h @@ -5,7 +5,6 @@ /* MicroPython configuration options * We're not listing the default options as defined in mpconfig.h */ -#if __EMSCRIPTEN__ // Enable a PyStack where most objects are allocated instead of always using the heap /* This enables to allocate and free memory in a scope (thus, Python can call * Python) but also has the collateral effect of removing bugs regarding @@ -15,8 +14,7 @@ * collecting roots the transpiled C code is denied access to Javascript * variables that can store pointers to the Python heap. The pointed objects * are therefore erased prematurely. */ -#define MICROPY_ENABLE_PYSTACK (1) -#endif +#define MICROPY_ENABLE_PYSTACK (0) // Maximum length of a path in the filesystem #define MICROPY_ALLOC_PATH_MAX (32) diff --git a/python/port/port.cpp b/python/port/port.cpp index 76c707372..21c9645df 100644 --- a/python/port/port.cpp +++ b/python/port/port.cpp @@ -163,10 +163,6 @@ extern "C" { } void MicroPython::init(void * heapStart, void * heapEnd) { -#if __EMSCRIPTEN__ - static mp_obj_t pystack[1024]; - mp_pystack_init(pystack, &pystack[MP_ARRAY_SIZE(pystack)]); -#endif /* We delimit the stack part that will be used by Python. The stackTop is the * address of the first object that can be allocated on Python stack. This * boundaries are used: