Some days clouds just look amazing, and in such a day it is so difficult not to photograph them. However this time I shoot about 1400 photos in about 1.25 hour to see how beautiful they move, change their shape and dissipate.
May 12, 2015
* This topic is based on experience with Texas Instruments (TI) Code Composer Studio (CCS) version 5.5
Let's say we have pressed the green bug button in order to debug our project when it is running on a target device. We add some variables of our interest, e.g. temperature sensors, to the CCS' Expressions view for watching them during the debug session. Here, assume we only use JTAG. What if we want to log these data in a file for analyzing it in a later time? Obviously to halt the program and do a copy and paste from the Expressions view to a text file manually is a burden! Good news is that there is a better way to do this, and the key is to use Scripting Console within CCS. To see the Scripting Console view follow this menu steps: "Window -> Show View -> Scripting Console". Let's denote Scripting Console by SC in the rest of this text.
js:> help saveData
Description: Save a block of target memory to a data file format
address - the first address in the block
page - the memory page, use one of the PAGE_X constant
filename - specifies the name of the file that store the target data
length - defines the number of words to store
IOFormat - Specifies the format in which memory words will be written to the output file. Use one of the IOMEMORY_X constant
append - true to append to an existing file, false to overwrite. Note: append is not supported for COFF formatted files.
It is pretty clear what to do now. So if we stick to our example of logging temperature sensors we need to know where in memory these values exist. If the variables are in a structure and we add that structure to the Expressions view, the address of that structure is already shown under the Value column. Another way to find the address for any variable is to right click on its name in the Expressions view and select "View Memory", and voila!, you find the address highlighted in the left column, e.g. something like 0x0000BA10. Note that if you change your code which manipulates data storage, then you want to check the addresses again.
The length is dependent on the number of variables we want to store at once, let's say we have 3 temperature sensors, so we write 3. We choose IOFormat based on the data type. If we want to log data as a float value we use IOMEMORY_FLOAT, if integer we choose IOMEMORY_INT and like that. Take care about the length and IOFormat, they are interrelated. The last parameter, append, is a Boolean and based on our need we choose either true or false. All said, let's see the example command in one line:
js:> saveData(0x0000BA10, PAGE_DATA, "C:\\MyProjects\\hemnik\\logs\\temp.log", 3, IOMEMORY_FLOAT, false)
Press enter, and we get an error that says 'Could not open file', so we need to make the file before running the command. Now it works and we are done with the basic logging! But still it is not convenient to type this command for different variables and in different times one by one in the SC. A better choice is to use "loadJSFile" command in SC:
js:> help loadJSFile
store - [optional] true, store the file(s) to the preference, the script will auto reload the next time the view is open.
Then we only need to run this script in SC as following:
js:> loadJSFile C:\MyProjects\hemnik\ccs_run_test_log.js
That's it! Good luck with your projects.