cancel
Showing results for 
Search instead for 
Did you mean: 

ST Utility External Loader Example

gokhannsahin
Associate II

Hi everyone,

I have to write a custom external loader and reviewed the examples. The read text of these examples say that after the folder placed inside cube files, it will run seamlessly. However, I can't do this, it needs lots of files to build. Please help me.

Using example: N25Q512A_STM32F769I-EVAL

Placed folder: ..STM32Cube_FW_F7_V1.12.0\Projects\STM32F769I_EVAL\Examples\QSPI

Toolchain : SW4STM32

28 REPLIES 28

In the Keil and IAR world you just paste the project/files into the QSPI tree at the same depth as the other examples and build the project. The HAL files are all at the right relative addresses for this to work. Eclipse based tools might be a nightmare, wouldn't surprise me.

Building and testing these loaders is complicated. The ST-LINK Utilities aren't particularly robust, 4.2 definitely had issues, and code worked better in the STM32 Cube Programmer.

There are a whole host of things that can go wrong with the build and execution here.

I would strongly recommend testing all routines within your own code framework first, and then one that emulates that of the External Loader.

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

Keil and IAR aren't free so have to use eclipse based tools.

Well, Can the HAL library be used in external loader? Or can the delay and while loop in code cause a issue?

Many things cause issues here. Yes you can use HAL, it makes things rather large and creates a lot of dependencies. You can't use interrupts. Debugging and testing can also be quite challenging.

When you use free tools you end up bearing all of the support costs/tasks.​

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

For external loader, what should setting of SW4STM32 be? ST link Utility can't connect external memory, however, all functions were tested, all run correctly.

Also, For STM32H750, how should the linker be?

>>Also, For STM32H750, how should the linker be?

I don't think you'd need anything for the external loader, it fits in RAM

For apps you'd need to shrink FLASH and SRAM regions per specs, and move the initial stack pointer to the end of SRAM.

Don't have an H750 sample here for work from.

Would recommend using the STM32 Cube Programmer over the ST-LINK Utilities.

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

I have tried with it both Cube programmer and ST link Utilities, but I can't make. The used flash is W25Q32 and communicates via QuadSPI. I refer to N25Q512A_STM32F769I-EVAL example with IAR. All function run correctly, they were double-checked and the generated stldr file is seen under external loader list. However, while trying to connect the 0x90000000 address, it give a warning and says that can not access the memory. I changed the Dev_Inf.c for the used flash and linker as giving in N25Q512A_STM32F769I-EVAL example. Why do I get this warning?

In the all giving examples, the ram end address set the 0x21000000 address although is overflow. Why does the end address set this value? Is it a specific value for the external loader?

Linker:

define symbol __ICFEDIT_region_RAM_start__     = 0x20000004;
define symbol __ICFEDIT_region_RAM_end__       = 0x21000000;
 
define memory mem with size = 4G;
define region RAM_region   = mem:[from __ICFEDIT_region_RAM_start__   to __ICFEDIT_region_RAM_end__];
define region Dummy_region   = mem:[from 0 to 0x200];
 
define block RAM_BLOCK with fixed order {readonly code, readonly data, readwrite };
define block Info_BLOCK with fixed order { readonly data object Dev_Inf.o};
 
place in RAM_region   { block RAM_BLOCK };
place in Dummy_region { block Info_BLOCK };
 
do not initialize  { section .info, readwrite };

Dev_Inf.c // for W25Q32JV

#if defined (__ICCARM__)
__root struct StorageInfo const StorageInfo  =  {
#else
struct StorageInfo const StorageInfo  =  {
#endif
   "STM32H750_LOADER", 					                        // Device Name + version number
   NOR_FLASH,                                                        // Device Type
   0x90000000,                                                          // Device Start Address
   0x400000,                 						// Device Size in Bytes (64MBytes)
   0x100,                 						// Programming Page Size 16Bytes
   0xFF,                       						// Initial Content of Erased Memory
// Specify Size and Address of Sectors (view example below)
   0x00000040, 0x00010000,     				 		// Sector Num : 1024 ,Sector Size: 64KBytes
   0x00000000, 0x00000000,
};

The loader expects some non address specific image to load in SRAM, nominally at 0x20000004. The end point here isn't particularly important, the image needs to work with parts that might have different SRAM sizes. At the end of the day it must fit with space for other data.

The linker shouldn't see at section data for the 0x90000000 region. Sorry not using IAR here.​

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

@Community member​ Thank you for your interest.

Unfortunately, the Keil example is given in examples also can't work, it gives lots of errors while compiling, also the project settings in some examples is default settings of Keil, they have never been changed. I tried to generate myself a new project and set both the settings and the linker file as in another Keil example, at this time get the linker error. I'm confused about this problem and the project can't move forward. 

Linker Error:

0690X000006CLm2QAG.png

The Linker is given in examples :

FLASH_LOADER 0x20000004 PI   ; FlashLoader Functions
{
  PrgCode +0           ; Code
  {
    * (+RO)
  }
  PrgData +0           ; Data
  {
    * (+RW,+ZI)
  }
}
 
DEVICE_INFO +0               ; Device Info
{
  DevInfo +0           ; Info structure
  {
    dev_inf.o
  }
}

I've used this

DEVICE_INFO 0               ; Device Info
{
  DevInfo +0           ; Info structure
  {
    dev_inf.o
  }
}
 
FLASH_LOADER 0x20000004 ; FlashLoader Functions
{
  PrgCode +0           ; Code
  {
    * (+RO)
  }
  PrgData +0           ; Data
  {
    * (+RW,+ZI)
  }
}

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