wiki:TBR/BSP/Ppc405ex

Version 12 (modified by shashvat jain, on Nov 8, 2018 at 10:14:07 PM) (diff)

Fixed Infobox

Ppc405ex

Infobox BSP

image PPC405EX-220x183.jpg
BSP_name haleakala
Board_URL http://www.apm.com/products/embedded/singlecore405/ppc_405ex/
Manufacturer AMCC/UDTech
Architecture PowerPC
CPU_model PPC405EX/EXr
Aliases kileaua
RAM 256M
NICs 1/2
Serial 2

Overview

This BSP supports boards based on the AMCC PPC405EX and 405EXr processors. It is derived from the 405-generic code but uses the new interrupt handling.

This BSP is known to work (4.9.1) on the Haleakala board (PPC405EXr, one Ethernet port) and should function on the Kileaua board (same board, PPC405EX and two Ethernet ports).

The BSP has a few lines of code writing to an onboard FPGA which are specific to the Haleakala/Kileaua? boards, but is otherwise suitable as a generic 405EX/EXR platform.

Work on a network interface for the PPC405EX/EXr/GP/GPr is underway (it functions, but needs testing)

Board Setup

This BSP assumes that the board jumpers and switches are set to the factory defaults

Downloading and Executing

This BSP is designed to be downloaded directly into DRAM by a Macraigor OCDemon BDM device. This means that the DRAM controller has to be set up first so that we have some working RAM to write to. The following gdbinit script does this and runs a very basic check to see if its working. Other loading methods need to prefix equivalent DRAM setup code to dlentry.S

echo Setting up gdb for AMCC PPC405EXr Haleakala.\n

# Common gdb setup for PowerPC CPUs
set complaints 1
set output-radix 10
set input-radix 10
set prompt (powerpc-gdb) 
set architecture rs6000:rs2
set endian big
dir .

# Set GDB to use 1024 bytes packets when downloading. This
# is optional but reduces load image download times
set remote memory-write-packet-size 1024
set remote memory-write-packet-size fixed

# Define some useful macros

# Test memory access using 32-bit operations
define memtest32
    echo Testing memory (32bit): $arg0 \t
	set $next = ($arg0 + 4)
	set {unsigned long} ($arg0) = 0x89abcdef
    set {unsigned long} ($next) = 0x01234567
    if ({unsigned long} ($arg0)) == 0x89abcdef		\
	  && ({unsigned long} ($next)) == 0x01234567
	echo Success.\n
    else
	if ({unsigned long} ($arg0)) == 0x01234567		\
		  && ({unsigned long} ($next)) == 0x89abcdef
	    echo Failure (read/write long word lanes are reversed.)\n
	else
	    echo Failure.\n
	end
    end
end

define sdram_set
	monitor dcr 0x10=$arg0
	monitor dcr 0x11=$arg1
end

define sdram_init
# Derived from Haleakala EVB users manual 3.3.1 plus check against EVB values
	sdram_set	0x40	0x6701		
# MB0CF base addr 0, 256M Nx10, 8 bank
	sdram_set	0x44	0			
# MB1CF not enabled
	sdram_set	0x80	0x80000000	
# CLKTR advance clock 180 degrees
	sdram_set	0x30	0x06180000	
# RTR:  1560 tCk = 7.8 usec
	sdram_set	0x85	0x80201000	
# SDTR1
	sdram_set	0x86	0x32204232	
# SDTR2
	sdram_set	0x87	0x080B0D1A	
# SDTR3
	sdram_set	0x88	0x00000442	
# MMODE
	sdram_set	0x89	0x00000404	
# MEMODE
	sdram_set	0x20	0x04322000	
# MCOPT1: No ECC
	sdram_set	0x50	0xA8380000	
# InitPLR0 No-op, wait min 400nsec
	sdram_set	0x51	0x81900400	
# INITPLR1 Precharge all wait min 3 cycle
	sdram_set	0x52	0x81020000	
# INITPLR2
	sdram_set	0x53	0x81030000
	sdram_set	0x54	0x81010404
	sdram_set	0x55	0x81000542
	sdram_set	0x56	0x81900400
	sdram_set	0x57	0x8d080000	
# INITPLR7
	sdram_set	0x58	0x8d080000
	sdram_set	0x59	0x8d080000
	sdram_set	0x5A	0x8d080000
	sdram_set	0x5B	0x81000442
	sdram_set	0x5C	0x81010780
	sdram_set	0x5D	0x81010400	
# INITPLR13
	sdram_set	0x5E	0			
# INITPLR14
	sdram_set	0x5F	0			
# INITPLR15
	sdram_set	0x26	0x0080F837	
# CODT
	sdram_set	0x22	0x01800000	
# MODT0
	sdram_set	0x81	0			
# WRDTR
	sdram_set	0x21	0x20000000	
# MCOPT2: Start initialisation. Delay 100 usec here
	sdram_set	0x7A	0x03000086	
# DLCR	// was ...A5
	sdram_set	0x78	0x40000000	
# RDCC
	sdram_set	0x70	0x80000038	
# RQDC
	sdram_set	0x74	0x00000209	
# RFDC
	sdram_set	0x21	0x08000000	
# MCOPT2, enable controller
end

#------------------------ Startup and debug  -----------------------------
# 10.0.1.2 is the IP address of a PC running the Macraigor OCDRemote software
# with a USB2Sprite connected to Haleakala board.
# The Cygwin command used to start debugging services on the PC is:
# $ /usr/local/bin/ocdremote -c PPC405 -d USB

target remote tcp:10.0.1.2:8888

# Reset the target board
monitor reset
flushregs

# Initialise the SDRAM controller so we have RAM to work with
sdram_init

# Check its working
memtest32

# Load an executable; "c" to run
load test.exe
symbol-file test.exe

Debugging

How do you debug code on this board? What gdb setup? BDM, stub, etc?

Test Reports

{{Test Report |Version = TBD |Date = TBD |User = TBD |Report = TBD }}

{{Navbox_BSPs}}