In the previous article we described the organization of the source code of our first program for the LPC1115 microcontroller. But we have left some things unexplained. For example - where do the definitions of the LPC1115 registers come from or how the makefile is composed. And that's what the article is about.
Our program for LPC1115 that blinks with LEDs on Lipicano is in fact very simple. But a lot of things happen before the processor gets to switching the LEDs on/off. Let us walk through the structure of the source code of the program and explain the operations that precede the function main().
We wrote a short program for the NXP LPC1115 microcontroller in order to test how the LPC1115 module, which we inserted into the Lipicano Board, works. The program is very simple - it only blinks with LEDs, but to see if it works we must first compile it and link it. The resulting binary must be programmed to the flash memory of the microcontroller.
We tested the Lipicano Board with the pyOCD library from the ARM mbed project. PyOCD is an open source library for Python 2.7 which enables to debug code and to program ARM Cortex-M microcontrollers through the CMSIS-DAP interface. The pyOCD library can be used on Linux, OSX and Windows operating systems. We tested pyOCD on Windows 8.1.
We have prepared a new prototyping board which allows to quickly test the circuits wiring and to develop and debug programs for microcontrollers with an ARM Cortex-M processor. Lipicano Board has a socket for processor modules and connectors for Arduino Shields. Firmware of the board implements a CMSIS-DAP debugger and a virtual COM port.
The usual usage scenario of the U-Boot bootloader is to load a Linux kernel image from an external device (NAND Flash, SD card etc.) and start it. But during development stage U-Boot is an invaluable helper because it allows to load large binary images from LAN and thus speed up frequent reboots instead of time consuming rewriting of flash memories or SD cards.
It's nice to know that the SAMA5D3 microprocessor responds to commands sent over the serial line. But we want it to run our program after reset. We will use the SAM-BA utility to store a program binary image to the SPI Flash memory which is on the module. After reset, the RomBOOT program loads the stored code into the internal SRAM and executes it.
Before we start any serious work with the SAMA5 module we should set up a development kit with the Baseboard prototyping board. Then we will connect the module over the serial line to a PC workstation and we will test communication with the RomBOOT program of the SAMA5D3 microprocessor.
Finally we will prepare content and then also the image of the root file system. In other words, the data content of the disk where commands, utilities, configuration files, drivers and other files are stored. We are going to create a binary image of all this, a binary image suitable for loading directly into NandFlash memory, which serves as a system disk for the module.
Standard source code of Linux kernel 2.6.38 does not contain support for uCSimply SAM9260 module. The support is handled by patches, which are applied to the kernel source code before configuration and compilation of the kernel. We will use AT91 Linux 2.6 Patches from maxim.org.za and then we will add SAM9260 module specific patch.