cancel
Showing results for 
Search instead for 
Did you mean: 

Size of the file read by ROM code

Stnoobs
Associate II

Hello,

I am developing on the STM32MP131FAE board in a bare-metal environment.

This chip does not have internal Flash, so I am planning to load a bin file from external Flash at initial boot.

The Flash will store two bootloaders and two main firmware images.

I understand that when the boot mode pin is set to Flash boot, the ROM code reads data from the external Flash and copies it to the sysram. I have confirmed that it successfully runs bootloader 1 stored in the external Flash.

The reason for splitting the bootloader into two parts is due to the sysram size, which is only 128KB. Since the bootloader is expected to exceed 128KB, I plan to execute bootloader 1 first and then jump to bootloader 2.

 

 question:

What is the maximum size that the ROM code can read from the external Flash? If I can reduce the bootloader to within 128KB, I plan to combine it into a single file, but I have not been able to find information on the maximum number of bytes that the ROM code can read.

1 REPLY 1
peteryan29
Visitor

For the STM32MP1 series like your STM32MP131FAE, the ROM code doesn’t have a specific file size limit per se, but it’s constrained by the 128KB of SysRAM it can use. This means that, practically speaking, the ROM code will load whatever fits into that 128KB space. So, if your bootloader can be kept under 128KB, you’re good to go as a single file; the ROM code will load and execute it without needing any extra stages.

Since you’re working with a bootloader larger than 128KB, splitting it into two parts like you mentioned is actually a tried-and-true method with STM32MP1 chips. The ROM will handle bootloader 1, and then you can have that jump to bootloader 2 to finish the process. The ROM code just loads what it can into SysRAM and doesn’t do a full check on file size beforehand—it simply stops at the 128KB limit. wiek

If you want to avoid splitting, look into minimizing the bootloader size by focusing on essentials, optimizing code, or maybe even compressing sections if that’s an option. But bottom line, 128KB is your effective max for any single load into SysRAM.