diff --git a/libs/esp32kernel/esp32kernel.erl b/libs/esp32kernel/esp32kernel.erl index 6187cedd1..f8086ead8 100644 --- a/libs/esp32kernel/esp32kernel.erl +++ b/libs/esp32kernel/esp32kernel.erl @@ -71,7 +71,7 @@ loop() -> boot() -> BootPath = get_boot_path(), - atomvm:add_avm_pack_file(BootPath, []), + atomvm:add_avm_pack_file(BootPath, [{name, app}]), StartModule = get_start_module(), StartModule:start(). @@ -87,7 +87,14 @@ get_boot_path() -> get_start_module() -> case esp:nvs_get_binary(atomvm, start_module) of undefined -> - main; + case atomvm:get_entry_point(app) of + undefined -> + main; + ModuleNameWithExt when is_binary(ModuleNameWithExt) -> + Len = byte_size(ModuleNameWithExt) - byte_size(<<".beam">>), + ModuleName = binary:part(ModuleNameWithExt, 0, Len), + erlang:binary_to_atom(ModuleName, latin1) + end; Module -> erlang:binary_to_atom(Module, latin1) end.