How do I set up two memory blocks to be active at different times ?

This example describes the steps that you should follow to set up two memory blocks that are activated at different times according to the value of a register. It uses the register MYREG set up in the example Set up a custom register, and assumes that you have worked through the example to set it up.

Two memory blocks MEM1 and MEM2 are set up. MEM1 is activated when MYREG is zero, MEM2 is activated when MYREG has a value of one.

1.   Open RealView Debugger without connecting to a target.

2.   Select Connection Properties… from the Code window Target menu to display the Connection Properties window.

3.   Expand the entries until you have the Advanced Information block for the relevant CONNECTION group:

image\myrireg1.gif

4. Click image\plus.gif in the left pane to expand the Memory_block group:

image\regs.gif

5. Right-click on REGS under Memory_block to display a context menu.

6. Select Make New….

7. Enter a name for the new entry. In this example it is MEM1.

A new group is created, with default settings.

8. Click MEM1 to display the settings in the right pane.

9. Right-click on Start, and select Edit Value. Enter a value of 0x10900000.

10. Right-click on Length, and select Edit Value. Enter a value of 0x40000.

11. Right-click on Access, and select Flash.

12. Right-click on Description, and select Edit Value. Enter Custom FLASH.

13. Right-click on MEM1 under Memory_block, and select Make Copy… from the context menu.

14. Click Create when you are prompted to Enter Name of New object.

A new entry is created with the default name of MEM2. It has the same settings as MEM1.

15. Click MEM2 to display the settings in the right pane.

16. Right-click on Access, and select RAM.

17. Right-click on Description, and select Edit Value. Enter Custom RAM.

You now have two identical memory blocks set up, one FLASH and the other RAM.

18. You must now set up map rules for selecting which of the blocks to use.

In this example, MEM1 is activated if MYREG is set to zero, and MEM2 is activated if MYREG is set to one.

19. Click image\plus.gif in the left pane to expand the Map_rule group:

20. Right-click on DEFAULT to display a context menu. Select Make Copy…, and enter RULE1 when prompted.

21. Right-click on RULE1 to display the context menu. Select Make Copy…, and enter RULE2 when prompted.

22. Click RULE 1 to see settings like this in the right pane:

image\membloc5.gif

23. Right-click on Register, and select MYREG from the list.

24. For this example, do not change the values in Mask or Value. The Mask is ANDed with the Register value to reach the value that is checked.

25. Right-click on On equal, and select MEM1 from the list.

The right pane now contains these values:

image\memblk1.gif

26. Repeat steps 22 to 25 for RULE2, setting Mask to 1, Value to 1, and On equal to MEM2.

27. Select the Save and Close option from the File menu to save your settings.

image\lamp.gifYou can see how the memory map switches by setting the register to 0 or 1 alternately.

image\twoblk1.gif image\twoblk2.gif

image\openred.gif For a more detailed discussion of connection properties, see the RealView Debugger v1.8 Target Configuration Guide.

Related Topics