Recovery U-Boot Image (Naon)

From DAVE Developer's Wiki
Jump to: navigation, search
Info Box
Naon am387x-dm814x.png Applies to Naon

Introduction

For different reason, starting from image corruption due power loss during upgrade or unrecoverable bug while developing a new U-Boot feature, the user will need, sooner or later, to recover his/her Naon SOM without using U-Boot itself.

In this article we'll see a few useful option for Bare-metal restore of a Naon module.

As prerequisite, we suggest an in-depth read of Naon boot sequence and options, Naon memory organization and Naon Flashing images because all this topic are required to understand the followings.

JTAG Recovery

JTAG recovery is very useful, especially in development or production environment. However it requires a dedicated hardware (which most of the time, is very expensive).

Due hardware dependency we can't cover all JTAG tool example, but we'll see two of them to give the user a brief introduction on the argument. If you need more support you can alway contact our Techinical Support Team

Lauterbach ICD Naon booting

The following script for Lauterbach ICD for ARM Cortex-A8 allow the user to:

  • configure T32 correctly
  • establish a connection with the target (which should already be powered on)
  • load u-boot.bin into internal SRAM
  • run it

At this point the user should be able to run commands from U-Boot serial console.

; T32 script to download u-boot 1st stage into the internal SRAM

break.delete /all

SYStem.RESet
SYStem.CPU DM8148
SYStem.JtagClock 10Mhz
SYStem.Mode Attach

; we assume that there's bootrom running. Stop it to allow binary load 
break  

data.load.binary MLO 0x40300000

R.S PC 0x40300000

go

enddo

As a more advance example, the next script, after loading the 1st stage and have it run until RAM initialization, also load 2nd stage (at 0x81000000). This is faster that loading the 2nd stage via serial protocol. After executing the script, the user should just type go 81000000 from U-Boot 1st stage prompt, to run the 2nd stage:

U-Boot 2010.06-dirty (Apr 20 2012 - 17:15:51) [nelk-0.0.3]

U-Boot code: 40300000 -> 4030D0E4  BSS: -> 4030E2EC
TI8148-GP rev 2.1

ARM clk: 600MHz
DDR clk: 400MHz

RAM Configuration:
Bank #0: 80000000 512 MiB
Using default environment

### main_loop entered: bootdelay=0

### main_loop: bootcmd=""
Hit any key to stop autoboot:  0
NAON-MIN#go 81000000
## Starting application at 0x81000000 ...


U-Boot 2010.06-dirty (Apr 30 2012 - 19:23:20) [nelk-0.9.0]

TI8148-GP rev 2.1

ARM clk: 600MHz
DDR clk: 333MHz

I2C:   ready
DRAM:  512 MiB
NAND:  HW ECC Hamming Code selected
1024 MiB
MMC:   OMAP SD/MMC: 0
Net:   Detected MACID:d4:94:a1:8e:46:a4
cpsw
Hit any key to stop autoboot:  0
NAON#


Here it is:

; T32 script to download u-boot 1st stage into the internal SRAM and,
; after the 1st stage initilize it, it loads also the 2nd stage in DRAM

break.delete /all

SYStem.RESet
SYStem.CPU DM8148
SYStem.JtagClock 10Mhz
SYStem.Mode Attach

; we assume that there's bootrom running. Stop it to allow binary load 
break  

data.load.binary MLO 0x40300000

R.S PC 0x40300000

go
;wait a bit, so U-Boot starts and initialize everything
wait 2s
break

data.load.binary ../u-boot/u-boot.git/u-boot.bin 0x81000000
go

enddo

If needed, the customer can contact us for more scripts or suggestion, for example to debug U-Boot or Linux kernel.

Code Composer Studio (CCS) and Spectrum Digital XDS560V2 STM USB

This combination of tool is described into this article of Texas Instruments Wiki.

More article on CCS are available into its dedicated section of TI Wiki.

UART Recovery

UART recovery does not requires any specialized hardware, except for

  • a PC (Windows or Linux based)
  • a DB9 serial cross cable
  • the binary image of the 1st stage bootloader (u-boot.min.uart) with UART support (if this file is not available, please see Getting the u-boot.min.uart)

If not already available, configure Naon boot sequence to include UART boot.

To verify this, is enough to open a serial terminal (115200 8N1) and power on the board. If everything is correctly configured you should see a sequence of CCC on your screen.

Please follow this instructions on TI Wiki to load both 1st and 2nd stages of U-Boot.

When the 2nd stage is running follow this article for instructions on how to update U-Boot in flash

Getting the u-boot.min.uart

To build the 1st stage bootloader with UART support:

  • configure the file Rules.make file contained into the EZSDK_INSTALL_DIR, modifying the MIN_UBOOT_CONFIG and MIN_UBOOT_IMAGE variables, choosing the uart variant:
MIN_UBOOT_CONFIG=naon_min_uart
MIN_UBOOT_IMAGE=u-boot.min.uart
  • build u-boot launching the make u-boot command, as described in Build/configure U-Boot only
  • enter the EZSDK_INSTALL_DIR/board-support/u-boot.git directory and launch the following command, which removes the MLO header (first 8 bytes):
dd if=MLO of=u-boot.min.uart bs=1 skip=8

u-boot.min.uart is the file that must be sent through the serial line to load the 1st stage bootloader on the board.

MMC Recovery

Due the fact that MMC is both removable and accessible on a system that support this device, MMC recovery is a valuable options that requires no special hardware at all, apart a properly formatted MMC.

For more information about MMC booting see its dedicated section inside Naon boot sequence.

After the board is booted via MMC, if you have U-Boot console access and a serial terminal emulator (and, of course, a PC), you can follow the standard Naon Flashing Images instructions to restore the broken bootloader (it's useful to have this binary image on MMC too)

If you are on-site without even a console access (or a skilled user that can send commands via serial console), a better way to recover the board is to prepare a custom U-Boot image as boot binary into the MMC with runs the update (and verify!) commands as soon as it's booted. However this is an advanced topic and requires a customization that is heavily system dependent. Feel free to contact us for more information and help.