cancel
Showing results for 
Search instead for 
Did you mean: 

How to do python development targeting the STM32 MPU

WGall.1
Associate II

Hello,

I have a STM32MP157F-DK2 and I'm planning to develop some python applications to run on the A7 processor. I have some questions related to python development for this platform, as I have not found too much documentations regarding this:

  1. Software package: Which ST software package do you recommend for python dev? Given that I will not need to cross-compile any C/C++ application with an SDK, can I use the Starter package, or do I need to use the dev package?
  2. Will the default starter of dev packages contain the python modules that I will need to connect and read data from Bluetooth devices?
  3. Will the default starter of dev packages contain the python modules that I will need to create GUIs for the TFT display?
  4. If I need to install a python module that is not present by default on the image, can I do it at run time, or do I need to create a custom distribution package? how?

If you have any examples or tutorials for python development for the STM32 they are very welcome. The "hello world" examples that I have found are for C applications cross-compiled with the SDK.

Thanks for your support,

Walter.

1 ACCEPTED SOLUTION

Accepted Solutions
Jean-Marc B
ST Employee

Hi @WGall.1​ 

In complement of excellent Tesla DeLorean and PatrickF's replies, I add some additive infos. If you want to know if a python module is available, just type:

# apt-get update
# apt-cache policy python3-<mymodule>

Many python modules are already available by default. If not, as mentioned by PatrickF, you can use the pip method if and only if the python module you want to install does not need any compilation steps.

If the python module you want to install is not available by default and required compilation steps, you need to build it and include it into your image or build it as a package and provide it in your own distribution. Feel free to ask for support to the Community to help you in developing recipes for these python modules or publish them here.

Best regards,

--JM

View solution in original post

4 REPLIES 4

Embedded Linux, you should be able to determine what packages get built into file system images, there's no reason you can't build C, C++ or Python code directly on the target, the packages are often skipped as they consume space on the eMMC, NAND or SDCards, and run like they're on a slower PC

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
PatrickF
ST Employee

Hi @WGall.1​ 

you could directly use Starter Package with STM32MP157F-DK2. Python3 is present by default.

Although not really recommended (as it might not work for some packages requiring on-target compilation), you could install pip to allow installing additional python packages.

apt-get update
apt-get install python3 python3-pip
python3 -m pip install -U pip

Regards.

In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
Jean-Marc B
ST Employee

Hi @WGall.1​ 

In complement of excellent Tesla DeLorean and PatrickF's replies, I add some additive infos. If you want to know if a python module is available, just type:

# apt-get update
# apt-cache policy python3-<mymodule>

Many python modules are already available by default. If not, as mentioned by PatrickF, you can use the pip method if and only if the python module you want to install does not need any compilation steps.

If the python module you want to install is not available by default and required compilation steps, you need to build it and include it into your image or build it as a package and provide it in your own distribution. Feel free to ask for support to the Community to help you in developing recipes for these python modules or publish them here.

Best regards,

--JM

WGall.1
Associate II

Hello @PatrickF​, @Jean-Marc B​ 

Thanks for the feedback.

I will try with the proposed methods for packages installation.

Best Regards

Walter.