Programming Microcontrollers Part 1 - JTAG and C

Microcontrollers are typically programmed using C, C++ or assembly languages when highly optimised code is required.

Microcontrollers differ considerably to processors in a computer in terms of memory architecture and clock speeds, many microcontrollers run at 50 MHz or 100's of MHz and not in the GHz range, also the accessible memory is considerably lower, it is not uncommon to have less than 512kB of RAM and 2MB of flash for example and these differences mean we cannot write code in the same way, we need to write code for an embedded environment where resources are limited.

To program an MCU we use a programmer which is typically a tool defined per MCU family, ST Microelectronics have the ST Link for example. The interface used to connect the programmer to the MCU programming pins is known as JTAG. It is common to hear embedded software engineers asking if a board has been "flashed with the latest software" by this they mean has the latest software been programmed into it where flashing refers to the Non-Volatile Memory (NVM) type commonly used, Flash memory like NAND flash, which stores the instructions.

C Basics