Linker scripts – Comtrol eCos User Manual

Page 295

Advertising
background image

Chapter 9. HAL Interfaces

HAL_XCACHE_INVALIDATE()

Invalidates all cache lines in the region. Any dirty lines are invalidated without being written to memory.

HAL_DCACHE_STORE()

Writes all dirty lines in the region to memory, but does not invalidate any lines.

HAL_DCACHE_READ_HINT()

Hints to the cache that the region is going to be read from in the near future. This may cause the region to be

speculatively read into the cache.

HAL_DCACHE_WRITE_HINT()

Hints to the cache that the region is going to be written to in the near future. This may have the identical

behavior to HAL_DCACHE_READ_HINT().

HAL_DCACHE_ZERO()

Allocates and zeroes lines in the cache for the given region without reading memory. This is useful if a large

area of memory is to be cleared.

Linker Scripts

When an eCos application is linked it must be done under the control of a linker script. This script defines the
memory areas, addresses and sized, into which the code and data are to be put, and allocates the various sections
generated by the compiler to these.

The linker script actually used is in

lib/target.ld

in the install directory. This is actually manufactured out of

two other files: a base linker script and an

.ldi

file that was generated by the memory layout tool.

The base linker script is usually supplied either by the architecture HAL or the variant HAL. It consists of a set of
linker script fragments, in the form of C preprocessor macros, that define the major output sections to be generated
by the link operation. The

.ldi

file, which is

#include’ed

by the base linker script, uses these macro definitions

to assign the output sections to the required memory areas and link addresses.

The

.ldi

file is supplied by the platform HAL, and contains knowledge of the memory layout of the target platform.

These files generally conform to a standard naming convention, each file being of the form:

pkgconf/mlt_

<

architecture

>

_

<

variant

>

_

<

platform

>

_

<

startup

>

.ldi

where

<

architecture

>

,

<

variant

>

and

<

platform

>

are the respective HAL package names and

<

startup

>

is the startup type which is usually one of

ROM

,

RAM

or

ROMRAM

.

In addition to the

.ldi

file, there is also a congruously name

.h

file. This may be used by the application to access

information defined in the

.ldi

file. Specifically it contains the memory layout defined there, together with any

additional section names defined by the user. Examples of the latter are heap areas or PCI bus memory access
windows.

The

.ldi

is manufactured by the Memory Layout Tool (MLT). The MLT saves the memory configuration into a

file named

include/pkgconf/mlt_

<

architecture

>

_

<

variant

>

_

<

platform

>

_

<

startup

>

.mlt

191

Advertising