Scatter Loading 은 Link 단계에서 Linker 에게 Scatter file을 던져줘서 원하는 메모리 영역에 위치시킬 수 있다. 그럼 언제 Scatter Loading 을 사용하는가?
1. Complex Memory Maps
위와 같은 image 는 simple memory map이다. 이를 scatter-loading description 을 작성해자.
LOAD_ROM 0x0000 0x8000 ; Name of load region (LOAD_ROM),
; Start address for load region (0x0000),
; Maximum size of load region (0x8000)
{
EXEC_ROM 0x0000 0x8000 ; Name of first exec region (EXEC_ROM),
; Start address for exec region (0x0000),
; Maximum size of first exec region (0x8000)
{
* (+RO) ; Place all code and RO data into
; this exec region
}
SRAM 0x10000 0x6000 ; Name of second exec region (RAM),
; Start address of second exec region (0x10000),
; Maximum size of second exec region (0x6000)
{
* (+RW, +ZI) ; Place all RW and ZI data into
; this exec region
}
}