Page 1 of 1

_thread not being enabled

Posted: Tue Nov 26, 2019 6:46 am
by devnull
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
>>> 

Re: _thread not being enabled

Posted: Tue Nov 26, 2019 8:12 am
by jimmo
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).

Re: _thread not being enabled

Posted: Tue Nov 26, 2019 9:51 am
by devnull
Jimmo;

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

Re: _thread not being enabled

Posted: Tue Nov 26, 2019 10:26 am
by jimmo
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

Re: _thread not being enabled

Posted: Tue Nov 26, 2019 10:36 am
by devnull
I think so, found the entry commented out in my GNUMakefile !

Re: _thread not being enabled

Posted: Tue Nov 26, 2019 10:40 am
by devnull
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 :-(

Re: _thread not being enabled

Posted: Tue Nov 26, 2019 11:09 am
by stijn
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'

Re: _thread not being enabled

Posted: Wed Nov 27, 2019 12:14 am
by jimmo
How are you deploying the firmware? Are you using the same arguments for the `make deploy` invocation?

Re: _thread not being enabled

Posted: Wed Nov 27, 2019 12:12 pm
by devnull
Thanks all this sewems to work:

Code: Select all

CFLAGS_EXTRA='-DMICROPY_PY_THREAD=1'