If you happen to be millenials, you may not know COBOL or COmmon Business Oriented Language. COBOL is primarily used in business, finance, and administrative systems, as a compiled English-like computer programming language, never for more bare metal purpose, not until now.
I’ve known COBOL since my childhood and used it extensively for learning and developing apps. After more than 30 years, I’m back to use it in order to program firmware for microcontroller! Yes, you read it right, COBOL is for programming microcontrollers.
Why on earth you want to use COBOL for microcontroller? Well, for starting, I’m getting bored of C and C++. I’ve been using C-like language since I coded professionally, more than 20 years! C, C++, Perl, Java, PHP, C#, and especially using Objective-C for the past 10 years. As it seems I’ll be programming for microcontroller for many years to come, it’s time to use another language, so I won’t be bored to death.
As COBOL supported object-oriented since 2002, it became easier than ever to use it for any use cases.
For this particular use case, I managed to make GnuCOBOL – a free and open-source modern COBOL compiler and runtime environment – to work together with Xtensa’s toolchain to compile COBOL program and target it for ESP8266.
A “hello world” LED blinking code to make LED connected to GPIO 15 to blink, is something like this:
OPEN OUTPUT gpio-15
*> LOOP FOREVER
PERFORM UNTIL 1 <> 1
WRITE gpio-15 TO FALSE
WRITE gpio-15 TO TRUE
CALL "C$SLEEP" using "1" end-call.
I have yet to manage it compiled and run for AVR-based microcontroller. But I hope that will change soon.
I should start with why. For starter, verbosity and English-like syntax of COBOL always fascinate me. With the maker movement and its “promise” to democratize hardware programming, I believe COBOL will be much easier to learn – even for kids – than other language.
With the abundant of now-retired oldtimer COBOL programmers and the more accessible hardware (microcontrollers, single-board computer), I believe they will be back to “hot seat” of programming, spending hours and days in front of their laptop and hardware kit, and eventually fill old age with happiness.
Then imagine, kids learn COBOL accompanied by their parent or grandparent that happens to have COBOL experience in the past, spending time together hacking hardware, man… that’s priceless. And that’s what really drive me to evangelize hardware programming with COBOL.
I will be back with some more details, sample code, working development and runtime environment, and share all resources on my GitHub.