cancel
Showing results for 
Search instead for 
Did you mean: 

what are all the things I need to create my external loader

Arman Ilmak
Senior

Hey guys

Im using stm32h743 and nand flash connected with fmc.

I searched to see how I can create my own external loader for nand(i couldnt find any for nand flash).

I think i just need to adapt Loader_Src.c file to nand flash hal function and a linker to build the .stldr?

Am I on a right way?

1 ACCEPTED SOLUTION

Accepted Solutions

Step#1 is to build and thoroughly test a BSP from your application space. All the read, write, erase, ECC generation/checking, and correction.

Then map that functionality into the loader and the function entry points that has for these operations.

External Loaders are hard to debug, you're not going to be able to step around with a debugger to solve issues. You can however use whatever board resources you have to output to serial ports, GPIO, LED's, etc.

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

View solution in original post

3 REPLIES 3

Step#1 is to build and thoroughly test a BSP from your application space. All the read, write, erase, ECC generation/checking, and correction.

Then map that functionality into the loader and the function entry points that has for these operations.

External Loaders are hard to debug, you're not going to be able to step around with a debugger to solve issues. You can however use whatever board resources you have to output to serial ports, GPIO, LED's, etc.

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

I do know that the following code passes which includes enabling memory mapped mode (see bold).  I also have been using these same quadspi drivers in my application that uses TouchGFX in memory mapped mode as well, so I do know memory mapped mode must be working with TouchGFX, right??  You actually created an external loader for me for this part that I've been using for quite a while but needed to develop my own to support other alternate Flash parts in the future.

uint8_t buffer_test[MEMORY_SECTOR_SIZE];
uint32_t var = 0;

CSP_QUADSPI_Init();

for (var = 0; var < MEMORY_SECTOR_SIZE; var++) {
  buffer_test[var] = (var & 0xff);
}

for (var = 0; var < SECTORS_COUNT; var++) {

    if (CSP_QSPI_EraseSector(var * MEMORY_SECTOR_SIZE,
       (var + 1) * MEMORY_SECTOR_SIZE - 1) != HAL_OK) {

        while (1)
        ; //breakpoint - error detected
    }

    if (CSP_QSPI_WriteMemory(buffer_test, var * MEMORY_SECTOR_SIZE, sizeof(buffer_test)) != HAL_OK) {

        while (1)
        ; //breakpoint - error detected
    }

}

if (CSP_QSPI_EnableMemoryMappedMode() != HAL_OK) {

    while (1)
    ; //breakpoint - error detected
}

for (var = 0; var < SECTORS_COUNT; var++) {
    if (memcmp(buffer_test,
       (uint8_t*) (0x90000000 + var * MEMORY_SECTOR_SIZE),
       MEMORY_SECTOR_SIZE) != HAL_OK) {
        while (1)
       ; //breakpoint - error detected - otherwise QSPI works properly
    }
}

https://community.st.com/t5/stm32-mcus-products/stm32h743-external-loader/td-p/639396

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