ConnectCore 6 U-Boot Customizations. Reference Manual

Similar documents
ConnectCore 6 Android/Yocto. Getting Started Guide

RakunLS1, Qseven SBC module with LS1021A

Use U-Boot. U-Boot Main Commands. U-Boot script capability

LTIB for i.mx28, a step-by-step guide

User s Manual for the Boundary Devices Nitrogen R board

DS2 Products Auto-Update Tool BSP

MCAM335x Linux User's Guide

Q7M EVK (Q7M120

Digi Embedded Yocto 1.6. First Steps Guide


SCM EVK (SCM120

COMX-P4080. Release Notes L69C February 2011

Oxalis Getting Started

Linux. For BCT RE2G2. User Guide. Document Reference: BCTRE2G2 Linux User Guide. Document Issue: Associated SDK release: 1.

Item Number Item Name Qty conga-qeval/qseven each

Getting Started with BeagleBoard xm

Overview for Axxia 5600 and Axxia 6700

Versatile Express. Boot Monitor. Reference Manual. Copyright ARM. All rights reserved. ARM DUI 0465F (ID110612)

400AP Application Note Uploading Firmware Images to 400AP NAND Flash Models

Acronis Disk Director 11 Home. Quick Start Guide

QUICK START GUIDE ALTA DS 4K. Android EVK v

SparkGate7 Quick startup guide

PL-I Assignment Broup B-Ass 5 BIOS & UEFI

GM8126 U-BOOT. User Guide Rev.: 0.2 Issue Date: May 2011

Pronto PicOS 1.4 Installation Reference Guide

ADS U-boot User's Manual. Applied Data Systems Old Columbia Road Columbia MD, USA

Filesystem. Disclaimer: some slides are adopted from book authors slides with permission

OMAP3530 has 256MB NAND flash in PoP (PoP: Package-On-Package implementation for Memory Stacking) configuration.

HKG Android Verified Boot 2.0 and U-boot. Igor Opaniuk, Texas Instruments

PetaLinux SDK User Guide. Firmware Upgrade Guide

IntelliServer RAS 2000 TM PowerRack Windows NT Supplement

Bootloader commands - Openmoko

A pragmatic guide to boot-time optimization

Using grub to Boot various Operating Systems

ECE 598 Advanced Operating Systems Lecture 14

VortiQa Enterprise Quick Start Guide

phycore -XScale/PXA270 Development Kit (KPCM-027) Loading a Linux Image (demo.img)

Lenovo Flex System SI Gb System Interconnect Module. Release Notes. for Networking OS 8.2

File System Case Studies. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Getting Started U-boot

U-boot quick start guide

ECE 471 Embedded Systems Lecture 16

i.mx Linux User's Guide

ConnectCore for i.mx6ul Starter Board. Hardware Reference Manual

Wind River Pulsar Linux Quick Start For Avnet Zynq Version 7.0

XBee Grove Development Board. User Guide

Lab2 - Bootloader. Conventions. Department of Computer Science and Information Engineering National Taiwan University

Linux+ Guide to Linux Certification, Third Edition. Chapter 2 Linux Installation and Usage

DNP/2110 Linux Starter Kit: First Steps

GIGABYTE. Software Reference Guide for MP30 (APM) Platform R01. Document Version:

UPGRADING THE ARCTIC FIRMWARE

PICO-i.MX6UL Development Platform for Android Things Quick Start Guide

ECE 471 Embedded Systems Lecture 16

Glomation. Embedded Single Board Computer GESBC-3130S User s Manual

NET+Works with GNU Tools Getting Started Guide

Session Overview. Background Integration Mender libostree (aktualizr) SWUpdate resin.io

Boot Loader. Bootloader

U-Boot Reference Manual

The Early System Start-Up Process. Group Presentation by: Tianyuan Liu, Caiwei He, Krishna Parasuram Srinivasan, Wenbin Xu

Parallella Linux - quickstart guide. Antmicro Ltd

Intel Entry Storage System SS4000-E

Partitioning and Formatting Guide

Renaming/Moving Parameter Files

Track One Building a connected home automation device with the Digi ConnectCore Wi-i.MX51 using LinuxLink

Release Notes for QNX Neutrino BSP for Renesas SH7780 EDOSK 1.0.0#

File System: Interface and Implmentation

UM2330 User manual. ST8500 boot. Introduction

ECE 471 Embedded Systems Lecture 12

9.5.1 Compiling and Installing

AN LPC1700 secondary USB bootloader. Document information. LPC1700, Secondary USB Bootloader, ISP, IAP

Command Register Settings Description Notes

Critical Analysis and last hour guide for RHCSA/RHCE Enterprise 7

How to Recover the OS7030

1. Conventions in this tutorial Introduction Check and change configuration settings as needed Start Digi ESP...

Operating Systems 2014 Assignment 4: File Systems

CHAPTER 11: IMPLEMENTING FILE SYSTEMS (COMPACT) By I-Chen Lin Textbook: Operating System Concepts 9th Ed.

Lenovo RackSwitch G8272. Release Notes. For Cloud Network Operating System 10.3

Boot. How OS boots

DEVELOPMENT GUIDE AMOS-820. Linux BSP v

Adding SD card to WRT54GL

CST Algonquin College 2

The LILO Configuration Handbook. Virgil J. Nisly

A+ Guide to Hardware, 4e. Chapter 7 Hard Drives

Linux. For BCT TM1 / HB5. User Guide. Document Reference: BCTTM1HB5 Linux User Guide. Document Issue: 1.2. Associated SDK release: 1.

REFERENCE 4D SYSTEMS TURNING TECHNOLOGY INTO ART. μdrive. (μdrive-μsd-g1) COMMAND SET. Document Date: 23 rd October 2012 Document Revision: 4.

Filesystem. Disclaimer: some slides are adopted from book authors slides with permission 1

In this video, I will be covering DM385 IPNC RDK out of box demo-- Here, I'll be showing flashing the uboot using prebuilt binaries available in RDK--

High Performance Real-Time Operating Systems

MP3 Trigger v2 User Guide

File System Case Studies. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

SUPERTRAK EX8300, EX8350 RAID 6 UPGRADE & PRIMER

FIAMMA MCAM335x Linux User's Guide

GUID Partition Table (GPT)

Configuring the MSA1000 for Linux or NetWare Environments

Linux Filesystems Ext2, Ext3. Nafisa Kazi

Microsoft File Allocation Table

Link Gateway ISO Installation Manual

Zephyr Kernel Installation & Setup Manual

MBL Users Manual For EV44B0-II Board

AFD4400 Reference Design Board Quick Start

Transcription:

ConnectCore 6 U-Boot Customizations Reference Manual

Revision history 90001422 Revision Date Description A August, 2014 Initial release B October, 2014 Added SBCv2 support; added carrier board version support; disable autoscript by default; console is UART4 on SBC; added known issues. C June, 2015 Update from RAM support; emmc-less variants support; corrected link on page 5. D September, 2017 Updated branding and made editorial enhancements. Trademarks and copyright Digi, Digi International, and the Digi logo are trademarks or registered trademarks in the United States and other countries worldwide. All other trademarks mentioned in this document are the property of their respective owners. 2017 Digi International Inc. All rights reserved. Disclaimers Warranty Information in this document is subject to change without notice and does not represent a commitment on the part of Digi International. Digi provides this document as is, without warranty of any kind, expressed or implied, including, but not limited to, the implied warranties of fitness or merchantability for a particular purpose. Digi may make improvements and/or changes in this manual or in the product(s) and/or the program(s) described in this manual at any time. To view product warranty information, go to the following website: www.digi.com/howtobuy/terms Send comments Documentation feedback: To provide feedback on this document, send your comments to techcomm@digi.com. Customer support Digi Technical Support: Digi offers multiple technical support plans and service packages to help our customers get the most out of their Digi product. For information on Technical Support plans and pricing, contact us at +1 952.912.3444 or visit us at www.digi.com/support. ConnectCore 6 Reference Manual 2

Contents About the ConnectCore 6 U-Boot Version 5 Supported interfaces 5 Digi custom commands Direct boot: dboot 7 Syntax 7 Examples 7 Firmware update: update 9 Examples 10 Addresses 10 Image file names 10 Source media 10 On-the-fly (OTF) update mechanism 11 Update files within partition 11 MMC extended CSD register: mmc ecsd 12 emmc partitioning Environment variables One-time programmable (OTP) bits (e-fuses) HWID and MAC address OTP words 17 Carrier board version 17 Coding the carrier board version on the OTP bits 17 Querying the carrier board for conditional code 17 Auto bootscript Bootscript process 19 Creating a bootscript 19 ConnectCore 6 Reference Manual 3

Updating the boot loader Recovering a bricked device Create a bootable microsd card from a U-Boot image 22 Using Linux 22 Using Windows 22 Boot from a usd card 24 Known issues PHY autonegotiation delay 26 ConnectCore 6 Reference Manual 4

About the ConnectCore 6 U-Boot The ConnectCore 6 platform uses U-boot (Universal Bootloader) as its primary boot loader. U- Boot is an open-source project. Standard documentation about commands, environment variables, Flattened Device Tree support and more can be found at www.denx.de/wiki/u-boot/documentation. This guide only describes specific changes done by Digi to the standard U-Boot. Version U-Boot for ConnectCore 6 is based on standard U-Boot v2013.04 plus Freescale patches at git.freescale.com/git/cgit.cgi/imx/uboot-imx.git. Supported interfaces The ConnectCore 6 module supports the following interfaces: UART4 for console (115200/8/N/1) 1GB DDR3 4GB emmc for storage (on USDHC4) usd card (on USDHC2) Gigabit Ethernet on Micrel PHY KSZ9031 (RGMII) I2C multi-port OTP bits (e-fuses) ConnectCore 6 Reference Manual 5

Digi custom commands In addition to the standard U-Boot commands, Digi provides custom U-Boot commands to perform common embedded platforms operations more efficiently. Direct boot: dboot 7 Firmware update: update 9 MMC extended CSD register: mmc ecsd 12 ConnectCore 6 Reference Manual 6

Digi custom commands Direct boot: dboot Direct boot: dboot The dboot command simplifies operating system bootup by performing the following operations: Downloads the required files (kernel, flattened device tree, init ramdisk) from the specified media to RAM. Sets the bootargs variable with the boot command line required for the operating system. Boots the system. Syntax => help dboot dboot - Digi modules boot command Usage: dboot <os> [source] [extra-args...] Description: Boots <os> via <source> Arguments: - os: a partition name or one of the reserved names: linux android - [source]: tftp nfs mmc - [extra-args]: extra arguments depending on 'source' source=tftp nfs -> [filename] - filename: file to transfer (if not provided, filename will will be taken from variable '<partition>_file') source=mmc -> [device:part] [filesystem] [filename] - device:part: number of device and partition - filesystem: fat (default) ext4 - filename: file to transfer (if not provided, filename will will be taken from variable '<partition>_file') Examples Boot Linux from TFTP using kernel image uimage-test: => dboot linux tftp uimage-test Boot Android from FAT partition 1 on emmc (kernel image name taken by default from variable $uimage): => dboot android mmc The behavior of the dboot command is highly customizable through its parameters and also using the following environment variables: Addresses $loadaddr: this is the RAM address where the kernel image is downloaded to. $fdt_addr: this is the RAM address where the flattened device tree image is downloaded to. $initrd_addr: this is the RAM address where the init ram disk image is downloaded to. ConnectCore 6 Reference Manual 7

Digi custom commands Direct boot: dboot Image file names $uimage: this is the kernel image filename $fdt_file: this is the flattened device tree image filename $initrd_file: this is the init ramdisk image filename Modifiers $boot_fdt: can be set to: yes: flattened device tree is required. If it cannot be downloaded dboot command will fail. try: dboot will try to load a flattened device tree file but will continue to boot the kernel without it if not available. no: flattened device tree not required. dboot will not try to download it. $boot_initrd: can be set to: yes: init ramdisk is required. If it cannot be downloaded dboot command will fail. try: dboot will try to load an init ramdisk file but will continue to boot the kernel without it if not available. no: init ramdisk not required. dboot will not try to download it. $ip_dyn: can be set to yes: will append 'ip=dhcp' to the kernel $booargs when booting for fetching dynamic address when booting from TFTP/NFS. no: will append 'ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}' to the kernel $booargs for using the static IP address configured in U-Boot, when booting from TFTP/NFS. Source media $mmcdev: this is the default device index when reading files from the MMC (when no device index is passed as parameter). $mmcpart: this is the default partition index when reading files from the MMC (when no partition index is passed as parameter). Boot arguments $bootargs_android: contains common Android boot arguments (independent of the media where Android is booting from). $bootargs_mmc_android: script that sets the bootargs variable with Android boot arguments when booting from the MMC. $bootargs_tftp_android/$bootargs_nfs_android: script that sets the bootargs variable with Android boot arguments when booting from TFTP and NFS. $bootargs_mmc_linux: script that sets the bootargs variable with Linux boot arguments when booting from the MMC. ConnectCore 6 Reference Manual 8

Digi custom commands Firmware update: update $bootargs_tftp_linux/$bootargs_nfs_linux: script that sets the bootargs variable with Linux boot arguments when booting from TFTP and NFS. $rootpath: this is the NFS root path to use in the bootargs when booting from TFTP/NFS. $mmcroot: this is the root path to use in the bootargs when booting from MMC. $video_args: the contents of this variable are appended to the bootargs variable when booting Android OS. The variable is a placeholder for the video arguments to pass to Android OS (Linux OS defines the video via the Device Tree). $bootargs_once: this is a special variable that is appended to the bootargs. It can only be set locally with the equals sign not with setenv command: => bootargs_once="<arguments>" This means the variable is not saved across reboots and will pass boot arguments only once. $extra_bootargs: this variable is a placeholder for appending any customized boot arguments at the end of the cmdline. Firmware update: update The update command simplifies the task of updating a partition of the storage media by performing the following operations: Download the required firmware image files from the specified media to RAM. Retrieve and check information (offset, size) of the partition to update. Write the firmware image to the partition. Read back and verify the written firmware image. The syntax of the update command is: => help update update - Digi modules update command Usage: update <partition> [source] [extra-args...] Description: updates (raw writes) <partition> in $mmcdev via <source> Arguments: - partition: a partition index, a GUID partition name, or one of the reserved names: uboot - [source]: tftp nfs mmc ram - [extra-args]: extra arguments depending on 'source' source=tftp nfs -> [filename] - filename: file to transfer (if not provided, filename will will be taken from variable '<partition>_file') source=mmc -> [device:part] [filesystem] [filename] - device:part: number of device and partition - filesystem: fat (default) ext4 - filename: file to transfer (if not provided, filename will will be taken from variable '<partition>_file') ConnectCore 6 Reference Manual 9

Digi custom commands Firmware update: update source=ram -> [image_address] [image_size] - image_address: address of image in RAM ($loadaddr if not provided) - image_size: size of image in RAM ($filesize if not provided) Examples Update partition named system with file test.img downloaded from TFTP: => update system tftp test.img Update the boot loader on the emmc of the module using default filename (in variable uboot_ file) that is stored on a FAT partition on the usd card: => update uboot mmc 1:1 fat The behavior of update command is customizable through its parameters and also using the following environment variables: Addresses $loadaddr: this is the RAM address where the firmware image file to use for the update is downloaded to. $verifyaddr: this is the RAM address where the firmware image is read back for verification. Normally, you should not set this variable, and U-Boot automatically sets it to a RAM address halfway through the available RAM, starting at $loadaddr, to maximize the size of firmware that can be transferred to RAM and verified during the update process. Image file names $uboot_file: this is the default image filename to use for updating the boot loader (if no filename is passed as parameter). $<partition-name>_file: a variable of this form will contain the default filename to use for updating the partition of that specific name. E.g. for a partition named system the variable containing the default filename should be called system_file. Source media $mmcdev: this is the default device index when reading files from the MMC (when no device index is passed as parameter). This variable is also used as target MMC device index to write the firmware to. $mmcpart: this is the default partition index when reading files from the MMC (when no partition index is passed as parameter). ConnectCore 6 Reference Manual 10

Digi custom commands Firmware update: update On-the-fly (OTF) update mechanism The standard update command first transfers the file completely from a media into the RAM memory. Then it writes the file from RAM into the MMC partition. Occasionally, the firmware files used to update a certain partition are very large, maybe larger than the available RAM of the platform. In that scenario, we must use a mechanism that transfers the file from the media to RAM in chunks. After transferring one chunk, the chunk is written to the storage media verified, and the RAM memory is reused to transfer the next chunk. We call this mechanism on-the-fly update. The on-the-fly update mechanism can be activated by defining the variable otf-update to yes, and then using the update command normally. For example: => setenv otf-update yes The on-the-fly update mechanism can only work when updating from TFTP source and is only recommended to update very large images. Notice that if there is any problem during the transmission of the file, the partition will be left partially written (as opposed to the standard update where if the transmission fails, the partition remains untouched). For security reasons, the on-the-fly update mechanism is automatically disabled when updating the boot loader. If the variable otf-update is undefined, U-Boot may automatically activate the on-the-fly update mechanism if the size of the partition to be updated is larger than the available RAM to hold the firmware. WARNING! The on-the-fly update mechanism will pause the TFTP transfer while it writes each chunk to the storage media, and will resume it after reading back and verifying the written data, for this reason it may not work with all TFTP servers. Check that your TFTP server has a large enough timeout so that it does not cancel the transfer due to not receiving the client's ACKs in time while the device is writing. Also, disable any mechanism that sends packets without waiting for the client's ACKs (such as anticipation window) that might not work with on-the-fly update mechanism. Update files within partition The updatefile command simplifies the update of files in a partition filesystem. While the standard update command writes raw data to the storage media, the updatefile command uses U-Boot file system support to write files to a formatted partition. Specifically it does the following: Download the required files from the specified media to RAM. Write the file to the storage media partition filesystem. The syntax of the updatefile command is: => help updatefile updatefile - Digi modules updatefile command Usage: updatefile <partition> [source] [extra-args...] Description: updates/writes a file in <partition> in $mmcdev via <source> Arguments: - partition: a partition index or a GUID partition name where to upload the file - [source]: tftp nfs mmc ram ConnectCore 6 Reference Manual 11

Digi custom commands MMC extended CSD register: mmc ecsd - [extra-args]: extra arguments depending on 'source' source=tftp nfs -> [source_file] [targetfile] [target_fs] - source_file: file to transfer - target_file: target filename - target_fs: fat (default) source=mmc -> [device:part] [filesystem] [source_file] [target_file] [target_fs] - device:part: number of device and partition - filesystem: fat (default) ext4 - source_file: file to transfer - target_file: target filename - target_fs: fat (default) source=ram -> [image_address] [image_size] [targetfile] [target_fs] - image_address: address of image in RAM ($loadaddr if not provided) - image_size: size of image in RAM ($filesize if not provided) - target_file: target filename - target_fs: fat (default) Examples: Update file newkernel.bin from TFTP to linux FAT partition: => updatefile linux tftp newkernel.bin Update file newkernel.bin from usd card FAT partition 3 to linux FAT partition and save it with filename my-uimage: => updatefile linux mmc 1:3 fat newkernel.bin my-uimage fat Limitations: Only FAT filesystem is supported Files can be overwritten but cannot be deleted Filesystem support does not check for available space Writing a file on a filesystem that does not have space for it may corrupt the entire filesystem. MMC extended CSD register: mmc ecsd emmc v4.4 specification defines a 512-byte Extended CSD register that contains parameters of the emmc. The mmc command has been extended with subcommand ecsd to access the fields of this register. Available operations are: => help mmc mmc - MMC sub system Usage: mmc read addr blk# cnt mmc write addr blk# cnt mmc erase blk# cnt mmc rescan mmc part - lists available partition on current mmc device mmc dev [dev] [part] - show or set current mmc device [partition] mmc list - ConnectCore 6 Reference Manual 12

Digi custom commands MMC extended CSD register: mmc ecsd lists available devices mmc ecsd dump - dump ECSD values mmc ecsd read offset - read ECSD value at offset mmc ecsd write offset value - write ECSD value at offset ConnectCore 6 Reference Manual 13

emmc partitioning emmc v4.4 specification defines four physical (hardware) partitions: Boot 1 Boot 2 RPMB User Data The size of the Boot and RPMB partitions is fixed in the chip and can be determined by reading information at the Extended CSD register. They are small partitions to hold a boot loader or secure parameters. The main storage is located at the User Data area. ConnectCore 6 emmc partitions are used for the following: Boot 1: holds the U-Boot boot loader. Boot 2: holds the U-Boot environment and its redundant copy. RPMB: not used. User Data: holds the operating system (divided in logical partitions). The User Data area can be partitioned as any standard block device. In U-Boot, the command gpt allows you to write a GUID partition table (GPT) by passing a string with the partition attributes. GPT standard supersedes old MBR partition table allowing to define multiple partitions with names and universal unique identifiers (UUID). There are two scripts (as environment variables) that use the gpt command to partition the internal emmc with a default partition table for Linux or Android operating systems: $partition_mmc_linux $partition_mmc_android You can view the partition table details by printing the contents of each variable with printenv. If you want to modify the number, start offset, or size of the partitions you can edit the values of variables $parts_linux or $parts_android. WARNING! These scripts partition the MMC device pointed to by variable $mmcdev. Never run these commands to partition a bootable microsd card. A Bootable microsd stores U-Boot on sector 2 and the GUID partition table uses the first 34 sectors, overwriting U-Boot and making the microsd card non-bootable. U-Boot in bootable microsd cards can only coexist with a DOS partition table. ConnectCore 6 Reference Manual 14

Environment variables There are several environment variables worth mentioning: Variable Description Flags ethaddr MAC address of the first wired Ethernet interface change-default wlanaddr MAC address of the WLAN interface change-default btaddr MAC address of the Bluetooth interface change-default These variables are protected and will not be overwritten by setenv or env default command (unless manually forced with -f option). On variants with emmc, the MAC addresses are programmed by Digi during manufacturing and saved in the U-Boot environment on the emmc. On variants without emmc, the MAC addresses are not programmed. You should program the MAC addresses of the available interfaces and save the environment on your boot storage media. The printed CC6 label contains the MAC addresses we assign to the unit. => setenv ethaddr 00:40:9D:AA:AA:AA => setenv wlanaddr 00:40:9D:BB:BB:BB => setenv btaddr 00:40:9D:CC:CC:CC => saveenv After saving the environment, you cannot overwrite the MAC addresses using setenv or env default (unless forced with the -f option). The following image shows the CC6 module label with the MAC addresses. ConnectCore 6 Reference Manual 15

One-time programmable (OTP) bits (e-fuses) The ConnectCore 6 has one-time programmable (OTP) bits. Most of the OTP bits have dedicated functionality and some are free to use. U-Boot supports access to the OTP bits through the fuse command. See the CPU Reference Manual for information about the OTP bits. WARNING! Programming the OTP bits is an irreversible operation that could potentially brick your module. Use the fuse command with extreme care. HWID and MAC address OTP words 17 Carrier board version 17 ConnectCore 6 Reference Manual 16

One-time programmable (OTP) bits (e-fuses) HWID and MAC address OTP words HWID and MAC address OTP words Digi saves MAC addresses in U-Boot environment variables (ethaddr, wlanaddr, btaddr). The two OTP words originally meant for the MAC address are reserved for Digi HWID, a unique identifier of the module. Carrier board version Since the ConnectCore 6 is an SMD module, customers can design their own carrier boards. Carrier boards often suffer redesigns and it is useful for the software to be able to determine the version of the carrier board it is running on. This allows the user to have conditional code depending on the board's version (like enabling different GPIOs or using different IOMUX). Digi U-Boot has built-in support to program and query the carrier board version number on the OTP bits. Coding the carrier board version on the OTP bits First, your board's include file should define: #define CONFIG_HAS_CARRIERBOARD_VERSION Second, you must define which OTP bits you will use to code the carrier board version. This is done by defining the following constants on your board's include file: #define CONFIG_CARRIERBOARD_VERSION_BANK #define CONFIG_CARRIERBOARD_VERSION_WORD #define CONFIG_CARRIERBOARD_VERSION_MASK #define CONFIG_CARRIERBOARD_VERSION_OFFSET For the SBC carrier board, Digi uses the lower 4 bits of the OTP General Purpose 1 register (GP1) which corresponds to Bank 4, Word 6 with a mask 0xf (four bits) and an offset of 0 (lower four bits). Not counting the value of 0x0, these four bits allow you to code up to 15 board versions. You can use this layout for your own carrier board or a different one. Querying the carrier board for conditional code ConnectCore 6 module common source code defines function get_carrierboard_version() which can be used to create conditional code basing on the carrier board version, for example: switch (get_carrierboard_version()) { case 1: /* Code for carrier board version 1 */ break; case 2: /* Code for carrier board version 2 */ break; default: /* Code for other (or undefined) carrier board version */ break; } ConnectCore 6 Reference Manual 17

Auto bootscript The bootscript is a script that is automatically executed when the boot loader starts, before U-Boot s default boot command bootcmd. The bootscript allows the user to execute a set of predefined U-Boot commands automatically, before proceeding with normal boot. This is especially useful for production environments and targets which don t have an available serial port for showing the U-Boot monitor. Bootscript process 19 Creating a bootscript 19 ConnectCore 6 Reference Manual 18

Auto bootscript Bootscript process Bootscript process The bootscript works in the following way: 1. U-Boot checks the variable bootscript. If it exists U-Boot tries to download the filename referred by the variable from the TFTP server IP address defined at variable $serverip (by default 192.168.42.1). If the bootscript file is successfully downloaded, it is executed. 2. If any of the commands in the bootscript fails, the rest of the script is cancelled. 3. When the bootscript has been fully executed (or cancelled) U-Boot continues normal execution. To cancel the automatic bootscript download, erase the $bootscript variable by setting it to nothing: => setenv bootscript => saveenv WARNING! On the ConnectCore 6, the variable bootscript is undefined by default. For more information, please refer to the PHY autonegotiation delay section. Creating a bootscript To create a bootscript file create a plain text file with the sequence of U-Boot commands. It is recommended that the last command erases the variable bootscript to avoid the bootscript from executing a second time. For example, create a file called myscript.txt with the following contents: setenv company digi setenv bootdelay 1 printenv company setenv bootscript saveenv This script creates a new variable called company with value digi and sets the bootdelay to one second. Finally it erases the variable bootscript so that U-Boot doesn t try to execute the bootscript in the future, and saves the changes. 1. Execute the mkimage tool (provided with U-Boot in the tools subdirectory) with the file above as input file. Syntax is: mkimage -A arm -T script -n "Bootscript" -C none -d <input_file> <output_file> The name of the output file must be in the form <platformname>-boot.scr, where <platformname> must be replaced with your target s platform name. For example, to create the bootscript from the text file above and for a ConnectCore 6 SBC platform, go to the U-Boot directory and execute: tools/mkimage -A arm -T script -n "Bootscript" -C none -d myscript.txt ccimx6sbc-boot.scr ConnectCore 6 Reference Manual 19

Updating the boot loader It is possible to update the boot loader in the storage media using the update command. For example, to update from TFTP using the default filename (in variable uboot_file): => update uboot tftp WARNING! Writing an invalid boot loader file may lead to the target not booting. Digi will release U-Boot updates from time to time to fix problems or add new functionality. Much of the custom functionality added to U-Boot depends on environment variables and scripts that may have new values in newly released versions. Generally, after upgrading U-Boot, it is recommended to reset the environment to its defaults using the following command. => env default -a This will reset the whole environment, with the exception of protected variables (like the MAC addresses). After resetting the environment, you may need to adjust your manufacturing or boot scripts to accommodate to changes in the default environment, like new or modified scripts, variables and default filenames ConnectCore 6 Reference Manual 20

Recovering a bricked device If for any reason the bootloader has been erased from the storage media (or written with an invalid image) and the target does not boot, we can boot the target from an alternative source, like the usd card. The ConnectCore 6 Getting Started Guide documentation (available on http://www.digi.com/products/wireless-wired-embedded-solutions/solutions-onmodule/connectcore/connectcore-imx6#docs) contains instructions to create a full bootable usd card with a complete Linux or Android operating system. The following chapter will only show you how to create a bootable usd card if you have a U- Boot boot loader binary image file (for example: u-bootccimx6sbc.imx). Note The ROM loader of the CPU expects to find U-Boot on sector 2 of the block device (offset of 1024 bytes). Create a bootable microsd card from a U-Boot image 22 ConnectCore 6 Reference Manual 21

Recovering a bricked device Create a bootable microsd card from a U-Boot image Create a bootable microsd card from a U-Boot image You might need root/administrator permissions. WARNING! The following procedure will destroy existing data in the usd card. Using Linux 1. Insert the usd card to your computer and check the node Linux assigns to it (/dev/[sdcard]) using dmesg: dmesg [1413652.901270] sd 41:0:0:0: [sdc] 7744512 512-byte logical blocks: (3.96 GB/3.69 GiB) [1413652.903140] sd 41:0:0:0: [sdc] No Caching mode page present [1413652.903144] sd 41:0:0:0: [sdc] Assuming drive cache: write through [1413652.905638] sd 41:0:0:0: [sdc] No Caching mode page present [1413652.905642] sd 41:0:0:0: [sdc] Assuming drive cache: write through [1413652.915154] sdc: sdc1 2. Do not mount any partitions the card might contain (or unmount any partition if automatically mounted) as you will be writing to the entire block device. 3. Write the U-Boot image file to the usd card with this command: where sudo dd if=[path/filename.imx] of=/dev/[sdcard] bs=512 seek=2 oflag=sync [path/filename.imx] must be substituted with the path and filename to the U-Boot image. /dev/[sdcard] must be substituted with the device node assigned by Linux to your usd card. WARNING! An incorrect device node here might destroy all data on your computer hard drive). The usd card is now ready. Using Windows 1. Download and uncompress the dd application for Windows from www.chrysocome.net/dd 2. Open a Command Prompt console in Windows. 3. Insert the usd card to your computer. ConnectCore 6 Reference Manual 22

Recovering a bricked device Create a bootable microsd card from a U-Boot image 4. Change to the directory where the dd application was uncompressed and run it to list the available drives and identify the device node assigned to your SD card (follow the dd documentation on the web page): dd --list 5. Copy the U-Boot image file to the same directory where the dd program is. 6. Write the U-Boot image file to the usd card with this command: dd if=[filename.imx] \\.\Volume{UUID}\ bs=512 seek=2 where [filename.imx] must be substituted with the filename of the U-Boot binary image. UUID must be substituted by the identifier given by Windows to the usd card on the --list command. The usd card is now ready. ConnectCore 6 Reference Manual 23

Recovering a bricked device Create a bootable microsd card from a U-Boot image Boot from a usd card 1. Insert the usd card on the usd card holder. 2. Change the boot source configuration to boot from the usd card: a. If using an SBC version1 (30014752-01), set the boot source jumpers: J4: open, J5: closed. b. If using an SBC version2 (30014752-02), set the boot source microswitches: SW3.1: OFF, SW3.2: ON. 3. Power up the board. When booted from usd card, U-Boot reads/writes the environment from the usd card as well, at an offset of 0x1C0000 bytes. WARNING! Such a microsd can hold a DOS partition table but not a GPT partition table. The first partition should start at an offset of 2MiB minimum, to avoid overwriting U-Boot or its environment. ConnectCore 6 Reference Manual 24

Known issues PHY autonegotiation delay 26 ConnectCore 6 Reference Manual 25

Known issues PHY autonegotiation delay PHY autonegotiation delay The Micrel PHY KSZ9031 on the SBC carrier board may take between 5 and 6 seconds to autonegotiate with Gigabit switches. To avoid this long delay during boot, the variable bootscript is undefined by default and the auto bootscript feature does not run. To speed up the PHY's autonegotiation, you can: Use a 10/100 switch (not Gigabit). Force the Micrel PHY to work as master during master/slave negotiation by setting variable phy_mode to master. ConnectCore 6 Reference Manual 26