13.4.4. Setting up a custom register

This example describes the steps to follow to specify a register MYREG, that appears as a new tab in the Register pane. It also describes how to set up named bit fields in this register. To set up the custom register, you must make changes in the Memory_block, Register, Register_enum, and Register_Window groups.

Note

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

If you have set up a memory map as described in Configuring a memory map, then delete the SSRAM entry before you begin.

In this example:

The example is split into the following sections, which must be executed in this sequence:

  1. Setting up the configuration

  2. Creating enumerations for the register values

  3. Creating the register descriptions

  4. Creating the register tab

  5. Displaying the register.

Setting up the configuration

In this stage, you set up a memory group that provides the base address for the new registers:

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

  2. Select Target → Connect to Target... to display the Connection Control window.

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

  4. If the connection has the linked board files from Setting up an Integrator board and core module, right-click on the *BoardChip_name AP setting in the right pane, and select Delete from the context menu.

    Repeat this for the *BoardChip_name CM940T setting.

  5. Expand the following entries in turn:

    1. CONNECTION=MP3Player (change as required)

    2. Advanced_Information

    3. Default

  6. Expand the Memory_block group.

  7. If the connection has the SSRAM memory block defined from Configuring a memory map, right-click on the SSRAM entry in the left pane, and select Delete from the context menu.

  8. Rename the Default entry under Memory_block to REGS.

  9. Click on the REGS entry, in the left pane, to display the group contents.

  10. Set the value of Start, in the right pane, to 0x10000000.

  11. Set the value of Length to 0x800000.

  12. Set the value of Description to I/O Registers, (shown in Figure 13.23).

    Figure 13.23. Configuring REGS

    Configuring REGS
  13. Select File → Save Changes to save the these changes.

Creating enumerations for the register values

In this stage you set up enumerations, or names for specific values, that are used when the register value is displayed:

  1. Expand Register_enum in the left pane.

  2. Right-click on Register_enum and select Make New... to create a new group. Name this E_SWITCH.

  3. Click on the E_SWITCH entry, in the left pane, to display the group contents.

  4. Set the value of Names, in the right pane, to On,Off.

    Note

    By default, enumerations are numbered 0,1,2,.... However, if you want to give your enumerations specific values, specify them as “enum1=val1,enum2=val2,...”. For this example, if you want On to equal 7 and Off to equal 0 (zero), then enter “On=7,Off=0”.

  5. Rename the Default entry under Register_enum to E_ENABLE.

  6. Click on the E_ENABLE entry, in the left pane, to display the group contents.

  7. Set the value of the Names entry, in the right pane, to Disable,Enable, shown in Figure 13.24.

    Figure 13.24. Creating enumerations

    Creating enumerations
  8. Select File → Save Changes to save the these changes.

Creating the register descriptions

In this stage you create descriptions of each register:

  1. Expand the Register group.

  2. Rename the Default entry under Register to Newreg.

  3. Select the Newreg group.

  4. Set the value of Base to REGS.

  5. Set the value of Start to 0x20, that is the offset from the base address of the REGS memory block.

  6. Expand the Newreg group.

  7. Expand the Bit_fields group. You are now going to set up four bit fields.

  8. Rename the Default entry under Bit_fields to IND1.

  9. Use Make Copy... on IND1. The dialog suggests the name IND2. Click Create.

  10. Use Make Copy... on IND2. The dialog suggests the name IND3. Click Create.

  11. Use Make Copy... on IND3. The dialog suggests the name IND4. Click Create.

  12. Click IND1, in the left pane and set these values, shown in Figure 13.25:

    • Position=0 (this is the default)

    • Size=1

    • Enum=E_ENABLE.

    Figure 13.25. Creating bit field descriptions

    Creating bit field descriptions
  13. Click on the IND2 entry and set these values:

    • Position=1

    • Size=1

    • Enum=E_SWITCH.

  14. Click on the IND3 entry and set these values:

    • Position=2

    • Size=4.

  15. Click on the IND4 entry and set these values:

    • Position=6

    • Size=4.

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

Creating the register tab

In this stage you create a Register_Window group to display the new register in the Register pane:

  1. Expand the Register_Window group.

  2. Rename the Default entry under Register_Window to MYREG. This is the name of the new tab in the Register pane.

  3. Click on MYREG, in the left pane.

  4. Click on MYREG, in the left pane.

  5. Set the Line entry, to Newreg.

  6. Use Make New... on *Line to create a new *Line entry.

  7. Set the *Line entry, to _INDICATORS. Literals entered in *Line (or Line) must be preceded by an underscore.

  8. Use Make New... on *Line “_INDICATORS” to create a new *Line entry.

  9. Set the new *Line to IND1,IND2,IND3,IND4.

    The Connection Properties window looks like Figure 13.26.

    Figure 13.26. The MYREG group

    The MYREG group

    All board file entries are now complete.

  10. Select File → Save and Close to save your changes and close the Connection Properties window.

Displaying the register

In the last stage, display the new register in the Register pane:

  1. Connect to your target.

  2. Select View → Registers to view the new tab, MYREG, shown in Figure 13.27.

    Figure 13.27. MYREG in the Register pane

    MYREG in the Register pane
Copyright © 2005, 2006 ARM Limited. All rights reserved.ARM DUI 0281C
Non-Confidential