Upload
abbas-raza
View
223
Download
0
Embed Size (px)
Citation preview
8/12/2019 Porting Yamon
1/14
1
Building, Porting and Debugging YAMON
8/12/2019 Porting Yamon
2/14
2
TABLE OF CONTENTS
OVERVIEW ................................................................................................... 3
YAMON PROGRAM FLOW ........................................................................ 3
GRAPHICAL REPRESENTATION OF THE FLOW:................................. 5
HOW TO BUILD YAMON ........................................................................... 6
BUILDING YAMON TO RUN STRICTLY FROM RAM .......................... 8
ADAPTING YAMON FOR A NEW AMD ALCHEMY DESIGN............ 10
REFERENCES ............................................................................................. 14
8/12/2019 Porting Yamon
3/14
3
Overview
YAMON is the ROM monitor provided on AMD Alchemy evaluation and reference
boards. YAMON is analogous to a PCs BIOS in that it performs system initialization,
but YAMON does not contain all the features and services of a PC BIOS. YAMON is
capable of the following:
1. YAMON detects the specific board/CPU at run time.
2. YAMON contains both little- and big-endian run-time images. YAMON detects
the endianess at run time and invokes the appropriate image.
3. YAMON performs initialization of the memory controllers, caches, TLB, and
peripherals and PCI.
4. Command line history and editing, common commands such as load , go , and
dump .
5. Downloads over Ethernet (via TFTP) and serial port.
YAMON is not an operating system. It does not support switching between several
concurrent applications nor does it manage memory, caches, or the TLB. YAMON
allows a user to examine/modify memory and memory mapped devices as well as loadingand starting an application.
YAMON Program Flow
A YAMON image consists of three components, which are concatenated together into a
single image. These components are:
1. YAMON startup/initialization code that initializes memory controllers, caches,
TLB and peripherals, and then passes control to either the little- or big-endian
YAMON monitor image.
2. Little-endian YAMON monitor image
3. Big-endian YAMON monitor image.
8/12/2019 Porting Yamon
4/14
4
The startup/initialization code is invoked upon a reset. At reset, the processor fetches
instructions starting at the reset exception vector, MIPS virtual address 0xBFC00000
which corresponds to physical address 0x1FC00000. Located at 0xBFC00000 is the
_reset_handler() function from file yamon/init/reset/reset.s . This
code performs the board-specific initialization of the memory controllers, caches, TLB
and peripherals. The actual board-specific code is partitioned into a separate file, e.g.
yamon/arch/init/reset_db1550.S , that is included at compile-time for the
board. To learn more about the board-specific reset file, refer to the separate application
note Reset Software for Alchemy Au1000 Processor[2]. When the board-specific
initialization comples, this code examines the CP0 Config0[BE] bit to determine the
appropriate big- or little-endian image to invoke.
The file yamon/bin/link/link.xn is the linker script for the startup/initialization
code. The script contains the symbols _reset_handler_be and
_reset_handler_l e that correspond to the locations of the YAMON monitor big-
and little-endian images. The values for these symbols correlate to the addresses utilized
in the endian-specific linker scripts yamon/bin/link/link_eb.xn and
yamon/bin/link/link_el.xn .
The big- and little-endian YAMON monitor images start with the code located in file
yamon/init/init.S and is reached by the startup/initialization code jumping to
function _reset_handler_end() . This code copies the YAMON monitor code and
data from ROM/Flash to RAM, initializes the stack and global pointers, and then calls
c_entry() . The function c_entry() in file yamon/init/main.c . performs the
initialization of the monitor itself. Most of the initialization is done in initmodules()
function in yamon/init/initmodules.c . The YAMON command line interface is
then started with the invocation of function shell_setup() .
8/12/2019 Porting Yamon
5/14
5
Graphical Representation of the flow:
Reset Exception vector BFC00000
.
Reset.S
_reset_handler()../arch/init/reset_xxxx.s
if (Little Endian) jump to EL YAMON
else jump to EB YAMON
EL YAMONreset_handler_end()Init.s Init_au1000.sInit_platform_s.sshell_setup()
EBYAMONreset_handler_end()Init.s Init_au1000.sInit_platform_s.sshell_setup()
8/12/2019 Porting Yamon
6/14
6
How to Build YAMONTo build YAMON, do the following things.
1) Install the supplied GNU tool-chain [5].
2) Extract the YAMON sources. Use Winzip, and be sure to select the option Use Folder Names so that the directory structure is preserved.
Note the ZIP archive is password-protected. The password is in the file Yamon
Software Agreement.pdf in the same directory as this document.
3) Invoke the Cygwin BASH shell for the subsequent commands (this step is not
necessary if performing on a Unix host).
4) Configure YAMON for the desired board:
% cd yamon
% cd bin
% make install
% vi makefile
and change the variable
BUILDTYPE
to reflect the proper board. Be sure to use all uppercase as the board type is translated into
a C pre-processor #define and used in the YAMON source code.
4a) If building on a Unix host, you may need to remove extraneous carriage returns (^M)
and make sure all script files (*.pl) are executable. Failure to do both of these may causethe build to fail. Typical error messages are:
"bad interpreter: No such file or directory"
(the shell literally tries to invoke /usr/bin/perl^M )
8/12/2019 Porting Yamon
7/14
7
"/bin/sh: line 1: ./postproc.pl: Permission denied"
(postproc.pl is not marked executable)
You must mark a file executable after using dos2unix because it marks files readable and
writable only.
% dos2unix *.pl
% chmod +x *.pl
5) Build YAMON:
% make
When the make process completes, there is an S-Record in the current directory by thename similar to:
yamon-02.24DB15500.rec.m
This S-Record can then be used by a part programmer (or YAMON itself) to program
into the Flash. The filename has two important pieces of information in it: the version and
the board name.
When updating YAMON on the board, please read the file
UpdateYAMON.txt
for the recommended instructions for updating YAMON. These instructions are specific
to each board, so please examine the correct UpdateYAMON.txt file.
8/12/2019 Porting Yamon
8/14
8
Building YAMON to Run Stric tly from RAMIt is possible to build a version of YAMON that runs strictly from RAM; meaning thatthe YAMON is not placed into ROM/Flash memory or booted from the reset vector.Instead, the RAM-only version of YAMON is downloaded into RAM (presumably by the
YAMON already present on the platform, or perhaps by an EJTAG probe), and run fromRAM. The following paragraphs describe how to create the RAM-only version ofYAMON.
There are two distinct differences between the RAM-only YAMON and the normalYAMON built for ROM/Flash.
1. The board-specific reset file which is normally included as part of theyamon/init/reset/reset.S code, is not utilized. Stated differently, the board-specificreset file is omitted or commented out in this file.
2. The load addresses for YAMON are changed from 0xBFC00000/0x9FC00000 toa RAM address. In the examples that follow, the address 0x80C00000 is utilized.
For the first difference cited above, this implies that the Alchemy platform has already been initialized, and in particular the memory controllers. This is normally the case ifusing the YAMON already present on the board to load the RAM-only YAMON, or ifduring bring-up of a new board, an EJTAG probe has been utilized to initialize memorycontrollers. Thus, with memory and other initialization already performed, the reset codeis not needed, and in fact may create problems, for the RAM-only YAMON.
For the second difference cited above, the link addresses must be changed to be that of avalid RAM address. The default link addresses of 0xBFC00000/0x9FC00000 are notvalid for the RAM-only version since RAM is not located at these addresses (ratherROM/Flash is). Any RAM address can be chosen so long as it meets the following
criteria: the address is outside the first 1MB of RAM; YAMON copies itself to the lowest
1MB of RAM upon startup and runs from this area there-after. the address must be at least 1MB from the end of RAM; typically upwards to
1MB of space is needed to download the YAMON image.So for example, if the Alchemy board has 64MB of RAM, physical 0x00000000 to0x04000000, then choosing to load YAMON at physical address 0x00C00000, orKSEG0 address 0x80C00000 (KSEG1 address 0xB0C00000), is a valid address.
With the above information in hand, the steps to create a RAM-only version of YAMONare outlined here.
1. If applicable, build and boot the normal YAMON which resides in ROM/Flash;this is merely a sanity check to make sure that known good YAMON sources arein use.
2. Edit file yamon/init/reset/reset.S and ensure that the board-specific reset file is not included in this file.
3. Edit file yamon/bin/link/link.xn and change three lines: _ r eset _handl er _ l e = 0x9FC10000; _r eset _handl er _be = 0x9FC90000;
8/12/2019 Porting Yamon
9/14
9
. t ext 0x9FC00000 :t o
_r eset _handl er _ l e = 0x80C10000; _r eset _handl er _be = 0x80C90000;
. t ext 0x80C00000 :
4. Edit file yamon/link/link_el.xn and change:. t ext_ i ni t 0x9FC10000 :
t o. t ext_ i ni t 0x80C10000 :
5. Edit file yamon/link/link_eb.xn and change:. t ext_ i ni t 0x9FC90000 :
t o. t ext_ i ni t 0x80C90000 :
6. Now build YAMON using the same commands as always.7. The RAM-only YAMON is located in the yamon/yamon-02..rec
file. Copy this file to the TFTP download folder.8. Using the existing YAMON, or an EJTAG probe, download the RAM-only
YAMON, and invoke it. Note that the entry point is going to 0x80C00000, andnot the default entry point cited in the S-Record file.
8/12/2019 Porting Yamon
10/14
10
Adapting YAMON for a New AMD Alchemy Design
In general, when porting YAMON to a new board, only the following files need to be
modified. However, the majority of the effort required in porting YAMON to the new board is focused on the board-specific reset file. AMD strongly encourages reading the
application notes Mapping a Boot ROM on the AMD Alchemy Au1xxx and Reset
Software for the AMD Alchemy Au1xxx as these documents describes memory map
issues and reset activities.
AMD recommends changing the following files in the order in which they appear in the
table.
File Name File Path File Status
Makefile Yamon/Bin/makefile Modified
Reset.S Yamon/Init/init/reset.S Modified
Pb1000.h Yamon/Arch/include/pb1000.h Modified
Initswitch.h Yamon/Arch/include/initswitch.h Modified
Init_platform.c Yamon/Arch/init/platform/init_platform.c Optional
Reset_xxxx.S Yamon/Arch/init/reset_xxxx.S New
1) Makefile: An entry needs to be added for the new board, specifically the
makefile variable BUILDTYPE must be declared with the name of the
new board. In the YAMON source files, the BUILDTYPE variable is
post-fixed with _CONFIG to provide compile-time C pre-processor
conditionals. For example, the Db1550 board is defined as BUILDTYPE= DB1550 in the Makefile, and is conditionalized as #ifdef
DB1550_CONFIG in yamon /init/reset/reset.S .
2) Reset.S: This file is modified to add a conditional to obtain the board-
specific startup/initialization code. For the Db1550 example, the file
8/12/2019 Porting Yamon
11/14
8/12/2019 Porting Yamon
12/14
12
Note: Refer flash memory Data sheet to know more about sector size.
4) Initswitch.h: This file describes which modules are included in a given
YAMON monitor. The sequence of modules is important as many
modules are dependent on other modules. Create an entry for the new
board to declare the Flash module and/or PCI support.
5) Init_platform.c: This file is can be optionally modified to perform
miscellaneous activities upon boot. For example, many AMD Alchemy
reference boards utilize this file to display the CPU frequency.
6) reset_xxxx.S: This file is specific to the new board and is written as per
the guidelines defined in [2].Typically an existing AMD Alchemy
reference design can be utilized as a reference while authoring this file.
This file contains 99% of all the code needed to successfully boot
YAMON on a new board. It is imperative that this file be authored
according to AMD recommendations.
The following files are associated with the AMD Alchemy processor support withinYAMON:
File Flash
Monitor Flash
System Flash
8/12/2019 Porting Yamon
13/14
13
yamon/init/reset/reset.S # modified for 16-bit boot supportyamon/arch/init/cpu/init_au1000.S # debug message supportyamon/arch/init/platform/init_platform.cyamon/arch/init/platform/init_platform_s.S # debug message supportyamon/drivers/serial/serial_Au1000.c
yamon/drivers/rtc/rtc_au1000.cyamon/drivers/lan/MAC_AU1000.cyamon/drivers/flash/flash_amd.cyamon/arch/pci/arch_pci_pb1500.c
Numerous example reset files are also available for reference when adapting YAMONonto a new AMD Alchemy design.
yamon/arch/init/reset_pb1000.Syamon/arch/init/reset_pb1100.Syamon/arch/init/reset_pb1500.S
yamon/arch/init/reset_pb1550.Syamon/arch/init/reset_db1000.Syamon/arch/init/reset_db1500.Syamon/arch/init/reset_db1100.Syamon/arch/init/reset_db1550.S
This version of YAMON is created such that all AMD Alchemy boards are treated as thesame "platform" (specifically PB1000) within YAMON.
When debugging the bringup of a new board utilizing YAMON, the following tips might
prove useful:
Have disassembly of YAMONs reset.o on-hand to ensure fetches from Flash
match disassembly.
Use EJTAG/Logic Analyzer to peek at first few instructions at 0xBFC00000
to ensure these match YAMONs reset.o. This also verifies that YAMON was
correctly programmed into Flash.
YAMON issues debug messages during its boot-up procedure, most common
failure is in the memory test. The DRAM memory controller must be
programmed correctly, and the correct size of DRAM reported to YAMON, in
order for this test to pass (assuming no board issues).
8/12/2019 Porting Yamon
14/14
14
References
[1] YAMON Reference Manual from MIPS Technologies Inc, 2000
[2] Reset Software for Alchemy Au1000 Processor from AMD, 2002
[3] MIPS32 Architecture for Programmers, MIPS Technologies, Inc, 2001
[4] Mapping a Boot ROM on Alchemy 1000 Processor from AMD, Jan 2002
[5] AMD Alchemy Au1x000 Processor Development Platform Quick Start Guide,AMD, May 2004.