cancel
Showing results for 
Search instead for 
Did you mean: 

How to building a custom external loader for a custom board based on a STM32F4 MCU?

eric.hsu
Associate II

Hi, community:

I'm working on a custom board based on a STM32F7 MCU,which I have use the MCU is STM32F750Z8T6 and spi flash is W25Q064AJVSSIQT(Winbond).

But the assets (images, font ...) are too large to be loaded into the memory of the MCU and have to be loaded directly into the external flash.

For this issue I need the external loader which will allow the STM32 ST-LINK Utility & STM32CubeProgrammer to load the code into the external flash.

In order to the STM32 ST-LINK Utility & STM32CubeProgrammer can load the code into the external flash.

I have find the example: "N25Q512A_STM32F769I-EVAL external loader example", that I was to try modify and then it working fine.

At the same time, I'm working on another custom board based on a STM32F4 MCU with the framework, this custom board I have use the MCU is the STM32F446ZET6 and spi flash is W25Q064AJVSSIQT(Winbond).

So, I also need the external loader which will allow the STM32 ST-LINK Utility & STM32CubeProgrammer to load the code into the external flash.

But, I can't find any external loader example let me to modify for STM32H series or STM32F series or STM32L series MCU, because I am using these series MCU.

Thanks in advance.

7 REPLIES 7
eric.hsu
Associate II

Can anyone answer me this question?

Thanks in advance.

Sounds like several hours of work, not something I'd be interested in doing for free.

External loaders are a concept, you might have to code them based on the idea rather than cut-n-paste some prepackaged example.​ the framework is reasonably well defined. I'm open to reasonable offers.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

I have referred to the following documents:

1. "AN4760": 4.1.1 Programming QSPI Flash memory using the STM32 ST-LINK utility

2. "UM0892": 3.9 Developing customized loaders for external memory

3. "UM2237": 2.3.3 Developing customized loaders for external memory

I used the example and modified it into a custom external loader for the STM32F750Z8T6 and it works fine.

(Example: C:\Program Files (x86)\STMicroelectronics\STM32 ST-LINK Utility\ST-LINK Utility\ExternalLoader\N25Q512A_STM32F769I-EVAL)

I used the example and modified it into a 32L476G-DISCO custom external loader, but it didn't work.

(Example: C:\Program Files (x86)\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin\ExternalLoader\N25Q256A_STM32L476G-EVAL_Cube)

What are the key points that I didn't notice?

eric.hsu
Associate II

I used the external loader example: "N25Q512A_STM32F769I-EVAL", that I tried to modify in to STM32F446ZET6 and it worked fine.

I used the external loader example: "N25Q256A_STM32L476G-EVAL_Cube", that I tried to modify in to STM32L476G-DISCO and it worked fine.

Eric

I am also trying to write an ext. Loader for the F723 quad spi flash.

It can read but not erase nor write.

Can you tell what you did to make the example from F769I-EVAL run? HAL_Delay() does not work for me, so the timings in the QUAD functions may fail, too?

Which address does the CubeProgrammer send to write() and erase(). Is it the 0x90000xxxx address or does it start from 0x000000?

I am pretty frustrated. There is no serious documentation from ST that really tells how to make it with CubeIDE.

Erwin

It only calls the routines if they are within the scope of memory you describe in your header info. I'm not sure ST is 100% consistent (implementation is a dogs breakfast using libraries they claim don't exist, that's why the docs are really sketchy), they generally mask the addresses in their own implementation as the value passed to the QSPI device via commands doesn't need to see the high order bits.

You cannot use interrupts or SysTick, you need to manage elapsed time via a timer or counter.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
ELink.1
Associate

Eric

meanwhile I have my external QSPI loader running with CubeProgrammer for an F723 (limited to a 16 MByte Flash, i.e. only 24 address bits used). The sample code was for an F769 and did not work originally due to various issues and errors.

For those who are interested, here come some vital things:

  1. The addresses coming from CubeProgrammer are in the range 0x90000000 +x , i.e in the two functions Write() and SectorErase() you must subtract 0x90000000 from each of the addresses passed to the functions. Don't use other masking.
  2. Instead of calling HAL_Resumetick() and HAL_Suspendtick() I simply called Init() at the beginning of Write() and SectorErase(). The Systemtick seems to keep running. This makes "debugging" much easier and all HAL..() needed for the quadspi work as intended.
  3. Be consequent: if you put the spi flash in QPI (quad) mode, then you should also setup commands and statusreq in qpi mode (InstructionMode, DataMode, AddressMode = ..4_LINES).
  4. Still struggeling with the StorageInfo in Dev_Inf.c. Avoid blanks in the devicename (not sure if it caused an issue, but thought so). Not sure about using uint32_t instead of unsigned long etc. . So I am using the long types.
  5. Verify() seems to work well, but you must enable memory mapped mode first thing within Verify(). So no address translation needed here.
  6. No main.c needed, no while(1) loop. Init() must terminate and return 1 or 0;
  7. The linker file ***.ld is vital but the demo file work ok apart from the RAM size that I had to adapt (see below).
  8. Init() can look as below.

Have fun

Erwin