exatomvm icon indicating copy to clipboard operation
exatomvm copied to clipboard

uart:read/2 not found

Open Rashidwi opened this issue 6 months ago • 2 comments

When compiling my project it fails with uart:read/2 not found. Yet this is running on 6.6 and the method is in the AtomVM source.

I believe the problem lies with the instructions for building the avm_deps directory.

in the exatomvm README it says:

Download a copy of the AtomVM-libs from the AtomVM Gitbub release repository. Extract the contents of this archive and copy the enclosed AVM files into your avm_deps directory.

I have downloaded the only file that seemed relevant : atomvmlib-v0.6.6.avm, however this is not an extractable archive and I don't have the list of files suggested:

shell$ ls -l avm_deps total 264 -rw-rw-r-- 1 frege wheel 11380 May 8 16:32 alisp.avm -rw-rw-r-- 1 frege wheel 48956 May 8 16:32 atomvmlib.avm -rw-rw-r-- 1 frege wheel 23540 May 8 16:32 eavmlib.avm -rw-rw-r-- 1 frege wheel 25456 May 8 16:32 estdlib.avm -rw-rw-r-- 1 frege wheel 1052 May 8 16:32 etest.avm -rw-rw-r-- 1 frege wheel 16356 May 8 16:32 exavmlib.avm

Could you clarify what archive should be downloaded to provide these avm_deps. Is it actually in the assets list?

Many thanks

Sunny

Rashidwi avatar Jul 16 '25 15:07 Rashidwi

I should add that there are many things undefined:

warning: :uart.open/1 is undefined (module :uart is not available or is yet to be defined) warning: GPIO.set_pin_mode/2 is undefined (module GPIO is not available or is yet to be defined). warning: :uart.write/2 is undefined (module :uart is not available or is yet to be defined) warning: GPIO.digital_write/2 is undefined (module GPIO is not available or is yet to be defined). warning: :uart.read/1 is undefined (module :uart is not available or is yet to be defined) warning: GPIO.set_pin_mode/2 is undefined (module GPIO is not available or is yet to be defined). warning: GPIO.set_pin_pull/2 is undefined (module GPIO is not available or is yet to be defined). warning: GPIO.digital_read/1 is undefined (module GPIO is not available or is yet to be defined).

Rashidwi avatar Jul 21 '25 17:07 Rashidwi

The docs should not say to extract the libraries, simply putting put a copy of atomvmlib-v0.6.6.avm (or whichever version matches your AtomVM release or build) into the avm_deps directory.

But your are correct about :uart.read/2, I forgot to submit a PR to add it to the functions list when I added the /2 variant:

https://github.com/atomvm/exatomvm/blob/main/priv/funcs.txt

I will try to submit that soon, in the meantime you can use a local checkout of ExAtomVM and manually add it to the funcs.txt in the priv directory of ExAtomVM.

Another acceptable workaround is to add:

@compile {:no_warn_undefined [GPIO, :uart]}

These should be in any modules that use the module that cause warnings. For example if you have two modules that uses GPIO include the compiler directive to not warn about GPIO in both modules, similarly add :uart to any modules that use uart functions.

UncleGrumpy avatar Jul 21 '25 19:07 UncleGrumpy