Skip to content
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

Fix boot_path Path loading #1502

Open
wants to merge 1 commit into
base: release-0.6
Choose a base branch
from

Conversation

petermm
Copy link
Contributor

@petermm petermm commented Jan 31, 2025

the boot path is a charlist eg erlang "".

"/dev/partition/by-name/main.avm";

But storing it in nvs with nvs_put_binary, means it's stored as a binary.

minimal fix.

eg this code now works:

  def start do
    case :esp.nvs_get_binary(:atomvm, :boot_path) do
      :undefined ->
        :esp.nvs_put_binary(:atomvm, :boot_path, "/dev/partition/by-name/main.avm")
        :timer.sleep(500)
        :esp.restart()

      "/dev/partition/by-name/main.avm" ->
        IO.inspect("boot_path already set")

      other ->
        IO.inspect("boot_path: #{other}")
    end
 end

would crash before with badarg, on the second boot with boot_path set.

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

the boot path is a charlist eg erlang "".

But storing it in nvs with nvs_put_binary, means it's stored as a binary.

minimal fix.

Signed-off-by: Peter M <petermm@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant