Compartilhar via


MEMORY Section (Compact 2013)

3/26/2014

The kernel requires a memory table to identify a region of memory as either RAM or ROM, and the amount of RAM available for applications.

Syntax

Name        Address        Size        Type

Parameters

  • Name
    Identifies the name of the MEMORY region.

    There is no naming convention for this string; however, the name must be unique.

    There is a predefined section name called RESERVE, which you can use multiple times. RESERVE specifies a hole in a ROM image.

    Note

    For regions of type FIXUPVAR, the region name must include the module and variable names. An example of a FIXUPVAR memory region name is nk.exe:dwOALVariable.

  • Address
    Specifies the hexadecimal address in memory where the MEMORY region begins.
  • Size
    Specifies the size, in hexadecimal bytes, of the MEMORY region.
  • Type
    Specifies the type of memory.

    The following table shows the values for type of memory.

    Value

    Description

    FIXUPVAR

    Changes the value of a global kernel variable, and of kernel module variables, when Romimage is called.

    Romimage typically uses FIXUPVAR regions to fill in the location of the CHAIN file, but these can be used for other purposes.

    FIXUPVAR regions are case insensitive.

    NANDIMAGE

    Specifies that RAM should overlap these regions when building an run-time image that uses BINFS.

    The overlapping regions are stored in NAND but are fixed up to virtually appear as though they do not overlap.

    When the kernel accesses these regions, BINFS responds by intercepting the request. BINFS accesses NAND and returns the proper data to the kernel.

    This enables a device with NAND to execute in place out of NAND, freeing up RAM for use by the system.

    Romimage generates one binary (.bin) file for each NANDIMAGE entry.

    NANDIMAGE sections must be page aligned.

    RAM

    Specifies the range of virtual addresses available to the kernel for allocation to running processes and the RAM-based Windows Embedded Compact-based file system. The region must be contiguous.

    Do not reserve memory in the middle of a RAM section. Doing so creates two noncontiguous regions of memory, which is the maximum supported by Windows Embedded Compact.

    If you need to reserve memory in the middle of your RAM allocation, a portion of free RAM is reported in the Config.bib file and the rest is reported when the kernel calls OEMGetExtensionDRAM or pNKEnumExtensionDRAM.

    RAM sections must be page aligned.

    RAMIMAGE

    Specifies that the region should be treated like RAM. The memory addresses in this entry can physically correspond to RAM or to linear flash memory. This memory-type value is useful when loading the ROM image into RAM during the development process or when burning the run-time image onto a single ROM.

    The kernel copies all writable sections for an application into RAM and fixes the memory addresses prior to starting the application process.

    The name used to describe a RAMIMAGE section must be the same name used in the .bib file that specifies the modules and files to add to the run-time image.

    Romimage generates one .bin file for each RAMIMAGE entry.

    After you run Romimage, all noncompressed executable code is fixed up to run at a virtual address in slot 0, which is an address space created by the kernel.

    The actual source code resides in the address range specified in the corresponding RAMIMAGE entry.

    RAMIMAGE sections must be page aligned.

    RESERVED

    Specifies that a region of RAM or ROM is reserved.

    During run-time image creation, Romimage skips these reserved sections.

    This memory could be a video frame buffer or a direct memory access (DMA) buffer.

    EXTENSION

    Specifies that a region of the run-time image (.bin) file is used as a data area for a ROMHDR extension.

    The Name parameter is used for the Name field of the extension, and can be up to 24 characters in length.

    The Address parameter is used for the Type field of the extension.

    The Size parameter is used to specify the size of the reserved data area.

    Romimage leaves this area empty, and the Stampbin tool places arbitrary data in this area.

    For information, see Stampbin Tool and ROMHDR.

Example

The following code example shows a MEMORY region entry. The memory region for NK starts at the address 0x9f800000 and is 8 MB.

The RAM entry indicates that the region should be handled as RAM, is located in a RAM region starting at the address 0x80080000 and has a size of 0x00780000 (7,680 KB). This region becomes available to the kernel for allocation to the file system or object store, process virtual address spaces such as heaps and stacks, memory mapped files, and writable data sections.

The RAM entry tells the ROM Image Tool (Romimage.exe) to place any executables, modules, data files, and compressed sections in this region.

When Romimage executes, all noncompressed executable code is fixed up to run at a virtual address in slot 0, which is an address space created by the kernel, while the actual code is located in the region specified in the RAM entry.

Six memory regions are specified as reserved. These include the audio DMA buffer, AUD_MDD, the display-frame buffer, DISPLAY, and the driver global memory region, DRV_GLB.

The six memory regions are used, but are not part of the run-time image or RAM space.

In the MEMORY section, you can also specify a memory region that is not filled with run-time image data. This memory region uses the memory name RESERVE and specifies no memory type name.

This option is useful for implementing OEM diagnostics at the reset vector. In the previous example, 4 KB of run-time image space is reserved, starting at the address 0x9fc00000.

MEMORY
  NK        9f800000  00800000  RAMIMAGE 
; Only specify one RAMIMAGE section
; Reserve 4K at reset vector for boot loader and diagnostics
  RESERVE    9fc00000    00001000
  RAM       80080000  00780000  RAM 
; Common RAM regions
  AUD_MDD    80002000  00000800  RESERVED
  DISPLAY    80008000  00013000  RESERVED
  DRV_GLB    80020000  00001000  RESERVED
  DBGSER_DMA  80022000  00002000  RESERVED
  SER_DMA    80024000  00002000  RESERVED
  IR_DMA    80026000  00002000  RESERVED

Remarks

The MEMORY section of a .bib file, specified in Config.bib, reserves MEMORY regions by name. Each board support package (BSP) contains one copy of Config.bib.

See Also

Reference

Binary Image Builder (.bib) File

Other Resources

OEMGetExtensionDRAM