exatomvm icon indicating copy to clipboard operation
exatomvm copied to clipboard

uf2tool is included in device avm

Open petermm opened this issue 10 months ago • 4 comments

  def start do
    :uf2tool.main([])
    |> IO.inspect()
  end
AtomVM init.
I (1419) sys: Loaded BEAM partition main.avm at address 0x250000 (size=1048576 bytes)
Starting application...
UF2 Tool: create or join UF2 binaries, for example for Raspberry Pi Pico
:ok
AtomVM finished with return value: ok

so we need to add at least runtime: false, if not only: :dev as well in mix.exs.. https://github.com/atomvm/exatomvm/blob/cbd2fb6cb3b0c614c1973919a4f43c00f4495c33/lib/mix/tasks/packbeam.ex#L163

petermm avatar Feb 07 '25 14:02 petermm

Good catch! It did not even cross my mind that could be a possibility when I wrote the task. We should double check that the pico flash, and stm32 flash tasks are not in there too, since I also contributed those. ;-)

UncleGrumpy avatar Feb 08 '25 00:02 UncleGrumpy

uf2tool is there because it's a dep.

Believe "Mix is not part of the runtime env", which is also why we have that deprecation/migration Mix.Config->Config afaik, so they should not be there..

But we should of course check ;-)

petermm avatar Feb 09 '25 18:02 petermm

Believe "Mix is not part of the runtime env", which is also why we have that deprecation/migration Mix.Config->Config afaik, so they should not be there..

Another reason we might actually want to keep the current Mix.Config... it's guaranteed not to leek into the runtime environment.

UncleGrumpy avatar Feb 09 '25 19:02 UncleGrumpy

these all currently works:

    ExAtomVM.hello()
    |> IO.inspect()

    ExAtomVM.PackBEAM.module_info()
    |> IO.inspect()

    Mix.Tasks.Atomvm.Check.module_info()
    |> IO.inspect()

My current thought is install instructions should include runtime: false eg:

{:exatomvm, git: "https://github.com/atomvm/ExAtomVM/", runtime: false},

that correctly gives you:

error: following modules or functions are not available on AtomVM:
* Elixir.ExAtomVM.PackBEAM:module_info/0
* Elixir.ExAtomVM:hello/0
* Elixir.Mix.Tasks.Atomvm.Check:module_info/0

petermm avatar Feb 13 '25 11:02 petermm