cancel
Showing results for 
Search instead for 
Did you mean: 

[STM32H743] How to flash LVGL assets to external flash (W25Q64) using OpenOCD?

JontyLi
Associate II

Hello everyone,

I'm a beginner in embedded systems and I'm trying to flash my LVGL UI resources to the external QSPI flash (a W25Q64) on an STM32H743IIT6 using OpenOCD. I'm running into some issues with OpenOCD detecting the flash.

Here is what I have done so far:

  1. Linker Script (.ld): I have defined the external flash memory region in my linker script and created a section named .lvgl_assets that points to this external flash address.

  2. Data Placement: I'm using __attribute__((section(".lvgl_assets"))) in my code to place the UI resource data into this specific section.

  3. Binary File: I have successfully generated a separate .bin file that contains only the data from the .lvgl_assets section.

My goal is to flash this .bin file to the W25Q64.

My OpenOCD Problem:

I am using the stm32h7x.cfg target file provided by OpenOCD. I saw that it contains a QSPI driver, so I added the following line to my config:

set QUADSPI 1

I then run OpenOCD with:

openocd -f interface/cmsis-dap -f target/stm32h7x.cfg

After it connects, I execute flash list in the telnet console, and this is the output:

{
    name       stm32h7x.bank1.cpu0
    driver     stm32h7x
    base       0x08000000
    size       0x100000
    bus_width  0
    chip_width 0
    target     stm32h7x.cpu0
}
{
    name       stm32h7x.qspi
    driver     stmqspi
    base       0x90000000
    size       0x0
    bus_width  0
    chip_width 0
    target     stm32h7x.cpu0
}

As you can see, the QSPI flash (stm32h7x.qspi) is listed, but its size is 0x0.

When I try to get more information by running flash info 1, I get the following error:

No QSPI, no OCTOSPI at 0x52005000
No QSPI, no OCTOSPI at 0x52005000
error retrieving flash info
#1 : stmqspi at 0x90000000, size 0x00000000, buswidth 0, chipwidth 0

QSPI flash bank not probed yet

I am confident that my external flash hardware (W25Q64) is wired correctly and is functional.

It seems OpenOCD is failing to probe or initialize the QSPI flash. Am I missing a configuration step? How can I properly configure OpenOCD to recognize the W25Q64 and allow me to flash my .bin file to it?

Thank you for any help you can provide!

1 ACCEPTED SOLUTION

Accepted Solutions

could this issue be related to the QSPI memory-mapped mode being enabled within my internal program?

It is unlikely. The debugger usually resets the MCU on connection so the memory-mapped mode resets.

So you already have the QSPI flash working in your program. To bypass all the nuisances of "external loaders" you can write another small program that uses the OpenOCD semihosting (see here) to read the data files from your PC and write to the flash.

 

View solution in original post

8 REPLIES 8
Andrew Neil
Super User

Have you tried asking at https://forum.lvgl.io/ ?

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

My apologies, I did have a look, but I wasn't able to find any related posts on the LVGL forum.

It also seems to me that the core of this issue is more about flashing data to the QSPI-driven external flash using OpenOCD, rather than a problem specific to LVGL itself. That is why I haven't posted this query on the LVGL forum.

Pavel A.
Super User

Do you already have the QSPI flash driver for your program? You'll need it anyway to access the flash.

 

Yes, the driver is ready. It has been tested and confirms that the external flash can be read and written to correctly.

As a follow-up question, could this issue be related to the QSPI memory-mapped mode being enabled within my internal program?

could this issue be related to the QSPI memory-mapped mode being enabled within my internal program?

It is unlikely. The debugger usually resets the MCU on connection so the memory-mapped mode resets.

So you already have the QSPI flash working in your program. To bypass all the nuisances of "external loaders" you can write another small program that uses the OpenOCD semihosting (see here) to read the data files from your PC and write to the flash.

 

Thanks, I will try this solution. If I have more questions later, can I reply here for more help?

Hi @JontyLi 

If you still have issues, do not hesitate to return to the Community, either by creating new threads or continuing this one (if related to the same initial topic). You are welcome.

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

I am trying, please give me some more time.