A survey of C compilers available for P2



  • I assume by scripting you mean controlling/extending VSCode with scripts...

    They have this: https://code.visualstudio.com/docs/editor/tasks

    And you can make extensions with JS, https://code.visualstudio.com/api/get-started/your-first-extension

    There are a ton of extensions already available, browse here: https://marketplace.visualstudio.com/VSCode

  • Scripting example that i do in NotePad++

    Load 4files into tabs

    Run python script that does...

    Convert special characters using regex type replacements

    Copy sections of code from file contents in one tab to a replacement in another tab

    Change dates in the files data in tabs

    Save the files with new filenames

    I havent been able as yet to work out if the python addin can do that for me. If i can find some examples then i can replace the use of NotePad++ which would be an advantage to use a single editor for a number of use cases.
  • The python extension is meant to be for editing python in VSCode. They have extensions for many languages.

    The tasks thing can probably do some (or all) of what you described. Also there is an extension called Code Runner that can run python scripts in the IDE, that might also work for you.

    Honestly, I've pretty much only used VSCode as an editor for python, HLSL (shaders), and C code (destined to be compiled by SimpleIDE). I have extensions installed that cater to those needs, but I don't do any building or running from there. I'm not really taking full advantage of it, but I think it is a decent editor.

    If I had any experience at all with node.js and javascript then I would make and extension for Spin/PASM that compiled with fastspin and/or openspin, but I don't even know the first thing about js.
  • Thanks Roy.
    I've been looking to see if I can use a scripting model on the open files. I'll take a look at tasks and see if that can help. I don't know anything about js either.

    If I can find a solution to using VSC for work, then I'll switch over to this for all my editing as it would be great to only use one. If I can do that, then I can take a look at what is required to highlight syntax for spin and pasm. Otherwise there is no point in learning yet another editor :(
  • Getting slightly back to the topic of C compilers, here's a program that will extract function declarations from source code and add __fromfile declarations. The output may need a bit of manual tweaking (e.g. to introduce type declarations) but it will get you most of the way to getting a .a file for fastspin.

    Of course the other compilers do not need this kludge (but do need a linker and library program). Actually that brings up a topic that I left out of my original survey; the support programs that aren't the C compiler per se but are used in a C environment. I'm thinking of:
      as  - assemble code to an object file
      ld  - link object files together
      ar  - create library file
      nm  - show symbol names in an object file
      gdb - debug programs
    The ZPU and RISCV compilers can of course use the appropriate platform versions of these (gdb may need some work). But for native compilers we don't have a standard set of tools yet.

    p2gcc does have a good start on some of these, although I don't think it uses any kind of standard object file format. But unless something better comes along it's probably where we should start.

    fastspin punts and compiles the whole program at a time, which has some advantages but also makes porting some kind of projects a lot harder

    I'm not sure what Catalina does for libraries; I know it relies on an external assembler like p2asm.

    The debugger is a story that we haven't even started to address yet for P2, AFAIK. The P2 has some interesting debug capabilities. It would be nice to be able to debug C/C++ programs with symbols, but even a basic assembly language debugger would be useful.
  • lol... libtool.c and libtool.h huh? Not to be confused with https://www.gnu.org/software/libtool/ I suppose
Sign In or Register to comment.