- IAR Embedded Workbench for RH850 3.20.x
- IAR C/C++ Development
- Linking your application
- Linking considerations
- Defining your own memory areas
Defining your own memory areas
In this section:
The default configuration file that you selected has predefined ROM and RAM regions. This example will be used as a starting-point for the following examples:
/* Define the addressable memory */ define memory Mem with size = 4G; /* Define a region named ROM with start address 0 and to be 64 Kbytes large */ define region ROM = Mem:[from 0 size 0x10000]; /* Define a region named RAM with start address 0x20000 and to be 64 Kbytes large */ define region RAM = Mem:[from 0x20000 size 0x10000];
Each region definition must be tailored for the actual hardware.
To find out how much of each memory that was filled with code and data after linking, inspect the memory summary in the map file (command line option ‑‑map).
Adding an additional region
To add an additional region, use the defineregion directive, for example:
/* Define a 2nd ROM region to start at address 0x80000 and to be 128 Kbytes large */ define region ROM2 = Mem:[from 0x80000 size 0x20000];
Merging different areas into one region
If the region is comprised of several areas, use a region expression to merge the different areas into one region, for example:
/* Define the 2nd ROM region to have two areas. The first with the
start address 0x80000 and 128 Kbytes large, and the 2nd with the start
address 0xC0000 and 32 Kbytes large */
define region ROM2 = Mem:[from 0x80000 size 0x20000]
| Mem:[from 0xC0000 size 0x08000];or equivalently
define region ROM2 = Mem:[from 0x80000 to 0xC7FFF]
–Mem:[from 0xA0000 to 0xBFFFF];