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.

MSP430FR4133: Cannot stop running debug session using msp430-elf-gdb and gdb_agent_console-

Part Number: MSP430FR4133
Other Parts Discussed in Thread: TI-CGT

Hello everyone,

I want to try other IDEs than CCS for developing firmware for MSP430FRXXXX microcontrollers. Currently, I want to try Visual Studio Code. My toolchain is the MSP430-GCC and my hardware is the LaunchPad MSP430FR4133
The debugging setup is as follows:

  • "gdb_agent_console" is started (on default port 55000)
  • "msp430-elf-gdb" then connects, erases the flash and loads my firmware (including debugging symbols)
  • I hit run and - as expected - the program runs
  • Breakpoints that are set before starting "gdb_agent_console" are hit as planned

However, there is an issue with debugging.

If I don't set a breakpoint and the program runs, I cannot break/stop the running program. On my console where I see all the commands between "gdb" and "gdbServer", I see the log  for the MI-command "-exec-interrupt".
So to me it seems that the command to stop is send but the debugger does not break.

So general running and flash works fine, stepping through the code also works fine, but stopping a running MSP does not work.
Has anyone a solution for my problem?

Here are all my files/configurations/binaries I use:

- GDB: msp430-elf-gdb v8.1

- GDB-Server: gdb_agent_console v8.0.809.0

- Compiler/Linker: msp430-elf-gcc v9.3.1

- Board Data file (for gdb_agent_console)

# config version=3.5
$ msp430
  msp430_drvr=msp430.dll
  msp430_port=TIUSB
  msp430_vcc=3.3
$ /

- Command so start GDB-Server (in Launch.json in VS Code): gdb_agent_console.exe msp430.dat

- Command to start GDB (in Launch.json in VS Code): msp430-elf-gdb.exe -ex="target remote :55000" -ex="mon erase" -ex="load" main.elf

- OS: Windows 10

PS:
I had the same issue when using "mspdebug" or "msp430-gdbproxy" as a GDB server

Any help is highly appreciated!

  • Forgot to add my firmware code:

    #include <msp430.h>
    
    int main(void) {
        WDTCTL = WDTPW | WDTHOLD;               // Stop watchdog timer
        PM5CTL0 &= ~LOCKLPM5;                   // Disable the GPIO power-on default high-impedance mode
                                                // to activate previously configured port settings
    
    
        P1DIR |= 0x01;                          // Set P1.0 to output direction
        P1OUT &= ~0x01;
    
    
        for(;;) {
            volatile unsigned int i;            // volatile to prevent optimization
    
            P1OUT ^= 0x01;                      // Toggle P1.0 using exclusive-OR
            i = 10000;                          // SW Delay
            do i--;
            while(i != 0);
        }
    }

    It is just a blinking LED 

  • I think there is no relationship with the code.

    Can you make a compare between CCS?

    Sorry, I know little about gcc tools chain, which is no more mantianed by TI...

  • So actually I got it to work.
    I will just insert my launch.json that ended up working.

    {
        "version": "0.2.0",
        "configurations": [
            {
                "name": "(gdb-server-agent) Launch",
                "type": "cppdbg",
                "request": "launch",
                "program": "${workspaceFolder}/build/main.elf",
                "args": [],
                "stopAtEntry": true,
                "cwd": "${workspaceFolder}",
                "environment": [],
                "externalConsole": false,
                "logging": {
                    "engineLogging": true,
                    "exceptions": true,
                    "moduleLoad": true,
                    "natvisDiagnostics": true,
                    "programOutput": true,
                    "trace": false,
                    "traceResponse": false
                },
                "MIMode": "gdb",
                "windows": {
                    "debugServerPath": "${config:msp430_gdb_bin_dir}/gdb_agent_console.exe",
                    "debugServerArgs": "-f MSP430 ${workspaceFolder}/.vscode/msp430.dat",
                    "miDebuggerPath": "${config:msp430_gdb_bin_dir}/msp430-elf-gdb.exe"
                },
                "miDebuggerServerAddress": "localhost:55000",
                "miDebuggerArgs": "${workspaceFolder}/build/main.elf",
                "preLaunchTask": "Flash MSP430"
            }
        ]
    }

    I used variables, that were declared in my settings.json to define my path to the binary directory of MSP430-GCC (in this directory, both the GDB and the gdb-agent-console are located). For your setup you can just use absolute paths.
    I also removed the path to the SVD file because this depends on the used microcontroller and the availability of SVD files (see dhoove/tixml2svd: This utility creates SVD files from the Texas-Instruments XML device and peripheral descriptor files. (github.com) if you want to generate SVD files for the MSP430).

    This works for code that is either generated with MSP430-GCC or TI-CGT 

**Attention** This is a public forum