Blinking An Arduino LED, In Julia

The Julia programming language is a horrible fit for a no-frills microcontroller like the ATMega328p that lies within the classic Arduino, but that didn’t stop [Sukera] from trying, and succeeding.

All of the features that make Julia a cool programming language for your big computer make it an awful choice for the Arduino. It’s designed for interactivity, is dynamically typed, and leans heavily on its garbage collection; each of these features alone would tax the Mega to the breaking point. But in its favor, it is a compiled language that is based on LLVM, and LLVM has an AVR backend for C. Should just be a simple matter of stubbing out some of the overhead, recompiling LLVM to add an AVR target for Julia, and then fixing up all the other loose ends, right?

Well, it turns out it almost was. Leaning heavily on the flexibility of LLVM, [Sukera] manages to turn off all the language features that aren’t needed, and after some small hurdles like the usual problems with volatile and atomic variables, manages to blink an LED slowly. Huzzah. We love [Sukera’s] wry “Now THAT is what I call two days well spent!” after it’s all done, but seriously, this is the first time we’ve every seen even super-rudimentary Julia code running on an 8-bit microcontroller, so there are definitely some kudos due here.

By the time that Julia is wedged into the AVR, a lot of what makes it appealing on the big computers is missing on the micro, so we don’t really see people picking it over straight C, which has a much more developed ecosystem. But still, it’s great to see what it takes to get a language designed around a runtime and garbage collection up and running on our favorite mini micro.

Thanks [Joel] for the tip!

Free Your Pi With This Bare Metal Programming Environment

[Rene Strange] has graced these fair pages a short while ago with a sweet Raspberry Pi software based poly synth, with a tantalising reference to it being a bare metal application. So now, we’ll look into circle, the bare metal programming environment that it is based upon. The platform consists of a large set of C++ classes to access the hardware as well as perform tasks such as task creation and scheduling in the cooperative multitasking, multicore environment. Supporting all Raspberry Pi boards from version 2 onwards (not including the Pico!) in both 32-bit and 64-bit flavours, the environment is pretty complete. Classes are provided for USB, networking, FatFS, as well as more mundane tasks such as dealing with interrupts. On top of these classes there are a pile of application-specific libraries, covering functions such as display interfacing, GUIs using a variety of frameworks, and some more esoteric applications such as interfacing to a Pico, and even sending the system log to a remote web browser!

Classes and libraries however, don’t always help by themselves, which is where the 42 (yes, we know) code examples come in very handy. They’ve provided example applications for some fun stuff like drawing Mandelbrot fractals to the display, as well as some more mundane tasks that we have to deal with such as getting that pesky DMA controller to play nice with the SPI hardware. All-in-all, this looks like a great set of tools for taking full advantage of some fairly beefy hardware for your next embedded project that needs plenty of resources, but not all that unnecessary operating system stuff.

Perhaps not quite as complete as circle, but we’ve seen a fair few Raspberry Pi Bare metal projects over the years, like the Nerdsynth, based on the PiZero, and this neat little bare metal assembly language clone of starfox.

Thanks [Ruhan] for the tip!

Header: Aryan Patidar, CC BY 4.0/Evan-Amos, Public domain.

Flashing TI Chips With An ESP

Texas Instruments is best known to the general public for building obsolete calculators and selling them at extraordinary prices to students, but they also build some interesting (and reasonably-priced) microcontrollers as well. While not as ubiquitous as Atmel and the Arduino platform, they can still be found in plenty of consumer electronics and reprogrammed, and [Aaron] aka [atc1441] demonstrates how to modify them with an ESP32 as an intermediary.

Specifically, the TI chips in this build revolve around the 8051-core  microcontrollers, which [Aaron] has found in small e-paper price tags and other RF hardware. He’s using an ESP32 to reprogram the TI chips, and leveraging a web server on the ESP in order to be able to re-flash them over WiFi. Some of the e-paper displays have built-in header pins which makes connecting them to the ESP fairly easy, and once that’s out of the way [Aaron] also provides an entire software library for interacting with these microcontrollers through the browser interface.

Right now the project supports the CC2430, CC2510 and CC1110 variants, but [Aaron] plans to add support for more in the future. It’s a fairly comprehensive build, and much better than buying the proprietary TI programmer, so if you have some of these e-paper displays laying around the barrier to entry has been dramatically lowered. If you don’t have this specific type of display laying around, we’ve seen similar teardowns and repurposing of other e-paper devices in the past as well.

Continue reading “Flashing TI Chips With An ESP”

Talking To A Texas Instruments Calculator

Texas Instruments is a world-class semiconductors company, but unfortunately what they are best known for among the general public is dated consumer-grade calculators thanks to entrenched standardized testing. These testing standards are so entrenched, in fact, that TI has not had to update the hardware in these calculators since the early 90s. They still run their code on a Z80 microcontroller, but [Ben Heck] found himself in possession of one which has a modern ARM coprocessor in it and thus can run Python.

While he’s not sure exactly what implementation of Python the calculator is running, he did tear it apart to try and figure out as much as he could about what this machine is doing. The immediately noticeable difference is the ARM coprocessor that is not present in other graphing calculators. After some investigation of test points, [Ben] found that the Z80 and ARM chips are communicating with each other over twin serial lines using a very “janky” interface. Jankiness aside, eventually [Ben] was able to wire up a port to the side of the calculator which lets him use his computer to send Python commands to the device when it is in its Python programming mode.

While there are probably limited use cases for 1980s calculators to run Python programs, we can at least commend TI for attempting to modernize within its self-built standardized testing prison. Perhaps this is the starting point for someone else to figure out something more useful to put these machines to work with beyond the classroom too. We’ve already seen some TI-84s that have been modified to connect to the Internet, for example.

Thanks to [Nikša] for the tip!

Continue reading “Talking To A Texas Instruments Calculator”

Code Wrong: Expand Your Mind

The really nice thing about doing something the “wrong” way is that there’s just so much variety! If you’re doing something the right way, the fastest way, or the optimal way, well, there’s just one way. But if you’re going to do it wrong, you’ve got a lot more design room.

Case in point: esoteric programming languages. The variety is stunning. There are languages intended to be unreadable, or to sound like Shakespearean sonnets, or cooking recipes, or hair-rock ballads. Some of the earliest esoteric languages were just jokes: compilations of all of the hassles of “real” programming languages of the time, but yet made to function. Some represent instructions as a grid of colored pixels. Some represent the code in a fashion that’s tantamount to encryption, and the only way to program them is by brute forcing the code space. Others, including the notorious Brainf*ck are actually not half as bad as their rap — it’s a very direct implementation of a Turing machine.

So you have a set of languages that are designed to be maximally unlike each other, or traditional programming languages, and yet still be able to do the work of instructing a computer to do what you want. And if you squint your eyes just right, and look at as many of them all together as you can, what emerges out of this blobby intersection of oddball languages is the essence of computing. Each language tries to be as wrong as possible, so what they have in common can only be the unavoidable core of coding.

While it might be interesting to compare an contrast Java and C++, or Python, nearly every serious programming language has so much in common that it’s just not as instructive. They are all doing it mostly right, and that means that they’re mostly about the human factors. Yawn. To really figure out what’s fundamental to computing, you have to get it wrong.

A Programming Language To Express Programming Frustration

Programming can be a frustrating endeavor. Certainly we’ve all had moments, such as forgetting punctuation in C or messing up whitespace in Python. Even worse, an altogether familiar experience is making a single change to a program that should have resulted in a small improvement but instead breaks the program. Now, though, there’s a programming language that can put these frustrations directly into the code itself into a cathartic, frustration-relieving syntax. The language is called AHHH and it’s quite a scream.

While it may not look like it on the surface, the language is Turing complete and can be used just like any other programming language. The only difference is that there are only 16 commands in this language which are all variants of strings of four capital- or lower-case-H characters. The character “A” in the command “AHHH” starts the program, and from there virtually anything can be coded as a long, seemingly unending scream. The programming language is loosely related to COW which uses various “moos” to create programs instead of screams, and of course is also distantly related to brainfuck which was an esoteric programming language created in order to have the smallest possible compiler.

We can’t really recommend that beginner programmers start to learn this language instead of something more practical like Python, esoteric languages like these can teach us a lot about the way that computers work. This language, for example, lets you code in pixels instead of characters. Others are more for fun such as this language which turns your code into an ’80s rock ballad.

Thanks to [Kyle F] for the tip!

Hackaday Podcast 146: Dueling Trackballs, Next Level BEAM Robot, Take Control Of Your Bench, And Green Programming

Postpone your holiday shopping and spend some quality time with editors Mike Szczys and Elliot Williams as they sift through the week in Hackaday. Which programming language is the greenest? How many trackballs can a mouse possibly have? And can a Bluetooth dongle run DOOM? Join us to find out!

 

Take a look at the links below if you want to follow along, and as always, tell us what you think about this episode in the comments!

Direct download (52 MB)

Continue reading “Hackaday Podcast 146: Dueling Trackballs, Next Level BEAM Robot, Take Control Of Your Bench, And Green Programming”