This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LoadTI memory parameter

LoadTI works great, but the problem is that I need to initialize a few memory locations.

The options are

Options:
  -a,   --async-run
  -b,   --init-bss-section[=VALUE]
  -c,   --cfg-file=CONFIG_FILE
  -h,   --help
  -l,   --load
  -mlr, --mem-load-raw="PAGE,ADDR,FILE,TYPE_SIZE,BYTE_SWAP"
  -mld, --mem-load-dat="PAGE,ADDR,FILE,LEN"
  -msr, --mem-save-raw="PAGE,ADDR,FILE,LEN,TYPE_SIZE,BYTE_SWAP"
  -msd, --mem-save-dat="PAGE,ADDR,FILE,LEN,IO_FORMAT,APPEND"
  -n,   --no-profile
  -q,   --quiet
  -r,   --reset
  -s,   --stdout-file=FILE
  -t,   --timeout=VALUE
  -v,   --verbose
  -x,   --xml-log=FILE
  -@,   --options-file=FILE

 

So, let's say I want to initialize address 0x80 to 0xFFFF, and address 0x91 to 0x1111.  How would I use LoadTI to do this?

I'm guessing that I need to specifcy the -mlr option, but there's NO documentation about what the parameters "PAGE,ADDR,FILE,TYPE_SIZE,BYTE_SWAP" mean, or how to use them.

Can anyone help?

  • We compiler experts do not know much about loadti.  So, I will move your post to the Code Composer Studio forum.  But first I will point out a few things which might help.

    The Wiki article about loadti is here http://processors.wiki.ti.com/index.php/Loadti .  One of the -mlr parameters is a file.  Unfortunately, there is no information about the format of this file.  But, it seems unlikely it would be a good way to poke values into specific memory locations.  You could try reading the source to loadti to see what underlying DSS command -mlr uses, then look in DSS documentation to get details about that command.

    Thanks and regards,

    -George

     

  • Mike said:
    I'm guessing that I need to specifcy the -mlr option, but there's NO documentation about what the parameters "PAGE,ADDR,FILE,TYPE_SIZE,BYTE_SWAP" mean, or how to use them.

    The parameters are documented in the DSS API doc:

    <INSTALL DIR>/ccsv4/scripting/docs/DS_API/com/ti/debug/engine/scripting/Memory.html#loadRaw(int, long, java.lang.String, int, boolean)

    However, that option is not what you need. You want to fill memory with a value using this API:

    <INSTALL DIR>/ccsv4/scripting/docs/DS_API/com/ti/debug/engine/scripting/Memory.html#fill(java.lang.String, long)

    But there is no loadti option for this. What you can do is simply modify loadti to add this option. We definitely encourage people to tweak loadti on their own.

    Thanks

    ki

  • Mike said:

    So, let's say I want to initialize address 0x80 to 0xFFFF, and address 0x91 to 0x1111.  How would I use LoadTI to do this?

    Ki-Soo Lee said:

    However, that option is not what you need. You want to fill memory with a value using this API:

     

    I think you missed my original question.  I want to write specific values to a specific address.  Not initialize everything to one value. 

    I'd think some register initialization is standard procedure for most people, so I'm suprised this isn't built into LoadTI by default.

    Perhaps I can still use the -MLR option, but specify several files?  Documentation is

    loadRaw

    public void loadRaw(int nPage,
                        long nAddress,
                        java.lang.String sFilename,
                        int nTypeSize,
                        boolean bByteSwap)
                 throws ScriptingException
    Load a raw file from the host to target memory (specified by start address, page and length). Filesize is automatically determined and the entire file is loaded *

     

    Parameters:
    nAddress - is the first address in the block.
    nPage - the memory page. Use one of Memory.Page enumeration.
    sFilename - specifies the name of the file that will store the target data.
    nTypeSize - specifies the type size of the data. Affects how data is byte-swapped to account for differences in host and target endianess. For example: if the target is big endian (the host is always little endian) and you specify nTypeSize = 16 then the upper and lower bytes are swapped after loading the file - but before writing to target memory.
    bByteSwap - Force a byte-swap of the data before writing to target memory. If Host and Target are difference endianess - this will effectively disable the automatic endianess conversion.

    So I think I want to do...

    loadti -c config.ccxml -mlr ( 0, 128, FFFF.hex, 16, 0 ) -mlr ( 0, 145, 1111.hex, 16, 0 ) execThis.out

    Where, FFFF.hex only has data 0xFFFF, and 1111.hex only has data 0x1111

    Can I execute multiple -mlr options?  Is this how you call the function from the command prompt?  Again, where is this documented?  The wiki would be a great place....

  • Mike said:

    I think you missed my original question.  I want to write specific values to a specific address.  Not initialize everything to one value. 

    I'd think some register initialization is standard procedure for most people, so I'm suprised this isn't built into LoadTI by default.

    Right. But you can so a fill with the number of values to 1 to fill just a specific address. I would rather do that than deal with loading in a binary file with the value I want.

    Register initialization is a very standard procedure. The most common way people do that is within the OnTargetConnect() call of their GEL startup file.

    Mike said:
    Perhaps I can still use the -MLR option, but specify several files?

    No but you can specify the -mlr option multiple times (one for each file)

    Mike said:
    loadti -c config.ccxml -mlr ( 0, 128, FFFF.hex, 16, 0 ) -mlr ( 0, 145, 1111.hex, 16, 0 ) execThis.out

    Use quotes instead of parenthesis as described in the readme:

    --mem-load-raw="PAGE,ADDR,FILE,TYPE_SIZE,BYTE_SWAP"

    Mike said:
    Again, where is this documented?  The wiki would be a great place....

    There is a wiki for loadti but it is more overview information. The only other documentation is the readme.txt in the same directory as the loadti script. Note that loadti is just a DSS example script on what you can do with DSS. It's not really a product or feature of DSS, hence the minimal documentation. You'll really want to look at the DSS documentation.

    Thanks

    ki

  • Managed to get everything into one contiguous block of memory, but as I feared, I get an invalid parameter response without any indication about which parameter is wrong

    loadti -a -r -t 3000 -c config.ccxml -x LOG.xml -mlr="2,2940,"reg_init.hex",16,FALSE" execThis.out

    --mem_load_raw parameters: 2,2940,reg_init.hex,16,FALSE option are invalid! see loadti --h
    elp for parameter specification
    Memory load failed with errCode: 1

    Or, with 0 instead of FALSE...

    loadti -a -r -t 3000 -c config.ccxml -x LOG.xml -mlr="2,2940,"reg_init.hex",16,0" execThis.out

    --mem_load_raw parameters: 2,2940,reg_init.hex,16,0 option are invalid! see loadti --help
    for parameter specification
    Memory load failed with errCode: 1

    Can anyone elaborate on what I'm not doing right here?  The parameters look ok to me...

  • try:

    loadti -a -r -t 3000 -c config.ccxml -x LOG.xml -mlr="2,2940,reg_init.hex,16,0" execThis.out

    (no additional quotes around the file name)

  • actually you need to pass in a bool for the last parameter. That is the real issue:

    loadti -a -r -t 3000 -c config.ccxml -x LOG.xml -mlr="2,2940,reg_init.hex,16,false" execThis.out

    It looks like wrapping quotes around the file name is actually ok.

  • Mike said:

    loadti -a -r -t 3000 -c config.ccxml -x LOG.xml -mlr="2,2940,"reg_init.hex",16,FALSE" execThis.out

    --mem_load_raw parameters: 2,2940,reg_init.hex,16,FALSE option are invalid! see loadti --h
    elp for parameter specification
    Memory load failed with errCode: 1

    [/quote]

    Ki-Soo Lee said:

    actually you need to pass in a bool for the last parameter. That is the real issue:

    loadti -a -r -t 3000 -c config.ccxml -x LOG.xml -mlr="2,2940,reg_init.hex,16,false" execThis.out

     

    I think I tried that, but with all CAPS for the boolean.

     

  • Mike said:
    I think I tried that, but with all CAPS for the boolean.

    All CAPS will fail. It is case sensitive

  • Finally got this to work.  Basically what it took was an investigation of the JavaScript that was being called by LoadTI. 

     

    Editing the run() function in main.js makes it much, much easier to get the program to do what you want.  

     

    Rather than dealing with the cryptic messages LoadTI spits out by default, it's so much easier to write your own output that actually tells you what's going on.

     

    Bottom line, if you want to use this code, you're probably going to have to write your own JavaScript.

  • loadti works for many people as-is but we really do encourage people to modify as needed whether to spit out better messages or add more functionality, that way you learn DSS also. It's meant to be a  baseline script to build off . Glad to see you were able to edit it to suit you needs.