prb28 / vscode-amiga-assembly

Amiga Assembly extension for Visual Studio Code
GNU General Public License v3.0
178 stars 12 forks source link

Makefile support / Migrating existing project #65

Open lastebil opened 5 years ago

lastebil commented 5 years ago

I've used vasm and vlink quite a bit in the past, and was hoping to be able to use the syntax highlighting and debugging of this project, but I'm very confused about makefile support - both in visual studio code and using your plugin.

Visual Studio Code seems to have recently changed the way makefiles are triggered - via a "tasks.json" with no documented location. There is a lot of confusion (see, for example, https://stackoverflow.com/questions/34268034/where-is-the-tasks-json-file-in-vscode for which the accepted answer no longer works (F1 does nothing) and the last answer indicates it MIGHT work with the .vs or .vscode folder...) Other searches have led me to many confused people and no clear answers.

However, your setup appears to be ... overloading vlink to just operate on all the files in a directory? (I honestly can't figure out why anyone would do this (: ) But it is not creating a tasks.json file. So your method seems to be at odds with the vscode documentation.

How is one supposed to go about adding a method of building, other than the suggested "just throw everything in a directory and hope vslink can figure it out" (which will not work for my project, and I anticipate it won't work well for any vbcc and vasm combined projects either.)

(I also have to echo the already open report that the documentation is very lacking - if you don't know VS Code, it's basically unusable. Instead of working on Amiga code, I'm fighting an editor, trying to get it to work... not optimal...

But despite my frustration, I'd be willing to help write better documentation on "how to get started" and "how to migrate an existing project." As I can't do either of those things now, learning how would enable me to write that documentation...)

prb28 commented 5 years ago

I understand your frustration. Please see this extensions as an hobby project and not a full professional grade IDE for the Amiga. My main purpose was to have something really easy to use for simple projects to learn and have fun with the asm on a amiga (copper/blitter) not for combined big vbcc/vasm/vlink projects.

So yes, this is not adapted for your needs because there is no build system (makefile / cmake / gradle / etc.) all the files are compiled into one dir and linked together because it is the simplest way to do with little projects, and that's what I wanted! (really!) (the link order is missing it will be fixed in the next release thanks to a pull request from @bSr43). The debugger will certainly not work with C projects because it will not resolve the symbols, and will not attach to the sources and that may be a lot of work to do.

In your case, you have to disable the vlink option and, as you figured out, to create a task in vscode to call a makefile (the cpp plugin will do that). If you have a not too big example I can try to configure it with you and see if a feature may be created in the extension, at least an FAQ.

But as you seem ready to dig into it and in the documentation, that would be a great contribution, really appreciated, I'm not a good documentation writer (as at least you and @abelanet noted) and I'm using vscode for some time so a lot of things seem natural for me. So the documentation is in markdown and this documentation on how to make pull requests on project wiki may be a good way to start. A video may be easier to understand ?

lastebil commented 5 years ago

I also am using this as a hobby project, all the amiga parts, so I understand (:

I'll try adding the cpp plugin, and see about one of my small projects (they're all small, but they also are in various states of code... so... ) Also they are fully assembly - the C portions, if I get to those at some point, will need further work to handle the symbol resolving. (I think this should be possible, but not quick (: )

and then I'll attempt to make a few pull requests on the wiki, perhaps noting where we need to be careful to watch for changes to the vscode procedures - which don't seem to always be updated by Microsoft, either.

I likely will write a few little (python) utilities to create configs for this, as I find the copy/paste/guess what you need VSCode json problematic (like most of my projects where I left the configuration in json, and then do not remember 6 months later what the undocumented json does...) so I may be forking and sending a pull request with some of those... but that's AFTER I get an understanding and likely after documenting (:

prb28 commented 5 years ago

In vscode you can add comments in the json configuration files -> that helps a lot ;-). Even if the C code is not in good shape, (I don't mind, I've a lot of shitty/testing/whatsoever code too), if it's compiling, it's ok for me, I can try to make a mixed build. And take your time, there is no hurry for me. Thanks for the feedback and help!

prb28 commented 5 years ago

I've started this repository: https://github.com/prb28/vscode-amiga-vbcc-example. I've a vbcc program with mixed asm and C building with vscode on osx. The debugging does not work (I'll dig into that later - the extension is not ready to use a C source). For now it's just a osx configuration and it's missing documentation. But before I want to prepare a binary bundle because the vbcc settings may be a bit tricky when done for the first time. @lastebil which OS do you use ?

geijer commented 5 years ago

Perfect! Makefile support will fit my toolchain a lot better!

prb28 commented 5 years ago

@geijer which OS do you use ? Do you already use vbcc in a project ? (I'm interested on feedback over windows because it's not my main dev platform) For now it is mainly a vscode task configuration, but I think with the C/C++ extension and some tasks, we can have a descent development platform.

geijer commented 5 years ago

@geijer which OS do you use ?

Windows 10 and Ubuntu.

Do you already use vbcc in a project?

Yes but my current main project (SysInfo) uses a custom Makefile with a debug/release/autotest/disassemble targets that bumbs version number, converts png to "raw", modify the end executable etc... using support tools built in python. Currently I use nmake/make to build the debug target with debug hunks, disassemble it back to asm and then load that source in your sample project to be able to use the single step debugger.

For now it is mainly a vscode task configuration, but I think with the C/C++ extension and some tasks, we can have a descent development platform.

I hope for Makefile support without requireing C/C++ to support advanced toolchains.

prb28 commented 5 years ago

@geijer , @mithrendal , @lastebil If you have some time can you test and review the readme of vscode-amiga-vbcc-example?

The zip bundle of the project with binaries for windows and osx: https://github.com/prb28/vscode-amiga-vbcc-example/releases/tag/0.17.0-b1

You will have to install manually the pre-release of the extension (type F1 then select Extensions: Install from VSIX...): https://github.com/prb28/vscode-amiga-assembly/releases/tag/0.17.0-b1

mithrendal commented 5 years ago

I already played a bit with it, and debugger stopped in hello.c ;-) ... ce tellement super !! ...You updated it ? I will get the new updated workspace and do some review .. j'espere ce soir ...

prb28 commented 5 years ago

The update is with the help/feedback of @geijer . It just removes/concats some files so it's more simple to use and 'understand'. (there is a problem with the CR/LF in the startup sequence on Windows)

mithrendal commented 5 years ago

Uuups, I can now not set breakpoints in c or asm anymore...

grafik In help->toggle developer tools ->console I get this ...

/Applications/Visual Studio Code.app/Contents/Resources/app/out/bootstrap.js:7 Error: ENOENT: no such file or directory, open '/Users/****/Library/Application Support/Code/clp/4b8dea7ac82d0258ab5bf4409406b31c.de/corrupted.info'
(anonymous) @ /Applications/Visual Studio Code.app/Contents/Resources/app/out/bootstrap.js:7
/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:3272 [Extension Host] debugger listening on port 46777
/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:238 [Extension Host] Error: ENOENT: no such file or directory, open '/Users/****/Library/Application Support/Code/clp/4b8dea7ac82d0258ab5bf4409406b31c.de/corrupted.info'
t.log @ /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:238
/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:238 [IPC Library: File Watcher (chokidar)] Error: ENOENT: no such file or directory, open '/Users/****/Library/Application Support/Code/clp/4b8dea7ac82d0258ab5bf4409406b31c.de/corrupted.info'
t.log @ /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:238
3/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:238 [Extension Host] Error: ENOENT: no such file or directory, open '/Users/****/Library/Application Support/Code/clp/4b8dea7ac82d0258ab5bf4409406b31c.de/corrupted.info'
t.log @ /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:238
/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:238 [Extension Host] activating extension
/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:238 [Extension Host] starting language server
12/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:238 [Extension Host] Error: Unexpected SIGPIPE
    at process.on (/Applications/Visual Studio Code.app/Contents/Resources/app/out/bootstrap.js:5:192)
    at process.emit (events.js:182:13)
t.log @ /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:238
/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:2365 The language server crashed 5 times in the last 3 minutes. It will not be restarted.
onDidNotificationChange @ /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:2365

Maybe I have to reinstall visual studio code ? Or the c/c++ extension ? Or OSX 10.11 is not supported and I must move to another more modern machine ? But yesterday the in the b1 workspace I could set breakpoints... Maybe something got corrupt? I will try...

UPDATE: I did deinstall the language extension. Now I can set breakpoints again...

prb28 commented 5 years ago

I work on a osx 10.11 too ;-). So, is it my pre-release that is corrupted ?

mithrendal commented 5 years ago

Question: when I step through the C file I can see 68k registers and callstack but I can't add watches for variables (for example the run variable "i") and also I discovered that while I am stepping through the C file that fsuae stays gray... In contrast to this "run" (not "debug") brings the printf output to the fsuae display.

grafik

Is this normal ????

prb28 commented 5 years ago

Yes there is no evaluation for now. I'm looking how to do that... maybe tricky. The display is.... normal... The program starts before the cli was loaded, the program is injected in FS-UAE. So printf does not know where to print. For now I'm trying to add a disassembled view to see the compiled program stepping.

mithrendal commented 5 years ago

Cool. I have definitly a problem with this grafik When I install it than the language server crashes... For what do I need it ?

prb28 commented 5 years ago

It is optional. It's just if you want to code in C.

mithrendal commented 5 years ago

🙃Je veux! Does it crash in yours osx 10.11 ?

prb28 commented 5 years ago

no, it works like a charm, I do all my fs-UAE devs with it. For these conversation better skip to this issue: https://github.com/prb28/vscode-amiga-assembly/issues/66 it's more related.