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.

CODECOMPOSER: How to load multiple images with GEL?

Part Number: CODECOMPOSER
Other Parts Discussed in Thread: MSPM0G3519, UNIFLASH

Tool/software:

Hello,

CCS 20.0.1 and MSPM0G3519

This is related to https://e2e.ti.com/support/tools/code-composer-studio-group/ccs/f/code-composer-studio-forum/1461153/codecomposer-loading-program-and-symbols-from-different-files

Let's say I have three images for Bank0, Bank1 and Data Flash (for MSPM0G3519).

Using GEL_Load() in consecutive calls erases previously loaded data - Bank0 program is erased and Bank1 is loaded with new data. This is quite unexpected behavior when function goes beyond the data from the image file.

Using GEL_LoadMemory() hangs indefinitely.

How would I load multiple image files for a specific memory ranges?

I am attaching image files.

Regards,

Eugene

  • Not sure it this helps.

    When I use UNIFLASH with three images and program them all at once it works.

    If I selectively program any one of them with UNIFLASH then the problem seems to be the same. It looks like there some form of mass erase happening even though image data only fall into limited address range.

    Eugene

  • Hi Eugene,

    By default in the flash settings a mass erase will be performed on the device.

    To load in separate images you will need to disable the erase by going into the flash settings and select "Do not erase flash memory" option

  • Henry,

    Thank you for response.

    Two questions:

    1. What does "Do not erase flash memory" do? Does it only erase sectors from image or none at all? AFIAK, to reprogram flash it has to be first erased.

    2. What about Code Composer GEL functions?

    Regards,

    Eugene

  • Hi Eugene,

    Once you do an initial erase you can program the other images, so for the First image, you can do Erase Main and Data, then subsequent programs select the Do not erase Flash Memory. You need to do an erase before a write, but if you erase everything and only program specific sections you don't necessary need to do an erase every time.

    Alternatively you can do the erase main memory sectors by range and do the first image at bank0, second image at bank1, then have the data bank image on the 'erase data memory only" option.

    ----

    Going to send this to our Code Composer team to address the GEL functions but from what I'm seeing in the Code Composer Studio User's guide on GEL files.

    GEL_MemoryLoad( startAddress, page, length, "fileName", [bitsize], [swap])  would be the function I would use.

    Regards,
    Luke

  • Hi Luke,

    Thank you for the advice. However, IMHO there are quite a few logical and behavior issues here. I am assuming that tools help developers rather than complicate their life. Please, consider your advice executed multiple times during the day as I develop an application.

    I will itemize my thoughts here hoping that it would somehow help and possibly be addressed with UNIFLASH:

    1. Mass erase should be an option and not default assumed behavior of a programming tool. We usually erase the whole, sectors or address ranges. This is user request and not a tool assumption.
    2. Only address range from input file should be erased and reprogrammed. If it spills over to whole flash sectors due to the input that is OK as this is user error. No erasing more than enclosing whole flash sector shall be done by the tool.
    3. It is dangerously easy to erase NONMAIN memory. The warning (which is not even aligned with the option) is not enough here. UNIFLASH should make erasure of NONMAIN memory difficult and at least hide it behind few layers of options with warning dialogs and possibility to back it up? The path to restoration has to be present as well.
    4. GEL_MemoryLoad() does not seem to work with CCS 20.0.1 and MSPM0G3519. It just does nothing (crashes GEL maybe but does not load?)

    Regards,

    Eugene

  • GEL_MemoryLoad() does not seem to work with CCS 20.0.1 and MSPM0G3519. It just does nothing (crashes GEL maybe but does not load?)

    What is the file format you are loading? hex?

  • S37 record which is generated by tiarmhex.

    I would expect to see something about unsupported format in GEL output window if that's the culprit.

    Edit: I tried BIN file from tiarmhex and that did not work either.

  • Please note that GEL_MemoryLoad() will not be able to write to Flash. If you are trying to load a binary to Flash, you need to use GEL_LoadBin. This will use the debugger program loaded which can then invoke the flash programmer for the device. 

    When the program loader is used, it will use the flash settings set such as the erase settings being discussed above.

    Regarding you other three comments regarding the flash erase options, I will let the device experts (Luke, Henry) respond to those.

    Thanks

    ki

  • Hi Ki,

    We are back to original question. 

    "Like GEL_Load <GEL_Load.html>, this function downloads both program code and data onto the target at the addresses specified in the file. However, no attempt will be made by the debugger to load symbol information."

    GEL_Load...() functions seem to be doing mass which contradicts to the above description for GEL_LoadProgramOnly and others from CCS help. Per description these functions support S-records.

    UNIFLASH has similar issues as stated above. Mass erase should be an option rather than default behavior.

    I need to selectively load content into flash but without mass erase. How would I do this in CCS with GEL functions.

    Going with Luke's suggestion creates development nightmare switching between tools and reconfiguring them.

    Regards.

    Eugene

  • Hi Eugene,

    Let me get you the code on how we do the Memory Erase by Address mode

  • Hi Eugene,

    Apologies for the delayed response.

    The erase that is performed is determined by the erase method chosen inside the mspm0 flash properties xml that lives at the path of C:\ti\<CCS_VERSION>\ccs\ccs_base\DebugServer\propertyDB\MSPM0_FlashProperties.xml

    Within the .xml under the property id of FlashEraseSelection, there is a defaultValue field and from there you can configure the erase method that the flashloader will utilized.

  • Hi Henry,

    Thank you for pointing to the configuration file. Unfortunately, this does not help.

    <property id="FlashEraseSelection">
    <target>TMS470RAX</target>
    <name>Erase method</name>
    <valueType>ChoiceList</valueType>
    <values>
    <value>Erase MAIN memory only</value>
    <value>Erase DATA memory only</value>
    <value>Erase MAIN and DATA memory</value>
    <value>Erase MAIN and NONMAIN memory (see warning above)</value>
    <value>Erase MAIN, DATA, and NONMAIN memory (see warning above)</value>
    <value>Erase MAIN and NONMAIN necessary sectors only (see warning above)</value>
    <value>Erase MAIN memory sectors by range (specify below)</value>
    <value>Do not erase Flash memory</value>
    </values>
    <defaultValue>Erase MAIN memory only</defaultValue>

    I do not see option to erase sectors from input files here or it is not obvious.

    I still state that erasing of NONMAIN memory is dangerously easy in UNIFLASH.

    The issue is not default selection (and I would question why I need to modify CCS install at all?) but the fact that mass erase or no erase once is set is performed for any download. That is not optimal. Mass erase is a single action selected by the user only when it is needed. In any other case, tool should only erase and reprogram address ranges from input files.

    Regards.

    Eugene

  • Hi Eugene,

    Typically the user would configure the erase options directly from the GUI if you wish to do so utilizing Uniflash through its GUI.

    To do this purely through the GEL file is not the easiest because it will typically grab it from the .launch file in a project in CCS. I'm currently looking at the configuration in Uniflash but typically what happens when a session is launched is a file that is of a .uniflash format which saves all the settings.

    One thing that can be done since it seems like everything from your setup is being executed from a GEL file would be utilizing the GEL api's to modify the debug properties. The flash properties .xml can be modified or read using the GEL api's related to DebugProperty so something like GEL_SetBoolDebugProperty or the get version would be able to modify the values as needed. 

  • Also in your case as well since you wish to modify the erase range you can utilize this api to modify the start and end address for the sector operation and set the default erase property to be sector erases.

  • Hi Henry,

    That API might provide a workaround. Thank you. I will try it.

    However, I still do not understand why this range behavior from input files is not default or settable in the tool and why users have to go through all of this complexity?

    Regards,

    Eugene

  • The point about GEL is that API behavior is differs from the description of it.

    "Like GEL_Load <GEL_Load.html>, this function downloads both program code and data onto the target at the addresses specified in the file. However, no attempt will be made by the debugger to load symbol information."

    It seems to be the bug that needs fixing.

    Eugene

  • I need to selectively load content into flash but without mass erase. How would I do this in CCS with GEL functions.

    Note that you could do this in an initialization script with the CCS Scripting Settings APIs. This allows you to modify the debugger options (including flash options) from a script.

    The settings.getDetailedSettings() API will return a detailed list of available options which you can then set with the settings.set API. See <CCS20 INSTALL DIR>/ccs/scripting/docs/interfaces/Settings.html for more details.

    Thanks

    ki

       

  • Hi Ki,

    Why is that so basic is so complicated? Why  GEL_Load() does not work out of the box as its description states?

    These are basic behavior so any flash/debug tools. Why CCS has chosen not to do that?

    Eugene

  • Why  GEL_Load() does not work out of the box as its description states?

    I'm not sure what is not working. GEL_Load mimicks the Load Program functionality of the IDE. The behavior has been the same across many CCS versions.

    Using GEL_Load() in consecutive calls erases previously loaded data - Bank0 program is erased and Bank1 is loaded with new data. This is quite unexpected behavior when function goes beyond the data from the image file.

    This is expected because GEL_Load is calling the CCS program loader. The CCS program loader will always respect the flash option when loading to flash.

  • Hi Ki,

    I'd guess that program loader has issues as well. Mass erase is not default behavior of any loader. It has not been for multitude of professional tools out there.

    "Like GEL_Load <GEL_Load.html>, this function downloads both program code and data onto the target at the addresses specified in the file. However, no attempt will be made by the debugger to load symbol information."

    This is logical description of a loader ... but it is not what it does. It corrupts other addresses through mass erase.

    Why are we keep going in circles around this? Don't you agree that there is problem with loader functions or not and CCS/UNIFLASH will not fix them?

    Regards,

    Eugene

  • Hi Eugene,

    I think the difference here was an understanding of the function's purpose itself. We don't currently have an easy way to just load in a file and parse it to erase the specific sections listed in your program, and subsequently flash the device. That would require a couple different parsers for each output format we support programming for with the purpose to pull out the memory addresses and only erase the relevant pieces, then call the current loading functions.

    Right now you'd have to create a batch script (or something similar) to call the memory erase by address fields or parse through your file then enter the parameters. We do have Uniflash command line functions which you can use in a batch file to execute the relevant commands.

    In the meantime, I'll load up a ticket to get this into the backlog because this is a nice QoL item to make flashing the device easier. 

  • Hi Luke,

    Yes, this should be addressed in some way. FYI, if I step out of CCS and UNIFLASH that is how most of other tools work.

    Regards,

    Eugene

  • Hi Henry,

    The erase that is performed is determined by the erase method chosen inside the mspm0 flash properties xml that lives at the path of C:\ti\<CCS_VERSION>\ccs\ccs_base\DebugServer\propertyDB\MSPM0_FlashProperties.xml

    I have been able to utilize this method with GEL functions for MAIN memory. However, it looks like DATA memory can only be erased as a whole? Is there a way to select erase address range for DATA memory with GEL functions?

    Regards,

    Eugene

  • Hi Eugene,

    Sorry for that and the late response. Did some test on my side and the current state of the flash driver will throw an error with sector erases on the DATA bank. I just updated it on my side and attached it for you to use on your side. You can backup the original file and  paste it at this path. C:\ti\<CCS_VERSION>\ccs\ccs_base\DebugServer\bin

    https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/81/FlashMSPM0.dll

  • Hi Henry,

    I just updated it on my side and attached it for you to use on your side. You can backup the original file and  paste it at this path. C:\ti\<CCS_VERSION>\ccs\ccs_base\DebugServer\bin

    That seems to work for me-no error message and DATA flash is programmed. Should this update be in the next release of CCS?

    There is issue with selection list though. "Erase MAIN memory sectors by range (specify below)"  now is incorrect and should probably include "DATA" and for UINIFLASH as well.

    Regards,

    Eugene

  • Hi Eugene,

    Yes, this will be released in the next version of CCS.

    I'll also keep your recommendation in mind and add it for future releases.

    Thank you,

    Henry Nguyen