cancel
Showing results for 
Search instead for 
Did you mean: 

Running STM32L0538-DISCO sample project

LPetr.1
Senior

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:

https://community.st.com/t5/stm32-mcus-touch-gfx-and-gui/problem-with-stm32l0538-disco-e-paper/td-p/230661

 

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?

LPetr1_0-1704273030053.png

 

Does it refer to whole Demonstrations directory? 

 

 

 

 

 

C:\Users\petrikas.lu\STM32Cube\Repository\STM32Cube_FW_L0_V1.12.2\Projects\32L0538DISCOVERY\Demonstrations\SW4STM32\STM32L0538-Discovery

 

 

 

 

 

 

Does it refer to SW4STM32 directory?

 

 

 

 

 

C:\Users\petrikas.lu\STM32Cube\Repository\STM32Cube_FW_L0_V1.12.2\Projects\32L0538DISCOVERY\Demonstrations\SW4STM32

 

 

 

 

 

 

Or STM32L0538-Discovery directory?

 

 

 

 

 

C:\Users\petrikas.lu\STM32Cube\Repository\STM32Cube_FW_L0_V1.12.2\Projects\32L0538DISCOVERY\Demonstrations\SW4STM32\STM32L0538-Discovery

 

 

 

 

 

 

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:

https://www.st.com/en/embedded-software/stsw-stm32152.html

 

I simply pasted the BSP directory from the 

 

C:\Users\petrikas.lu\Downloads\en.stsw-stm32152\Drivers\BSP

 

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

LPetr1_0-1704274883646.png

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'
 2829 | #define __GPIOB_CLK_ENABLE __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'
 2823 | #define __GPIOA_CLK_ENABLE __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'
  133 | #define BUTTONx_GPIO_CLK_ENABLE(__INDEX__)      (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/subdir.mk:34: 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:

LPetr1_0-1704275435893.png

 

 

 

 

I appreciate all the help in advance! 

 

 

 

 

 

 

1 ACCEPTED SOLUTION

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:

https://help.eclipse.org/latest/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Fconcepts%2Fconcepts-13.htm

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:

"C:\Users\yourname\STM32Cube\Repository\STM32Cube_FW_L0_V1.12.2\Projects\32L0538DISCOVERY\Demonstrations\SW4STM32\STM32L0538-Discovery\.project"

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. 

<linkedResources>
...
<link>
<name>Drivers/BSP/Compnents/gde021a1.c</name>
<type>1</type>
<location>PARENT-5-PROJECT_LOC/Drivers/BSP/Components/gde021a1/gde021a1.c</location>
</link>
....
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,
romain,

 

 

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

16 REPLIES 16
RomainR.
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...

RomainR_0-1704276956898.png

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

RomainR_1-1704277014729.png

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.

RomainR_2-1704277236393.png

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.

RomainR_3-1704277627865.png

Let me know if it help you?

Best regards.

Romain

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.

 

LPetr1_0-1704278881806.png

The small tear can be seen below:

LPetr1_1-1704278907158.png

 

 

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.

JW

[EDIT] https://community.st.com/t5/stm32-mcus-embedded-software/stm32l0538-disco-demo-program/m-p/82762

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

RomainR_0-1704283886429.png

 

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="Demonstrations.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\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127\tools\arm-none-eabi\bin\ld.exe: ./Drivers/BSP/STM32L0538-Discovery/stm32l0538_discovery_epd.o: in function `BSP_EPD_Init':
C:/Users/petrikas.lu/Desktop/WORK/STM32/Demonstrations/Drivers/BSP/STM32L0538-Discovery/stm32l0538_discovery_epd.c:105: 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

LPetr1_0-1704287719458.png

 

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:

RomainR_0-1704289727758.png

 

 

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.

JW

 @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,
Romain

 

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.