All Rights Reserved. The contents of this document cannot be reproduced without prior permission of the authors. Building Embedded Systems Chapter 3: Bootloader Andreas Knirsch andreas.knirsch@h-da.de
Agenda Motivation Startup Memory Optimization
Building Embedded Systems Chapter 3: Bootloader Motivation Why is the startup of ES so important?
Available instant on "Embedded software is software integrated with physical processes." [Lee, 2006] However, the software must not have negative effect on the physical process. This applies in particular to the usage of the system.
Building Embedded Systems Chapter 3: Bootloader Startup How does an embedded system startup?
Startup time is important. But how does a system start? to optimize the startup? to implement this? fundamentals approach application
When is a system up and running? cba bogenfreund (flickr.com) "When you can use it
How does a System Start? Reset Vector 1 Startup Code 2 OS 3 Application 4
Phase #1 Reset Vector 1 cba g4ll4is (flickr.com) power-on, initialize hardware
Phase #2 Startup Code 2 initialize further HW and load OS-kernel
Phase #3 OS 3 startup OS-kernel ( and init further hardware)
Phase #4 the system becomes usable Application 4
Startup Overview Init HW Load* and start OS Init (even more) HW Load and start App(s) *) this may include a staged boot loader
Building Embedded Systems Chapter 3: Bootloader Memory Copy data is an essential part during system start.
Startup in detail SPL secondary program loader NAND OS APP RBL ROM boot loader USB MMC UART uboot Hyper visor OS 0 OS 1 http://processors.wiki.ti.com/index.php/the_boot_process http://www.embedded-bits.co.uk/2011/writeanmlo/
Load & Start the Kernel Power RAM CPU Data Addr initrd FLASH kernel
Toshiba NAND vs. NOR Flash Memory Technology Overview Flash = Flash: NAND / NOR Fig. 1 Comparison of NOR and NAND Flash Cost-per-bit NOR NAND Standby Power Low Low Easy File Storage Use High Active Power (*) Low (*) : Dependant on how memory is used. NOR is typically slow on writes and consumes more power than NAND. NOR is typically fast on reads, which consume less power. Read Speed High High Hard Low Low High Easy High Capacity Code Execution Write Speed The History of Flash Memory [THOSHIBA: NAND vs. NOR Memory Technology Overview. White Paper.] As a recognized pioneer in flash technology, Toshiba was a principal innovator of both
a significant factor. h_da Choosing NAND vs. NOR Toshiba continues to make both types of Flash memory, and recognizes that both forms have their own unique merits. Flash = Flash: NAND / NOR When should one choose NAND Flash over NOR Flash? The answer depends on the system requirements. Figure 4 below compares NAND Flash with asynchronous NOR Flash in terms of various operating and performance characteristics: SLC NAND Flash (x8) MLC NAND Flash (x8) MLC NOR Flash (x16) Density 512 Mbits 1 4 Gbits 2 1Gbit to 16Gbit 16Mbit to 1Gbit Read Speed 24 MB/s 3 18.6 MB/s 103MB/s Write Speed 8.0 MB/s 2.4 MB/s 0.47 MB/s Erase Time 2.0 msec 2.0mSec 900mSec Interface I/O indirect access I/O indirect Random access access Application Program/Data mass Program/Data executeinplace storage mass storage Figure 4: NAND and NOR Flash Operating Specifications The characteristics of NAND Flash are: high density, medium read speed, high write speed, high erase speed, and an indirect or I/O like access. The characteristics of NOR Flash are lower density, high read speed, slow write speed, slow erase speed, and a random access interface. For a system that needs to boot out of Flash, execute code from the Flash, or if read latency is an issue, NOR Flash may be the answer. However, for storage applications, NAND Flash s higher density, and high programming and erase speeds make it the best choice. While the benefit of high programming speed in high-density Flash devices is obvious, erase performance is equally important, though less obvious. Unlike magnetic memory systems (hard disk drives and tape [THOSHIBA: NAND vs. NOR Memory Technology Overview. White Paper.]
Building Embedded Systems Chapter 3: Bootloader Optimization How accelerate the startup?
How to accelerate the startup? Knowledge Optimization Upgrade Avoidance Parallelizing Prioritization hard- and software only the necessary utilize hardware essentials first
Approach: architecture Identify building blocks know the dependencies Order the tasks prioritization & avoidance Describe and visualize UML, SysML etc.
Approach: hardware Direct Memory Access (DMA) parallelize Simultaneous Multi-Threading (SMT) and Multicore (pseudo-)parallelize
Approach: operating system Customize avoid unnecessary initialization/abstraction postpone the load of specific driver prioritization utilize Hyper-Threading and SMP parallelization Resume from image avoid initialization exectue in place (XIP) avoid copy to memory
Approach: user application Customize libraries avoid/disable unnecessary features Customize toolchain make use of specific compiler and flags Multithread/-process parallelization Resume from image avoid initialization
Approach: system development Strip-Down Build-Up
Approach: system development QNX System Builder creates a well defined target system Linux From Scratch step-by-step manual to build a Linux system Debian debootstrap assembles a root system from prebuilt packages Buildroot builds a toolchain, rootfs, kernel, bootloader-image openembedded (YOCTO) builds a toolchain, rootfs, kernel, bootloader-image and many more.
Architecture 4 Tools Application(s) Framework 3 Libraries Kernel 2 1 Bootloader Hardware
Recap: How does a System Start? Reset Vector 1 Startup Code 2 OS 3 Application 4
Analyze t cb wwarby (flickr.com) 4 Tools Application(s) Framework 3 Libraries Kernel 2 1 Bootloader Hardware
Low Hanging Fruits identify where optimization is most efficient do the easy targets first... premature optimization is the root of all evil... (Donald E. Knuth, 1974) gather knowledge
Building Embedded Systems Chapter 4: Building Bootloader References [Wietzke, 2012] Wietzke, J.: Embedded Technologies. Springer, 2012.
All Rights Reserved. The contents of this document cannot be reproduced without prior permission of the authors. Building Embedded Systems Chapter 3: Bootloader Andreas Knirsch andreas.knirsch@h-da.de