Refine interpreter to improve performance, refine memory usage (#161)
This commit is contained in:
@ -109,3 +109,6 @@ https://docs.zephyrproject.org/latest/getting_started/index.html</br>
|
||||
First, connect PC and STM32 with UART. Then install to use host_tool.</br>
|
||||
`./host_tool -D /dev/ttyUSBXXX -i ui_app -f ui_app.wasm`
|
||||
|
||||
- Install AOT version WASM application
|
||||
`wamrc --target=thumbv7 --target-abi=eabi --cpu=cortex-m7 -o ui_app.aot ui_app.wasm`
|
||||
`./host_tool -D /dev/ttyUSBXXX -i ui_app -f ui_app.aot`
|
||||
|
||||
@ -25,4 +25,5 @@ all:
|
||||
-Wl,--no-threads,--strip-all,--no-entry -nostdlib \
|
||||
-Wl,--export=on_init -Wl,--export=on_timer_callback \
|
||||
-Wl,--export=on_widget_event \
|
||||
-Wl,--export=__heap_base,--export=__data_end \
|
||||
-o ui_app_lvgl_compatible.wasm
|
||||
|
||||
@ -10,11 +10,11 @@ include_directories(
|
||||
)
|
||||
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS},-L${WAMR_ROOT_DIR}/wamr-sdk/out/gui/app-sdk/wamr-app-framework/lib")
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS},--export=on_init,--export=on_timer_callback,--export=on_widget_event")
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS},--export=on_init,--export=on_timer_callback,--export=on_widget_event,--export=__heap_base,--export=__data_end")
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -Wno-unused-command-line-argument")
|
||||
|
||||
add_executable(ui_app.wasm
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/main.c
|
||||
)
|
||||
|
||||
target_link_libraries(ui_app.wasm app_framework)
|
||||
target_link_libraries(ui_app.wasm app_framework)
|
||||
|
||||
@ -30,4 +30,5 @@ all:
|
||||
-Wl,--no-threads,--strip-all,--no-entry -nostdlib \
|
||||
-Wl,--export=on_init -Wl,--export=on_timer_callback \
|
||||
-Wl,--export=on_widget_event \
|
||||
-Wl,--export=__heap_base,--export=__data_end \
|
||||
-o ui_app.wasm
|
||||
|
||||
@ -14,7 +14,7 @@ enable_language (ASM)
|
||||
# change to "ARM[sub]", "THUMB[sub]", "X86_32", "MIPS" or "XTENSA"
|
||||
# if we want to support arm_32, x86, mips or xtensa
|
||||
if (NOT DEFINED WAMR_BUILD_TARGET)
|
||||
set (WAMR_BUILD_TARGET "THUMB")
|
||||
set (WAMR_BUILD_TARGET "THUMBV7")
|
||||
endif ()
|
||||
|
||||
|
||||
@ -24,8 +24,7 @@ if (NOT DEFINED WAMR_BUILD_INTERP)
|
||||
endif ()
|
||||
|
||||
if (NOT DEFINED WAMR_BUILD_AOT)
|
||||
# Disable AOT by default.
|
||||
set (WAMR_BUILD_AOT 0)
|
||||
set (WAMR_BUILD_AOT 1)
|
||||
endif ()
|
||||
|
||||
if (NOT DEFINED WAMR_BUILD_JIT)
|
||||
|
||||
@ -7,3 +7,4 @@ CONFIG_LOG=y
|
||||
CONFIG_UART_INTERRUPT_DRIVEN=y
|
||||
CONFIG_STACK_SENTINEL=y
|
||||
CONFIG_MAIN_STACK_SIZE=2048
|
||||
CONFIG_ARM_MPU=n
|
||||
|
||||
@ -84,12 +84,12 @@ https://docs.zephyrproject.org/latest/getting_started/index.html</br>
|
||||
` ln -s <wamr_root> wamr`</br>
|
||||
d. build source code</br>
|
||||
Since ui_app incorporated LittlevGL source code, so it needs more RAM on the device to install the application.
|
||||
It is recommended that RAM SIZE not less than 320KB.
|
||||
It is recommended that RAM SIZE not less than 420KB.
|
||||
In our test use nucleo_f767zi, which is not supported by Zephyr.
|
||||
However, nucleo_f767zi is almost the same as nucleo_f746zg, except FLASH and SRAM size.
|
||||
So we changed the DTS setting of nucleo_f746zg boards for a workaround.</br>
|
||||
|
||||
`Modify zephyr/dts/arm/st/f7/stm32f746.dtsi, change DT_SIZE_K(256) to DT_SIZE_K(320) in 'sram0' definition.`</br>
|
||||
`Modify zephyr/dts/arm/st/f7/stm32f746.dtsi, change DT_SIZE_K(256) to DT_SIZE_K(512) in 'sram0' definition.`</br>
|
||||
`mkdir build && cd build`</br>
|
||||
`source ../../../../zephyr-env.sh`</br>
|
||||
`cmake -GNinja -DBOARD=nucleo_f746zg ..`</br>
|
||||
@ -129,3 +129,6 @@ First, connect PC and STM32 with UART. Then install to use host_tool.</br>
|
||||
`./host_tool -D /dev/ttyUSBXXX -i ui_app -f ui_app_no_wasi.wasm`
|
||||
**Note**: WASI is unavailable on zephyr currently, so you have to use the ui_app_no_wasi.wasm which doesn't depend on WASI.
|
||||
|
||||
- Install AOT version WASM application
|
||||
`wamrc --target=thumbv7 --target-abi=eabi --cpu=cortex-m7 -o ui_app_no_wasi.aot ui_app_no_wasi.wasm`
|
||||
`./host_tool -D /dev/ttyUSBXXX -i ui_app -f ui_app_no_wasi.aot`
|
||||
|
||||
@ -74,7 +74,7 @@ host_interface interface = {
|
||||
|
||||
timer_ctx_t timer_ctx;
|
||||
|
||||
static char global_heap_buf[270 * 1024] = { 0 };
|
||||
static char global_heap_buf[370 * 1024] = { 0 };
|
||||
|
||||
extern void display_init(void);
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ enable_language (ASM)
|
||||
# change to "ARM[sub]", "THUMB[sub]", "X86_32", "MIPS_32" or "XTENSA_32"
|
||||
# if we want to support arm_32, x86, mips or xtensa
|
||||
if (NOT DEFINED WAMR_BUILD_TARGET)
|
||||
set (WAMR_BUILD_TARGET "THUMB")
|
||||
set (WAMR_BUILD_TARGET "THUMBV7")
|
||||
endif ()
|
||||
|
||||
if (NOT DEFINED WAMR_BUILD_INTERP)
|
||||
@ -23,8 +23,7 @@ if (NOT DEFINED WAMR_BUILD_INTERP)
|
||||
endif ()
|
||||
|
||||
if (NOT DEFINED WAMR_BUILD_AOT)
|
||||
# Disable AOT by default.
|
||||
set (WAMR_BUILD_AOT 0)
|
||||
set (WAMR_BUILD_AOT 1)
|
||||
endif ()
|
||||
|
||||
if (NOT DEFINED WAMR_BUILD_JIT)
|
||||
|
||||
@ -7,3 +7,4 @@ CONFIG_LOG=y
|
||||
CONFIG_UART_INTERRUPT_DRIVEN=y
|
||||
CONFIG_STACK_SENTINEL=y
|
||||
CONFIG_MAIN_STACK_SIZE=2048
|
||||
CONFIG_ARM_MPU=n
|
||||
|
||||
@ -52,4 +52,5 @@ all:
|
||||
-Wl,--allow-undefined \
|
||||
-Wl,--no-threads,--strip-all,--no-entry \
|
||||
-Wl,--export=on_init -Wl,--export=on_timer_callback \
|
||||
-Wl,--export=__heap_base,--export=__data_end \
|
||||
-o ui_app.wasm
|
||||
|
||||
Reference in New Issue
Block a user