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.

GEL examples that interact with target code

Are there GEL examples on how to control target code execution?  I've checked the wiki and the forums and haven't found much. Things like:

  • Set a breakpoint on a line.  Do you need to know the absolute address?  I tried putting a label on the line such as bkpt:  but the script doesn't like that.
  • Set a variable in target code.  Does it need to be global?  I tried setting a local variable, but it doesn't find that.  Maybe because I couldn't get the breakpoint set in the function where it is?
  • Fill memory with a value.
  • Load memory from a pc file and know what the length is inside the script (like it is shown in the window when manually loading a file)

Looking for examples that show these sorts of things.  Thanks.

Mike

  • Mike,

    The Online Help in CCS is pretty good with regards to GEL Functions. Have you had a look at it? If you go to menu Help->Help Contents and search for GEL, you should get the list of GEL functions and you can then click on any of the functions to get more details/examples of usage.

  • I have looked at that and it has helped.  But the examples are sparse.  For example, I finally figured out that you have to GEL_LoadSymbols before you can access target variables.  I did not expect this since I had just loaded and run the program on the target with the debugger and it had loaded symbols during that process.  Figured GEL would just access those. This is the sort of thing I was looking for complete examples on.  And I still haven't figured out how to set a breakpoint other than with the hex address of the line.  This won't be very robust since that could move around as code evolves.

    Mike

  • Mike,

    A few comments:

    Mike Stich said:

    I did not expect this since I had just loaded and run the program on the target with the debugger and it had loaded symbols during that process.

    When you say you have loaded and run the program with the debugger, did you do this at a previous debug session? If so, that is expected as symbols are not loaded to the target device, but instead are associated with the running debug session. Terminate and restart and you need to reload symbols.

    Mike Stich said:

    And I still haven't figured out how to set a breakpoint other than with the hex address of the line.  This won't be very robust since that could move around as code evolves.

    Check the highlighted examples for Gel_BreakPtAdd()

    Hope this helps,

    Rafael

  • Regarding the symbols, I load and run the program on the target with CCS.  Without detaching from the target, I load the gel file.  It seems I still need to do the GEL_LoadSymbols to be able to access target variables symbolically.


    Regarding the breakpoints, I tried creating a label in C code such as bkpt:  but doing GEL_BreakPtAdd("bkpt") does not work.  I can do GEL_BreakPtAdd("main + 0x160") for example, where main is the name of a function.  That risks the breakpoint being in the wrong spot if the code between the start of main and the desired stopping point changes.

    Mike