Giter VIP home page Giter VIP logo

esp8266_gdb_debugging_vscode's Introduction

launch.json file for VSCode IDE debugging (gdb) with ESP8266 ESP-12E microcontrollers

after a LOT of struggling with the settings, I finally made it to get the ball rolling.

IF the launch.json file inside the .vscode folder gets overwritten by PlatformIO use content from this file. Read explanation in comments (note: this is a .json with comments)

// ON PROJECT INITIALIZAZION PART OF THIS MAY BE REMOVED BY
// PLATFORMIO AUTOMATICALLY GENERATED CONTENT (too bad!).
// PLEASE REMEBER TO MANUALLY ADD IT AGAIN EVERYTIME
//
"version": "0.2.0",
"configurations": [

    {

        // for debug configuration, remember to:
        //
        // use proper compiler switches in platformio.in
        // build_flags = -Og -ggdb3 -g3 -D VM_DEBUG_GDB
        //
        // #ifdef VM_DEBUG_GDB
        //     #include "GDBStub.h" and call gdbstub_init();
        // #endif
        //

        "name": "(gdb) Launch",
        "type": "cppdbg",
        "request": "launch",
        
        // targetArchitecture of the ESP8266 is "arm", although deprecated it made this work!
        "targetArchitecture": "arm",
        
        // the full path of the built ELF image
        "program": "${workspaceRoot}/.pio/build/${workspaceFolderBasename}/firmware.elf",
        "args": [],
        "stopAtEntry": false,
        
        // this tells VSCode that the target supports only 1 HW breakpoints
        // (https://code.visualstudio.com/docs/cpp/launch-json-reference)
        "hardwareBreakpoints": {
            "require": true,
            "limit": 1
        },
        "cwd": "${workspaceFolder}",
        "environment": [],
        "externalConsole": true,
        "MIMode": "gdb",
        
        // full path of the xtensa-lx106-elf-gdb.executable running on Windows OS
        "miDebuggerPath": "<USER_HOME_PATH>/.platformio/packages/toolchain-xtensa/bin/xtensa-lx106-elf-gdb.exe",
        
        // the COM port assigned by windows to the board
        "miDebuggerServerAddress": "\\\\.\\COM4",
        
        // GDB config stuff from https://arduino-esp8266.readthedocs.io/en/latest/gdb.html
        "setupCommands": [
            { "text": "set remote hardware-breakpoint-limit 1" },
            { "text": "set remote hardware-watchpoint-limit 1" },
            { "text": "set remote interrupt-on-connect on" },
            { "text": "set remote kill-packet off" },
            { "text": "set remote symbol-lookup-packet off" },
            { "text": "set remote verbose-resume-packet off" },
            { "text": "mem 0x20000000 0x3fefffff ro cache" },
            { "text": "mem 0x3ff00000 0x3fffffff rw" },
            { "text": "mem 0x40000000 0x400fffff ro cache" },
            { "text": "mem 0x40100000 0x4013ffff rw cache" },
            { "text": "mem 0x40140000 0x5fffffff ro cache" },
            { "text": "mem 0x60000000 0x60001fff rw" },
            // If you want to go fast (default: 115200) but
            // make sure this is the SAME baudrate as the one
            // you specify in Serial.open(..blabla..); code
            { "text": "set serial baud 921600" }
        ]
    }
  ]
}

esp8266_gdb_debugging_vscode's People

Contributors

mbonesi avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.