Hi,
Please try with below comments.
1. Define SDRAM Region in Linker Script: Add the following to your linker script to define the SDRAM region and place the GUI buffer there:
MEMORY
{
FLASH (rx) : ORIGIN = 0x60000000, LENGTH = 0x200000 /* 2MB */
SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x20000 /* 128KB */
SDRAM (rwx) : ORIGIN = 0x80000000, LENGTH = 0x100000 /* 1MB */
}
SECTIONS
{
.text :
{
*(.text*)
} > FLASH
.data :
{
*(.data*)
} > SRAM AT > FLASH
.bss :
{
*(.bss*)
} > SRAM
.guidata :
{
*(.guidata*)
} > SDRAM
.ApplicationRam :
{
*(.ApplicationRam*)
} > SDRAM
}
2. Initialize SDRAM in Bootloader: Ensure your bootloader initializes the SDRAM before using it:
void SDRAM_Init(void) {
// Configure SDRAM controller
// Example: Set timing parameters, refresh rate, etc.
// Initialize SDRAM
// Example: Perform precharge, refresh operations
}
int main(void) {
SDRAM_Init();
// Load and display bitmap
DisplayBitmap((uint8_t *)0x80000000);
// Check for bootloader or application entry
if (CheckForBootloaderEntry()) {
BootloaderEntry();
} else {
JumpToApplication();
}
while (1) {
// Main loop
}
}
3. Load and Display bitmap picture, define functions to load and display the bitmap for reference.
extern uint8_t _m_guidata_start;
extern uint8_t _m_guidata_end;
#define GUIDATA_SIZE (0x2FFFFF - 0x80000000)
void DisplayBitmap(uint8_t *bitmap) {
// Load bitmap data to SDRAM
LoadBitmapToSDRAM((const uint8_t *)FLASH_BITMAP_ADDRESS, (uint8_t *)0x80000000, GUIDATA_SIZE);
// Display bitmap
// Example: Call display driver function to show bitmap
}
void LoadBitmapToSDRAM(const uint8_t *source, uint8_t *dest, size_t size) {
memcpy(dest, source, size);
}
4. Jump to application, for examples (after 3-5 seconds to jump)
void JumpToApplication(void) {
uint32_t *app_vector_table = (uint32_t *)APP_START_ADDRESS;
SCB->VTOR = APP_START_ADDRESS;
__set_MSP(app_vector_table[0]);
void (*app_reset_handler)(void) = (void (*)(void))app_vector_table[1];
app_reset_handler();
}