3.6.5. Setting up memory blocks

This example uses the connection created in Setting up an Integrator board and core module. However, the AP and CM940T board groups are removed to ensure a default memory mapping.

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 IND1 is set to Enabled, 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. Select Target ? Connect to Target... to display the Connection Control window.

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

  3. Right-click on the MP3Player entry and select Connection Properties... from the context menu.

  4. Expand the following entries in turn:

    1. CONNECTION=MP3Player (change as required)

    2. Advanced_Information

    3. Default

    4. Memory_Block

  5. Right-click on the REGS entry, in the left pane, and select Make New... from the context menu to see the prompt shown in Figure 3.34.

    Figure 3.34. Creating a new memory block

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

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

  8. Set the value of Start to 0x0 (this is the default).

  9. Set the value of Length to 0x80000.

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

  11. Set the value of Access entry to RAM (this is the default).

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

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

  14. Set the value of Access to ROM.

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

  16. Select File ? Save Changes to save the these changes.

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 IND1 is set to Enabled (one). Otherwise MEM1 is used.

  2. Click on the Default entry.

  3. Set the following values, shown in Figure 3.35:

    • Register to Newreg (use the context menu).

    • Mask to 0x0001 (to check IND1 value only)

    • Value to 0 (IND1 set to Disabled)

    • On_equal to MEM1.

    Figure 3.35. Creating a map rule

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

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

  6. Click on RULE2 and set the value of Value to 1 (IND1 set to Enabled).

  7. Set the value of *On_equal to MEM2, shown in Figure 3.36.

    Figure 3.36. Settings for the second map rule

    Settings for the second map rule

    All board file entries are now complete.

  8. Select File ? Save and Close to save your changes and close the Connection Properties window.

  9. Connect to your target.

  10. In the Code window, select View ? Registers to view the MYREG tab.

  11. Select View ? Memory Map tab to view the Map tab, shown in Figure 3.37.

    Figure 3.37. New memory block in the Map tab

    New memory block in the Map tab
  12. Set the IND1 value to Enable to activate the memory rule (RULE2) and so change the memory map. The Start entry in the Map tab changes to a ROM entry, indicated by a yellow icon.

Copyright © 2002-2005 ARM Limited. All rights reserved.ARM DUI 0182G