LCC for the Gigatron. Take two.

Using, learning, programming and modding the Gigatron and anything related.
Forum rules
Be nice. No drama.
lb3361
Posts: 77
Joined: 17 Feb 2021, 23:07

Re: LCC for the Gigatron. Take two.

Post by lb3361 »

Releasing GLCC-RELEASE-1.1

This new version has a complete ANSI C 89 library with the trigonometrics and hyperbolic functions that were missing from 1.0.

It is available from the github page https://github.com/lb3361/gigatron-lcc.

Thanks to axelb, it now compiles under Windows using either cygwin or mingw64.

Linux and Mac users are simply encouraged to clone the directory and follow the instructions of the README.md file.

Todo: cmake...
Last edited by lb3361 on 01 Sep 2021, 21:42, edited 1 time in total.
lb3361
Posts: 77
Joined: 17 Feb 2021, 23:07

Re: LCC for the Gigatron. Take two.

Post by lb3361 »

Gigatron LCC for Windows

Porting GLCC to Windows has several aspects. Besides compiling the GLCC executables for Windows and ensuring that invoking the command `glcc` or `glink` finds the correct version of Python, we also need to consider which supporting commands are available to a programmer writing Gigatron programs with GLCC. Under Unix, a programmer can rely on a`make` command and on many standardized commands to manipulate and process files. Under Windows, similar facilities exists but are different or sometimes require installing other packages. One solution is simply to install Cygwin https://www.cygwin.org. Thanks to axelb, GLCC can be built, installed, and used under Cygwin just like one builds it, install it, or use it under Unix. The only problem is that what was built in Cygwin remains in Cygwin. For instance, there is no easy way to execute such a version of GLCC from the Windows command line. Everything has to happen from the Cygwin command line.

Many readers of this post have already installed Git for Windows (https://gitforwindows.org). It turns out that Git for Windows comes with a very stable and very well optimized suite of Unix-like tools, derived from MSYS2, and accessible through the "Git Bash" start menu item. Since they are already on your system, why not providing GLCC for Windows as an addon?

Prerequisites: Installation and usage:
  • Download the attached file `glcc-1.3.zip` and extract it somewhere, for instance in `c:\glcc`.
  • To use GLCC from the Windows command line, open a command window (cmd.exe), and add `c:\glcc\bin` to the search path with the following command. You can then invoke `glcc`, `glink`, and `gtsim` in this window.

    Code: Select all

    C> path c:\glcc\bin;%PATH%
    
  • To use GLCC from the Git Bash, open a Git Bash window and add `/c/glcc/bin` to the search path with the following command. You can then invoke `glcc`, `glink`, and `gtsim` directly. You can also use `git` or any of the many unix-like commands available in Git bash. You can even invoke `make` because /c/glcc/bin also contains a Mingw version GNU-Make (https://packages.msys2.org/package/ming ... po=mingw32).

    Code: Select all

    joe@machine MINGW32 /Users/joe
    $ PATH=/c/glcc/bin:$PATH
    $ alias glcc=glcc.cmd
    
    For instance you can directly compile versions of the horizon program by simply invoking the command `make`.
    No need to change anything.

    Code: Select all

    joe@machine MINGW32 /Users/joe
    $ cd /c/glcc/stuff/horizon
    
    joe@machine MINGW32 /c/glcc/stuff/horizon
    $ make
    glcc -map=32k,./horizon.ovl --no-runtime-bss-init -rom=v4 horizon.c -o horizon-v4.gt1
    glcc -map=32k,./horizon.ovl --no-runtime-bss-init -rom=v5a horizon.c -o horizon-v5a.gt1
    glcc -map=32k,./horizon.ovl --no-runtime-bss-init -rom=at67x horizon.c -o horizon-at67x.gt1
    
    joe@machine MINGW32 /c/glcc/stuff/horizon
    $ ls -l
    ...
    
The main issue is that compiling this version of GLCC for Windows can be involved. The simplest solution is in fact the install the 32 bits version of the Git for Windows SDK" which contains all that is needed and much more.

[Update] We now have a CMake version that makes it *theoretically* possible with any compiler including Microsoft's MSVC.

[Update] I'll periodically update the Windows binary in this post to keep it current.
Attachments
glcc-1.3.zip
(1.43 MiB) Downloaded 2 times
Last edited by lb3361 on 17 Sep 2021, 13:55, edited 1 time in total.
veekoo
Posts: 25
Joined: 07 Jun 2021, 07:07

Re: LCC for the Gigatron. Take two.

Post by veekoo »

Now that GLCC is updated recently, how can I see the version of my installed files?
I am using virtual Ubuntu linux as enviroment.
lb3361
Posts: 77
Joined: 17 Feb 2021, 23:07

Re: LCC for the Gigatron. Take two.

Post by lb3361 »

veekoo wrote: 17 Sep 2021, 04:39 Now that GLCC is updated recently, how can I see the version of my installed files?
I am using virtual Ubuntu linux as enviroment.
Ooops. Good question. I should have a version string and a change log somewhere :-)

In the mean time you can try `glcc -v` to know when the code was compiled.

Code: Select all

$ glcc -v
/c/glcc/lib/gigatron-lib/lcc -v
lcc: (compiled on Sep 14 2021)
[Update] I've just added two things into the git repository:
  • A file `GLCC.log` describing the changes (https://github.com/lb3361/gigatron-lcc/ ... r/LOG.glcc)
  • A new option `-V` in glcc and glink to report the version.

    Code: Select all

    $ glcc -V
    GLCC_RELEASE_1.3-3-gf8c3d76
    
    The version is reported from command `git-describe --tags`. For instance the above version string means
    that the running version is 3 commit ahead of tag `GLCC_RELEASE_1.3` at commit `f8c3d76...`
Post Reply