GithubHelp home page GithubHelp logo

jamiedstewart / gba_vscode_basic Goto Github PK

View Code? Open in Web Editor NEW
98.0 6.0 32.0 149 KB

A 'simple' Game Boy Advance development setup using Visual Studio Code

License: GNU General Public License v3.0

Makefile 89.92% C 10.08%

gba_vscode_basic's Introduction

GBA_VSCode_Basic

A 'simple' Game Boy Advance development setup using Visual Studio Code and relying on devkitPro and devkitARM to do the heavy lifting. If You're on OS X there's a bit at the bottom of this you should read

Dependencies

To get this project to compile there are some dependancies that need to be taken into consideration. Obviously you will need a GBA emulator set up on your sytem, I tend to flip flop between using NO$GBA or lately mGBA. At the minute I use mGBA as it hooks up nicely with gdb debugging. Which I've configured this VS Code set up to make use of, so get a copy of mGBA (I'm using Version 0.6.2 as version after this at the time of release weren't working correctly with GDB).

devkitPro

You will need to have devkitPro with devkitARM installed, this can easily be carried out by heading over to the devkitPro Installer page and getting the most current version for your development platform. Try to avoid installing devkitPro to a directory or sub directory with long path names. I tend to install devkitPro to the root of my data drive. After installing it, you need to add "%DEVKITPRO%\tools\bin" to the Path. The installation seems to no make this and is necessary for the debugger to work correctly. Once devKitPro has done it's thing you can move on to getting VS Code set up.

VS Code Extensions

To make life easier install the following extensions ARM Extension C/C++ C++ Intellisense

.vscode file modifications

c_cpp_properties.json - line 54 of this file may need to be modified. You can modify this line of code to point to the arm-none-eabi/include folder within devkitPro/devkitARM/

launch.json - There are a few modifications to be made here, again surrounding where you have installed devkitPro to on your machine.

  • Line 19 the location that miDebuggerPath points to will need to change to reflect your devkitPro installation folder path.

tasks.json - line 29 will need to change to reflect where you have installed mGBA. Only the first part of this line needs to change up to the call to the exe. The latter half of the line need not change. Line 35 may need to change, or you can remove the whole run label if you choose to. I sometimes use No$GBA as the source debugger is pretty great.

Debugging the Game

Once all of the above changes have been squared away you should be able to make this project (ctrl+shift+p -> make debug) then press F5 to begin debugging, if all your paths are set up you should be good to go. There was an issue with "The specified task cannot be tracked" but pressing the button for "debug anyway" keeps the process going with no ill effects, this issue I've managedd to work around by having the launch task run as non-background and have set a simple sleep value in the shell command as a way to delay the process enough for mGBA to get up and running before attempting to connect with gdb, these didn't seem to be anyother way to do this as mGBA doesn't provide any hooks to inform when it has successfully started and I couldn't find any in the process history. You should then be presented with a debug view, where you can navigate through the code line by line and track individual values and memory addresses.

Click on the video to view a youtube video going through this GitHub repo.

alt text

OS X Users

While this does 'work' on OS X it's not as perfect as I'd like. To get the gdb debugger to work correctly, make sure to get mGBA version 0.6.1 as the latest version wasn't connecting properly for me. Make sure to codesign the gdb debugger, to do this you need to follow along with this guide although I ran into an isue with creating the certificate in the 'system' location and had to create it in 'login' then copy it over to the 'system' location (just drag and drop). Then in the final step of actually codesigning, target the devkitpro arm gdb : "codesign -s gdb-cert /opt/devkitpro/devkitARM/bin/arm-none-eabi-gdb"

Ok and now the bit I'm the least satisfied with, there seems to be an issue with VS Code an running mGBA as a background task, mGBA on OS X refuses to pass control back to the terminal to allow the debugger to launch this is no matter what I set the "isBackground" flag to. But, debugging still works, it's just a three step process now.

  1. Press F5 to launch the process
  2. Once mGBA is up and displaying it's startup screen, stop the debugger in VS code by pressing the stop button on the debug toolbar
  3. Press F5 to relaunch the debugger, this time it will attach itself to the existing instance of mGBA.
  4. Happy debugging.

I will come back to address this issue to attempt to get this working without the need to stop and start again.

gba_vscode_basic's People

Contributors

aljenci avatar jamiedstewart avatar mic1211 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

gba_vscode_basic's Issues

Linux setup?

Would this work under linux? I have the build part working, but getting the launch and debugger working seems to be giving me problems.

White screen

All I get is a white screen.
Compiled under Ubuntu 18.04 with current devkitpro.
Tried visualboyadvance and retroarch mgba core

Doesn't work

Completely borked, all it does is error out and then after MGBA starts, it closes after 5 seconds.

mGBA 6.2 not working in macOS Mojave (10.14.6)

Hello.

Thank you for the tutorial. You stated that last mGBA version (0.8.0) does not work with proposed debug configuration (it really doesn't), so I tried the suggested version (0.6.2), but it does not work with macOS Mojave. It displays the following error:

mbpro-falvarez:MacOS fede$ /Applications/Emulators/mGBA-0.6.2-osx/mGBA.app/Contents/MacOS/mGBA
dyld: Library not loaded: /usr/local/opt/qt/lib/QtMultimedia.framework/Versions/5/QtMultimedia
  Referenced from: /Applications/Emulators/mGBA-0.6.2-osx/mGBA.app/Contents/MacOS/mGBA
  Reason: image not found
Abort trap: 6

Do you figure out any workaround to have the whole thing working? I'm also trying to set up all the stuff under Windows, but I prefer to work under macOS. I must admit I'm totally newby with VSCode and GDB.

Thanks in advance. Kind regards.

Debug woes on macOS, can't start a debugger

  • macOS 10.14.6
  • Xcode 11.3.1
  • mGBA 0.8.1 (older version recommended doesn't launch on my machine, insta crash, output is at the bottom)
  • code signed the gdb binary

I was able to adjust various params in the launch.json to point to the right places, and when I launch I get mGBA that just sits there. I went ahead and pressed the stop button in VSCode, and relaunched (like the README instructs) but it never connects.

Do you think mGBA still doesn't do remote debugging and the real problem is I need to get mGBA 0.6.1 to work?

Crash output (if you have any ideas here, QtOpenGL (5.14 - 5.14.2))

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_platform.dylib      	0x00007fff66472100 _platform_strncmp + 320
1   com.endrift.mgba-qt           	0x00000001065dbc8d mGLES2ShaderInit + 381
2   com.endrift.mgba-qt           	0x00000001065db8af mGLES2ContextInit + 591
3   com.endrift.mgba-qt           	0x000000010651415e QGBA::PainterGL::PainterGL(int, QGLWidget*) + 334
4   com.endrift.mgba-qt           	0x0000000106512523 QGBA::DisplayGL::DisplayGL(QGLFormat const&, QWidget*) + 243
5   com.endrift.mgba-qt           	0x0000000106512049 QGBA::Display::create(QWidget*) + 169
6   com.endrift.mgba-qt           	0x00000001065a8e01 QGBA::Window::Window(QGBA::ConfigController*, int, QWidget*) + 625
7   com.endrift.mgba-qt           	0x0000000106516686 QGBA::GBAApp::newWindow() + 86
8   com.endrift.mgba-qt           	0x00000001065021a9 main + 1321
9   com.endrift.mgba-qt           	0x0000000106501c74 start + 52

mGBA debugging not working

Hello!
I am trying your code. All seems to work correct. The rom is generated and I can test it in the emulator and works correctly.
But the debugging don't work.
Using the mGBA version 0.6.2 directly with the vscode the rom don't load, so I changed to another version. I am trying with the version 0.8.3 that is the last, but with others is the same.
With version 0.8.3 the emulator starts with the rom in debug mode correctly, but the vscode show an error:
image
All the config seems ok, the debugger address and port (localhost:2345), the devkitPro path and devkitARM path, etc
I tested some more mGBA versions, so I think that is not problem of that version concrete.
Thanks!

Mac: GDB Timed Out!

Hello everyone,
Trying to run the project on my Mac I get the following error:
Unexpected GDB output from command "-target-select remote localhost:2345". localhost:2345: Operation timed out.

Also the VSCode output gives me the following Error:

Error: the description can't be converted into a problem matcher:
{
    "background": {
        "activeOnStart": true,
        "beginsPattern": "^.*debuggerReady.*$",
        "endsPattern": "^.*debuggerReady.*$"
    }
}

I followed the medium guide in the README and tried launching mGBA first and then restarting the debugging.

Thanks for the help in advance. ๐Ÿ˜„

Couldn't find a debug adapter descriptor for debug type 'cppdbg' (extension might have failed to activate)

I posted this same issue in the cpptools repo as well, but it is still unresolved so I will post it here as well. Also, to Jamie, if you are reading this, your video series on GBA development is absolute excellent, and really helped me get started in homebrew development. :)

I am using VSCode to develop homebrew for the Game Boy Advance. Everything was working fine until I opened VSCode one day and the debugger stopped working.

Whenever I go to run and debug my code, this error pops up, "Couldn't find a debug adapter descriptor for debug type 'cppdbg' (extension might have failed to activate)". Sometimes, the game I am working on will pop up on the emulator before the I get the error message, and be able to play. Other times, the error message pops up and the emulator doesn't even load the game. Regardless, I am unable to use breakpoints or anything along those lines.

Note: I do have ms-vscode-cpptools installed and active in my VSCode, and have reloaded VSCode several times now to no avail.

I used a popular tutorial to configure my JSON to load the code into a GBA emulator.

My Launch.json looks like this:

{
    "version": "2.0.0",
    "configurations": [
        {
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "preLaunchTask": "gdb-debug", 
            "postDebugTask": "stop emulation",
            "serverLaunchTimeout": 10000,
            "stopAtEntry": true,
            "program": "${workspaceFolder}/${workspaceFolderBasename}.elf",
            "MIMode": "gdb",
            "externalConsole": true,
            "cwd": "${workspaceFolder}",
            "targetArchitecture": "arm",
            "miDebuggerServerAddress": "localhost:2345",
            "windows": {
                "miDebuggerPath": "C:/devkitPro/devkitARM/bin/arm-none-eabi-gdb.exe",
                "setupCommands": [
                    {
                    "description": "Enable pretty-printing for gdb",
                    "ignoreFailures": true,
                        "text": "file ${workspaceFolder}/${workspaceFolderBasename}.elf -enable-pretty-printing"
                    }]
            },
            "osx":{
                "miDebuggerPath": "/opt/devkitPro/devkitARM/bin/arm-none-eabi-gdb",
                "setupCommands": [
                    {
                    "description": "Enable pretty-printing for gdb",
                    "ignoreFailures": true,
                        "text": "file ${workspaceFolder}/${workspaceFolderBasename}.elf -enable-pretty-printing"
                    }]
            },
        }
    ]
}

Platform and Versions

  • Operating System: Windows 10
  • C/C++: v0.29.0
  • VSCode Version: 1.48.0

Other Notes/Information

I hope I did a decent job of outlining the problem, I am newer to forum posts like this. If there is any more information needed I would be pleased to update the post.

Edit for people of the future: The templates that I am working with are provided by Jamie D Stewart, with his repository listed here
. The video series he has documenting the basics of GBA development are can be found here.

Unable to establish a connection to GDB!

Howdy! I'm following along with the videos and readme file. I've gotten to the point in the video where we run the debugger and it opens up mGBA to see all the pretty colors displayed. But I'm receiving the same error message as user Aljenci posted in another thread. Though in my case mGBA never opens and I'm greeted with these errors.

terminateded
Then...
snip
This also gets printed in the debug console
debug
I also noticed in the terminal I was receiving an error.
terminal
After adding a GBA folder to my desktop it changed to this
newterm

I tried adding the devkitpro\tools\bin addition to the path but that didn't seem to change anything.
paths

Any advice on this problem I'm thankful for. It seems like I really goofed something up along the way to be getting this many errors...

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.