U-Boot recovery for i.MX6 Q/D/DL/S/ULL via JTAG: Difference between revisions

From Wiki-DB
Jump to navigationJump to search
No edit summary
No edit summary
Line 76: Line 76:


== Trouble shooting ==
== Trouble shooting ==
If there is any uBoot starting, you can delete it with entering uBoot (press DEL after powering up the board)
If there is a U-Boot starting, the OpenOCD procedure may not work properly.
There are two solutions to prevent the start of U-Boot from the SPI-NOR-Flash.


=== SDP Boot (i.MX6 ULL) ===
=== SDP Boot (i.MX6 ULL) ===

Revision as of 14:26, 8 October 2019

Technically all JTAG-adapter listed by OpenOCD should work, but DH electronics recommends the Olimex Arm-USB-OCD-Tiny-H. All tests and Documents were made in use of this one.

Needed Hardware

Note: One cable is included with the DHCOM JTAG adapter.

Installation

This installation was made on the Virtual Machine for Application Development. All console expressions refer to this Debian system, but any other debian based system should also work.

OpenOCD from Debian repositories (i.MX6 Q/D/DL/S)

  1. Install OpenOCD from Debian repositories
    sudo apt-get install openocd

OpenOCD from master branch (i.MX6 ULL)

  1. Install needed libraries and tools
    sudo apt-get install git build-essential pkg-config autoconf automake libtool libusb-dev libusb-1.0-0-dev libhidapi-dev libftdi-dev
  2. Clone git repository to local directory
    git clone https://repo.or.cz/openocd.git
  3. Prepare source directory and submodules (when building from the git repository)
    ./bootstrap
  4. Generate the Makefiles to build OpenOCD
    ./configure
  5. Build OpenOCD from source
    make -j4
  6. Install OpenOCD to /usr/local
    sudo make install

U-Boot Programing

There are two ways for doing this. The easy way is an automatic Bash-script, which handles all the commands needed for the programing process. In this case you need a specified folder-structure so that the automatic script can find all its needed files. The other one is to type in the required commands. In a few cases this fails then you need to go the other way and program the uBoot manually.

  1. Download the needed files here: Programing Files
    • Here you get the "dhcom_olimex_arm_usb_tiny_h.cfg" and the "u-boot-spl-prog"
  2. Download newest uBoot here: uBoot_iMX6
    • Here you get the "uBoot.imx"
  3. Connecting everything
    • Connect the JTAG-Adapter with your PC and the Debian VM (Player - Removeable Devices)
    • Connect the JTAG interface via the DHCOM JTAG adapter to the i.MX6 module (If you don't have a JTAG adapter, please ask DH electronics)
  4. Automatic Script
    • Create a new folder (it isn't necessary where the folder is located, you just need to keep the folder structure)
    • The needed folder structure looks like this:
      • DHcom_uBoot_Programmer
        • bin_File (here are the uBoot files)
        • uBoot_Programmer (here are the Programing scripts)
      • Paste the "dhcom_olimex_arm_usb_tiny_h.cfg"-file in the OpenOCD folder at /usr/share/openocd/scripts/board
      • The "uBoot_Programmer_Olimex_arm_usb_tiny_h.sh"-file needs to be in the uBoot_Programmer folder
      • In the bin_Folder belongs the "u-boot-spl-prog.bin" and your own uBoot file
      • You need to adjust the "uBoot_Programmer_Olimex_arm_usb_tiny_h.sh" in terms of the name of your uBoot-file. Paste the name instead of the term "Your uBoot File"
    • Open a Linux terminal and navigate into the folder e.g. cd DHcom_uBoot_Programmer/uBoot_Programmer
    • Power up the i.MX6 board and have a look at the serial output (COM-port). There must not be any output (no uBoot starting) else go to Delete uBoot
    • Start the programing script: ./uBoot_Programmer_Olimex_arm_usb_tiny_h.sh
    • Note: If some error occures you can try the Manual Programing method below
  5. Manual Programming (Only needed if automatic script is not used!!!)
    • Power up the board and have a look at the serial output. If there is any uBoot starting:Delete uBoot
    • You need two terminals, one for GDB the other for OpenOCD an a Com-Port to get the serial output
    1. OpenOCD
      • openocd –f board/dhcom_olimex_arm_usb_tiny_h.cfg
      • If OpenOCD does not open like in the picture then close and open it again
    2. GDB
      • Open second terminal window
      • gdb --quiet
      • target remote localhost:3333
      • mon load_image /path/to/the/u-boot-spl-prog/file 0x908000
      • mon reg pc 0x908000
      • mon reset
      • mon resume
      • Wait until the message "Searching for IVT header at DDR address 0x18000000" is on the serial output
      • mon halt
      • mon load_image /path/to/the/u-boot-with-spl/file 0x18000000
      • mon resume

Trouble shooting

If there is a U-Boot starting, the OpenOCD procedure may not work properly. There are two solutions to prevent the start of U-Boot from the SPI-NOR-Flash.

SDP Boot (i.MX6 ULL)

  1. Boot in Serial Download Mode to prevent booting the broken U-Boot from SPI-NOR-Flash
    1. Hold the button for sdp boot mode on the SODIMM-200-Module (DHCOM) next to the BGA-Module (DHCOR)
    2. Power cycle the device. To restart the device, press the reset button on the baseboard or unplug and plug in the power plug.
    3. Release the button for sdp boot mode
  2. Go on with your procedure

Delete U-Boot (i.MX6 Q/D/DL/S)

  1. sf probe
  2. sf erase 0 f0000
  3. Restart the board
  4. Go on with your procedure