Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with semihosting with J-Link #996

Open
axelnxp opened this issue Mar 13, 2024 · 0 comments
Open

Issues with semihosting with J-Link #996

axelnxp opened this issue Mar 13, 2024 · 0 comments

Comments

@axelnxp
Copy link

axelnxp commented Mar 13, 2024

This ticket is more a question than a bug report, I'm not sure what I'm trying to do is actually supported, so please let me know.

Describe the bug
I'm trying to setup semihosting with cortex-debug, using J-Link.
I came accross the following page: https://mcuoneclipse.com/2023/10/14/semihosting-with-vs-code-on-rp2040/
In this page, the author uses a custom library, on my side I'm using standard newlib-nano.
I re-used the launch configuration shared in this page to enable semihosting, so I added this:

"postLaunchCommands": [
                "monitor semihosting enable",
                "monitor semihosting ioclient 3",
            ],

I don't see any printf output in the debug consol or in the "gdb-server" terminal.
But, in my workspace folder, I see files are created and contain the printf output, those files have somehow corrupted names, eg:
:tt'$'\230\375\177
Also, I'm running gcov on the target, so when it dumps all the coverage results, the .gcda file name contains corrupted characters like the previous example.

I used Ozone to compare, and it correctly shows the printf/scanf in the terminal, and the .gcda file is named correctly.

Maybe worth to mention, I'm using VS Code in SSH from Windows to a Linux machine. The build/debug happens on the Linux machine.

Environment:

  • Cortex-Debug Version 1.12.1
  • OS: Linux Ubuntu 20.04 LTS
  • GDB Version: 10.2.90.20210621
  • Compiler Toolchain Version: GNU Arm Embedded Toolchain 10.3-2021.10
  • J-Link version: V7.94b

launch.json

{
            "name": "Debug CMake Target",
            "type": "cortex-debug",
            "request": "launch",
            "executable": "${command:cmake.launchTargetPath}",
            "cwd": "${workspaceFolder}",
            "runToEntryPoint": "main",
            "servertype": "jlink",
            "device" : "${input:JLinkDevice}",
            "interface": "${input:JLinkInterface}",
            "serialNumber": "${input:JLinkSerial}",
            "rtos": "FreeRTOS",
            "svdFile": "${input:SvdFile}",
            "serverArgs": [
                "-speed",
                "${input:JLinkSpeed}"
            ],
            "postLaunchCommands": [
                "monitor semihosting enable",
                "monitor semihosting ioclient 3",
            ],
            "rttConfig": {
                "enabled": false,
                "address": "auto",
                "decoders": [
                    {
                        "label": "RTT Console",
                        "port": 0,
                        "type": "console"
                    }
                ]
            }
        },
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant