Showing results for 
Search instead for 
Did you mean: 

Running STM32L0538-DISCO sample project


Hello. I have recently purchased STM32L0538-DISCO board and I want to play a bit with the E-paper display. After struggling for a couple of hours trying to find some sample code or projects to run on STM32CubeIDE, I have found somewhat relevant thread here:


I have located STM32_Cube_FW_L0_V1.12.2 on my PC and tried to follow the migration guide UM2579.

Unfortunately, I have not been able to migrate the project to STM32CubeIDE as I think the instructions are not fully clear.


My questions regarding migrating the project:

1. The first step in the guide mentions that I need to make a copy of the project and copy that inside the workspace currently being used in STM32CubeIDE. I cannot understand how to properly do that. First of all, when it refers to "make a copy of the project" which directory does it refer to exactly?



Does it refer to whole Demonstrations directory? 













Does it refer to SW4STM32 directory?













Or STM32L0538-Discovery directory?













Additionally, which files exactly do I need to copy?


2. It also mentions that I need to copy those files to already open workspace. Does it mean that I need to create a blank project for the STM32L053? I do not get how can I have workspace already open prior to creating a project?


3. Perhaps there is an easier way to get the most basic E-Paper example running on STM32L0538-Discovery board? I am not interested in the touch bar or anything else. I just want to display some text on the e-paper  for example "Hello World"  before moving to more complex tasks.


I have tried to simply create a blank project for the STM32L0538 and download the following:


I simply pasted the BSP directory from the 




to my project directory. that BSP directory contains gde021a1 and files for stm32l0538_discovery board:


However, since I created a blank project using stm32CubeMX, I cannot build the project perhaps I am missing some configuration:



make -j16 all 
arm-none-eabi-gcc "../Drivers/BSP/STM32L0538-Discovery/stm32l0538_discovery.c" -mcpu=cortex-m0plus -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32L053xx -c -I../Core/Inc -I../Drivers/STM32L0xx_HAL_Driver/Inc -I../Drivers/STM32L0xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32L0xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/BSP/STM32L0538-Discovery/stm32l0538_discovery.d" -MT"Drivers/BSP/STM32L0538-Discovery/stm32l0538_discovery.o" --specs=nano.specs -mfloat-abi=soft -mthumb -o "Drivers/BSP/STM32L0538-Discovery/stm32l0538_discovery.o"
In file included from ../Core/Inc/stm32l0xx_hal_conf.h:188,
                 from ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_hal.h:29,
                 from ../Drivers/BSP/STM32L0538-Discovery/stm32l0538_discovery.h:48,
                 from ../Drivers/BSP/STM32L0538-Discovery/stm32l0538_discovery.c:40:
../Drivers/BSP/STM32L0538-Discovery/stm32l0538_discovery.c: In function 'BSP_LED_Init':
../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_hal_rcc.h:724:40: error: expected expression before 'do'
  724 | #define __HAL_RCC_GPIOB_CLK_ENABLE()   do { \
      |                                        ^~
../Drivers/STM32L0xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h:2829:28: note: in expansion of macro '__HAL_RCC_GPIOB_CLK_ENABLE'
      |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~
../Drivers/BSP/STM32L0538-Discovery/stm32l0538_discovery.h:104:49: note: in expansion of macro '__GPIOB_CLK_ENABLE'
  104 | #define LED3_GPIO_CLK_ENABLE()                  __GPIOB_CLK_ENABLE()
      |                                                 ^~~~~~~~~~~~~~~~~~
../Drivers/BSP/STM32L0538-Discovery/stm32l0538_discovery.h:112:71: note: in expansion of macro 'LED3_GPIO_CLK_ENABLE'
  112 | #define LEDx_GPIO_CLK_ENABLE(__INDEX__)         (((__INDEX__) == 0) ? LED3_GPIO_CLK_ENABLE() : LED4_GPIO_CLK_ENABLE())
      |                                                                       ^~~~~~~~~~~~~~~~~~~~
../Drivers/BSP/STM32L0538-Discovery/stm32l0538_discovery.c:154:3: note: in expansion of macro 'LEDx_GPIO_CLK_ENABLE'
  154 |   LEDx_GPIO_CLK_ENABLE(Led);
      |   ^~~~~~~~~~~~~~~~~~~~
../Drivers/BSP/STM32L0538-Discovery/stm32l0538_discovery.c: In function 'BSP_PB_Init':
../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_hal_rcc.h:716:40: error: expected expression before 'do'
  716 | #define __HAL_RCC_GPIOA_CLK_ENABLE()   do { \
      |                                        ^~
../Drivers/STM32L0xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h:2823:28: note: in expansion of macro '__HAL_RCC_GPIOA_CLK_ENABLE'
      |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~
../Drivers/BSP/STM32L0538-Discovery/stm32l0538_discovery.h:128:49: note: in expansion of macro '__GPIOA_CLK_ENABLE'
  128 | #define KEY_BUTTON_GPIO_CLK_ENABLE()            __GPIOA_CLK_ENABLE()
      |                                                 ^~~~~~~~~~~~~~~~~~
../Drivers/BSP/STM32L0538-Discovery/stm32l0538_discovery.h:133:50: note: in expansion of macro 'KEY_BUTTON_GPIO_CLK_ENABLE'
      |                                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~
../Drivers/BSP/STM32L0538-Discovery/stm32l0538_discovery.c:222:3: note: in expansion of macro 'BUTTONx_GPIO_CLK_ENABLE'
  222 |   BUTTONx_GPIO_CLK_ENABLE(Button);
      |   ^~~~~~~~~~~~~~~~~~~~~~~
make: *** [Drivers/BSP/STM32L0538-Discovery/ Drivers/BSP/STM32L0538-Discovery/stm32l0538_discovery.o] Error 1
"make -j16 all" terminated with exit code 2. Build might be incomplete.

11:42:20 Build Failed. 3 errors, 0 warnings. (took 362ms)



It is quite strange why I am getting errors such as this after adding BSP inside my Drivers folder:






I appreciate all the help in advance! 








Accepted Solutions

Hello @LPetr.1 

Perhaps you should take some time to familiarize yourself with the Eclipse environment and take a look at this link:

Regarding your first two questions, what you see in the STM32CubeIDE Project Explorer does not correspond to the physical structure of directories. In the Eclipse environment, there is a notion of Linked Resource for directories or files. As the demonstration project was converted from SW4STM32 to STM32CubeIDE, you can see the list of these Linked Resources in the following file:


You can read with your preffered advanced text editor (such as Notepad++ or SublimeText) and found all the source file (.c) linked with this project. 

These lines are specific for gde021a1.c but all c files of the project are listed. This is because the project was initially designed in this way.

For your third point, when you dragged and dropped the file gdem0213b74.c into the corresponding directory, Eclipse must have prompted you to either copy or link it. This is where you choose link it (and you should see a the file with an arrow icon in this case)

Finally, to exclude the other file gde021a1.c, you simply right-click on it, then select properties, C/C++ Build and check Exclude from build. This file will not be compiled.

Let me know if my guideline helps you.

Best regards,



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.

View solution in original post

ST Employee

Hello @LPetr.1 

I suggest you to import 32L0538-Discovery Demonstration in this way:

1°) Start from STM32CubeIDE, and in Project Explorer select Import projects...


2°) In import Wizard choose STM32Cube Example, and click Next.  


3°) In the example selector, set the Board filter to STM32L0538-DISCO, the search in the project list Demonstration project. Then click Next and Finish to copy the full project and libraries in your STM32CubeIDE workspace. The folder SW4STM32 will be migrated to STM32CubeIDE.


4)) After that, you can edit, compile and debug the Demonstration project with STM32CubeIDE. 

if you check Project Properties, in Resource, Linked Resources, you will find the Path variables PROJECT_LOC is located in your workspace.


Let me know if it help you?

Best regards.


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.

Yes I am able to compile and flash the device using the methods you have suggested above! Thank you very much. This is much easier than what is explained in the Migration guide document.

Unfortunately, despite the fact that I was able to compile the code and flash the board, I cannot get the Display to work properly. Perhaps this is due to damage flex cable as I have noticed a small tear at the end of the cable.



The small tear can be seen below:




AFAIK there are two different versions of the 'L0 Disco board, with different e-paper display. And old demo won't properly support the newer version.

Check the Disco's user manual, schematics, compare to the code you have.



For the new revision of  STM32L0538-Disco RevB03, the epd display driver supporting gdem0213b74 is implemented in the STM32Cube_FW_L0_V1.12.2.

I suggest you to change the global define into project -> Properties -> C/C++ Build -> Settings -> GCC Compiler -> Preprocessor, and change USE_STM32L0538_DISCO by USE_STM32L0538_DISCO_REV_B03



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.

I have replaced USE_STM32L0538_DISCO with USE_STM32L0538_DISCO_REV_B03 and now I can no longer compile the code 




15:09:32 **** Incremental Build of configuration Debug for project Demonstrations ****
make all 
arm-none-eabi-gcc -o "Demonstrations.elf" @"objects.list"   -mcpu=cortex-m0plus -T"../STM32L053C8Tx_FLASH.ld" --specs=nosys.specs -Wl,-Map="" -Wl,--gc-sections -static --specs=nano.specs -mfloat-abi=soft -mthumb -Wl,--start-group -lc -lm -Wl,--end-group
c:\st\stm32cubeide_1.10.0\stm32cubeide\plugins\\tools\arm-none-eabi\bin\ld.exe: ./Drivers/BSP/STM32L0538-Discovery/stm32l0538_discovery_epd.o: in function `BSP_EPD_Init':
C:/Users/ undefined reference to `gdem0213b74_drv'
collect2.exe: error: ld returned 1 exit status
make: *** [makefile:75: Demonstrations.elf] Error 1
"make all" terminated with exit code 2. Build might be incomplete.

15:09:32 Build Failed. 3 errors, 0 warnings. (took 547ms)





That is because I have followed RomainR. instructions provided above to create a project based on the STM32L0538Discovery Demonstrations which is probably based on the old version (not REV B03).

and I do not have the required driver source and header files for the new revision board



How can I create an example project that would be based on REV BO3? Is it available somewhere in the Example Selector?



You get this linker error because  Drivers\BSP\Components\gdem0213b74\gdem0213b74.c is missing in the project

Drag "gdem0213b74.c" from location and link it in the project structure.
And exclude from build the "gde021a1.c" file.

See my Project explorer below, and the project will compile/link:




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.

These steps match the description from thread I linked above.

@RomainR.could the resulting project be published somewhere (here for example?) together with appropriate description, as it appears to be a recurring and, frankly, a quite legitimate request.


 @waclawek.jan you are absolutely right. Ok, I have taken this action internally. We will see how we can improve this in the future version of Cube L0.
Best regards,


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.