STM32MP157C MPU and programming sophisticated graphic application - Page 1
Forum section: electronics / general

author: FlyingDutch
author_rank: Regular Contributor
timestamp: September 21, 2020, 10:57:21 am
content: Hello,I have to extend system developed (by me and my coleague) for few years. System consists of from two to eight modules connected by CAN bus (CAN 2.0). First module is control unit and the next modules are acting as measuring and executive units. Every miodule (board) has its own processor - STM32F103VGTx and various peripherals. Up to this date for every instance of this system - dedicated panel had been designed and built in. I would like to add display( HDMI port) with "touch interface" by USB (17 to 24 inch display). For this purpose I would like to use "STM32MP157C" MPU (two Cortex-A7 cores with 650 MHz clock and one real-time core Cortex-M4 with 209 Mhz clock) with Linux OS - see link:https://www.st.com/content/st_com/en/products/microcontrollers-microprocessors/stm32-arm-cortex-mpus/stm32mp1-series/stm32mp157/stm32mp157c.htmlI have bought such development board:https://kamami.pl/en/stm32-development-kits/574376-stm32mp157c-dk2-starter-kit-with-stm32mp157c-microprocessor.htmlfor application development, but for production system I woiuld like to use such SOM modules:https://somlabs.com/product/visionsom-stm32mp1/with dedicated PCB board (only with needed peripherals). I am considering few options:1) To use or not to use "Boost" C++ libraries2) Use GTK toolkit for programming GUI (and use not OOP C language)3) Use QT framework for programming GUI and use C++ (OOP) languageSo far I made test of comunication from STM32MP157C-DK2 starter kit and control unit of my system (STM32F103 with CAN 2.0). I wrote program using CAN-FD from STM32MP157C-DK2 (on Cortex-M4 core) to comunicate with system control unit (CAN-FD was working in CAN 2.0 compatible mode). The comunication is fine.I can not decide what way of graphical application (on STM32MP157C ) programming to choose:1) Not object C language and GTK toolkit for Graphical GUI (in this case without "Boost" libraries)2) Using C++ OOP with QT framework and "Boost" librariesI am familiar with these two approach to C programming (non object versus OOP programming in C++.) What approach would be better in your opinion?Maybe someone caan give me some "pros and cons" ?Thanks in advance and regards

author: julian1
author_rank: Frequent Contributor
timestamp: September 21, 2020, 09:22:17 pm
content: For GTK in c++ there is gtkmm, which a wrapper around GTK and which is written in a reasonably modern style (More modern than QT).So if you chose c++/GTK, then you would likely use gtkmm, the STL for datastructures and agorithms, and then selectively use Boost libraries where they make sense.With that said, if you do not already know c++, then you will end up spending(wasting) a lot of time learning and experimenting on stuff, that does not particularly benefit you in getting to a working product.c++ has huge inherent complexity, and many developers end up writing in a subset of the language. There are also arguably better languages coming up, that provide for a similar mix of low-level control/no gc, while offering higher level language features. So there is no reason to feel obligated to learn c++, because it may be a valuable market skill for the future.My advice would be - to not be afraid to choose C, and the C api to GTK if it makes sense for the application's features, and if you already know it.

author: FlyingDutch
author_rank: Regular Contributor
timestamp: September 22, 2020, 07:05:22 am
content: Hello @Julian1,thank you for comprehensive and valuable answer. I know C++ - I has been writing programs in C++ (with STL nad Boost libraries) for about four years , but it was a little different situation: I wrote application for powerful Sun servers with Ultra-Sparc CPUs. I know that it is taking more resources (especially memory) comparing with not object C language. On the real time part of system there are STM32F103 MCUs were programs are in non object C.Problem is that I don't know neither GTK nor QT. The second problem is that the hardware for this application is not very powerful STM32MP157 MPU with STLinux OS. Could you write some comparison between GTK and QT?Thanks very much and Regards

author: Jeroen3
author_rank: Super Contributor
timestamp: September 22, 2020, 08:35:10 am
content: For Qt in your application you need the commercial license. Maybe this license speeds things up, do they give ready to go example?Maybe it doesn't help at all.

author: julian1
author_rank: Frequent Contributor
timestamp: September 22, 2020, 10:22:08 pm
content: Ok, if you know c++ that changes the picture a bit. A couple of points.c++ memory usage should not be too different to C, and is absolutely not a concern with the capability of hardware you are looking at - any kind of embedded linux. If you really want more fine grained memory control, then you can do things like pass custom allocators to stl containers etc. c++ is based around the principle of zero- cost abstractions unlike VM languages.gtk in C or gtkmm in c++ are both using object orientated techniques. Just because you program in C doesn't mean the code is not 'object orientated'. For example, you can do virtual dispatch in C using an array of function pointers, or just use a switch block to dispatch control based on message enums. Using gtk in C or gtkmm in c++ will follow mostly the same patterns.I would strongly suggest to look at example code and tutorials, and try to prototype something to get a feel for how gtk in C, and gtkmm and qt in c++ work in practice.The platform choice makes that easy as you can already target GUI stuff by writing code for a desktop linux box.I don't know know about performance on the specific embedded hardware you have chosen, as my experience is also limited to desktop linux, but I would be surprised if basic stuff was not Ok.