In this post I will show you how I have ported the Littlev Graphical Library to an STM32 Discovery board. The porting was quite simple because the GUI library needs only a few interface functions. Although I’ve never used STM microcontrollers before the whole process took me only a half day. You can see the result in the video below.
Without any comments. The first start and creating of project.- a new project- settings of hardware in graphical tool- upgrade of ST-Link FW- debug of code.
- I was looking for an Eclipse based IDE and I’ve found SW4STM32. I had to register at openstm32.org to download the IDE. I was able to easily install the program and it worked fine with my Linux Mint operation system. The IDE is cross platform so is should work on Windows and OSX as well.
- Setting up Eclipse and Code Sourcery lite for STM32 Discovery Development. Here is a step by step guide to setting up a Open Source Stm32 Arm based embedded development tool chain with the Eclipse IDE. It is Targeted for the ST32-Discovery demo board under Windows (This was implemented under Windows 7 64bit) and uses the open source Code Sourcery version of the Gnu Arm cross assembler.
- Getting started ARM cortex M4 STM32 with Eclipse in Linux Setting up Eclipse C/C IDE for Windows emIDE is a free and full-featured IDE (Integrated Development Environment) integrating all features needed for developing and testing embedded applications.
I will show you how to port LittlevGL to STM Discovery but you can download a ready-to-use project as well: Project
To clone with git:
Or Download in Zip.
- The development board contains a powerful STM32F429ZIT6 (ARM Cortex-M4 core) microcontroller featuring 2 Mbytes of Flash memory and 256 Kbytes of RAM
- 320 × 240, 2.4” QVGA TFT LCD with resistive touch pad
- 64-Mbit SDRAM however it is not required because the internal RAM is enough for one frame buffer and in the Littlev Graphical Library double buffering is not required to use high level graphical features like transparency, scrolling or animations.
- And of course a new firmware can be loaded and debugged via USB
If you are not using the ready-to-use project here you can learn how to set up a new project from scratch.
I started with searching some code examples and I quickly found STM32CubeF4 which is the new, portable embedded software library of ST and it comes with a lot of examples. So downloaded it!
I was looking for an Eclipse based IDE and I’ve found SW4STM32. I had to register at openstm32.org to download the IDE. I was able to easily install the program and it worked fine with my Linux Mint operation system. The IDE is cross platform so is should work on Windows and OSX as well.
I have tried and reviewed some display related examples from the downloaded STM32CubeF4 pack using the Eclipse IDE. In this MCU the LCD controller modul is called LTDC (LCD TFT Display Controller). It also features with a graphical accelerator called Chrom-ART (aka DMA2D).
I began to create a new project in File/New/C Project and I chose Empty project with Ac6 STM32 MCU GCC tool chain and on a next page I have selected my board’s type. Finally I set that I would like to use Cube HAL. On the image below the “Download target firmware” button is inactive for me, however if it is active for you then you should click on it! As a result I get a project with lot of folders an files. I could build this initial project without any warning or error.
To test in the development board I’ve written a simple LED blinker in the main function:
Using a terminal I’ve cloned the the lvgl repositories from the Littlev Graphical Library’s GitHub page. To do this go the project’s root folder and type the following command into a Terminal:
git clone https://github.com/littlevgl/lvgl.git
To add the new directory firstly I right-clicked on the project name and chose Refresh. After that I’ve copied the lvgl/lv_conf_templ.h next to lvgl folder and renamed it to lv_conf.h. I’ve removed the #if 0 at the beginning and its #endifat the end to enable their content.
In lv_conf.h I’ve only changed:
- LV_HOR_RES 240
- LV_VER_RES 320
After that I’ve done the porting of the display, touch pad and system tick according to the example programs. I’ve created hal_stm_lvgl folder and write the drivers in tft.c and touchpad.c. I added lv_tick_inc(1) to src/stm32f4xx_it.c -> SysTick_Handler()
Eclipse Ide Stm32 Software
Eclipse Ide Download
In main.c I called lv_init(), tft_init() and touchpad_init(). I was able to compile the project and load it to the board.
Finally also added the lv_examples repository and called demo_create(). It created a GUI can be seen on the video above.
Stm32 Eclipse Plugin
In summary I can say the STM32 Discovery board is a great, powerful and low-cost development board which can be a good starting point for your first GUI application! With Littlev Graphics Library you can create a modern and innovative graphical user interfaces on it. By following this guide you can easily get through the first steps!