wasp-os: MicroPython for PineTime!
#36
(06-01-2020, 06:53 PM)lupyuen Wrote: Hi @danielt: I'm almost done documenting my wasp-os experiment on Mynewt, please have a look...

https://lupyuen.github.io/pinetime-rust-...icropython

I'm stuck with a multitasking conflict between wasp-os and Mynewt... wasp-os runs the REPL loop forever, scheduling its own tasks. But Mynewt needs to run the Event Loop to handle NimBLE Bluetooth packets.

Any idea which part of wasp-os I should modify to feed the Mynewt Event Loop?

Alternatively I could start another Mynewt task to run wasp-os, but that would consume extra memory (for the stack). Plus extra overheads for task switching. Thank you so much :-)

Sorry for the delay. I'm afraid missed this when I looked at the forum yesterday.

To keep things robust you probably need to deeply integrate this into Micropython rather then the wasp-os code.

I'd consider adding an implementation of MICROPY_VM_HOOK_LOOP to the MyNewt port that handles pending MyNewt events. This allows will dispatch the events from the main VM execution loop and will share the processor regardless of what Python code we are running. Note that this code is a really, really hot path so needs to be written for maximum performance. That usually means a divisor so the hook does not for every virtual opcode, take a loop at ports/esp8266/mpconfigport.h for an example.

After that you'd probably also need to call the MyNewt event loop from mp_hal_stdin_rx_chr() as well since most implementation of micropython just stop dead in that function when they are seeking user input! This code is less performance critical because is mostly runs a human speed however for simplicity I think it would be OK to call MICROPY_VM_HOOK_LOOP here as well.

A simpler alternative that would probably also work is to dispatch MyNewt events from mp_hal_stdin_rx_char(), machine_deepsleep and machine_lightsleep. That would rely on the system calling one of the sleep functions when it want to save power (which wasp-os does).
PineTime: wasp-os and MicroPython, Pinebook Pro:  Debian Bullseye


Messages In This Thread
wasp-os: MicroPython for PineTime! - by danielt - 02-04-2020, 01:43 PM
RE: wasp-os: MicroPython for PineTime! - by mulm - 02-22-2020, 09:31 AM
RE: wasp-os: MicroPython for PineTime! - by mulm - 02-22-2020, 10:45 AM
RE: wasp-os: MicroPython for PineTime! - by 33YN2 - 03-06-2020, 04:02 PM
RE: wasp-os: MicroPython for PineTime! - by 33YN2 - 04-13-2020, 09:46 PM
RE: wasp-os: MicroPython for PineTime! - by tllim - 04-20-2020, 11:47 AM
wasp-os: MicroPython for PineTime! - by lupyuen - 05-28-2020, 01:59 AM
RE: wasp-os: MicroPython for PineTime! - by danielt - 06-03-2020, 09:45 AM
RE: wasp-os: MicroPython for PineTime! - by 33YN2 - 07-15-2020, 07:01 PM
wasp-os: MicroPython for PineTime! - by lupyuen - 06-03-2020, 05:38 PM
wasp-os: MicroPython for PineTime! - by lupyuen - 07-15-2020, 07:08 PM
wasp-os: MicroPython for PineTime! - by lupyuen - 07-16-2020, 02:43 AM
wasp-os: MicroPython for PineTime! - by lupyuen - 07-16-2020, 03:53 AM
wasp-os: MicroPython for PineTime! - by lupyuen - 08-02-2020, 03:55 AM
RE: wasp-os: MicroPython for PineTime! - by Igor7 - 10-11-2020, 07:27 AM
RE: wasp-os: MicroPython for PineTime! - by 33YN2 - 10-15-2020, 06:39 PM
RE: wasp-os: MicroPython for PineTime! - by 33YN2 - 10-24-2020, 01:56 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Develop a new firmware for PineTime belushi 2 1,282 09-25-2023, 12:32 PM
Last Post: ccchan234
  Bluetooth BLE-MIDI-controller app for PineTime / InfiniTime Luno 0 500 08-20-2023, 05:17 AM
Last Post: Luno
  Zephyr Backlight Examples for PineTime lcj 0 691 05-06-2023, 02:54 PM
Last Post: lcj
  Zephyr is ready for pinetime jandy 1 2,075 05-06-2023, 02:15 PM
Last Post: lcj
  Send a message from Android to pinetime via BLE razrosman 0 905 11-05-2022, 08:24 AM
Last Post: razrosman
  PineTime Stuck in DFU Mode Eesha Barua 1 2,000 07-25-2022, 09:17 PM
Last Post: heyhewmike
  Idle tracking with PineTime: how versatile it is? schaman 1 1,613 07-13-2022, 12:50 AM
Last Post: wibble
  PineTime implemented with partial of pebble API jandy 0 1,535 03-20-2022, 08:58 PM
Last Post: jandy
  "Pine64 USB JTAG Adapter + OpenOCD + PineTime" should it work? ITCactus 4 3,875 03-02-2022, 05:58 AM
Last Post: wibble
  Zephyr based Pinetime jandy 4 4,634 11-11-2021, 05:53 AM
Last Post: jandy

Forum Jump:


Users browsing this thread: 2 Guest(s)