_thread not being enabled

The official PYBD running MicroPython, and its accessories.
Target audience: Users with a PYBD
Post Reply
User avatar
devnull
Posts: 473
Joined: Sat Jan 07, 2017 1:52 am
Location: Singapore / Cornwall
Contact:

_thread not being enabled

Post by devnull » Tue Nov 26, 2019 6:46 am

As you can see I am making with _thread:

Code: Select all

make -j6 BOARD=PYBD_SF6 FROZEN_MANIFEST= FROZEN_MPY_DIR=/nfs/qnap/dev/uPython/bash/../build/micropython/micropython/ports/stm32/modules MICROPY_PY_THREAD=1
But it does not appear to be enabled:

Code: Select all

import MicroWebSrv2

       ---------------------------
       - Python pkg MicroWebSrv2 -
       -      version 2.0.5      -
       -     by JC`zic & HC2     -
       ---------------------------

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "MicroWebSrv2/__init__.py", line 15, in <module>
  File "MicroWebSrv2/libs/XAsyncSockets.py", line 7, in <module>
ImportError: no module named '_thread'
>>> 

Code: Select all

help('modules')
MicroWebSrv2/__init__               dht               uarray            uos
MicroWebSrv2/httpRequest            framebuf          uasyncio/__init__ urandom
MicroWebSrv2/httpResponse           gc                uasyncio/core     ure
MicroWebSrv2/libs/XAsyncSockets     jsondb            ubinascii         uselect
MicroWebSrv2/libs/urlUtils          logging           ubluetooth        usocket
MicroWebSrv2/microWebSrv2           lwip              ucollections      ussl
MicroWebSrv2/mods/PyhtmlTemplate    math              ucryptolib        ustruct
MicroWebSrv2/mods/WebSockets        micropython       uctypes           utime
MicroWebSrv2/webRoute               network           uerrno            utimeq
__main__          pkg_resources     uhashlib          uwebsocket
_onewire          pyb               uheapq            uzlib
_webrepl          sh                uio               wget
builtins          stm               ujson             wlan
cmath             sys               umachine          www
Plus any modules on the filesystem
>>> 

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: _thread not being enabled

Post by jimmo » Tue Nov 26, 2019 8:12 am

From memory, I don't know think threading can be controlled from the Makefile. You'll need to set it in mpconfigport.h or mpconfigboard.h (or add the plumbing to set it from the Makefile).

User avatar
devnull
Posts: 473
Joined: Sat Jan 07, 2017 1:52 am
Location: Singapore / Cornwall
Contact:

Re: _thread not being enabled

Post by devnull » Tue Nov 26, 2019 9:51 am

Jimmo;

Ahh so it's changed, how do I add the plumbining to use my existing GNUmakefile ??

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: _thread not being enabled

Post by jimmo » Tue Nov 26, 2019 10:26 am

What's changed? Did this used to be possible? I don't see a way that the stm32 Makefile takes this argument. Is it possible you're thinking of the Unix port?

But if you want to do this in your GNUmakefile, you need to add -DMICROPY_PY_THREAD=1 to the compiler flags.

e.g. CFLAGS_MOD += -DMICROPY_PY_THREAD=1

User avatar
devnull
Posts: 473
Joined: Sat Jan 07, 2017 1:52 am
Location: Singapore / Cornwall
Contact:

Re: _thread not being enabled

Post by devnull » Tue Nov 26, 2019 10:36 am

I think so, found the entry commented out in my GNUMakefile !

User avatar
devnull
Posts: 473
Joined: Sat Jan 07, 2017 1:52 am
Location: Singapore / Cornwall
Contact:

Re: _thread not being enabled

Post by devnull » Tue Nov 26, 2019 10:40 am

Nope, just added that to my Gnumakefile and I still don't get threads.

Code: Select all

## THREADS
CFLAGS_MOD += -DMICROPY_PY_THREAD=1
Also added:

Code: Select all

## THREADING
MICROPY_PY_THREAD ?= 1
to mpconfigport.mk and that does not work either, not having much luck today :-(

stijn
Posts: 735
Joined: Thu Apr 24, 2014 9:13 am

Re: _thread not being enabled

Post by stijn » Tue Nov 26, 2019 11:09 am

According to travis.yml it should be something like this:

Code: Select all

make -C ports/stm32 BOARD=NUCLEO_H743ZI CFLAGS_EXTRA='-DMICROPY_PY_THREAD=1'

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: _thread not being enabled

Post by jimmo » Wed Nov 27, 2019 12:14 am

How are you deploying the firmware? Are you using the same arguments for the `make deploy` invocation?

User avatar
devnull
Posts: 473
Joined: Sat Jan 07, 2017 1:52 am
Location: Singapore / Cornwall
Contact:

Re: _thread not being enabled

Post by devnull » Wed Nov 27, 2019 12:12 pm

Thanks all this sewems to work:

Code: Select all

CFLAGS_EXTRA='-DMICROPY_PY_THREAD=1'

Post Reply