17.4.4. Setting up memory blocks

This example assumes that you have worked through Setting up a custom register , because it uses some of the configuration details set up in that example and saved in the board file.

This example describes how to set up two memory blocks that are activated at different times according to the value of a register. It uses the Newreg register created in Setting up a custom register . This is displayed in the MYREG tab in the Register pane.

This example also describes setting a memory rule to specify how the memory is used. When Newreg is zero, MEM2 is activated. Otherwise, MEM1 is used. The example is split into these sections, which must be executed in this sequence:

  1. Defining the memory blocks

  2. Defining the memory rules.

Defining the memory blocks

The first stage is to define the two Memory_blocks named MEM1 and MEM2:

  1. Ensure that RealView Debugger is not connected to a target.

  2. Expand the following entries of the selected board group:

    1. CONNECTION=RVI-ME

    2. Advanced_Information

    3. Default

    4. Memory_Block

  3. Right-click on the REGS entry, in the left pane, and select Make New... from the context menu (Figure 17.21).

    Figure 17.21. Creating a new memory block

    Creating a new memory block
  4. Enter a new name for this entry, for example MEM1, and click Create.

  5. Click on the MEM1 entry, in the left pane.

  6. Set the value of Start to 0x0. (This is the default.)

  7. Set the value of Length to 0x80000.

  8. Set the value of Description to Fast Static RAM.

  9. Set the value of Access entry to RAM. (This is the default.)

  10. Use Make Copy... on MEM1 to create a new group, MEM2.

  11. Click on the MEM2 entry, in the left pane, to display the settings values.

  12. Set the value of Access to ROM.

  13. Set the value of *Description to Slow Boot ROM.

Defining the memory rules

The second stage is to define the rules that control which memory block is used:

  1. Expand the Map_rule group.

    The map rule defines which memory block to use. In this example, MEM2 is activated if Newreg is set to zero. Otherwise MEM1 is used.

  2. Click on the Default entry.

  3. Set the value of Register to Newreg (use the context menu).

    Do not change the settings for Mask or Value.

  4. Set the value of On_equal to MEM1. (Figure 17.22).

    Figure 17.22. Creating a map rule

    Creating a map rule
  5. Rename the Default entry of Map_rule to RULE1.

  6. Use Make Copy... on RULE1, to create a new group, RULE2.

  7. Click on RULE2 and set the value of Value to 1.

  8. Set the value of *On_equal to MEM2. All board file entries are now complete (Figure 17.23).

    Figure 17.23. Settings for the second map rule

    Settings for the second map rule
  9. Select File → Save and Close to save the new settings and close the Connection Properties window.

  10. Connect to your target.

  11. In the Code window, select View → Pane Views → Registers to view the MYREG tab.

  12. Toggle the register value to activate the memory rule and so specify the memory block.

  13. Select View → Pane Views → Memory Map to view the Map tab, shown in Figure 17.24.

    Figure 17.24. New memory block in the Map tab

    New memory block in the Map tab
Copyright © 2003, 2004 ARM Limited. All rights reserved.ARM DUI 0234B
Non-Confidential