Skip to main content
Visitor II
October 31, 2018
Question

ST Utility External Loader Example

  • October 31, 2018
  • 11 replies
  • 6822 views

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

    This topic has been closed for replies.

    11 replies

    Graduate II
    October 31, 2018

    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.

    Visitor II
    November 1, 2018

    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?

    Graduate II
    November 1, 2018

    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.​

    Visitor II
    November 5, 2018

    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?

    Graduate II
    November 5, 2018

    >>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.

    Visitor II
    November 7, 2018

    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,
    };

    Graduate II
    November 7, 2018

    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.​

    Visitor II
    November 9, 2018

    @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
     }
    }

    Graduate II
    November 10, 2018

    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)
     }
    }

    Visitor II
    November 12, 2018

    Thank you @Community member​ 

    It works to build the project. However, it isn't still connected the external flash. Where do I mistake, please review my project ? All function run correctly, all has been double-checked.

    Graduate II
    November 13, 2018

    Rebuilt based on understanding of the required functionality.

    Assuming use of STM32 Cube Programmer tool.

    Visitor II
    November 13, 2018

    Thank you, but it doesn't work. Again not connected to the external memory or erase it. I have checked the CS pin afterclicked the erase sector button on STCube Programmer. However, I don't see any changes this pin.

    Visitor II
    November 16, 2018

    I have tried set the a LED when Cube programmer calls the init function, but noticed that it never calls init function. Why? I set wrong setting of Keil?

    Also, does it need a program is on internal flash in order to program the external memory with loader? Or not need, so the MCU can be empty?

    Visitor II
    March 4, 2019

    Did you manage to solve the problem? I am having the same issue. I am replicating the external loader of STM32H743I-EVAL with single Bank QSPI and facing the same issue.

    Graduate II
    March 4, 2019

    Been several months, would need to dig up the notes/code. I do have an STM32H743I-EVAL and means to debug the loaders. Did have the NOR loader working, and have built QSPI loaders for a couple of the platforms. ST makes the process long, difficult and expensive.

    Visitor II
    March 5, 2019

    Using TrueStudio I managed to make QSPI loader work in STM32F746G-DISCO. Well of course they have provided the example code in ST-Link Utility but I am using STMCubeProgrammer. On trying the same procedure in STM32H743I-EVAL, the Loader is not able to read,Write or Erase. I tried to debug by switching LED ON (as above mentioned) in INIT function, but the function is not called at all from linker file.

    Visitor II
    October 4, 2019

    Hi @bonumaster​ 

    I can't get the external loader for my custom STM32F767II board working. I've also tried to make the QSPI loader for STM32F746G-DISCO and didn't get it working.

    Is there something specially I need to set to get it working for the disovery board?

    Regards

    Dejan

    Graduate II
    October 4, 2019

    I've rebuilt a number of these.

    Please indicate the specific make/model of Flash IC, along with the specific pins on the STM32 being used.​