Replies: 1 comment
-
i am trying to build wamrc with llvm_xtensa. then ./build_llvm_xtensa.sh then throw: [ 77%] Building C object CMakeFiles/aotclib.dir/home/leonardo/wasm-micro-runtime/core/iwasm/compilation/aot_llvm.c.o |
Beta Was this translation helpful? Give feedback.
-
I am trying with the mini-product example, i modified to load the .wasm or .aot from spiffs.
the .wasm file run ok, but the .aot file break the code. this is the monitor output:
Executing action: monitor
Running idf_monitor in directory /home/leonardo/Espressif-IDE/workspace/wamr-hello
Executing "/home/leonardo/.espressif/python_env/idf4.4_py3.8_env/bin/python /home/leonardo/esp/esp-idf/tools/idf_monitor.py -p /dev/ttyUSB0 -b 115200 --toolchain-prefix xtensa-esp32s2-elf- --target esp32c3 --decode-panic backtrace --print_filter /home/leonardo/Espressif-IDE/workspace/wamr-hello/build/wamr-hello.elf -m '/home/leonardo/.espressif/python_env/idf4.4_py3.8_env/bin/python' '/home/leonardo/esp/esp-idf/tools/idf.py'"...
--- idf_monitor on /dev/ttyUSB0 115200 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
�ESP-ROM:esp32c3-api1-20210207
Build:Feb 7 2021
rst:0x1 (POWERON),boot:0xc (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:2
load:0x3fcd6100,len:0x1730
load:0x403ce000,len:0x8e0
load:0x403d0000,len:0x2a14
entry 0x403ce000
I (30) boot: ESP-IDF v4.4-dev-3042-g220590d599-dirty 2nd stage bootloader
I (31) boot: compile time 17:37:42
I (31) boot: chip revision: 3
I (34) boot.esp32c3: SPI Speed : 40MHz
I (39) boot.esp32c3: SPI Mode : DIO
I (44) boot.esp32c3: SPI Flash Size : 4MB
I (49) boot: Enabling RNG early entropy source...
I (54) boot: Partition Table:
I (58) boot: ## Label Usage Type ST Offset Length
I (65) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (72) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (80) boot: 2 factory factory app 00 00 00010000 00100000
I (87) boot: 3 storage Unknown data 01 82 00110000 000f0000
I (95) boot: End of partition table
I (99) esp_image: segment 0: paddr=00010020 vaddr=3c040020 size=09a50h ( 39504) map
I (116) esp_image: segment 1: paddr=00019a78 vaddr=3fc8aa00 size=01e1ch ( 7708) load
I (118) esp_image: segment 2: paddr=0001b89c vaddr=40380000 size=0477ch ( 18300) load
I (129) esp_image: segment 3: paddr=00020020 vaddr=42000020 size=38604h (230916) map
I (182) esp_image: segment 4: paddr=0005862c vaddr=4038477c size=06260h ( 25184) load
I (189) esp_image: segment 5: paddr=0005e894 vaddr=50000000 size=00010h ( 16) load
I (192) boot: Loaded app from partition at offset 0x10000
I (194) boot: Disabling RNG early entropy source...
I (211) cpu_start: Pro cpu up.
I (221) cpu_start: Pro cpu start user code
I (221) cpu_start: cpu freq: 160000000
I (221) cpu_start: Application information:
I (224) cpu_start: Project name: wamr-hello
I (229) cpu_start: App version: 1
I (233) cpu_start: Compile time: Apr 17 2022 17:38:59
I (239) cpu_start: ELF file SHA256: b3d9a76b671e6655...
I (245) cpu_start: ESP-IDF: v4.4-dev-3042-g220590d599-dirty
I (252) heap_init: Initializing. RAM available for dynamic allocation:
I (260) heap_init: At 3FC8D6A0 len 00032960 (202 KiB): DRAM
I (266) heap_init: At 3FCC0000 len 0001F060 (124 KiB): STACK/DRAM
I (273) heap_init: At 50000010 len 00001FF0 (7 KiB): RTCRAM
I (279) spi_flash: detected chip: generic
I (284) spi_flash: flash io: dio
I (288) sleep: Configure to isolate all GPIO pins in sleep state
I (294) sleep: Enable automatic switching of GPIO sleep configuration
I (301) cpu_start: Starting scheduler.
I (306) spiffs: Initializing SPIFFS
I (336) spiffs: Partition size: total: 896321, used: 4518
I (336) spiffs: Reading file
I (336) SPIFFS: File open "/spiffs/hello.aot". File size: 1648 Bytes
I (336) SPIFFS: content-length 1648
I (346) spiffs: Archivo hello.aot leido:
I (346) wamr: Initialize WASM runtime
I (356) wamr: Run wamr with interpreter
E (356) wamr: Error in wasm_runtime_load: AOT module load failed: mmap memory failed
Guru Meditation Error: Core 0 panic'ed (Load access fault). Exception was unhandled.
Stack dump detected
Core 0 register dump:
MEPC : 0x40385784 RA : 0x40385602 SP : 0x3fc8cf30 GP : 0x3fc8b200
0x40385784: vTaskSwitchContext at /home/leonardo/esp/esp-idf/components/freertos/tasks.c:3456 (discriminator 3)
0x40385602: vTaskSwitchContext at /home/leonardo/esp/esp-idf/components/freertos/tasks.c:3424 (discriminator 3)
TP : 0x3fc89000 T0 : 0x3fc8d5a8 T1 : 0x600c2120 T2 : 0x00000001
S0/FP : 0x00000000 S1 : 0x00000001 A0 : 0x00000000 A1 : 0x000080e7
A2 : 0x3fc8cf6c A3 : 0x00000005 A4 : 0x00090713 A5 : 0x00000001
A6 : 0x00000000 A7 : 0x00000014 S2 : 0x00001881 S3 : 0x00000001
S4 : 0x00000000 S5 : 0x00000000 S6 : 0x00000000 S7 : 0x00000000
S8 : 0x00000000 S9 : 0x00000000 S10 : 0x00000000 S11 : 0x00000000
T3 : 0x00000000 T4 : 0x00000000 T5 : 0x00000001 T6 : 0x00000304
MSTATUS : 0x00001801 MTVEC : 0x40380001 MCAUSE : 0x00000005 MTVAL : 0x0009071f
0x40380001: _vector_table at ??:?
MHARTID : 0x00000000
and this is my code:
#include <stdio.h>
#include <string.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "wasm_export.h"
#include "bh_platform.h"
//#include "test_wasm.h"
#include "esp_err.h"
#include "esp_spiffs.h"
#include "esp_log.h"
#define LOG_TAG "wamr"
#define TAG "spiffs"
static void *
app_instance_main(wasm_module_inst_t module_inst)
{
const char *exception;
}
void *
iwasm_main(void arg)
{
// Open renamed file for reading
ESP_LOGI(TAG, "Reading file");
FILE f = fopen("/spiffs/hello.aot", "r");
if (f == NULL) {
ESP_LOGE(TAG, "Failed to open file for reading");
return NULL;
}
fseek(f, 0, SEEK_END);
unsigned int f_size = ftell(f);
fseek(f, 0, SEEK_SET);
char cont_len[8];
sprintf(cont_len, "%d", f_size);
ESP_LOGI("SPIFFS", "File open "/spiffs/hello.aot". File size: %d Bytes", f_size);
#if WASM_ENABLE_INTERP != 0
ESP_LOGI(LOG_TAG, "Run wamr with interpreter");
fail2interp:
/* unload the module */
ESP_LOGI(LOG_TAG, "Unload WASM module");
wasm_runtime_unload(wasm_module);
fail1interp:
#endif
}
void
app_main(void)
{
ESP_LOGI(TAG, "Initializing SPIFFS");
}
I think i dont know the metod to generate the correct hello.aot file
Beta Was this translation helpful? Give feedback.
All reactions