RT-Thread Startup and Memory Allocation

In AMP startup process, Linux and RT-Thread RTOS start up independently, with their configuration entry set in the DTS of U-Boot, which separates Linux domain and RTOS domain. In OpenSBI, each core will jump to a different address based on different configurations. RT-Thread does not jump to the second stage of U-Boot, but directly jumps from OpenSBI to RT-Thread.

RT-Thread Side

The rtthread.bin and u-boot.bin files of the RT-Thread are used together to generate visionfive2_fw_payload_amp.img, and SPL image u-boot-amp-spl.bin.normal.out will read this image to the starting physical address of DDR, which is 0×40000000. The components of this image are as follows:
Table 1. Memory Address Range
RT-Thread Side Range Memory Reclaim Linux kernel or not?
OpenSBI 0×40000000 - 0×401fffff 2M Always keep it
U-Boot (S Mode) 0×40200000- 0×4032ffff 1.19M Linux kernel will be reclaimed after startup
RT-Thread 0×6e800000 - 0×6effffff 8M First U-Boot SPL loads RT-Thread into memory, the starting address is 0x40330000, and then migrates to 0x6e800000. The 0x40330000 address will be reclaimed.

Linux Side

The Linux side has reserved 28M for AMP, with shared memory set to 4M. The memory distribution is as follows:
Table 2. Memory Address Range
Linux Side Range Memory
Shared Memory 0×6e400000 - 0×6e7fffff 4M
RT-Thread code, stack space 0×6e800000 - 0×6effffff 8M
RT-Thread code, stack space 0×6f000000 - 0×6fffffff 16M