Is there a specific reason CPU 0 is not used by the Pycom MicroPython implementation?



  • While digging through the source of the Pycom MicroPython fork, I noticed that all FreeRTOS tasks are pinned to CPU 1. Even the _thread API pins all its tasks to CPU 1.

    Is there a specific reason to do so? Would it cause problems if something ran on CPU 0?
    Does that mean any Python code will run on CPU 1?

    Edit: Just found out that this was changed in version 1.14.0.b1. Before that CPU 1 was not used at all.
    Since CPU 0 will be mostly idle in my use case (no WiFi/BT), it may be a good idea to switch for example the LoRa Task to CPU 0 to balance the load. As far as I can see there shouldn't be any problems with that, because everything is already using FreeRTOS queues internally which should be truly thread safe. Is this correct?

    As far as I can see changing the _thread API to allow to run on different or any CPU would not give any benefits, because MicroPython uses a GIL internally which would prevent other Python code from running at the same time anyway. Is this correct?



Pycom on Twitter