Книга: Real-Time Concepts for Embedded Systems

2.4.3 Example in Practice

2.4.3 Example in Practice

Consider an example system containing 256 bytes of ROM, 16KB of flash memory, and two blocks of RAM. RAMB0 is 128KB of SDRAM, and RAMB1 is 2MB of DRAM. An embedded application with a number of sections, as listed in Table 2.3, needs to be mapped into this target system.

Table 2.3: Example embedded application with sections.

Sections Size Attribute[1] Description
_loader 10KB RD Contains the loader code
_wflash 2KB RD Contains the flash memory programmer
.rodata 128 bytes RD Contains non-volatile default initialization parameters and data, such as copyright information
.sbss 10KB R/W Contains uninitialized data less than 64KB (e.g., global variables)
.sdata 2KB R/W Contains initialized data less than 64KB
.bss 128KB R/W Contains uninitialized data larger than 64KB
.data 512KB R/W Contains initialized data larger than 64KB
_monitor 54KB RD Contains the monitor code
.text 512KB RD Contains other program code 

One possible allocation is shown in Listing 2.5; it considers why an embedded engineer might want greater section allocation control.

Listing 2.5: Possible section allocation.

MEMORY {
 ROM: origin = 0x00000h, length = 0x000100h
 FLASH: origin = 0x00110h, length = 0x004000h
 RAMB0: origin = 0x05000h, length = 0x020000h
 RAMB1: origin = 0x25000h, length = 0x200000h
}
SECTION {
 .rodata: › ROM
 _loader: › FLASH
 _wflash: › FLASH
 _monitor: › RAMB0
 .sbss (ALIGN 4): › RAMB0
 .sdata (ALIGN 4): › RAMB0
 .text: › RAMB1
 .bss (ALIGN 4): › RAMB1
 .data (ALIGN 4): › RAMB1
}

This program allocation is shown in Figure 2.8. The section allocation strategies applied include the following:

· The .rodata section contains system initialization parameters. Most likely these default values never change; therefore, allocate this section to ROM.

· The loader program is usually part of the system program that executes at startup. The _loader and the _wflash sections are allocated into flash memory because the loader code can be updated with new versions that understand more object formats. You need the flash memory programmer for this purpose, which can also be updated. Therefore, section _wflash is allocated into the flash memory as well.

· The embedded programmer interacts with the monitor program to probe system execution states and help debug application code; therefore, it should be responsive to user commands. SDRAM is faster than DRAM, with shorter access time. Therefore, section _monitor is allocated into RAMB0.

· RAMB0 still has space left to accommodate both sections.sbss and.sdata. The allocation strategy for these two sections is to use the leftover fast memory fully.

· The remaining sections (.text, .bss, and .data) are allocated into RAMB1, which is the only memory that can accommodate all of these large sections.


Figure 2.8: Mapping an executable image into the target system.

Оглавление книги


Генерация: 1.488. Запросов К БД/Cache: 3 / 0
поделиться
Вверх Вниз