1from arm_ds.debugger_v1 import Debugger
2from arm_ds.debugger_v1 import DebugException
3import os
4
5# The Pandaboard must be in reset *before* this script starts.
6
7# The CPU driver is linked at this address
8LINKADDRESS = 0
9
10# The boot driver is relocated to this address
11RAMBASE = 0x80000000
12
13debugger = Debugger()
14ec = debugger.getCurrentExecutionContext()
15
16# Load the boot driver symbols
17im= ec.getImageService()
18im.loadSymbols('Barrelfish/armv7/sbin/boot_omap44xx', RAMBASE)
19
20# Use a hardware breakpoint to wait until the boot driver is loaded
21# and running.
22bs= ec.getBreakpointService()
23bs.setBreakpoint('boot_bsp_core', hw=True, temporary=True)
24
25# Use usbboot to download the image
26os.system('Barrelfish/tools/bin/usbboot Barrelfish/armv7_omap44xx_image')
27
28# Wait until we hit that breakpoint
29es = ec.getExecutionService()
30es.waitForStop()
31
32# The previous execution context is now invalid
33ec = debugger.getCurrentExecutionContext()
34
35# Get the CPU driver's final load address.
36vs = ec.getVariableService()
37kernel_start = vs.readValue('boot_arguments.cpu_driver_base')
38
39offset = int(kernel_start) - LINKADDRESS
40
41print "Kernel loaded at: %08x" % int(kernel_start), " linked at %08x" % LINKADDRESS, " offset %08x" % offset
42
43# Add the CPU driver symbols, but don't replace the boot driver ones.
44im.addSymbols('Barrelfish/armv7/sbin/cpu_omap44xx', offset)