[STM32F411_Nucleo] Adding libraries to firmware

Discussion and questions about boards that can run MicroPython but don't have a dedicated forum.
Target audience: Everyone interested in running MicroPython on other hardware.
Post Reply
PavloP
Posts: 2
Joined: Thu Jul 13, 2017 12:47 pm

[STM32F411_Nucleo] Adding libraries to firmware

Post by PavloP » Tue Jul 18, 2017 12:54 pm

Hello everybody,
I'm making first steps with uPython on STM32F411 Nucleo board and I think it's simple and great. But I met one problem that I can't solve - threading, that has locked heap. For dynamic type language this is just..not right. I've found few workarounds on this forum, but I also found a bunch of libraries to implement async into micropython. All manuals for those libraries recommend to install with micropython-pip. As far as I understand this method won't work on the STM board. Could you advise me how to add custom micropython libraries(like uasyncio) to clean micropython build?

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: [STM32F411_Nucleo] Adding libraries to firmware

Post by pythoncoder » Thu Jul 20, 2017 7:56 am

The way I do it is to install the library to the Unix build using upip. The library files can then be found in ~/.micropython/lib, from where they can be copied to your board.
Peter Hinch
Index to my micropython libraries.

PavloP
Posts: 2
Joined: Thu Jul 13, 2017 12:47 pm

Re: [STM32F411_Nucleo] Adding libraries to firmware

Post by PavloP » Thu Jul 20, 2017 2:46 pm

I don't quite understand how can I copy files to the board directly. The only way I see - as a custom module of my program. I run my code on board via pyboard tool

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: [STM32F411_Nucleo] Adding libraries to firmware

Post by dhylands » Thu Jul 20, 2017 4:36 pm

Yeah - the stm32f411 nucleo doesn't expose the USB connector, so you typically use the REPL over UART.

You can either use a tool like rshell (https://github.com/dhylands/rshell), or you can write a python script which writes the appropriate stuff to the file system and executes that via pyboard.py (rshell uses this technique and is built on top of pyboard,py).

Note that if you do use rshell over a UART, ensure that you use --buffer-size=30

nikhiledutech
Posts: 118
Joined: Wed Dec 27, 2017 8:52 am

Re: [STM32F411_Nucleo] Adding libraries to firmware

Post by nikhiledutech » Tue Jan 02, 2018 9:36 am

Whenever i followed this link https://github.com/peterhinch/micropyth ... UTORIAL.md to install uasyncio .
But in this command micropython -m upip install -p ~/syn micropython-uasyncio i get error of micropython command not found.
edutech@edutech-desktop:~/nikhil/upython_stm/micropython/syn$ micropython -m upip install -p ~/syn micropython-uasyncio
micropython: command not found
I tried to install with the help of pip utility. And here is the output which i get in the terminal.
edutech@edutech-desktop:~/nikhil/upython_stm/micropython/syn$ pip install micropython-uasyncio
Collecting micropython-uasyncio
Downloading micropython-uasyncio-1.4.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-0W1VQO/micropython-uasyncio/setup.py", line 7, in <module>
import optimize_upip
ImportError: No module named optimize_upip

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-0W1VQO/micropython-uasyncio/
I am currently using Ubuntu 14.04. So how to install this without error ? I tried to follow document, but their its not mentioned properly how to install it. A single command is given with creating a folder ~/sys.
So can you help me in installing uasyncio either with upip or pip utility.

Thanks :)

swington
Posts: 1
Joined: Wed Oct 25, 2017 6:50 am

Re: [STM32F411_Nucleo] Adding libraries to firmware

Post by swington » Tue Jan 16, 2018 6:57 am

Usually when getting an error like "command not found" the first thing that you could do is make sure that the program, that you are trying to run is accessible from the system PATH variable perspective. I used to stumble upon the same problem - I compiled the micropython in some directory and I didn't add this directory path to the PATH variable. So maybe try that and share the results.

From what I understand, you cannot successfully install micropython-lib packages using pip.

User avatar
bestazi
Posts: 3
Joined: Fri Jan 19, 2018 11:01 am

Re: [STM32F411_Nucleo] Adding libraries to firmware

Post by bestazi » Fri Jan 19, 2018 1:14 pm

Since you're running an executable in the current working directory, you should prefix it with ./. So for your program run it as ./a.out.
I'm right?
Thanks in advance.
-Besi

User avatar
bestazi
Posts: 3
Joined: Fri Jan 19, 2018 11:01 am

Re: [STM32F411_Nucleo] Adding libraries to firmware

Post by bestazi » Sat Jan 20, 2018 6:05 pm

Bump.
I need a solution to this problem ;)
Thanks
-Bes
"Let us sacrifice our today so that our children can have a better tomorrow."Bestay

SpotlightKid
Posts: 463
Joined: Wed Apr 08, 2015 5:19 am

Re: [STM32F411_Nucleo] Adding libraries to firmware

Post by SpotlightKid » Sun Jan 21, 2018 1:24 pm

Which problem exactly?

Post Reply