jurc192 Posted May 17, 2018 Report Posted May 17, 2018 Hello World! I am trying to integrate uGFX to PlatformIO IDE and after experience all the "newbie-getting-into-embedded-systems-with-stm32" pain and giving up a few times, I believe I am very close to success. I work on STM32F746 discovery board and am trying to make a simple hello world test of the display (barebones, no RTOS). Upon compiling, I get the following error from the linker: pio_builds/disco_f746ng/src/gdisp_lld_STM32LTDC.o: In function `gdisp_lld_init': gdisp_lld_STM32LTDC.c:(.text.gdisp_lld_init+0x1a2): undefined reference to `BSP_SDRAM_Init' collect2: error: ld returned 1 exit status *** [pio_builds/disco_f746ng/firmware.elf] Error 1 Now I am not sure whether it's my configuration problem (trying to somehow hack the uGFX to PIO) or something else... This is my project structure: . ├── inc │ ├── board_STM32LTDC.h │ └── gfxconf.h ├── lib │ └── readme.txt ├── pio_builds │ ├── disco_f746ng │ ├── do-not-modify-files-here.url │ └── structure.hash ├── src │ ├── gdisp_lld_STM32LTDC.c │ ├── gfx_mk.c │ └── main.c └── platformio.ini And this is the main.c file: #include "gfx.h" int main(void) { gfxInit(); gdispDrawPixel(10, 10, GFX_BLUE); while(1) {} } Any ideas where to start debugging?
David Thomas Posted May 18, 2018 Report Posted May 18, 2018 (edited) That function will be in the board BSP files in cubemx, something like stm32f746_discovery_sdram.c/h Maybe the BSP packages are available as a library in platformio, if you're using mbed which it looks like you might be, they definitely are: https://os.mbed.com/teams/ST/code/BSP_DISCO_F746NG/ Edited May 18, 2018 by David Thomas
Joel Bodenmann Posted May 18, 2018 Report Posted May 18, 2018 @David Thomas is correct. You're missing some board support package files. You will find that µGFX also supplies those as part of the board files for the STM32F746 Discovery board files. You can find them under /boards/base/STM32F746-Discovery. Just add the appropriate files that you're missing (most notably the SDRAM ones) and you should be ready to go After all, board files are completely application specific. You're not forced to use what you find in the /boards directory. If you're using another framework you can either use their board files (if they exist already) or create your own. Board files are just there to give the µGFX driver(s) access to the actual hardware. You'll find a board file template in each driver directory (eg. /drivers/gdisp/STM32LTDC in your case) which you can implement however you want using whatever you want.
jurc192 Posted May 21, 2018 Author Report Posted May 21, 2018 Thank you both for answering Aah right, the BSP drivers! But afaik the BSP drivers should be included already: - I added the BSP include path to gcc : -I/<path_to_stm32cube>/STM32Cube_FW_F7_V1.11.0/Drivers/BSP/STM32746G-Discovery - I changed the include line in the board_STM32LTDC.h file (the original STM32F7 cube BSP drivers are misspelled!) - I wanted to use original BSP files, to avoid duplication (using the original BSP stuff anyway): #include "stm32f746g_discovery_sdram.h" /* BEFORE */ #include "stm32746g_discovery_sdram.h" /* AFTER */ And the error stays the same: arm-none-eabi-gcc -o pio_builds/disco_f746ng/firmware.elf -Os -Wl,--gc-sections,--relax -mthumb -mcpu=cortex-m7 --specs=nano.specs --specs=nosys.specs -Wl,-T"/home/jure/.platformio/packages/framework-stm32cube/platformio/ldscripts/STM32F746NG_DEFAULT.ld" pio_builds/disco_f746ng/src/gdisp_lld_STM32LTDC.o pio_builds/disco_f746ng/src/gfx_mk.o pio_builds/disco_f746ng/src/main.o -L/home/jure/.platformio/platforms/ststm32/ldscripts -Lpio_builds/disco_f746ng -L/home/jure/.platformio/packages/framework-stm32cube/f7/Drivers/CMSIS/Lib/GCC -L/home/jure/.platformio/packages/framework-stm32cube/platformio/ldscripts -Wl,--start-group -lc -lgcc -lm -lstdc++ -lnosys pio_builds/disco_f746ng/libFrameworkHALDriver.a pio_builds/disco_f746ng/libFrameworkCMSISDevice.a -Wl,--end-group pio_builds/disco_f746ng/src/gdisp_lld_STM32LTDC.o: In function `gdisp_lld_init': gdisp_lld_STM32LTDC.c:(.text.gdisp_lld_init+0x1a2): undefined reference to `BSP_SDRAM_Init' collect2: error: ld returned 1 exit status *** [pio_builds/disco_f746ng/firmware.elf] Error 1 @Joel Bodenmann I then tried to use the BSP files provided in uGFX board directory, by adding the include path to gcc and leaving the board file as it was originally. I get billions of this kind of error messages (for every HAL driver file I guess): In file included from /home/jure/.platformio/packages/framework-stm32cube/f7/Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_conf.h:259:0, from /home/jure/.platformio/packages/framework-stm32cube/f7/Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal.h:46, from /home/jure/.platformio/packages/framework-stm32cube/f7/Drivers/CMSIS/Device/ST/STM32F7xx/Include/stm32f7xx.h:211, from /home/jure/.platformio/packages/framework-stm32cube/f7/Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_def.h:46, from /home/jure/.platformio/packages/framework-stm32cube/f7/Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_rcc.h:45, from /home/jure/Projects/ARMdev_stuff/uGFX/boards/base/STM32F746-Discovery/board_STM32LTDC.h:29, from src/gdisp_lld_STM32LTDC.c:94: /home/jure/.platformio/packages/framework-stm32cube/f7/Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_gpio.h:254:1: error: unknown type name 'HAL_StatusTypeDef'; did you mean 'SAI_Block_TypeDef'? HAL_StatusTypeDef HAL_GPIO_LockPin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin); ^~~~~~~~~~~~~~~~~ SAI_Block_TypeDef In file included from /home/jure/.platformio/packages/framework-stm32cube/f7/Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_conf.h:263:0, from /home/jure/.platformio/packages/framework-stm32cube/f7/Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal.h:46, from /home/jure/.platformio/packages/framework-stm32cube/f7/Drivers/CMSIS/Device/ST/STM32F7xx/Include/stm32f7xx.h:211, from /home/jure/.platformio/packages/framework-stm32cube/f7/Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_def.h:46, from /home/jure/.platformio/packages/framework-stm32cube/f7/Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_rcc.h:45, from /home/jure/Projects/ARMdev_stuff/uGFX/boards/base/STM32F746-Discovery/board_STM32LTDC.h:29, from src/gdisp_lld_STM32LTDC.c:94: /home/jure/.platformio/packages/framework-stm32cube/f7/Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_dma.h:160:3: error: unknown type name 'HAL_LockTypeDef' ... Compiling pio_builds/disco_f746ng/src/main.o In file included from /home/jure/.platformio/packages/framework-stm32cube/f7/Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_dma.h:630:0, from /home/jure/.platformio/packages/framework-stm32cube/f7/Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_conf.h:263, from /home/jure/.platformio/packages/framework-stm32cube/f7/Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal.h:46, from /home/jure/.platformio/packages/framework-stm32cube/f7/Drivers/CMSIS/Device/ST/STM32F7xx/Include/stm32f7xx.h:211, from /home/jure/.platformio/packages/framework-stm32cube/f7/Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_def.h:46, from /home/jure/.platformio/packages/framework-stm32cube/f7/Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_rcc.h:45, from /home/jure/Projects/ARMdev_stuff/uGFX/boards/base/STM32F746-Discovery/board_STM32LTDC.h:29, from src/gdisp_lld_STM32LTDC.c:94: /home/jure/.platformio/packages/framework-stm32cube/f7/Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_dma_ex.h:129:1: error: unknown type name 'HAL_StatusTypeDef'; did you mean 'HAL_DMA_StateTypeDef'? HAL_StatusTypeDef HAL_DMAEx_MultiBufferStart_IT(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t SecondMemAddress, uint32_t DataLength); ^~~~~~~~~~~~~~~~~ HAL_DMA_StateTypeDef ... Lastly, I copied the original BSP files (stm32746g_discovery_sdram.h / .c) to my projects /src and /inc folder -> and it compiles successfully. The pixels didn't show up on screen, but I guess I missed something in the GFX configuration/initialization.... @David Thomas I would love to see the BSP packages available as a PlatformIO library, but the one provided is only "mbed" compatible and I do NOT use mbed or any other RTOS (in future I plan to try FreeRTOS, but for learning purposes I want to stick to HAL+BSP). That's why I downloaded the stm32cube and included the BSP package path manually...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now