A large collection of ARM links

A large collection of ARM links

Circit board
From Pixabay

ARM being the CPU brand inside Raspberry Pis. This is a collection of talks and links to articles about the ARM architecture, concurrency, performance and way too much other stuff to list. There’s a lot in there and I defy anyone with the vaguest interest not to find something of interest.

I’m not a hardware person myself, but dipping into stuff like this can yield benefits. Remember the CPU in the Pi 4B has four cores. If you are writing software that just runs one one thread then it’s like driving a car with a four cylinder engine but its only firing on one. And if you manage to write software to use all four cores, do you know how to avoid false sharing? (Yes it’s a thing!)

 

 

 

Added the sources of another game

Added the sources of another game

Basic Computer games bookThis was a text mode game, my idea being to do something like the old Star Trek BASIC game but better. I called it Star Empires and it’s on GitHub, just follow the link to GitHub on the C Games sources link.

The zip file includes both C and a C++ version. Both will compile with Visual C++ 2019 Community edition. There is a minor compile error, a = that should be == in the C++ source. I ill get round to fixing it and uploading a replacement.

I do get a bit of pleasure (more like an exercise in masochism!) converting old BASIC games to C. I’m looking at the two Creative Computing books (and while 95% of the games are not exactly great (well lets be generous and say they were good 45 years ago!) but there’s one or two that might be worth the effort! I bought these in 1982 lost those and then bought them a few years back again.

Plus when you think how the games industry has matured since the late 70s and 80s, and many of those early programmers will have cut their teeth on games like that before learning more advanced stuff, so  lets not be too harsh!

 

Raspberry Pi – a couple more tips

Raspberry Pi – a couple more tips

Cogs
Image by Arek Socha from Pixabay

I have my Pi networked via a switch to my main (Windows) PC. I use WinSCP or my PC for copying files both ways but it means I’m not using the Pi for periods of 15 or 20 minutes.

Unfortunately the default display timeout on the Pi is 10 minutes. It’s not a bad thing but I decided I wanted an hour.

This fix seems to work. It came from this page on the Raspberry Pi forums.  To save you the effort of reading through a few different suggestions, the one that worked for me is this in a terminal (From the answer at 1.02 am). The 3600 is the time period in seconds in case you hadn’t guessed!

Apparently there are two timeout mechanism hence two commands are needed.

xset s 3600
xset dpms 3600 3600 3600

You can view the settings with

xset q

However to make these settings permanent, you need to edit the file:

sudo nano /etc/xdg/lxsession/LXDE/autostart

That way they are set at boot time.

Note. I’m not really a fan of nano. From Ubuntu I’ve used gedit quite a bit and it is a visual full-screen editor, not line by line like nano. Yeah you could use VS Code if it were open but then on files where you have to use sudo, it’s easier to use gedit.

So

sudo apt install gedit

will install it. Just gedit or sudo gedit (for those awkward files!)

 

 

 

Bit of an oddity with VS Code

Bit of an oddity with VS Code

When I first started using it, the C++ extension, and configuring for C++, I got a tasks.json one which was suited for gcc, but recently when I install it, (and the C/C++ Extension for Visual Studio Code, the only choices seem to be these. What happened to the the ones for clang/gcc? The one on the right is what I’m expecting. Even with a C/C++ file open as the instructions here say, I’m getting the one on the left.

VS Code ConfigureVs Configure C++
It’s possible that I’m getting this because I’m using the headmelted and VsCodium versions on a Raspberry Pi.

There’s a bit of a question mark about using the official extension on non-official build of Visual Studio. Headmelted allows it, but VsCodium has its own marketplace.

It’s easy enough to copy tasks.json over so not really a problem but just a minor irritation.

A pleasant surprise – scrot handles multiple screens

A pleasant surprise – scrot handles multiple screens

Scrot screenshot of two monitosrMy Raspberry Pi now has both a 7″ touchscreen and a 24″ monitor working at the same time. Most work is done on the big screen but the smaller display is for testing. I’ve reconfigured it so the menu is on the bigger screen, it makes more sense.

For quick and dirty screen shots, I use scrot (the name is derived from SCReenshOT). I’m fairly certain this was included with the operating system as it was installed, it wasn’t anything I added. What I didn’t expect was that it would capture both screens and put them in the one image. It fills the gap with a copy of the smaller screen.

Scrot is fine for most stuff but I thought that if I wanted to capture things like menus then I was going to install another utility that offered a time delay but digging a bit deeper, it turns out that scrot can do that as well. As with most Linux programs,

scrot --help

Gives you a list of commands and there’s a -d (or –delay) NUM which pauses NUM seconds before doing the grab. Other options let you do a countdown (-c), capture with border (-b)  and you can even have it run another program (-e) on the screenshot. Handy if you had it running unattended on a cron job and wanted to email the grab.

There’s a bit more but I’ll leave that for you to investigate.

A rather powerful C Graphics library

A rather powerful C Graphics library

Raylib libraryI’m not going to be departing from SDL2 any day soon, but if I were starting from scratch, I would seriously consider raylib.  It ticks many boxes!

  • Written in C(C99). Tick.
  • Cross platform including Raspberry Pi desktop. Tick.
  • Open source and liberal licensing tick.
  • Full 3D support with animated models. Tick.
  • Extensive Sound support. Tick.
  • Very open license that even allows static linking with closed software. Tick.
  • Lots of examples. Tick.

There’s even a set of open source games on GitHub. including several that you can play in your browser (HTML5). Documntation is in the form of a 36-page Wiki. I took a quick glance through there and was impressed with some of the features. For example, OpenGl can be used directly and not through X11 though that is also available.

Plus full marks for including struct sizes on the data structures page. That’s not something you often see, nor is instructions for configuring Visual Studio, Visual Studio Cocde, Codeblocks, Eclipse and Sublime Text. The cheat sheet (which you can also download as a pdf) gives an idea of the number of functions in Raylib. They cover five pages!

Playing with VSCodium

Playing with VSCodium

open-vsx.orgThere are some subtle differences between it and Visual Studio Code. The main one is the not having access to the VisualStudio market place. The C/C++ template isn’t there but instead is installed by default.

However I have found that the tasks and launch json files created from the F1 menu don’t have the C++ choices. What this means is that you have to get them from an official Visual Studio source, like Visual Studio Code installed on 64-bit Windows/Ubuntu/Mac.

I’d already done this so I used WinSCP to send them via ssh from my Windows box to the Pi. It’s a slight irritation but once you’ve got them setup it works ok. I can build applications haven’t got debugging working yet though.

There is an alternate Extensions Marketplace which has 266 items in it.  That’s a screenshot of the programming language extensions.

Benchmarking my Raspberry Pi

Benchmarking my Raspberry Pi

hardinfo running on Raspberry PiI played with a couple of free packages today. I can recommend hardinfo. (sudo apt install hardinfo to install then hardinfo to run ) though less about the benchmarks than the information it gives on your system.

I’ve got both 32-bit Raspbian and 64-bit Raspberry Pi OS on two sd cards and intend to run both and compare benchmarks just to see the difference.

Another benchmark utility that looks interesting is sysbench (sudo apt install sysbench to install). It runs from the terminal and lets you run benchmarks against file io, cpu, memory threads, mutex and oltp.  Just type sysbench and you’ll get a list of commands.

 

How to install VSCodium on a Raspberry Pi.

How to install VSCodium on a Raspberry Pi.

64-bit VSCodium running on a 64-bit PI.It was very easy.  This was onto my Pi 4 running 64-bit Raspberry Pi OS.

Go to the releases page on the vsCodium website, it’s on GitHub.  If you are running 32-bit Pi OS then you need the codium_1.46.0-1591900344_armhf.deb file (the number will most likely have changed).  For the 64-bit one, you need the codium_1.46.0-1591900344_arm64.deb.

When you click on the link it will download and ask if you want to keep it. It will then give you the option of opening it and select the archiver. That will install it for you.

After that, to run it from the command line just type codium.

Or as I just discovered. Look on the pull down menu, go onto accessories and you should see (probably near the bottom) VSCodium. Move the mouse over and right-click.You’ll see a popup menu with Add to Desktop and Properties. If you click the former, you get an icon on your desktop.

Raspberry Pi IconsScreenshots were captured with the Flameshot utility. It’s installed with sudo apt install flameshot. That’s the VSCodium and Flameshot icons.