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

Automatic debug setup from the build system #94

Open
perigoso opened this issue Oct 8, 2021 · 4 comments
Open

Automatic debug setup from the build system #94

perigoso opened this issue Oct 8, 2021 · 4 comments
Labels
build system enhancement New feature or request question Further information is requested

Comments

@perigoso
Copy link
Member

perigoso commented Oct 8, 2021

This might be a bit out of scope

Since we're working with a couple of different targets and families, with different debug setup requirements, every time I want to work on a different family I need to setup the debugging environment, either dealing with stashes, copy pasting or just writing things from scratch, this gets old quick.
Maybe we could consider integrating some of this with the build system, for instance we configure a target, and the bs automatically sets up the configuration for debugging that specific target, it's just a couple json files if we're talking VSCode which is what I use to work on this. of course limiting developers to Code is not great, but doing something more flexible would maybe complicate things.

This could also just be a different tool/script altogether, or even be approached from a different angle and have an extension for Code instead.

This is just an idea I had, sorry if the explanation is a bit convoluted.

@perigoso perigoso added enhancement New feature or request build system question Further information is requested labels Oct 8, 2021
@FFY00
Copy link
Member

FFY00 commented Oct 8, 2021

Can you elaborate how your debugging setup works? I think ideally we would have something built on the build system which you could then easily plug into vscode or any other development setup.

@perigoso
Copy link
Member Author

perigoso commented Oct 8, 2021

for cortex-m devices its just a file on the .vscode config folder configuring the Cortex-Debug extension for Code, but this config varies with every device.

We could also use environment variables for this, instead of generating the file.

One thing i forgot to mention is this extension makes use of the binary generated on build, and since we're appending the version on it, it is constantly changing (E: also different targets mean different build output directories), having an environment variable or something at least for this would help out a lot

@perigoso
Copy link
Member Author

perigoso commented Oct 8, 2021

example config file (it's from a different project so mind some differences)

.vscode/launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Debug",
            "cwd": "${workspaceRoot}",
            "executable": "./bin/v1.test.elf",
            "request": "launch",
            "type": "cortex-debug",
            "preLaunchTask": "Build",
            "servertype": "jlink",
            "device": "EFM32GG11B820F2048",
            "svdFile": "SiliconLabs.EFM32GG11B_DFP.5.7.0/SVD/EFM32GG11B/EFM32GG11B820F2048GQ100.svd",
            "interface": "swd",
            "swoConfig": {
                "enabled": true,
                "swoFrequency": 2000000,
                "cpuFrequency": 36000000,
                "source": "probe",
                "decoders": [
                    {
                        "port": 0,
                        "label": "Console",
                        "type": "console",
                    }
                ]
            }
        }
    ]
}

.vscode/tasks.json

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Build",
            "type": "shell",
            "command": "make",
            "group": {
                "kind": "build",
                "isDefault": true
            }
        },
        {
            "label": "Rebuild",
            "type": "shell",
            "command": "make clean; make"
        },
        {
            "label": "Clean",
            "type": "shell",
            "command": "make clean"
        }
    ]
}

@FFY00
Copy link
Member

FFY00 commented Oct 8, 2021

Hum, I think we can just have the build system automatically generate these files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build system enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants