Entwicklung der Terkin-Sandbox

Ich schreibe das mal in die upload-framework.rshell

mkdir /pyboard/lib

# Upload lib folder
rsync ./lib /pyboard/lib

Nun bleibt er hier hängen …

.venv3/bin/rshell --port /dev/ttyS6 --user micro --password python --buffer-size 2048 --file tools/upload-framework.rshell
Using buffer-size of 2048
Connecting to /dev/ttyS6 (buffer-size 2048)...
Trying to connect to REPL .. connected
Testing if ubinascii.unhexlify exists ... Y
Retrieving root directories ... /boot.py/ /dist-packages/
Setting time ... Feb 20, 2020 21:11:58
Evaluating board_name ... pyboard
Retrieving time epoch ... Jan 01, 2000

… wenn ich dann nach ein paar Minuten abbreche

^X^CTraceback (most recent call last):
  File ".venv3/bin/rshell", line 8, in <module>
    sys.exit(main())
  File "/home/cgruber/hiveeyes/sources/hiveeyes-micropython-firmware/.venv3/lib/python3.6/site-packages/rshell/command_line.py", line 4, in main
    rshell.main.main()
  File "/home/cgruber/hiveeyes/sources/hiveeyes-micropython-firmware/.venv3/lib/python3.6/site-packages/rshell/main.py", line 2843, in main
    real_main()
  File "/home/cgruber/hiveeyes/sources/hiveeyes-micropython-firmware/.venv3/lib/python3.6/site-packages/rshell/main.py", line 2815, in real_main
    shell.cmdloop('')
  File "/home/cgruber/hiveeyes/sources/hiveeyes-micropython-firmware/.venv3/lib/python3.6/site-packages/rshell/main.py", line 1692, in cmdloop
    cmd.Cmd.cmdloop(self)
  File "/usr/lib/python3.6/cmd.py", line 138, in cmdloop
    stop = self.onecmd(line)
  File "/home/cgruber/hiveeyes/sources/hiveeyes-micropython-firmware/.venv3/lib/python3.6/site-packages/rshell/main.py", line 1722, in onecmd
    self.onecmd_exec("".join(group))
  File "/home/cgruber/hiveeyes/sources/hiveeyes-micropython-firmware/.venv3/lib/python3.6/site-packages/rshell/main.py", line 1733, in onecmd_exec
    return cmd.Cmd.onecmd(self, line)
  File "/usr/lib/python3.6/cmd.py", line 217, in onecmd
    return func(arg)
  File "/home/cgruber/hiveeyes/sources/hiveeyes-micropython-firmware/.venv3/lib/python3.6/site-packages/rshell/main.py", line 2609, in do_rsync
    print_func=pf, recursed=False, sync_hidden=args.all)
  File "/home/cgruber/hiveeyes/sources/hiveeyes-micropython-firmware/.venv3/lib/python3.6/site-packages/rshell/main.py", line 883, in rsync
    cp(src_filename, dst_filename)
  File "/home/cgruber/hiveeyes/sources/hiveeyes-micropython-firmware/.venv3/lib/python3.6/site-packages/rshell/main.py", line 657, in cp
    filesize, xfer_func=send_file_to_remote)
  File "/home/cgruber/hiveeyes/sources/hiveeyes-micropython-firmware/.venv3/lib/python3.6/site-packages/rshell/main.py", line 1439, in remote
    output = self.pyb.exec_raw_no_follow(func_src)
  File "/home/cgruber/hiveeyes/sources/hiveeyes-micropython-firmware/.venv3/lib/python3.6/site-packages/rshell/pyboard.py", line 238, in exec_raw_no_follow
    data = self.serial.read(2)
  File "/home/cgruber/hiveeyes/sources/hiveeyes-micropython-firmware/.venv3/lib/python3.6/site-packages/serial/serialposix.py", line 483, in read
    ready, _, _ = select.select([self.fd, self.pipe_abort_read_r], [], [], timeout.time_left())
KeyboardInterrupt
Makefile:240: recipe for target 'install-framework' failed
make: *** [install-framework] Error 1

Das kann schon mal etwas länger dauern, gerade beim framework. Die Fehlermeldung scheint mir dann auch üblich.

@poesel hatte per Cross-compilation for MicroPython 1.12 by poesel · Pull Request #61 · hiveeyes/terkin-datalogger · GitHub angefangen, den Bytecode-Support für Genuine MicroPython 1.12 auf Vanilla ESP32 zu verbessern. @Thias hat das nun aufgegriffen und arbeitet gerade an sandbox support for Pycom and Non-Pycom devices · thiasB/terkin-datalogger@210689d · GitHub.

Danke Euch beiden!

@poesel und @clemens könnt ihr in einer freien Minute den oben genannten HEAD testen - am besten auf einer sauberen Firmware (erase_all …)? Auf meinem Setup (LoPy4, Pycom MP und Bytecode) funktioniert das schon. Wäre schön zu wissen, ob der T-Call damit richtig angesprochen wird.

  • git checkout:

    git remote add thias git@github.com:thiasB/terkin-datalogger.git
    git fetch thias
    git checkout --track thias/mpy-simple
    
  • sandbox install:

      make recycle-ng MPY_CROSS=true MPY_TARGET=bytecode MPY_VERSION=1.12
1 Like

Äh - ich bin verwirrt. Wo drin soll ich das testen? Meine git skills sind nicht so dolle.

1 Like
Nelson:terkin-datalogger markus$ make install-ng
Device port: usb => /dev/cu.SLAB_USBtoUART
[INFO]    Uploading MicroPython code to device using USB
Traceback (most recent call last):
  File "tools/terkin.py", line 12, in <module>
    import netaddr
ModuleNotFoundError: No module named 'netaddr'
make[1]: *** [notify] Error 1
make: *** [install-ng] Error 2

Verstehe ich nicht. netaddr ist in den requirements drin. ???

source .venv3/bin/activate
pip install netaddr netifaces scapy

Sicher das das nicht pip2 oder pip3 sein muss? Habs für alle 3 ausgeführt. Dann kam das:

Nelson:terkin-datalogger markus$ make install-ng
Device port: usb => /dev/cu.SLAB_USBtoUART
[INFO] Uploading MicroPython code to device using USB
Device port: usb => /dev/cu.SLAB_USBtoUART
if test “bytecode” = “pycom”; then
.venv3/bin/rshell --port /dev/cu.SLAB_USBtoUART --user micro --password python --buffer-size 2048 mkdir /flash/dist-packages;
.venv3/bin/rshell --port /dev/cu.SLAB_USBtoUART --user micro --password python --buffer-size 2048 rsync dist-packages /flash/dist-packages;
else
/bin/sh: -c: line 1: syntax error: unexpected end of file
make[2]: *** [install-requirements] Error 2
make[1]: *** [install-rshell] Error 2
make: *** [install-ng] Error 2

ups.

passt schon. vorher wird ja das Python3 virtual environment aktiviert. da ist dann pip = pip3

das rührt von diesem Block, der aufgerufen wird in der install-ng Rule, unabhängig von der terkin-agent Rule.

@Andreas: wollen wir die 3 Pakete schon mit make setup installieren über die requirements-dev.txt?

Danke! Das sollte nun endlich ordentlich behoben worden sein, so dass man von solchen Fehlern nicht mehr aufgehalten wird. Tut mir leid, dass wir dieses Hindernis so lange mitgeschleift haben.

Die Desktop-Notifications sind nun komplett optional, so wie es auch sein sollte. Wie man sie installiert, wenn man sie haben will, kann man bei Setup desktop notifications nachlesen.

1 Like

Erster Versuch ohne erase-fs und mit install-ng. Danach waren nur boot.py, main.py & /dist-packages (neu) auf dem T-Call. Dazu 4 Anmerkungen:

  • nach ‘Retrieving time epoch … Jan 01, 2000’ passiert eine lange Zeit gar nichts. Kann man da nicht irgendeinen Fortschritssindikator hinpacken? Ungeduldigere Zeitgenossen könnten sich genötigt fühlen, das abzubrechen.
  • ‘File ‘/Users/markus/Documents/Github/terkin-datalogger/settings.py’ doesn’t exist’ - eindeutige Fehlermeldung. Sollte aber besser vorher kommen, sonst macht man den upload ja zweimal.
  • der prozess hält die serielle Schnittstelle offen. Das ist unschön.

Dann habe ich das ganze nochmal von vorne gestartet. Anscheinend löscht aber ‘erase-fs’ nicht bei einem ESP32. Die alten Sachen sind noch drauf. Da sollte besser esptool verwendet werden.

Hier der Mitschrieb
Nelson:terkin-datalogger markus$ make erase-fs
Device port: usb => /dev/cu.SLAB_USBtoUART
[CONFIRM] Erase the filesystem on the device? THIS WILL DESTROY FILESYSTEM DATA ON YOUR DEVICE. [y/n] y
Erasing filesystem
/Applications/Pycom\ Firmware\ Update.app/Contents/Resources/pycom-fwtool-cli --port /dev/cu.SLAB_USBtoUART erase_fs
Running in FTDI mode
Flash file system erasure successful          
Nelson:terkin-datalogger markus$ make recycle-ng
Device port: usb => /dev/cu.SLAB_USBtoUART
[INFO]    Uploading MicroPython code to device using USB
Device port: usb => /dev/cu.SLAB_USBtoUART
Using buffer-size of 2048
Connecting to /dev/cu.SLAB_USBtoUART (buffer-size 2048)...
Trying to connect to REPL  connected
Testing if ubinascii.unhexlify exists ... Y
Retrieving root directories ... /boot.py/ /main.py/ /project.pymakr/ /example_SIM800L.py/ /SIM800L.py/ /test_SIM800L.py/ /dist-packages/
Setting time ... Feb 23, 2020 11:02:53
Evaluating board_name ... pyboard
Retrieving time epoch ... Jan 01, 2000
Unable to create /pyboard/dist-packages
/Users/markus/Documents/Github/terkin-datalogger /Users/markus/Documents/Github/terkin-datalogger Using buffer-size of 2048
Connecting to /dev/cu.SLAB_USBtoUART (buffer-size 2048)...
Trying to connect to REPL  connected
Testing if ubinascii.unhexlify exists ... Y
Retrieving root directories ... /boot.py/ /main.py/ /project.pymakr/ /example_SIM800L.py/ /SIM800L.py/ /test_SIM800L.py/ /dist-packages/
Setting time ... Feb 23, 2020 11:02:57
Evaluating board_name ... pyboard
Retrieving time epoch ... Jan 01, 2000
/Users/markus/Documents/Github/terkin-datalogger /Users/markus/Documents/Github/terkin-datalogger Using buffer-size of 2048
Connecting to /dev/cu.SLAB_USBtoUART (buffer-size 2048)...
Trying to connect to REPL  connected
Testing if ubinascii.unhexlify exists ... Y
Retrieving root directories ... /boot.py/ /main.py/ /project.pymakr/ /example_SIM800L.py/ /SIM800L.py/ /test_SIM800L.py/ /dist-packages/
Setting time ... Feb 23, 2020 11:03:09
Evaluating board_name ... pyboard
Retrieving time epoch ... Jan 01, 2000
Destination directory /pyboard/lib does not exist.
Unable to create /pyboard/lib/terkin
Destination directory /pyboard/lib/terkin does not exist.
Using buffer-size of 2048
Connecting to /dev/cu.SLAB_USBtoUART (buffer-size 2048)...
Trying to connect to REPL  connected
Testing if ubinascii.unhexlify exists ... Y
Retrieving root directories ... /boot.py/ /main.py/ /project.pymakr/ /example_SIM800L.py/ /SIM800L.py/ /test_SIM800L.py/ /dist-packages/
Setting time ... Feb 23, 2020 11:03:14
Evaluating board_name ... pyboard
Retrieving time epoch ... Jan 01, 2000
File '/Users/markus/Documents/Github/terkin-datalogger/settings.py' doesn't exist
[OK]      MicroPython code upload finished
 
[WARNING] It is crucial all files have been transferred successfully before restarting the device.
          Otherwise, chances are high the program will crash after restart.
 
[ADVICE]  You might want to check the output of the file transfer process above for any errors.
 
[CONFIRM] Restart device using the REPL? [y/n] y
Device port: usb => /dev/cu.SLAB_USBtoUART
Resetting device
/Users/markus/Documents/Github/terkin-datalogger Entering REPL. Use Control-X to exit.

MicroPython v1.12 on 2019-12-20; ESP32 module (spiram) with ESP32
Type "help()" for more information.
>>> 
>>> import machine ; machine.reset() 
ets Jun  8 2016 00:22:57
 
rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
 clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:4844
load:0x40078000,len:10532
load:0x40080400,len:6736
entry 0x400806f0
I (525) psram: This chip is ESP32-D0WD
I (526) spiram: Found 64MBit SPI RAM device
I (526) spiram: SPI RAM mode: flash 40m sram 40m
I (529) spiram: PSRAM initialized, cache is in low/high (2-core) mode.
I (536) cpu_start: Pro cpu up.
I (540) cpu_start: Application information:
I (544) cpu_start: Compile time:     Dec 20 2019 07:52:43
I (550) cpu_start: ELF file SHA256:  0000000000000000...
I (556) cpu_start: ESP-IDF:          v3.3
I (561) cpu_start: Starting app cpu, entry point is 0x40083d90
I (553) cpu_start: App cpu up.
I (1437) spiram: SPI SRAM memory test OK
I (1438) heap_init: Initializing. RAM available for dynamic allocation:
I (1438) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (1444) heap_init: At 3FFBA658 len 000259A8 (150 KiB): DRAM
I (1450) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (1457) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (1463) heap_init: At 400973F0 len 00008C10 (35 KiB): IRAM
I (1469) cpu_start: Pro cpu start user code
I (146) cpu_start: Chip Revision: 1
W (146) cpu_start: Chip revision is higher than the one configured in menuconfig. Suggest to upgrade it.
I (150) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
[boot.py] INFO: Python module search path is: ['', '/lib']
[boot.py] INFO: Universal MicroPython Application Loader (umal)
Traceback (most recent call last):
  File "boot.py", line 29, in 
ImportError: no module named 'umal'
[main.py] INFO: Loading settings
Traceback (most recent call last):
   File "main.py", line 18, in 
 ImportError: no module named 'settings'
 MicroPython v1.12 on 2019-12-20; ESP32 module (spiram) with ESP32
 Type "help()" for more information.
>>> /Users/markus/Documents/Github/terkin-datalogger> 
 
Device port: usb => /dev/cu.SLAB_USBtoUART
Connecting via serial port /dev/cu.SLAB_USBtoUART.
.venv3/bin/miniterm.py /dev/cu.SLAB_USBtoUART 115200
--- Miniterm on /dev/cu.SLAB_USBtoUART  115200,8,N,1 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---

Nachtrag: ist wieder nur /dist-packages drauf, aber nicht /terkin

>>> import os
>>> os.listdir()
['boot.py', 'main.py', 'project.pymakr', 'example_SIM800L.py', 'SIM800L.py', 'test_SIM800L.py', 'dist-packages']
1 Like

Hatte die Pfade ja händisch angepasst vor dem Wochenende, da landeten auch nur die dist-packages bei einer Iteration auf dem Gerät, muss mal nachschauen, was es dann war. Irgendwo hier im thread ab Entwicklung der Terkin-Sandbox - #35 by Andreas und folgende haben wir das sicher implizit dokumentiert! Hört sich fast so an also ob irgendwo noch /flash steht oder was mit den Verzeichnissen nicht passt.

Könnte es das sein:

habe ich dann so gefixed mit

war aber nur die halbe Miete … wir haben den ursprüngichen thread aufgeteilt und nun fehlt mir hier der Nachgang! :-/ Vielleicht hatte ich - wie Thias vermutete auch nicht lange genug gewartet, den Vorschlag mit dem Fortschrittsbalken o.ä., irgendein heartbeat an dem man erkennt ob er noch hochlädt oder abgestürtzt ist fände ich auch sehr hilfreich!!

1 Like

Hmmm …

root@XPS13-CGruber:/home/cgruber/hiveeyes/sources/hiveeyes-micropython-firmware# git remote add thias git@github.com:thiasB/terkin-datalogger.git
root@XPS13-CGruber:/home/cgruber/hiveeyes/sources/hiveeyes-micropython-firmware# git checkout --track thias/mpy-simple
fatal: 'thias/mpy-simple' is not a commit and a branch 'mpy-simple' cannot be created from it

habe ich jetzt im bestehenden “hiveeyes datalogger”-Verzeichnis versucht, muss ich das in einem neuen machen? Sorry, nicht so git-erfahren.

@clemens - da fehlt noch:

git remote set-url thias GitHub - thiasB/terkin-datalogger: Terkin-Datalogger for MicroPython - data logging for humans

@weef - wie geht das mit dem Einklappen?

1 Like

Das git fetch thias natürlich vor dem checkout, sorry

Einfach bei dir mit “edit” …

... spicken
[details="spicken"]
Eingeklappt 
[/details]
1 Like

Jetzt hab ich das auch gefunden: unter dem Zahnrad -> ‘Details ausblenden’

habe das oben schon eingebaut. hast ne PM, auch zu weiteren advanced Formatierungsmöglichkeiten.