This article talks about the commands that allow the user to obtain information about the environment and modify the environment variables.
For related subjects, please refer to the SOC Table of Contents.
The md command is used to display the RAM value. Formatting is as follows:
md[.b, .w, .l] [address] [Number of Objects]
Where [.b, .w, .l] refers to byte, word, and long; which is 1 byte, 2 bytes, and 4 bytes respectively. You may choose how to display the RAM value. [address] is the starting address of the RAM you wish to view. Finally, is the length of the data you wish to view. Note that this corresponds to the RAM display value. If you chose to view a RAM length of 20 and you chose to use .w, it would be bytes long.
If you wanted to see the RAM value of the first 20 bytes starting from 0x8000000, and you chose to display as .b, you would use the following command:
md.b 8000000 14
In order to better display the differences, we will execute the following three commands:
md.b 8000000 10
md.w 8000000 10
md.l 8000000 10
The first has the .b format, and has a length of 0x10, thus it would be bytes.
The second has the .w format, and has a length of 0x10, thus it would be bytes.
The third has the .l format, and has a length of 0x10, thus it would be bytes.
The nm command is used to change the RAM values of a specified directory. Formatting is as follows:
nm[.b, .w, .l] address
As an example, we will be using .l format to change 0x8000000 to 0x12345678.
First, we will execute the following command:
The 8000000 represents the current RAM address, while the 3245101a represents the current data stored at that address. We can type in what we wish to change it to after the “?”. Make sure you return “q” when you are all done to exit.
Finally, we can use the md command again to see if the change is successful.
The mw command can be used to fill a specified section of RAM with specified data values. Formatting is as follows:
mw[.b, .w, .l] [address] [value] [count]
Where address is the starting address of the RAM to be filled, value is the data value to be filled, and count is the fill length. For example, using .l to fill 0x10 RAM slots as 0x0A0A0A0A starting at 0x8000000 would use the following command:
mw.l 8000000 0A0A0A0A 10
Next, we can verify this by using md.
The cp command is used to copy data in DRAM from a section of RAM to another. Formatting is as follows:
cp[.b, .w, .l] [target] [count]
Where source is the origin address, target is the target address, and count is the length to be copied. If we were to use .l to copy the data at 0x8000000 to 0x8000100, with the length of 0x10 (which is 0x10 bytes), the command would be as follows:
cp.l 8000000 8000100 10
First, we will show the data stored at 0x8000000 and 0x8000100.
Next, we will copy the data at 0x800000 to 0x8000100 and check if the data stored at 0x8000100 has changed.
The cmp command is used to compare if two sections of RAM have the same data. Formatting is as follows:
cmp[.b, .w, .l] [address 1] [address 2] [count]
Where address 1 is the starting address for the first section of RAM, address 2 is the starting address for the second section of RAM, and count is the length to be compared. If we were to use .l to compare if the data starting at 0x800000 and 0x8000100 is equal, with a length of 0x10 (which is 0x10 bytes), the command would be as follows:
cmp.l 8000000 8000100 10
As we can see, the two are the same as apparent from the previous command. After we changed the address, they no longer have any matches.