< back

Week 7: Embedded Programming


November 3, 2015

Another low-bandwidth week for me. Grad school (and specifically Member's Week) is hard! Hoping to return to this week to do some more with networking and communications. To start, I just focused on programming the board I made two weeks ago. I already programmed this board two weeks ago using the Arduino IDE and the High Low Tech tutorial. Here's a video of the blinking light program I loaded then:

I wanted to be comfortable programming the board using gcc, C and a makefile. Briefly, here are the steps I used (cobbled together from this image and this tutorial):

Here is an image of the screen output of running the echo program and interacting with the program through the screen command. The formatting is a little funky. It also looks like the buffer saves whatever text you've typed in from the last session.

After a little investigation, I learned the format was funky because the serial monitor is getting just a newline ('\n' or 10) but no carriage return ('\r' or 13), which would bring the output back to the beginning of the line. (Perhaps term.py does this preprocessing for you, which is why this problem didn't come up for people using that serial interface?) I made a small modification in the code to add a carriage return, and my formatting in the serial monitor looked a lot better after that:

I also thought it could be nice to allow users to input a "clear" command and a "delete" command. With a bit of debugging (it's been a loooongggg time since I did string manipulation in C) I implemented these commands.

Playing around with the code like this got me more familiar with the toolchain. I felt pretty comfortable making quick changes, compiling and uploading them to the board, and testing the outcome. I realize this is made much easier by having the built-in "put_char" and "put_string" functions from Neil's code. For future steps, I'm hoping to mill another board to try some networking, and perhaps do something more interesting with the LED.