Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 7417

General • Unable to set temporary breakpoint Function main not defined

$
0
0
Hi guys,

I just started a new project, but I'm not able to start debugging.
After start debugging I get following error message:

Code:

launch.json: Unable to set temporary breakpoint "runToEntryPoint":"main".Function may not exist or out of breakpoints? Function "main" not defined. (from break-insert -t --function main)
The software doesn't seem to get loaded and VSCode stopps debugging at line 99 of boot2_w25q080.S (first line of _stage2_boot).
After continue running the pico, it seems to run the previous loaded software project.

I'm running VSCode on Windows 11 and a picoprobe (using latest "debugprobe_on_pico" from GitHub) to debug another.
Both are 1st generation picos, without WiFi.
Since other projects are running I'm pretty sure there is no hardware or wiring fault.
I also can't really find any relevant difference to other project setups, so I assume the cmake build kit whatever setup to be wrong.

Project:
CMakeLists.txt

Code:

cmake_minimum_required(VERSION 3.13)include(pico_sdk_import.cmake)project(sometest C CXX ASM)set(CMAKE_C_STANDARD 11)set(CMAKE_CXX_STANDARD 17)pico_sdk_init()add_executable(sometest sometest.cpp)pico_enable_stdio_usb(sometest 1)pico_enable_stdio_uart(sometest 0)pico_add_extra_outputs(sometest)target_link_libraries(sometest pico_stdlib hardware_i2c)
sometest.h

Code:

#ifndef SOMETEST_H#define SOMETEST_Hclass SomeTest {    public:        SomeTest();        void run();};#endif
sometest.cpp

Code:

#include <stdio.h>#include "pico/stdlib.h"#include "hardware/gpio.h"#include "pico/binary_info.h"#include "sometest.h"SomeTest::SomeTest() {    gpio_init(25);    gpio_set_dir(25, true);}void SomeTest::run() {    while(true) {        gpio_put(25, true);        sleep_ms(900);        gpio_put(25, false);        sleep_ms(100);    }}int main() {    SomeTest main = SomeTest();    main.run();    return 0;}
I took the .vscode folder from other working project folders.
.vscode/c_cpp_properties.json

Code:

{  "configurations": [    {      "name": "Pico",      "includePath": [        "${workspaceFolder}/**",        "${env:PICO_SDK_PATH}/**"      ],      "defines": [],      "compilerPath": "${env:PICO_INSTALL_PATH}/gcc-arm-none-eabi/bin/arm-none-eabi-gcc.exe",      "cStandard": "c11",      "cppStandard": "c++11",      "intelliSenseMode": "linux-gcc-arm",      "configurationProvider": "ms-vscode.cmake-tools"    }  ],  "version": 4}
.vscode/extensions.json

Code:

{  "recommendations": [    "marus25.cortex-debug",    "ms-vscode.cmake-tools",    "ms-vscode.cpptools",    "ms-vscode.cpptools-extension-pack",    "ms-vscode.vscode-serial-monitor"  ]}
.vscode/cmake-kits.json

Code:

[  {    "name": "Pico ARM GCC",    "description": "Pico SDK Toolchain with GCC arm-none-eabi",    "toolchainFile": "${env:PICO_SDK_PATH}/cmake/preload/toolchains/pico_arm_gcc.cmake"  }]
.vscode/tasks.json

Code:

{  "version": "2.0.0",  "tasks": [    {      "label": "Flash",      "type": "shell",      "command": "openocd",      "args": [        "-f",        "interface/cmsis-dap.cfg",        "-f",        "target/rp2040.cfg",        "-c",        "adapter speed 5000; program {${command:cmake.launchTargetPath}} verify reset exit"      ],      "problemMatcher": []    },    {      "label": "Build",      "type": "cmake",      "command": "build",      "problemMatcher": "$gcc",      "group": {        "kind": "build",        "isDefault": true      }    }  ]}
.vscode/settings.json

Code:

{  // These settings tweaks to the cmake plugin will ensure  // that you debug using cortex-debug instead of trying to launch  // a Pico binary on the host  "cmake.statusbar.advanced": {    "debug": {      "visibility": "hidden"    },    "launch": {      "visibility": "hidden"    },    "build": {      "visibility": "hidden"    },    "buildTarget": {      "visibility": "hidden"    }  },  "cmake.buildBeforeRun": true,  "cmake.configureOnOpen": true,  "cmake.configureSettings": {    "CMAKE_MODULE_PATH": "${env:PICO_INSTALL_PATH}/pico-sdk-tools"  },  "cmake.generator": "Ninja",  "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools",  "cortex-debug.variableUseNaturalFormat": false,  "C_Cpp.errorSquiggles": "enabled",  "files.associations": {    "type_traits": "cpp"  }}
.vscode/launch.json

Code:

{  "version": "0.2.0",  "configurations": [    {      "name": "Pico Debug (Cortex-Debug)",      "cwd": "${workspaceFolder}",      "executable": "${command:cmake.launchTargetPath}",      "request": "launch",      "type": "cortex-debug",      "servertype": "openocd",      "gdbPath": "arm-none-eabi-gdb",      "device": "RP2040",      "configFiles": [        "interface/cmsis-dap.cfg",        "target/rp2040.cfg"      ],      "svdFile": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd",      "runToEntryPoint": "main",      "openOCDLaunchCommands": [        "adapter speed 5000"      ]    },    {      "name": "Pico Debug (Cortex-Debug with external OpenOCD)",      "cwd": "${workspaceFolder}",      "executable": "${command:cmake.launchTargetPath}",      "request": "launch",      "type": "cortex-debug",      "servertype": "external",      "gdbTarget": "localhost:3333",      "gdbPath": "arm-none-eabi-gdb",      "device": "RP2040",      "svdFile": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd",      "runToEntryPoint": "main"    },    {      "name": "Pico Debug (C++ Debugger)",      "type": "cppdbg",      "request": "launch",      "cwd": "${workspaceFolder}",      "program": "${command:cmake.launchTargetPath}",      "MIMode": "gdb",      "miDebuggerPath": "arm-none-eabi-gdb",      "miDebuggerServerAddress": "localhost:3333",      "debugServerPath": "openocd",      "debugServerArgs": "-f interface/cmsis-dap.cfg -f target/rp2040.cfg -c \"adapter speed 5000\"",      "serverStarted": "Listening on port .* for gdb connections",      "filterStderr": true,      "stopAtEntry": true,      "hardwareBreakpoints": {        "require": true,        "limit": 4      },      "preLaunchTask": "Flash",      "svdPath": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd"    }  ]}
Since I can't really find any difference to other, perfectly working projects, I'm pretty confused.
Those are the available VSCode cmake kits and the red selected is the used one, also tried others.
Unbenannt1.png
These are the available build targets ant the red selected is the one I used, but also tried others.
Unbenannt2.png
Since this post already is pretty long, I'll only post the debug log:

Code:

Cortex-Debug: VSCode debugger extension version 1.12.1 git(652d042). Usage info: https://github.com/Marus/cortex-debug#usageReading symbols from arm-none-eabi-objdump --syms -C -h -w D:/Projects/pico/sometest/build/pico-sdk/src/rp2_common/boot_stage2/bs2_default.elfReading symbols from arm-none-eabi-nm --defined-only -S -l -C -p D:/Projects/pico/sometest/build/pico-sdk/src/rp2_common/boot_stage2/bs2_default.elfLaunching GDB: arm-none-eabi-gdb -q --interpreter=mi2    IMPORTANT: Set "showDevDebugOutput": "raw" in "launch.json" to see verbose GDB transactions here. Very helpful to debug issues or report problemsLaunching gdb-server: openocd.exe -c "gdb_port 50000" -c "tcl_port 50001" -c "telnet_port 50002" -s "D:\\Projects\\pico\\sometest" -f "c:/Users/<...>/.vscode/extensions/marus25.cortex-debug-1.12.1/support/openocd-helpers.tcl" -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c "adapter speed 5000"    Please check TERMINAL tab (gdb-server) for output from openocd.exeFinished reading symbols from objdump: Time: 53 msFinished reading symbols from nm: Time: 53 msOutput radix now set to decimal 16, hex 10, octal 20.Input radix now set to decimal 10, hex a, octal 12.warning: multi-threaded target stopped without sending a thread-id, using first non-exited thread0x100012b8 in ?? ()Program stopped, probably due to a reset and/or halt issued by debugger[rp2040.core0] halted due to debug-request, current mode: Thread xPSR: 0xf1000000 pc: 0x000000ee msp: 0x20041f00[rp2040.core1] halted due to debug-request, current mode: Thread xPSR: 0xf1000000 pc: 0x000000ee msp: 0x20041f00[rp2040.core0] halted due to debug-request, current mode: Thread xPSR: 0xf1000000 pc: 0x000000ee msp: 0x20041f00[rp2040.core1] halted due to debug-request, current mode: Thread xPSR: 0xf1000000 pc: 0x000000ee msp: 0x20041f00launch.json: Unable to set temporary breakpoint "runToEntryPoint":"main".Function may not exist or out of breakpoints? Function "main" not defined. (from break-insert -t --function main)
Anyone around here knows something about what's wrong with my configuration?
Looking forward for any ideas.

Kind regards,
Michel_0

Statistics: Posted by Michel_0 — Sat Mar 08, 2025 5:57 pm — Replies 0 — Views 48



Viewing all articles
Browse latest Browse all 7417

Trending Articles