cancel
Showing results for 
Search instead for 
Did you mean: 

Python GUI for STM32MP157F-DK2

VTorr.1
Associate II

I am trying to create a GUI on the LCD of the STM32MP157C-DK2 but I get errors.

For example, when I try the code from Shail in this thread, I get:

root@stm32mp1:/tmp# su -l weston -c "env QT_QPA_PLATFORM=wayland-egl python3 /home/weston/filename.py"
[ 1] Failed to open device: No such file or directory, Try again...
[ 2] Failed to open device: No such file or directory, Try again...
[ 3] Failed to open device: No such file or directory, Try again...
[ 4] Failed to open device: No such file or directory, Try again...
[ 5] _OpenDevice(1111): FATAL: Failed to open device, errno=No such file or directory.
[ 6] Failed to open device: No such file or directory, Try again...
[ 7] Failed to open device: No such file or directory, Try again...
[ 8] Failed to open device: No such file or directory, Try again...
[ 9] Failed to open device: No such file or directory, Try again...
[ 10] _OpenDevice(1111): FATAL: Failed to open device, errno=No such file or directory.

-------------------------------

The display works ok and I am able to execute the GTK "hello world" example. 

I am using the kernel from stm32mp1-openstlinux-6.1-yocto-mickledore-mp1-v23.06.21.

I haven't found a guide/tutorial on this topic. Any help would be appreciated.

 

19 REPLIES 19
Jean-Marc B
ST Employee

Hi @VTorr.1 

I take Shail's example:

from PyQt5.QtWidgets import QApplication, QMainWindow, QPushButton
from PyQt5 import sip
app = QApplication([])
mainWin = QMainWindow()
button = QPushButton("Hello, PyQt5!")
mainWin.setCentralWidget(button)
mainWin.show()
app.exec_()

I install the required packages and copy the python script to /home/weston:

root@stm32mp1:~# apt-get install qtwayland python3-pyqt5
[...]
root@stm32mp1:~# cp filename.py /home/weston/filename.py

 Then I execute the program with the command you provided:

root@stm32mp1:~# su -l weston -c "env QT_QPA_PLATFORM=wayland-egl python3 /home/weston/filename.py"

 The Qt window appears on the screen but there is no error message.

Could you confirm you followed the same steps than the one described above, including the contents of the python script filename.py?

Best regards

--JM

Hi Jean-Marc,

thank you for your help. I appreciate it.

This is the output I get for those commands:

root@stm32mp1:/tmp# cat filename.py

from PyQt5.QtWidgets import QApplication, QMainWindow, QPushButton
from PyQt5 import sip
app = QApplication([])
mainWin = QMainWindow()
button = QPushButton("Hello, PyQt5!")
mainWin.setCentralWidget(button)
mainWin.show()
app.exec_()

root@stm32mp1:/tmp# apt-get install qtwayland python3-pyqt5
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
qtwayland is already the newest version (5.15.9+git0+8f56244ea7-r0).
python3-pyqt5 is already the newest version (5.15.9-r0).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.


root@stm32mp1:/tmp# cp filename.py /home/weston/filename.py
root@stm32mp1:/tmp# su -l weston -c "env QT_QPA_PLATFORM=wayland-egl python3 /ho
me/weston/filename.py"
[ 1] Failed to open device: No such file or directory, Try again...
[ 2] Failed to open device: No such file or directory, Try again...
[ 3] Failed to open device: No such file or directory, Try again...
[ 4] Failed to open device: No such file or directory, Try again...
[ 5] _OpenDevice(1111): FATAL: Failed to open device, errno=No such file or directory.
[ 6] Failed to open device: No such file or directory, Try again...
[ 7] Failed to open device: No such file or directory, Try again...
[ 8] Failed to open device: No such file or directory, Try again...
[ 9] Failed to open device: No such file or directory, Try again...
[ 10] _OpenDevice(1111): FATAL: Failed to open device, errno=No such file or directory.

 

I don't know if this info helps, but if I execute "weston-terminal", for example, the terminal window pops-up on the screen.

Thank you.

 

Jean-Marc B
ST Employee

Hi @VTorr.1 

Thank you for your feedback.

Do you confirm you are using the STM32MP157C-DK2 board?

What is the image you are running on the board? Is it an image you build by yourself?

Best regards,

--JM

Hi Jean-Marc,

thank you for your help.

It is not the 147C but the 147F version. My bad. 

U-BOOT recognizes it as STM32MP157F-DK2:

Model: STMicroelectronics STM32MP157F-DK2 Discovery Board
Board: stm32mp1 in trusted mode (st,stm32mp157f-dk2)

I compiled the kernel using the stm32mp1-openstlinux-6.1-yocto-mickledore-mp1-v23.06.21 files and then created the SD image using FlashLayout_sdcard_stm32mp157f-dk2-optee.tsv.

 

Hi @VTorr.1 

hum, I guess you mean 157F and not 147F ;)

It seems to me your problem looks like this one: https://community.st.com/t5/stm32-mpus-products/can-t-run-st-example-image-qt-qt-examples-on-a-custom-board/td-p/154722

Did you accept the EULA when building your own image?

Best regards

--JM

Hi Jean-Marc B,

thank you again for your help. I don't know if I accepted the EULA or not. I probably did.

I am going to compile the kernel again without accepting the EULA and I will post here how it went.

Thank you

 

Hi Jean-Marc B,

I looked for the "EULA accep" option and, if I I am not wrong, it is asked when you try to generate the files in the linus file system using yocto. I tried to do that (bitbake commands after not accepting the EULA) but I couldn't regenerate the files. The compilation failed due to problems with do_configure() function in m4 module, or something like that.

Right now I don't have time to try again. I don't know how yocto works, so if it fails I run out of options. 

I wonder if there is any way, that you know of, to download a file with the SD partition that is involved in this problem, so that I can change that partition on my SD and test if the python program works? Would that change work, i.e. simply changing in the SD the partition that has the files involved in the EULA?

Hi @VTorr.1 

The EULA choice is done when you install the bitbake environment. The result is an option (its name is ACCEPT_EULA_stm32mp1) set in the file conf/local.conf. Its value is "0" if the EULA is not accepted and "1" if it is accepted.

I tried to rebuild the st-image-weston without accepting the EULA and the result is successful. Perhaps you have some cache side effects between your two attempts.

Best regards,

--JM

Thank you again for yor help, Jean-Marc. I tried again with a new (therefore clean) repo folder and checkout. There were problems again.

I executed (following this guide:(

repo init -u https://github.com/STMicroelectronics/oe-manifest.git -b refs/tags/openstlinux-6.1-yocto-mickledore-mp1-v23.06.21
repo sync

DISTRO=openstlinux-weston MACHINE=stm32mp15-disco IMAGE=st-image-weston source layers/meta-st/scripts/envsetup.sh

(I selected IGNORE WARNING in the first screen, then READ THE EULA and EXIT in the second screen)

bitbake st-image-weston (y tried also with bitbake st-image-weston --runall=deploy_archives) 

The text ACCEPT_EULA_stm32mp15-disco = "0" was printed on the terminal.

I attach the messages on the terminal. This text was on red color: 

ERROR: m4-native-1.4.19-r0 do_configure: configure failed
ERROR: m4-native-1.4.19-r0 do_configure: ExecutionError('/datos/ST/Distribution-Package/build-openstlinuxweston-stm32mp15-disco/tmp-glibc/work/x86_64-linux/m4-native/1.4.19-r0/temp/run.do_configure.100825', 1, None, None)
ERROR: Logfile of failure stored in: /datos/ST/Distribution-Package/build-openstlinuxweston-stm32mp15-disco/tmp-glibc/work/x86_64-linux/m4-native/1.4.19-r0/temp/log.do_configure.100825

 

NOTE: on a first run I didn't uncomment ST_ARCHIVER_ENABLE = "1", as the guide suggests, but I uncommented it on a second bitbake run, with the same error messages.

 

Thank you