6 Boot Loader
Total Page:16
File Type:pdf, Size:1020Kb
BootBoot LoaderLoader 66 6.1 INTRODUCTION The Boot Loader is a utility program supplied with the ADSP-21000 Family Development Software. The loader converts an ADSP-21xxx executable program, generated by the linker, into a format which can be used to boot a target hardware system and initialize its memory. The loader’s invocation command is LDR21K. The boot loader replaces the MEM21K memory initializer used with the ADSP-21020 processor. Any executable file to be processed with the LDR21K boot loader must not be processed by MEM21K. The -nomem switch of the C compiler should be used when compiling any C source files—this switch prevents the compiler from running MEM21K. The following naming conventions are used throughout this chapter: The loader refers to LDR21K contained in the software release. The boot loader refers to the executable file that performs the memory initialization on the target. The boot file refers to the output of the loader that contains the boot loader and the formatted system configurations. Booting refers to the process of loading the boot loader, initialization system memory, and starting the application on the target. Memory is referred to as being either data memory, program memory, or internal memory. Remember that the ADSP-21020 processor has separate external program and data memories, but does not have any internal memory. The ADSP-2106x SHARC has both internal and external memory. 6 – 1 66 BootBoot LoaderLoader To use the loader, you should be familiar with the hardware requirements of booting an ADSP-21000 target. See Chapter 11 of the ADSP-2106x SHARC User’s Manual or Chapter 9 of the ADSP-21020 User’s Manual for further information. Different hardware architectures can be created with ADSP-21000 Family processors. In some systems, the ADSP-21000 processor executes a program directly from ROM. For systems that use the ADSP-21020 or that use the ADSP-2106x processor configured to execute its program directly from 48-bit wide external ROM, the PROM Splitter utility (SPL21K) is normally used instead of the loader to create ROM-based boot files. In systems that use 8-bit wide boot PROMs, the loader utility configures the executable code to be downloadable through this narrower datapath. It does this by creating a small executable, the boot loader, which is added to the assembled/ compiled source files, and is downloaded first into the processor at reset. The boot loader then downloads the actual program to be run on the system, initializes memory (both internal and external), and finishes up by copying over itself and jumping to the restart vector address. The boot loader is designed to have a minimal impact on the target executable. The loader supports 32-bit, 40-bit and 48-bit data memory. It is designed for use with systems that execute from RAM, either internal, external, or both. The target application’s architecture file is important to the loader. It specifies the type of processor in the target and its memory configuration, especially the widths of the memory segments. The loader uses this information to initialize memory correctly. The ADSP-2106x has a special hardware feature that loads a small program into internal memory at chip reset. This program can come from external PROM, the host port, or the link port, based on how the chip’s external pins are hooked up. The loader uses this feature to load a program of arbitrary size into the ADSP-2106x’s internal and external memory. The boot file generated by the loader can be tested in the ADSP-2106x Simulator. 6 – 2 BootBoot LoaderLoader 66 6.1.1 Types Of Boot Files The loader can be used to create four types of loadable images: the PROM-based loader, the host-based loader, the link port loader, and the specialized JTAG loader. 6.1.1.1 PROM Booting The input to LDR21K is an executable file. From that file, the loader generates a PROM-based loader file (*.ldr ) that can be programmed into a PROM chip. This file can be used as an input to most PROM/ EPROM/EEPROM programmers. Based on the requirements of your system design, you may need to change the 060_prom.asm file. If so, here is how to recompile it (be sure to copy the original 060_prom.asm file to your local directory, and only edit this copy of the original file): asm21k -adsp21060 060_prom ld21k -a 060_ldr.ach 060_prom 6.1.1.2 Host Booting Command line switches -bhost and -f are used to generate a host-based loader: From the input file (*.exe ), the loader generates a loader file (*.ldr) that can be used as an input or data file for a host based program that boots the processor through the data and address buses of the external port. Based on the requirements of your system design, you may need to change the 060_host.asm file. If so, here is how to recompile it (be sure to copy the original 060_host.asm file to your local directory, and only edit this copy of the original file): asm21k -adsp21060 060_host ld21k -a 060_ldr.ach 060_host 6 – 3 66 BootBoot LoaderLoader 6.1.1.3 Link Port Booting The LDR21K loader option -blink is used to generate an .ldr file that facilitates booting from an external source (such as a host processor) through the ADSP-2106x’s link port buffer 4 using DMA channel 6. This .ldr file is loaded as a variable within the host’s program and transmitted over the link port to load the booting processor. An example is included later in this chapter that illustrates the details of this process. Based on the requirements of your system design, you may need to change the 060_link.asm file. If so, here is how to recompile it (be sure to copy the original 060_link.asm file to your local directory, and only edit this copy of the original file): asm21k -adsp21060 060_link ld21k -a 060_ldr.ach 060_link 6.1.1.4 JTAG Booting (ADSP-21020) The LDR21K loader may be used to download a small kernel of booting instructions that utilize the JTAG test access port (TAP) of the ADSP-21020 processor. The command line switch -bjtag is used to generate a boot file for the JTAG port. For complete information on JTAG booting of the ADSP-21020, see Chapter 10, JTAG Downloader, in the ADSP-21000 Family Applications Handbook, Volume 1. Sample source code and hardware design information are included. Based on the requirements of your system design, you may need to change the 020_jtag.asm file. If so, here is how to recompile it (be sure to copy the original 020_jtag.asm file to your local directory, and only edit this copy of the original file): asm21k 020_jtag ld21k -a 020_jtag.ach 020_jtag 6.1.2 Distribution Files For proper operation, the loader requires that the following files are located in the distribution directory of your disk. In the ADI_DSP/21k/bin/ directory: LDR21K 6 – 4 BootBoot LoaderLoader 66 In the ADI_DSP/21k/etc/ directory: 060_ldr.ach 060_host.asm 060_host.exe 060_prom.asm 060_prom.exe 060_link.asm 060_link.exe jtagboot.asm jtagboot.ach jtagboot.exe 020_jtag.asm 020_jtag.ach 020_jtag.exe Note: The 060_ldr.ach file is a generic architecture file for PROM, host, or link port booting of all SHARC processors. 6.2 INVOKING THE LOADER The loader is invoked with the LDR21K command. Any file that has been successfully processed by the linker can be used as input to the loader. Several options are available through the use of command line switches and additional files. The command line command structure is: LDR21K infile [-a filename -b {type} -c {custom} -e {segment} -f {format) -h -l filename -o filename -v -t N ] Implementation Notes: • Any executable (a C source program, assembly program, etc.) can be processed by the loader. The only requirement for an ADSP-2106x program to be processed is that it must not use address 0x020004 to store an instruction. The loader requires this location for last minute patching of the system state before starting the target executable. Your program should have a NOP or IDLE instruction at address 0x020004. • The target application should be aware the DMAC6 control register on the ADSP-2106x will not equal zero. This is noted in the SHARC User’s Manual. 6 – 5 66 BootBoot LoaderLoader • The loader takes the place of the MEM21K application. If you use the loader to initialize your target’s memory, it is not necessary to use the MEM21K application. If you are using the C compiler, G21K , you should use the -nomem switch on the compilation line to stop the compiler from processing your executable with MEM21K . • The input to LDR21K is an executable file generated by the Linker. Some of the boot loaders require particular segments to be defined. These requirements can be found in the section that discusses the types of loaders. 6.2.1 Command Line Switches The loader supports the following command line switches: • -a [architecture filename ] Specify an alternate architecture file. LDR21K follows the normal convention for default architecture file specification. • -b[type] Where type indicates the method of booting to be used. The value of type can be prom, host, link, or JTAG. The default is -bprom . • -c[custom option ] This switch causes the loader to change operation for a custom boot loader file. See the discussion on customizing your loader before using this option. Multiple -c switches may be used on the command line. The available options for custom option are 20004 and 20040. • -e[segment name ] Where segment name describes a segment in the architecture file that should be considered to contain 40-bit extended precision data.