Gawking Text Files

Some tools in a toolbox are versatile. You can use a screwdriver as a pry bar to open a paint can, for example. I’ve even hammered a tack in with a screwdriver handle even though you probably shouldn’t. But a chainsaw isn’t that versatile. It only cuts. But man does it cut!

aukAWK is a chainsaw for processing text files line-by-line (and the GNU version is known as GAWK). That’s a pretty common case. It is even more common if you produce a text file from a spreadsheet or work with other kinds of text files. AWK has some serious limitations, but so do chainsaws. They are still super useful. Although AWK sounds like a penguin-like bird (see right), that’s an auk. Sounds the same, but spelled differently. AWK is actually an acronym of the original author’s names.

If you know C and you grok regular expressions, then you can learn AWK in about 5 minutes. If you only know C, go read up on regular expressions and come back. Five minutes later you will know AWK. If you are running Linux, you probably already have GAWK installed and can run it using the alias awk. If you are running Windows, you might consider installing Cygwin, although there are pure Windows versions available. If you just want to play in a browser, try webawk.

Continue reading “Gawking Text Files”

Macro Assembly For AVR Chips

avr-macro-assembly

Here’s an interesting tip that can help improve your ability to write assembly code. In an effort to remove the complexity of assembly code for an AVR project [Quinn Dunki] figured out how to use macros when writing AVR code with the GNU toolchain. Anyone using AVR-GCC should keep this in mind if they ever want or need to pound out a project in assembly language.

If you look at the code snippet above you’ll see two commands that are obviously not assembly; PulseVRAMWrite and DisableVRAMWrite. These are macros that direct the assembler to roll in a hunk of code. But avr-as, the assembler used with this toolchain, lacks the ability to handle macros. That’s too bad because we agree with [Quinn] that these macros make the code easier to read and greatly reduce the probability of error from a typo since the code in the macro will be used repeatedly.

The answer is to alter the makefile to use GNU M4. We hadn’t heard of it, but sure enough it’s already installed on our Linux Mint system (“man m4” for more info). It’s a robust macro processor that swaps out all of her macros based on a separate file which defines them. The result is an assembly file that will play nicely with avr-as.

Her implementation is to help in development of the GPU for her Veronica computer project.

Raspberry Pi Runs XBMC; Reliably Decodes 1080p

This is the Raspberry Pi board, an ARM based GNU-Linux computer. We’ve heard a little bit about it, but it recently garnered our attention when the machine was shown running XBMC at 1080p. That’s a lot of decoding to be done with the small package, and it’s taken care of at the hardware level.

Regular readers will know we’re fans of the XBMC project and have been looking for a small form factor that can be stuck on the back of a television. We had hoped it would be the BeagleBaord but that never really came to fruition. But this really looks like it has potential, and with a price tag of $35 (that’s for the larger 256MB RAM option) it’s a no-brainer.

Now there’s still a lot of rumors out there. We came across one thread that speculated the device will not decode video formats other than h.264 very well since it uses hardware decoding for that codec only. We’ll reserve judgement until there’s more reliable info. But you can dig through this forum thread where the XMBC dev who’s been working with the hardware is participating in the discussion.

Don’t forget to peek at the demo clip after the break too.

Continue reading “Raspberry Pi Runs XBMC; Reliably Decodes 1080p”

ARM Prototyping On-the-cheap With STM32 Discovery

STMicroelectronics has another inexpensive development board out; the STM32 Discovery is an ARM Cortex-M3 prototyping platform. Coming in under $10 puts it right along the lines of their 8-bit offering, but this one is 32-bits with 5 KB of RAM and 128 KB of programming memory. It runs a bootloader and has on-board USB for easy programming. They’ve even got a trio of crippled IDE’s to get you started.

Unfortunately this is following a growing trend with the exclusion of Linux support. [Gordon] wrote in to let us know that there is hope in a couple of forms (but not using the USB functionality). The first is a serial programmer using the RS232 that [Paul] came up with (there’s a lot more on his blog so spend some time there). But you can also use the serial debug protocol to program the board.

Either way you’ll still need a method of compiling the code. We’ve had great success rolling our own GNU ARM cross compiler using this guide. Or you can grab a pre-built package by downloading Sourcery G++ lite.

Firmware Hacking On Behringer Midi Devices

A new project called the Unofficial Behringer Control Development Kit lets you tweak or completely replace the firmware on the popular devices. The proof of concept demo shows a custom message scrolling on the 4-character 7-segment display but you can do with the device is only limited by how well you can code for the ARM processor inside. Development takes place using the GNU ARM toolchain but don’t worry, you don’t have to crack the case open to program the chip. The BCR2000 and BCF2000 models supported by the project both run bootloaders that allow firmware updates via midi commands. There’s even a recovery mode if you screw something up. Just make sure you have a direct midi connection for recovery, the USB port won’t work for that purpose. If you need a shove to get you started there’s a nice little example file in the repository.

[Thanks Bjonnh]