Interested in embedded programming? Warren Gay, an Ontario, Canada-based senior programmer, is an excellent resource for professional programmers, students, and makers alike. Here he talks about his new book, FreeRTOS for ESP32-Arduino (Elektor, 2020), and shares insights about FreeRTOS, ESP32, Arduino, embedded technologies, and more. You are sure to find his input informative and inspiring, especially if you plan to work with ESP32 or Arduino in the near future.  
Warren Gay's workspace for embedded programming and embedded projects
Warren Gay at his workbench.

Programming and writing

Abate: Have you been a programmer since you graduated from Ryerson University, or did you do something else first? 
Because I was messing with old shortwave radios and TV sets as a youngster, I had originally planned on a career in electronics. That changed in grade 10 (high school) when I signed up for a computer programming class. I wanted to learn what those lab coat people did with a computer using punched cards and watching those “blinken lights.” So, I started out on the IBM 1130 minicomputer using FORTRAN and became hooked. It seems laughable today to think that it only had 8k words (16KB) of core memory to compile and run programs in.

Abate: What sort of projects do you work on as a Senior Software Programmer at Datablocks?
The people at Datablocks have been great. They have allowed me to develop multi-threaded Internet servers to handle back-end ad-related services on Linux. The back-end software is written in C++, mainly for efficiency and to leverage the Standard Template Library (STL). Their requirements have frequently forced me to solve some difficult problems. It is good to be challenged.
I also wrote and support a process that downloads the log files from each Internet server. A new set of logs are downloaded and processed every 5 minutes, so it has to be fast and run paralleled. The last time I checked, I think there were 37 active threads running in it.  With all this thread parallelism, you have to be extremely careful or wind up analyzing core dumps.
Abate: Tell us about your first book, Mastering the Raspberry Pi (Apress, 2014).
That book actually began with a self-published book titled, Assimilating the Raspberry Pi, sold and printed on demand by I had other books published like the Linux Socket Programming by Example (Que) back in 2002, but because I had become downsized at the time, I decided to write about the new Raspberry Pi. Soon after the Pi book was available, Michelle Lowman (Apress) purchased a copy and convinced me to republish it as Mastering the Raspberry Pi with Apress.
At the time, I felt like the Pi needed an owner’s manual, because it was so new and documentation was lacking. So, the book was designed to provide a software/hardware guide for the new Pi owner. Aside from the hardware, the Raspberry Pi is essentially about Linux. However, if the Pi owner wants to do SPI or I2C for example, this book provides the necessary C programming guidance for that.
Abate: You followed up that book with Exploring the Raspberry Pi 2 with C++ in 2015. What was the impetus for writing it?
The Pi 2 had just come out with more memory and increased clock speed. For a credit card-sized PCB and its price point, this was cool. At the same time, I wanted to encourage people to use C⁠+⁠+ on the Pi and Linux generally. I also developed the PiSpy program for that book to benefit the hacker community with a built-in logic analyzer. The open sourced GtkWave program was used to display the captured data.

Programming languages

Abate: What are the benefits of C++ for Raspberry Pi?
I think too many programmers cling to the C language. Today, this is like driving a car with a standard transmission and no power steering. But to be fair, my earliest experiences with g++ were problematic in the 1990s. With each new release of the Gnu g++ compiler, programs that used to compile ok, would generate error messages and fail to build. This was a support nuisance for open sourced projects at the time.
But the C++ language standardization efforts have come a long way since then and now provide a consistent level of compiler support. Additionally, the Gnu version of the Standard Template Library (STL) has also matured. The wide range of suitable containers in the STL eliminates the need for C programmers to write custom lookup tables and functions. This alone saves an enormous amount of effort.
In recent years, there seems to be popular interest in interpreted languages like Python. They are suitable for quick and dirty work where scripting is the norm. But all dynamic languages are prone to runtime error surprises and so I feel that this enthusiasm is misguided. The worst time to have a program failure is when it is in the hands of the end user.
Contrast that to the C++ compiler, which employs strong type checking and static validations to ensure that it will succeed at runtime, long before it is executed. Issues raised by the compiler can then be properly addressed by the program developer rather than produce surprises at runtime. The Ada language (open source gnat) does an even better job of program correctness, but other factors seem to affect its adoption. It is encouraging to see that the g++ compiler seems to be borrowing from Ada in some ways. For example, warnings are issued for missing case clauses in a switch statement (when no default case is present). This is very helpful when a new enumerated constant is added to an enum data type referenced in a switch statement.