• Nem Talált Eredményt

BOOT LOADER OPTION

In document Assembler Tools& Simulator Manual (Pldal 124-129)

5.4.1 1K Boot Pages For ADSP-2105, ADSP-2115

5.5 BOOT LOADER OPTION

The boot loader option (-loader switch) of the PROM splitter generates a bootable version of your program which automatically initializes all necessary ADSP-21xx RAM memory spaces from internal program

memory. Memory loading routines are added to your program to perform the initialization following each boot page load.

The standard booting operation of the ADSP-2101, ADSP-2111, and ADSP-21msp50 loads only the processor’s internal 2K of program memory RAM at reset. None of the other memory spaces—internal data memory, external program memory, or external data memory—are

loaded. If your bootable program requires the initialization of any of these memory spaces which are RAM, you must write routines to copy the code/data from internal PM to the necessary locations, or use the -loader switch. (The alternative is to use initialized ROM devices for external memory.) See the section “Initializing Your Program in Memory” in Chapter 3.

The boot loader option also lets you create multiple-page programs which are completely booted at reset—the code and data is booted into internal PM and copied to the other memory spaces, one page at a time.

To use the boot loader option for an 2101, 2111, or ADSP-21msp50 system with 2K-size boot pages, invoke the PROM splitter with only the -loader switch and a PROM file format switch:

SPL21 imagefile PROMfile -loader [-s] [-i]

To use the boot loader option for an ADSP-2105 or ADSP-2115 system with 1K-size boot pages, invoke the PROM splitter with the -loader switch, a PROM file format switch, and the -bs and -bb switches with pagesize and boundary set to 1024:

SPL21 imagefile PROMfile -loader -bs 1024 -bb 1024 [-s] [-i]

Do not use the -bm, -pm, or -dm switches—a boot memory .BNM file is automatically generated. The output file should be used to burn boot memory EPROMs. Your entire executable program is contained in this file, including all code and data to be copied to program and data memory RAM.

5 PROM Splitter

“Loader” routines copy code/data

to off-chip PM Boot Memory

Program Memory

ADSP-2101

RAM RAM

ROM

2K

1K 1K

Reserved

16K

External Program Memory

RAM 14K

External Data Memory

RAM 14K Booting

at RESET

“Loader” routines copy data to

off-chip DM

“Loader” routines copy data to on-chip DM Data

Memory

The booting and copying process is pictured in Figure 5.2, for ADSP-2101 2K-size boot pages.

The -loader switch causes the PROM splitter to scan the input .EXE file for external PM RAM segments and internal or external DM RAM segments;

it creates as many boot pages as necessary to store the code and data, regardless of how many pages are declared in the system specification file.

In addition, small loader routines are constructed and placed at the beginning (low addresses) of each page.

Figure 5.2 Program Booting & Memory Initialization

5 PROM Splitter

Figure 5.3 shows a program created with the -loader switch which is contained on boot pages 0, 1, and 2. The loader routines for pages 0 and 1 include several loops, each of which copies a segment of code or data to the appropriate destination in PM or DM after booting. One copy loop is needed for each discontiguous segment. At the end of each page’s loader routine is a sequence of instructions which force a software boot of the next page. The last page, page 2, does not have a loader routine—it contains the first 2K page of the complete executable program. When this page is booted, program execution begins at address 0 in the ADSP-21xx’s internal PM.

initialization (src1,dest1) copy loop1

initialization (src2,dest2) copy loop2

initialization (src3,dest3) copy loop3

software-forced boot of page 1

initialization (src1,dest1) copy loop1

initialization (src2,dest2) copy loop2

software-forced boot of page 2

unused

code & data code & data

unused

start of executable program

First page (2K) of executable program

Boot Page 0 Boot Page 1 Boot Page 2

addr 0

addr 0x3FF addr 0x3FF addr 0x3FF

addr 0 addr 0

Loader routine

Loader routine

...

...

Figure 5.3 Boot Loader Program Example

5 PROM Splitter

The -loader switch causes the PROM splitter to assign code and data to each boot page (except the last) starting at the highest address and working down (see Figure 5.3). An unused region will usually be left in the middle of each page.

After page 0 is booted, code and data segments are copied by the page 0 loader routine to the appropriate destinations. Page 0 then forces a software boot of page 1, whose loader performs the same operation.

Successive boots continue until your entire program is loaded, up to a maximum boot memory space of 15K.

For the example of Figure 5.3, the following sequence of events will occur after system reset:

1. Page 0 is booted into the ADSP-21xx’s internal PM. The Page 0 loader routine is executed, copying the Page 0 code and data to internal DM, external PM, and/or external DM.

2. Page 1 is booted by the Page 0 loader routine. The Page 1 loader routine is executed, performing the necessary copies of code and data. This completes the initialization process.

3. Page 2 is booted by the Page 1 loader routine. Main program execution is started at address 0.

When setting the memory-mapped System Control Register for software-forced boots, the loader routines set the BWAIT (Boot Wait States) field of this register to the default value of 3. Refer to the “Boot Memory Interface”

section of the Memory Interface chapter in the ADSP-2100 Family User’s Manual for further information.

5 PROM Splitter

5.5.1 How To Prepare Your Program For The Boot Loader

If you intend to use the PROM splitter’s -loader switch to generate a bootable, auto-initializing version of your ADSP-21xx program, the following steps should be taken:

1. Declare the maximum number of boot pages allowed, eight, in your system architecture file.

2. Write your assembly modules without using the /BOOT qualifier on the .MODULE directive.

3. Assemble and link.

4. Invoke the PROM splitter with the -loader switch. As the PROM splitter processes your program, a message is displayed indicating the number of boot pages created. (To save this information, use operating system commands to capture the text into a file.)

When using the boot loader option you should not assign the assembler’s /BOOT qualifier to your program modules. This allows the PROM splitter to determine boot page placement for each module.

Note that when copying code/data to external PM or DM, the loader routines added to your program may write to memory locations other than those used by the main program. For example, if the main program initializes locations DM[0x03FF] and DM[0x0401], and a memory-mapped I/O port is declared at DM[0x0400], the loader routine may write an

undefined value to the port. You must ensure that such spurious writes do not cause errors in your system. One way to do this is to declare a unique memory segment (with the system builder’s .SEG directive) in the system architecture file for all of your ports. If no code or data is located in this segment, the ports will not be overwritten during memory initialization.

5 PROM Splitter

5.5.2 Simulating A Boot Loader Program

Since the boot loader function is implemented by the PROM splitter and not by the linker, you must use the PROM splitter-output .BNM file to simulate the bootable program. The linker-output .EXE file contains no boot memory information.

To load the .BNM file into an ADSP-21xx simulator or emulator, use the LR (Load ROM file) command instead of the L command. The booting and memory initialization process can then be observed during program execution.

In document Assembler Tools& Simulator Manual (Pldal 124-129)