GPY full flash erase



  • OK I've figured out that the pycom-fwtool is part of the updater & a test command worked

    C:\Program Files (x86)\Pycom\Pycom Firmware Update>pycom-fwtool-cli.exe -p COM3 chip_id
    Running in FTDI mode
    ESP32D0WDQ6 (revision 1)
    

    No obvious reason why the adhoc wifi is gone after the change to 1.20.1.r1 though

    C:\Program Files (x86)\Pycom\Pycom Firmware Update>pycom-fwtool-cli.exe -p COM3 wmac
    Running in FTDI mode
    WMAC=30AEA42A6AB4
    

    it knows it's wifi MAC

    Anyway I'm anxious about trying the full flash erase considering "Erase entire flash, only use this if you are sure you know what you are doing. This will remove your devices lpwan mac addresses etc." at https://docs.pycom.io/advance/cli/ At the moment 1.20.1.r1 has delivered reduced functionality (no adhoc wifi) I'm worried the full flash erase could leave me even worse off.



  • I don't think pycom would refuse to promote pybytes as there entry into service business.



  • @kjm You can use that to build the firmware package. The actual flashing must be done on Windows, since the VM's usually have issues with USB devices. For builing, follow the instructions in the README.me here:
    https://github.com/pycom/pycom-micropython-sigfox
    and here:
    https://github.com/pycom/pycom-micropython-sigfox/tree/Dev/esp32
    and the links therein.
    Follow the instructions carefully. My favorite pitfalls are:

    • you forgot to set environment variables
    • you forgot the command "git submodule update --init"
    • you selected the wrong branch. It is Dev for micropython and idf_v3.2 for the esp-idf. That changes from time to time.


  • @robert-hh I've got a ubuntu VM running under windows, would it be able to flash a GPY? If so, can you link me to a guide for b) setting up the firmware build environment?



  • @kjm If you want to include code into the firmware as so called "frozen bytecode", you must set up the firmware build environment. That is based on Linux. For building, you can use a virtual machine. There are some hints that WSL (Windows Subsystem for Linux = Linux inside Windows) works too. Only flashing requires then the native machine. These are two big steps, a) setting up and dealing with a virtual machine, b) setting up the firmware build environment. a) is relatively straightforward, b) is more tricky, even if well documented.
    P.S.: boot.py and main.py are, as it is now, always executed from the file system. Of course you can change the code of mptask.c to let them start from the flash. But there are already two files, _boot.py and _main.py, which just do that.



  • @robert-hh Thnx for that. Suppose I wanted to edit uping what extra software do I need on my Windows PC to do that? Filezilla & Atom seem to show me only a limited part of the total flash memory. I would like to move towards being able to include my boot.py in the firmware in case LittleFS is not the great saviour of reformatted/removed/randomly-syntax-errored user programs most people seem to think it is.



  • @kjm for uping, type e.g.:

    from uping import ping. 
    ping(host_address, interval=<ms>)
    

    The host address can be numeric or symbolic. The 10 ms default for interval is a little bit short for the xxPy devices. I typically use 500. This is the def line:

    def ping(host, count=4, timeout=5000, interval=10, quiet=False, size=64):
    

    The git repor is here: https://gist.github.com/91cc8979e33e82af6d99ec34c38195fb.git



  • @robert-hh said in GPY full flash erase:

    @andreas My build typicall include some utility scripts in frozen bytecode:

    • mount.py - Mount the SD card
    • pye_mp.py - A file editor which runs on the Pyxx device. Typically imported as from pye_mp import pye. Then you can type: pye("filename"). For the documentation look here: https://github.com/robert-hh/Micropython-Editor
    • uping.py - a ping utility
    • upysh.py - a small set of unix like commands, typically imported as from uping import *

    Confirming adhoc wifi working in your 1.20.1.r1 firmware Robert. How do I use your utilities? For example what would I type in the Atom console to try uping? Is there a way to see the full extent of the flash memory in Atom/Filezilla? Do I need a new windows or unix program to see deeper into the gpy flash?



  • Now we are really getting things mixed up within this conversation.

    @kjm said in GPY full flash erase:

    the 20s wait when a DNS lookup fails at getaddrinfo in urequests really bugs me. In reality if a DNS server hasn't replied in a tenth of that time it's not going to. I'd kill to be able to tweak that value.

    Let's divert that to the thread where you already started this topic [1], right?

    [1] https://forum.pycom.io/topic/4932/urequests-timeouts



  • Only those which by its semantics require waiting, like the ones dedicated to communication.

    You're right the 20s wait when a DNS lookup fails at getaddrinfo in urequests really bugs me. In reality if a DNS server hasn't replied in a tenth of that time it's not going to. I'd kill to be able to tweak that value.



  • @robert-hh I've updated the documentation accordingly [1]. Thanks a bunch and keep up the spirit.

    [1] https://packages.hiveeyes.org/hiveeyes/foss/pycom/#robert-hh


    P.S.: We might really want to divert that discussion into another thread ;]. Nevertheless, thanks for bringing us to these topics, finally making me build a humble hut for community-based firmware images.



  • @andreas My build typicall include some utility scripts in frozen bytecode:

    • mount.py - Mount the SD card
    • pye_mp.py - A file editor which runs on the Pyxx device. Typically imported as from pye_mp import pye. Then you can type: pye("filename"). For the documentation look here: https://github.com/robert-hh/Micropython-Editor
    • uping.py - a ping utility
    • upysh.py - a small set of unix like commands, typically imported as from uping import *


  • @robert-hh said in GPY full flash erase:

    There is a GPY package here: https://github.com/robert-hh/Shared-Stuff

    Thanks, @robert-hh. We took a bunch of your builds scattered around the forum and gave them a canonical home on our page for Inofficial firmware images for Pycom devices in order to be able to find them back easier.

    We hope that you and all others are fine with that.

    To whom that may concern:
    I've tried to reflect the copyright and license terms of Pycom as good as possible, please let me know if I missed something relevant.

    it is quite a pack of software

    True. Thanks to all software authors for your hard work on that!



  • @kjm Most of the source code is available. There are only a few binary blobs for specific drivers. The espressif RTOS source is also provided. So yes, in theory you can change everything. But it is quite a pack of software. I do not agree that most OSErrors have a 20 s timeout. Only those which by its semantics require waiting, like the ones dedicated to communication.



  • @robert-hh said in GPY full flash erase:

    @kjm There is a GPY package here: https://github.com/robert-hh/Shared-Stuff

    Much obliged I'll give it a try. As a matter of interest, does compiling your own firmware let you modify micropython? For example are you able to change the default 20s timeout micropython has for most OSErrors?



  • /flash is the default directory of the GPY file system, with e.g. boot.py and main.py.
    Edit: I can compile later today a non-pybytes GPY image and send the link.

    Yeah I know what \flash is, but my 1.20.1.r1 does not have that file,

    ['boot.py', 'cert', 'lib', 'main.py', 'sys']
    

    So there is no 1.20.1r1 without pybyte firmware?



  • @kjm There is a GPY package here: https://github.com/robert-hh/Shared-Stuff



  • @kjm You can simple create that file locally and copy it to your device, either using atom or adafruit ampy. With ampy call:

    ampy -p <your_com_port> put pybytes_config.json

    /flash is the default directory of the GPY file system, with e.g. boot.py and main.py.
    Edit: I can compile later today a non-pybytes GPY image and send the link.



  • @robert-hh said in GPY full flash erase:

    The json script for disabling pybytes can be shorter. This single line in the file /flash/pybytes_config.json is sufficient:

    I don't have the skills set to find & edit /flash/pybytes_config.json, Atom doesn't show it. It took me most of a day just to figure out how to do the full flash erase using the CLI! Can you not link me to the 1.20.1r.1 without pybyte firmware & I could download it with the pycom firmware downloader as legacy?



  • @kjm The json script for disabling pybytes can be shorter. This single line in the file /flash/pybytes_config.json is sufficient:

    {"pybytes_autostart": false}
    

Log in to reply
 

Pycom on Twitter