Skip to main content
Visitor II
November 13, 2021
Solved

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

  • November 13, 2021
  • 1 reply
  • 1460 views

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?

    This topic has been closed for replies.
    Best answer by Tesla DeLorean

    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.

    1 reply

    Graduate II
    November 13, 2021

    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.

    Graduate II
    February 13, 2024

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