Problem with ESP32 FOTA

Good afternoon,

I have been trying to use zerynth ADM to load the firmware in an esp32, but when I press the button to prepare the new bytecode I get this error:

File “C:\Users\FCS\zerynth2\dist\r2.3.0\ztc\ztc.py”, line 114, in

cli()

File “C:\Users\FCS\zerynth2\sys\python\lib\site-packages\click\core.py”, line 716, in call

return self.main(*args, **kwargs)

File “C:\Users\FCS\zerynth2\sys\python\lib\site-packages\click\core.py”, line 696, in main

rv = self.invoke(ctx)

File “C:\Users\FCS\zerynth2\sys\python\lib\site-packages\click\core.py”, line 1060, in invoke

return _process_result(sub_ctx.command.invoke(sub_ctx))

File “C:\Users\FCS\zerynth2\sys\python\lib\site-packages\click\core.py”, line 1060, in invoke

return _process_result(sub_ctx.command.invoke(sub_ctx))

File “C:\Users\FCS\zerynth2\sys\python\lib\site-packages\click\core.py”, line 889, in invoke

return ctx.invoke(self.callback, **ctx.params)

File “C:\Users\FCS\zerynth2\sys\python\lib\site-packages\click\core.py”, line 534, in invoke

return callback(*args, **kwargs)

File “C:\Users\FCS\zerynth2\dist\r2.3.0\ztc\packages\packagecmd.py”, line 199, in install_deps

pack = tools.get_package(fullname)

File “C:\Users\FCS\zerynth2\dist\r2.3.0\ztc\base\tools.py”, line 34, in get_package

return env.repo["packs"][env.repo["byname"][fullname]]

KeyError: ‘undefined’

1 Like

Hello @nsantiago.giraldo,

thanks for reporting. Let us check if we can replicate your issue and get back to you asap.

Did you figure out this KeyError?

I’m seeing the exact same problem. This is on v2.3.2. I’m trying to create a custom VM based on cvm_espwroom32. I edited the device yml and compiled it. I have added the PIDs and VIDs to the yml file so it does show up in the list to disambiguate. But also shows a ‘missing deps’ along with the device name. When I click on the ‘virtualize’ button, I see a dialog asking permission to install missing dependencies. Then this traceback
when I click ‘Install’

    Traceback (most recent call last):
      File "/Users/faisal/.zerynth2/dist/r2.3.2/ztc/ztc.py", line 114, in
        cli()
      File "/Users/faisal/.zerynth2/sys/python/lib/python3.5/site-packages/click/core.py", line 716, in __call__
        return self.main(*args, **kwargs)
      File "/Users/faisal/.zerynth2/sys/python/lib/python3.5/site-packages/click/core.py", line 696, in main
        rv = self.invoke(ctx)
      File "/Users/faisal/.zerynth2/sys/python/lib/python3.5/site-packages/click/core.py", line 1060, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "/Users/faisal/.zerynth2/sys/python/lib/python3.5/site-packages/click/core.py", line 1060, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "/Users/faisal/.zerynth2/sys/python/lib/python3.5/site-packages/click/core.py", line 889, in invoke
        return ctx.invoke(self.callback, **ctx.params)
      File "/Users/faisal/.zerynth2/sys/python/lib/python3.5/site-packages/click/core.py", line 534, in invoke
        return callback(*args, **kwargs)
      File "/Users/faisal/.zerynth2/dist/r2.3.2/ztc/packages/packagecmd.py", line 199, in install_deps
        pack = tools.get_package(fullname)
      File "/Users/faisal/.zerynth2/dist/r2.3.2/ztc/base/tools.py", line 34, in get_package
        return env.repo["packs"][env.repo["byname"][fullname]]
    KeyError: 'undefined'

Any clues?

Ok. After digging around the ztc code here’s what I’ve found:
In base.tools.Tools.get_devices, populating the devices for custom VMs doesn’t call get_pack_info(cdir) as the bdirs loop above. So the returned object (for custom VMs) doesn’t have the extra parameters that come from z.yml as the inbuilt devices do.

I patched my code and that now runs. Here’s what my function now looks like:

    def get_devices(self):
    bdirs = fs.dirs(env.devices)
    for bdir in bdirs:
        try:
            pkg = self.get_pack_info(bdir)
            if pkg is None:
                continue
            bj = fs.get_json(fs.path(bdir,"device.json"))
            bj["path"] = bdir
            bj["deps"] = self.get_package_deps(pkg["fullname"])
            bj["has_all_deps"] = self.has_all_deps(pkg["fullname"])
            bj["fullname"] = pkg["fullname"]
            yield bj
        except Exception as e:
            warning(e)
    #load custom devices
    cdirs = fs.dirs(env.cvm)
    for cdir in cdirs:
        if not fs.exists(fs.path(cdir,"active")):
            #not compiled yet, skip
            continue
        try:
            pkg = self.get_pack_info(cdir)
            if pkg is None:
                continue
            bj = fs.get_json(fs.path(cdir,"device.json"))
            bj["path"] = cdir
            bj["deps"] = self.get_package_deps(pkg["fullname"])
            bj["has_all_deps"] = self.has_all_deps(pkg["fullname"])
            bj["fullname"] = pkg["fullname"]
            yield bj
        except Exception as e:
            warning(e)

Then I hit another problem. The inbuilt serial module was unable to communicate with my TTGO ESP32 device. I had to update the zerynth python serial module to the latest and now it works fine. I’m running on a Macos Mojave.

Just putting this out here for anyone else who hits this or for the zerynth folks to fix the code.