STM32H747 and stldr for external NAND Flash. Why is the size not correct?
Hi,
I have written a STM32H747 external loader for a NAND Flash on the FMC bus of the CM7. The test software of the loader functions (Init, MassErase, SectorErase, ...) works perfectly. The functions are called correctly by the STM32CubeProgrammer. As a test of the functions, I forward the parameters of the function calls and the results to a UART and can thus debug the "internal" processes. The initialization and erase works perfectly. When programming a page there is now an unsolvable problem. The function
int Write( uint32_t Address, uint32_t Size, uint8_t *buffer )
gets values for Size that are much too large. The hex file to be programmed is about 303kB. The 303kB are divided into only two programming cycles:
1. Page programming address: 0x80000800 size: 0x0002502C
2. Page Programming Address: 0x8002582C Size: 0x00025000
Why is the size 0x0002502C or 0x00025000 and not 0x800 as defined?
The ext. NAND Flash starts at 0x8000'0000, the actual start is at 0x8000'0800.
Here the StorageInfo:
struct StorageInfo const StorageInfo = {
"MT29F1G08_HMI-MODEL-4",
NAND_FLASH,
0x80000000,
0x8000000,
0x800,
0xFF,
{ 0x00000400UL, 0x00020000UL,
0x000000UL, 0x000000UL }
};
Additional information about the environment:
- Keil IDE and Compiler V5 (Necessary, because V6 can't handle Scatter File Alignment 0x20000004, Alignment / 4 is not allowed).
- The loader is about 40kB in size, it has some software in it for bad block management of a NAND Flash.
- The similar loader (same backend) works perfectly with the Keil loader.
- I have tried ST-Link V2 and V3, it is the same behavior.
Why is the size not correct for page write access?
Thank you for your help.
