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.

i2c LED example, unable to step through C code

Other Parts Discussed in Thread: SYSBIOS

With the AM335x ICE board I am able to load the i2c_led example that is included in the SYSBIOS Industrial SDK (C:\ti\am335x_sysbios_ind_sdk_1.0.0.4\sdk\examples\i2c_led)  and run it but I am unable to step through certain functions. For example, I put a breakpoint inside of the taskFxn function and when I start stepping through the code I am unable to step into the set_led function. Is there a way to step through the C code that is being executed inside this function? 

  • It's because the code is part of a .lib that is just being linked into your project, so CCS doesn't know where to find the original source code when you want to debug.  You can provide additional source code paths for debugging under Window..Preferences..C/C++..Debug..Source Lookup Path.  In your case, you would need to set a reference to C:\ti\am335x_sysbios_ind_sdk_1.0.0.4\sdk\os_drivers\src, where the source sys_led.c file is located (which contains set_led()).

    Darrin

  • Unfortunately that did not work. I did the following steps:

    Menu->Window->Preferences->C/C++->Debug->Source Lookup Path->Add->File System Directory->C:\ti\am335x_sysbios_ind_sdk_1.0.0.4\sdk\os_drivers\src

    But when I try to step into set_led() it still doesn't work. If I do an Assembly Step Into I get the following message "No source available for "set_led() at C:\...\CCS Workspaces\ICE\i2c_led\Debug\i2c_led.out:{3} 0x80009566{4}" .

  • Yes, I seem to recall when I've used this feature in the past that it's a little bit dodgy.  I think I had to play around with the "type of source to add" (absolute file path vs. file system directory etc.), and even then I think I had to restart CCS after chaning things to get it to work right.  I didn't use it extensively but I did get it to work, so if you play around with it a little bit hopefully you should be able to get it working too.

    Darrin

  • I couldn't get it to work using your suggested method. So what I did instead was to copy the .c files over into my project and update the include options to include all necessary .h files (for example, "${IA_SDK_HOME}/starterware/include).

    This now allows me to step into the set_led function but unfortunately that is a relatively simple function that just calls SetupI2CTransmitMan which like before, I can't step into. Where can I find the function SetupI2CTransmitMan?

    It is very frustrating the amount of hoops you have to jump through just to see what C code is being executed.

  • I was able to step into the SetupI2CTransmitMan by copying over all the C files from C:\ti\am335x_sysbios_ind_sdk_1.0.0.4\sdk\platform\am335x\src and making sure to include the correct paths, like ("${IA_SDK_HOME}/starterware/tools/flash_writer/src/spi-flash-writer_AM335x/inc").

    I'm pretty sure there is a much more elegant way to do this? Anyone else have any other methods or ideas how one can step through functions inside a .lib file when equivalent .c files exist?

  • You basically want to point CCS to the location of your source files so it know where they are for source level debug. You can add them to the project like you did, but that is a pain if you don't already have a project. The other ways to do this in CCSv5 is mentioned in slides 48-53 of: http://software-dl.ti.com/dsps/dsps_public_sw/sdo_ccstudio/presentations/CCSv5_Tips_&_Tricks.pdf

    Thanks

    ki

  • None of the methods (1, 2, 3, or 4) worked. Method 1 says to use the "Locate File..." button, but I don't have that button. Only button that pops up for me is "View Disassembly...".

    Ki-Soo can you try this with the TI provided I2C example and see if your behavior is any different?