-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ESP32: add support for init / esp32boot.avm
#657
Conversation
e305246
to
6cd8afc
Compare
d6f79f0
to
f07cce5
Compare
13ec09f
to
b2f582b
Compare
esp32boot.avm
7ef680e
to
2b1aadc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
High level comments:
Breaking changes:
- The changes to the return value and looping in the
esp32init:start/0
function significantly change the current behavior of AtomVM. Specifically, the VM will never terminate with this change. This needs to be discussed. - The current change breaks images created in CI and even by default on the command line without changes to the image building process and the creation of an AVM file to populate the
boot.avm
partition that include the esp32boot contents and the libatomvm.avm contents.
Devops/style issues:
- This PR should be split into probably 3 PRs and reviewed separately
- Addition of a new Nif (
atomvm_get_start_beam_nif
) - Change of the return type of an internal API (
sys_open_avm_from_file
) - The thrust of this PR -- the new esp32init module and support for it
- Addition of a new Nif (
- The
esp32init
module needs to be broken up into a core module that doesn't bring in any of the web server or networking logic. This adds code and atoms that do not need to be loaded in the majority of applications that are not using dev mode. - Debugging code needs to be removed
- Dev mode probably needs to be documented in the Getting Started Guide.
…type Make atomvm:add_avm_pack_file/2 return a meaningful error This change is required for #657. These changes are made under both the "Apache 2.0" and the "GNU Lesser General Public License 2.1 or later" license terms (dual license). SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
NIFs: add atomvm:get_start_beam/1 This change is required in order to implement #657. These changes are made under both the "Apache 2.0" and the "GNU Lesser General Public License 2.1 or later" license terms (dual license). SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
If we don't feel 100% sure about a number of choices we can also defer this as default (and hence the mkimage change), and iterate over this more and more until it is good enough for using it as default. |
esp32init purpose is to load the application from an application partition. Signed-off-by: Davide Bettio <[email protected]>
Try to boot boot.avm partition first, which will take care of application loading. Signed-off-by: Davide Bettio <[email protected]>
Use atomvm:get_start_beam/1 for finding startup module instead of relying on some static default. Signed-off-by: Davide Bettio <[email protected]>
Do not enable it by default. Signed-off-by: Davide Bettio <[email protected]>
Add (opt-in) NVS setting for enabling always ALISP console and web server. Signed-off-by: Davide Bettio <[email protected]>
Keep esp32init as small as possible. Signed-off-by: Davide Bettio <[email protected]>
d1bab7b
to
98b88d4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dev mode started even when you have flashed an application to main.app
Application is started inside of `try .. catch` block and `timer:sleep(infinity)` is used after application exit according to devmode settings. Signed-off-by: Davide Bettio <[email protected]>
Init takes care of launching startup module and eventually ALISP console and web server according to configuration / in case of failure.
Closes #654
These changes are made under both the "Apache 2.0" and the "GNU Lesser General
Public License 2.1 or later" license terms (dual license).
SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later