12.1. The uClinux Operating System
uClinux is based on the popular open-source Linux operating system. This operating system has been ported to many different embedded processors, including both the MicroBlaze embedded processor provided by Xilinx, and the Nios II processor from Altera.
The uClinux kernel is designed to be compact and simple and is appropriate for a wide variety of 32-bit, non-MMU processor cores. The tradeoff is that multitasking must be carefully managed to avoid memory conflicts.
The lack of memory management on uClinux target processors means that there is no protection against badly behaved processes, which can write anywhere in memory. There is also no support for virtual memory, which also requires memory management. For most embedded applications, however, these restrictions are not critical. In fact, the lack of memory management can provide performance advantages and opportunities for more direct control over hardware through memory-mapped I/O interfaces.
The port of the uClinux kernel to MicroBlaze was performed by Dr. John Williams, Research Fellow at the University of Queensland in Brisbane, Australia using the Memec V2MB1000 prototyping board, which is coincidentally the same board we used for the triple-DES test application of Chapter 9.
Combining uClinux and Impulse C
The lack of memory management in uClinux greatly simplifies the use of the MicroBlaze processor as an embedded test bench or as the primary processing element in a mixed hardware/software application. Because there is no limitation in uClinux on writing to specific memory-mapped addresses, the same code that implements an Impulse C process on MicroBlaze without an operating system (as was the case in Chapter 9) can be compiled with little or no change to operate in a multitasking environment under uClinux. Additionally, the lack of a driver layer results in very little impact on the potential throughput rate of data moving between the processor and the FPGA. If memory management existed on the processor, as is the case in PowerPC-based Virtex II Pro and Virtex-4 platforms, it would be necessary to create a device driver or other abstraction layer between the Impulse C software process and the FPGA-resident processes, resulting in substantial performance degradation.
There are many benefits to using uClinux (or a commercial operating system of similar capabilities) on an embedded FPGA processor. Because the operating system includes a wide variety of common peripheral interfaces as standard, it is relatively easy to create applications in which test data in the form of actual files, or from other standard interfaces, may be read using standard C functions, such as calls to fopen, fread, and getc, then subsequently streamed to the FPGA using the software-to-hardware streaming macros provided with Impulse C. Using a board such as the Memec V2MB1000 it is possibleeven trivialto create a network-enabled device in which the FPGA board becomes a computing node connected to other such nodes, and to desktop computers via TFTP, via an embedded web server or through the use of other such mechanisms.
Because Impulse C allows hardware processes to be expressed entirely in the C language, and the CoDeveloper tools automatically generate the necessary hardware-to-software interfaces, software engineers using uClinux and Impulse C have everything they need to generate and test complex, hardware-accelerated algorithmsentirely in the context of C-language programming.