############################################################ # # Copyright Altera 2013 # All Rights Reserved # File: uboot.ds # ############################################################ # # This is an ARM DS5 debugger script that is intended to help folks run and # debug uboot. It loads the preloader (a.k.a. spl) into onchip ram, runs it # to setup DDR, then loads uboot, lets uboot run a bit to calculate relocation # offset, and finally reloads symbol table with calculated offset in the # relocated code. # # # load and run the preloader # source -v "$sdir/preloader.ds" # if trace is enabled and you have self-modifying code, # you'll want to turn this off. u-boot is self-modifying set trust-ro-sections-for-opcodes off # # now load unrelocated uboot into ddr # loadfile "$sdir/u-boot-socfpga/u-boot" pause 1s # # delete any breakpoints # delete # set pc to start of uboot start wait restore "$sdir/u-boot-socfpga/u-boot.dtb" binary &_end pause 1s # # delete any breakpoints # delete # u-boot-dtb.img u-boot-dtb.img # set breakpoint at start of code that relocates uboot thbreak relocate_code pause 1s cont wait 60s # # # now reload the symbol table with runtime calculated relocation offset. # register r8 is uboot's "global data" pointer. # symbol-file "$sdir/u-boot-socfpga/u-boot" ((gd_t*)$r9)->reloc_off pause 1s # # delete any breakpoints # delete # # Now set a break in the board_init_r (from uboot). It must be a hardware # breakpoint because this is after relocation. # thbreak board_init_r pause 1s cont wait 60s