They say that in order to understand recursion, you must first understand recursion. Once you master that concept, you might decide that it’s time to write your own compiler that can compile itself as a fun side project. According to [Warren] aka [DoctorWkt], who documented every step of writing this C compiler from scratch, a true compiler will be able to do that.
Some of the goals for the project included self-compiling, focusing on a real hardware platform, practicality, and simplicity. [Warren] outlines a lot of the theory of compilers as well, including all the lexical, grammar, and semantic analysis and then the final translation into assembly language, but really focuses on making this compiler one for practical use rather than just a theoretical implementation. He focuses on Intel x86-64 and 32-bit ARM platforms too, which are widely available.
This project is a long read and very thoroughly documented at around 100,000 words, so if you’ve ever been interested in compilers this is a great place to start. There are a lot of other great compiler tools floating around too, like the Compiler Explorer which shows you generated code as you write in a higher level language.
We’re surrounded by ARM processors, which enjoy a commanding foothold in the consumer market, especially with portable electronics. However, Arm Holdings has never focused its business model on manufacturing chips, instead licensing its CPUs to others who make the physical devices. There is a bit of a tightrope to walk, though, because vendors want to differentiate themselves while Arm wants to keep products as similar as possible to allow for portability and reuse of things like libraries and toolchains. So it was a little surprising when Arm announced recently that for the first time, they would allow vendors to develop custom instructions. At least on the Armv8-M architecture.
We imagine designs like RISC-V are encroaching on Arm’s market share and this is a response to that. Although it is big news, it isn’t necessarily as big as you might think since Arm has allowed other means to do similar things via special coprocessor instructions and memory-mapped accelerators. If you are willing to put in some contact information, they have a full white paper available with a pretty sparse example. The example shows a population count function hand-optimized into 12 Arm instructions. Then it shows a single custom instruction that would do the same job. However, they don’t show the implementation nor do they offer any timing data about speed increases.
Continue reading “Arm Allows Custom Instructions”
Sometimes it seems like Arduino is everywhere. However, with a new glut of IoT processors, it must be quite a task to keep the Arduino core on all of them. Writing on the Arduino blog, [Martino Facchin], Arduino’s chief of firmware development, talks about the problem they faced supporting two new boards from Nordic.
The boards, the Nano 33 BLE and Nano 33 BLE Sense are based on an ARM Cortex M4 CPU from Nordic. The obvious answer, of course, is to port the Arduino core over from scratch. However, the team didn’t want to spend the time for just a couple of boards. They considered using the Nordic libraries to interact with the hardware, but since that is closed source, it didn’t really fit with Arduino’s sensitivities. However, in the end, they took a third approach which could be a very interesting development: they ported the Arduino core to the Mbed OS. There’s even an example of loading a sketch on top of Mbed available from [Jan Jongboom].
Continue reading “Arduino On MBed”
When a processor has a fault it can leave what looks to be precious little in the way of cause and effect. Debug-by-print-statement works surprisingly well in simple cases, but where in a desktop environment you would drop into a debugger to solve trickier problems this can be an onerous task on an embedded system. [Ross Schlaikjer]’s excellent blog post walks through setting up one of our favorite Open Hardware debug probes and shows us that with the right tooling in place, unexpected faults aren’t quite so impenetrable. Continue reading “Debug Superpowers Bring An STM32 Back From The Dead”
KiCAD has a rightfully earned image problem regarding beginners. The shiny new version 5 has improved things (and we’re very excited for v6!) but the tool is a bit obtuse even when coming from a electronics design background, so we’re always excited to see new learning material. [Mike Watts] is the latest to join the esteemed group of people willing to export their knowledge with his KiCAD tutorial series on GitHub that takes the aspiring user from schematic through fab and assembly.
The tutorial is focused around the process of creating a development board for the dimuitive Microchip née Atmel ATSAMD10 Cortex M0 ARM CPU. It opens by asking the reader to create a schematic and proceeds to teach by directing them to perform certain actions then explaining what’s going on and which shortcuts can accelerate things. This method continues through layout, manufacturing, and assembly.
Of note is that when defining the board outline [Mike] describes how to use OpenSCAD to parametrically define it; a neat micro-tutorial on using the two great tools to compliment each other. We also love that upon successful completion of the tutorial series the user will have developed a tiny but useful development board that can be assembled for about $3 in single quantities!
As with all open source work, if you have quibbles or want to contribute open a pull request and give [Mike] a hand!
When [Andy Brown] recently tripped over ST’s new G0 series of MCUs, he figured after some research that the best way to learn everything there’s to know about the STM32G0xx by making his own development board based around the STM32G081. The result is a Nucleo-style board, breaking out all pins to convenient 2.54 mm headers, and with a number of niceties, such as an on-board coin cell and 32.768 kHz LSE oscillator for RTC use and three different power supplies (3.3 V, 2.5 V, and 1.8 V) for the MCU.
The board is programmed with an external ST-Link programmer that connects to the SWD interface on the MCU, with a 20-pin programming header provided. While by no means small or compact, it makes for very easy breadboarding and prototyping, with all 2.54 mm headers accessible from the bottom and top.
As for the STM32G0 series itself, the jury is still out on its performance compared to the F0. The former swaps the Cortex-M0 core for an M0+, with a reduced pipeline length (3 stages in the G0) but increased frequency (64 MHz versus 48 MHz). The G0 has a little bit more SRAM, but so far less Flash storage. According to ARM, this MCU range is designed to remove any need to still use an 8-bit MCU. Big claims, indeed.
The biggest issue which [Andy] had while developing this board was probably with the CH340 USB-UART chip. Ordering them from AliExpress as is common, the CH340G ICs he got just wouldn’t work on the first board revision, forcing him to switch to the CH340E and requiring a board respin. This version has an internal oscillator and as a bonus even came in the original tape packaging when it arrived, instead of in a plastic baggy like with the CH340G parts.
See a video of [Andy] going through the design after the break.
Continue reading “Building A Development Board For The STM32 G0 Series”
Ten years is almost ancient history in the computing world. Going back twelve years is almost unheard of, but that’s about the time that Palm released the last version of their famed PalmOS, an operating system for small, handheld devices that predated Apple’s first smartphone by yet another ten years. As with all pieces of good software there remain devotees, but with something that hasn’t been updated in a decade there’s a lot of work to be done. [Dmitry.GR] set about doing that work, and making a workable Palm device for the modern times.
He goes into incredible detail on this build, but there are some broad takeaways from the project. First, Palm never really released all of the tools that developers would need to build software easily, including documentation of the API system. Since a new device is being constructed, a lot of this needs to be sorted out. Even a kernel was built from scratch for this project, since using a prebuilt one such as Linux was not possible. There were many other pieces of software needed in order to get a working operating system together running on an ARM processor, which he calls rePalm.
There are many other facets of this project that we aren’t able to get into in this limited space, but if you’re at all interested in operating systems or if you fondly remember the pre-smartphone era devices such the various Palm PDAs that were available in the late ’90s and early ’00s, it’s worth taking a look at this one. And if you’d like to see [Dmitry.GR]’s expertise with ARM, he is well-versed.
Thanks to [furre] for the tip!