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: Target must be connected before calling the function

Part Number: CODECOMPOSER
Other Parts Discussed in Thread: SEGGER

It seems I've started having some difficulty with programming one of my (custom) boards. The processor on the board is a TM4C1294N, I'm not sure if it matters just yet. Everything was working well until I switched my debugger settings to connect without loading a program, without halting the processor, so that I could look at the contents of certain values in RAM for some debugging tasks. The following problems started after I tried to switch the debugger setup back to loading code. I even tried a previous GIT commit that was working correctly (I'm tracking the .cprojects folder) but no luck.

When I hit the debug button I get an error saying "Target must be connected before calling the function". I believe this is from the GEL file, who's output is below

CORTEX_M4_0: GEL Output: 
Memory Map Initialization Complete
CORTEX_M4_0: GEL: Target must be connected before calling the function

If I switch my debug configuration back so that I just connect and load symbols, I'm able to connect to the target and see the contents of RAM update live. Yet when I go to Run > Load > Load Program, I get the same error saying "Target must be connected before calling the function". Which is odd since I'm connected to the target. What does this error mean?

Restarting CCS, reconnecting the JTAG, and power cycling the target don't seem to help. Does anyone have any idea what might be wrong?

  • Yet when I go to Run > Load > Load Program, I get the same error saying "Target must be connected before calling the function". Which is odd since I'm connected to the target. What does this error mean?

    This is indeed very odd. Can you provide a screenshot of the whole CCS IDE when this error occurs?

    Thanks

    ki

  • Sure! In the screenshot below I connected to the target (symbol load only). Despite the little 'x' icon next to the SEGGER J-Link in the debug window, it is connected. Note that the yellow highlighted data in my expressions window is updating live. Then I went to Run > Load > Load Program > (the correct program is selected) and then I hit 'Load'. The error window pops up right after.

    If I do this with my debug session configured to load program (instead of load symbols only), I simply get the pictured error message and my debug session exits.

  • Despite the little 'x' icon next to the SEGGER J-Link in the debug window, it is connected.

    The screenshot is indeed confusing. Not only is there the 'x', but the status says "Connecting". It looks like the debugger doesn't have the correct state which is causing the issue.

    I will see if I can reproduce the issue.

    ki

  • Let me know if there's anything you'd like me to try on my end!

  • I can't seem to reproduce the issue you see. If the target is connected and running, it should look like:

    Since this worked in the past, prior to the change, I suggest try cleaning up your environment.

    Try steps 9.4.2 and 9.4.3 as mentioned in the user's guide:

    https://software-dl.ti.com/ccs/esd/documents/users_guide/ccs_troubleshooting.html#general-ide

    Also try steps 9.7.3 to 9.7.5:

    https://software-dl.ti.com/ccs/esd/documents/users_guide/ccs_troubleshooting.html#debug

    Let me know if this helps.

    Thanks

    ki

  • I went through the links you provided and started working through it, unfortunately that wasn't able to resolve it.

    But it gave me an idea, to start deleting temporary files within my project. The last step I took was to delete:

    • .config
    • .launches
    • src

    Since none of these were tracked by GIT I assumed they weren't really necessary. I rebuilt the code and hit debug, everything works! The "src" and ".launches" folders were rebuilt but the ".config" folder was not. I guess it's not necessary? Anyways, that doesn't matter much as everything else seems to now be working!

  • Glad to hear you resolved the issue!

    It was likely the .launch file (9.7.5). The .config and .launches files are generated depending on the project settings. The 'src' may or may not be generated. Some components (like RTSC) will create an 'src' folder and generate files inside it. If you didn't explicitly create the 'src' folder yourself, it was likely generated by some component (likely SYS/BIOS). 

  • Ah that makes sense! I use TI RTOS on most of my projects the "src" folder has been there as long as I remember, it's just "excluded from the build" (automatically).

    Thanks for the help Ki, I really appreciate it!