Other Parts Discussed in Thread: SYSCONFIG
Tool/software:
Hello,
Issues :
- The app works in debug mode but fails the release mode (when burn the app to the flash). The execution error at power ON as follows : (on terminal windows)
“Image loading done, switching to application …
ERROR : Bootloader rprcImageLoad: 317: Application image has a load address (0x70020000) in the SBL reserved memory range!!”
The issue was when need the HEAP memory needed beyond the capacity of MSRAM(2MB). So
In the Memory Configuration Section, under General I increase the heap size as :
And under Section, Memory Segments, I split across memories with DDR as :
My application is to read the user’s data in the flash region starting 0x100000 and ending at 0x280000 with the app to be programmed at 0x80000 as per “default_sbl_ospi.cfg” file. In my application I will load this user’s data into the pointer variable (in the heap memory).
With this configuration, I can malloc the pointer variable in my application and it works fine with
the debug mode. But it fails the app at Power ON when burning the release to the flash as shown.
- The remedy for the flash execution problem was to reduce the heap to fit in MSRAM for the app to work with flash and not using the extension into DDR4 above is to transfer the user’s data in chunks and mimic the flash read of “ospi_flash_io” example. Here is the information :
#define APP_OSPI_FLASH_BASE (0x100000) // start address of User’s data
#define HEAP_SIZE (262144U)
#define APP_DATA_SIZE (1241804U) // This is User’s data size in the flash
uinit32_t quotient, remainder, byteUsed;
uint8_t *prgmBuffer __attribute__((aligned(32U))) = (unit8_t *)malloc(HEAP_SIZE);
// so the heap for the pointer *prgmBuffer is now reduced
……
quotient = APP_DATA_SIZE/HEAP_SIZE;
remainder = APP_DATA_SIZE % HEAP_SIZE;
// Now is the loop to get the data in chuck from flash each of 256KB instead of one big heap of
// more than 1.5MB
for (uint8_t loopcnt = 0; loopcnt <(quotient+1); coopcnt++)
{
byteUsed = (loopcnt == quotient)? remainder : HEAP_ZISE
offset = APP_OSPI_FLASH_BASE + (loopcnt*HEAP_SIZE);
Flash_offsetToBlkPage(gFlashHandle[CONFIG_FLASH0], offset, &blk, &page);
status = Flash_read(gFlashHandle[CONFIG_FLASH0], offset, prgmBuffer, byteUsed);
…….
// application code continues
…….
} // the offset is page alignment for sure
The problem was the loop runs the first loopcnt = 0 and then for the second loop the Flash_read() was hanged (with break point verification). So added the Flash_Reset(gFlashHandle[CONFIG_FLASH0]) before Flash_offsetToBlkPage() to no avail.
As per “ospi_flash_io” the example code the flash read of the second offset was fine and don’t know why it was stucked here.
I need help how to resolve this.
- This is minor but curious. The setting of Memory Region for FLASH in the sysconfig was :
Start Address : 0x60100000
Size : 0x80000
What is it at 0x60100000 instead of even boundary of 0x60000000 and why the size only 0x80000 (512K) instead of 0x4000000 (64MB or 512Mbit) of the device on the board ?