Modern development environment for Archimedes

discuss general risc os software applications and utilities
Related forum: adventures


Post Reply
User avatar
kieranhj
Posts: 882
Joined: Sat Sep 19, 2015 11:11 pm
Location: Farnham, Surrey, UK
Contact:

Modern development environment for Archimedes

Post by kieranhj » Fri Jan 31, 2020 7:05 pm

Hey all, I've recently started dabbling in some ARM development again, as a change from several years of 6502, targeting the 'classic era' Archimedes machines, so A310 through A5000, but mostly focused on A30x0 as a standard configuration.

I thought I'd start a thread on setting up a modern development environment for the Archie to see what other folks think. As I do most of my hobby coding whilst commuting on the train, it's not really feasible to use real hardware :wink: and as awesome as Arculator v2 is, I don't really want to write code inside the emulator itself as the tools of the era now really show their age.

My requirements are:
  • Windows based
  • Proper code editor
  • Fast assembly direct to an executable binary
  • Fast testing of output executable in an emulator
What I've ended up with is quite similar to my BeebAsm setup:
  • VSCode as the editor
  • vasm assembler built for Windows with the standard syntax module, ARM cpu module and simple binary output module
  • Arculator v2 emulator (awesome)
  • A simple make.bat batch file for assembly and copying to hostfs folder for rapid iteration in the emulator
Essentially my workflow then becomes: edit -> type make in cmd -> press F12 and type *<executable name> in open Arculator window. The turn around time is seconds as the assembler is pretty much instant and Arculator just picks up the new file in the hostfs folder instantly.

Some gotchas / things that could be improved:
  • I was using simonm's BeebAsm syntax highlighter plugin for VSCode but literally just installed an ARM assembly highlighter - will let you know how I get on! [-o<
  • I could run the build commands from directly inside VSCode and/or use proper make - old habits die hard, I guess :-
  • The standard syntax module for vasm takes a bit of getting used to - could potentially write my own BeebAsm / BBC Basic assembler syntax module... :-k
  • The worst part is that the ARM assembler in vasm has some bugs #-o of which I've fixed a couple:
    • mov reg, #imm sometimes results in using a non-obvious / unnecessary shift - fixed(ish)
    • adrl just flat out didn't work at all - fixed
    • sometimes the assembler fails to resolve all symbols after 8 passes due to an alignment issue - temporarily adding a mov r0,r0 NOP anywhere fixes it :-k
    • looks like conditional assembly flag is getting confused with the opcode mnemonic - e.g. adrleq is interpreted as adrle
  • For now I'm just assembling one output binary but it is possible to build object files with vasm then link them with vlink
If anyone is interested I'm happy to share the resulting source / binary. I'm on vasm version 1.8e whilst the latest version is 1.8g.

This has proven to be pretty efficient for me. My only missing feature is a debugger in the emulator but !DDT works reasonably well within RISCOS once you get used to the shortcuts, it's a bit slow though. Does anyone else have a similar setup or particular thoughts on this topic?

EDIT: I guess this could have been in the 'development tools' forum. I'll leave it up to the mods if they feel like moving it.
Bitshifters Collective | Retro Code & Demos for BBC Micro & Acorn computers | https://bitshifters.github.io/

User avatar
myelin
Posts: 912
Joined: Tue Apr 26, 2016 10:17 pm
Location: Mountain View, CA, USA
Contact:

Re: Modern development environment for Archimedes

Post by myelin » Fri Jan 31, 2020 11:27 pm

Very nice!

For bare metal stuff, which is a pretty particular case as I doubt anyone else is trying to write ROMs for the Arc, I used the embedded ARM GCC (arm-none-eabi-gcc and friends). It turns out that it will build for ARMv2 if you turn off the Thumb options and don't try to compile stuff like "bx lr". After battling through the process of setting up the C stack, I could happily link C++ and assembly together, which really made things a lot easier.

Code: https://github.com/google/myelin-acorn- ... bootloader

I also use Arculator for testing, although I have to restart every time, so I have a "build and run" script that builds the bootloader (and Arculator, if necessary, because I sometimes add debug print statements in there), and launches the whole thing.
SW/EE from New Zealand, now in Mountain View, CA, making BBC/Electron hardware projects for fun.
Most interesting: Arcflash, FX2+PiTubeDirect Tube/Cartridge adapter, USB cart interface.

VectorEyes
Posts: 323
Joined: Fri Apr 13, 2018 2:48 pm
Contact:

Re: Modern development environment for Archimedes

Post by VectorEyes » Sat Feb 01, 2020 1:43 am

kieranhj wrote:
Fri Jan 31, 2020 7:05 pm

Some gotchas / things that could be improved:
  • [...]
  • I could run the build commands from directly inside VSCode and/or use proper make - old habits die hard, I guess :-
    [...]
You can do this. The tasks.json file inside the .vscode folder defines what happens when you 'Build' and/or 'Run' in VSCode. For BeebAsm-based development I have 'Build' set up to run a shell script that calls make, then takes the resulting SSD and copies it to various places, and 'Run' spawns JSBeeb and passes it the appropriate arguments to boot up the SSD. Because 'Build' and 'Run' are just calling shell scripts, you can basically customise the build and run to your heart's content, so you'd probably be able to get them to run your build.bat file or do anything else you like.

The nice thing about the tasks.json is you can specialise it for Windows, Mac and Linux, so if you happen to be doing x-plat development, you can have different build and run steps for each platform. The not so nice thing is that the tasks.json layout is a bit esoteric. It's not actually complicated, it just takes a bit of Googling and reading the VSCode documentation before you get it right.

sirbod
Posts: 1089
Joined: Mon Apr 09, 2012 9:44 am
Location: Essex
Contact:

Re: Modern development environment for Archimedes

Post by sirbod » Sun Feb 02, 2020 7:59 am

Outside of RISCOS I also use Visual Studio Code, with an ARM addon along with Ghidra to debug problematic games. I do most development within RedSquirrel on a Windows 10 laptop though.

As "work" laptops can't be used for personal use, I'd need a 2nd laptop, so would probably use real hardware such as a pi-top or the R-Comp ARMbook. Only problem is I already commute with two work laptops, so ceased development back in March 2019 as I'm not carrying three around London! As I'm nearing the end of the project to remove one of the laptops, I might investigate the ARMbook to develop during the commute.

Modern does not mean you necessary need to use Windows 10, Mac or Linux.

User avatar
kieranhj
Posts: 882
Joined: Sat Sep 19, 2015 11:11 pm
Location: Farnham, Surrey, UK
Contact:

Re: Modern development environment for Archimedes

Post by kieranhj » Wed Jul 01, 2020 10:03 am

Just a quick update on this, I decided rather belatedly to just contact the author of vasm to report the bugs. Lo & behold he fixed them all in less than 24 hours. #-o I wish I had done this sooner.

There hasn't been a new official release of 1.8i yet but you can grab the nightly sources with all known bugs fixed in the ARM backend from here: http://sun.hasenbraten.de/vasm/index.php?view=source

It's a super-fast assembler and I've been enjoying using it with Arculator as my dev environment. I've had to get used to the 'GNU as standard' syntax but I'm sure I could write a BBC BASIC assembler / BeebAsm syntax frontend if I really cared about it that much.
Bitshifters Collective | Retro Code & Demos for BBC Micro & Acorn computers | https://bitshifters.github.io/

Post Reply

Return to “32-bit acorn software: other”