Running Linux on i.MX RT1170 in 5 Minutes Print

 

Hardware Setup

Prepare hardware as described below:

  1. Connect the microUSB cable to the J11 connector on the MIMXRT1170-EVK board and the development host to provide the serial console access, which is required to run Linux (uClinux) on the i.MX RT11700. The serial console operates in U-Boot and uCLinux with the following parameters:
    • Baud rate - 115200
    • Data bits - 8
    • Stop bits - 1
    • Parity - none
  2. Connect Ethernet cable to the J1 connector on the MIMXRT1170-EVK board.
  3. The MicroUSB SD Card used to boot the system on the MIMXRT1170-EVK board.
    Since U‑Boot (SPL+TPL) + U‑Boot environment are located at the 0x400..0x100000 range of the raw SD Card address-space, the SD Card must be partitioned properly, so that U‑Boot does not overwrite the file system on the partition. The SD Card must contain at least one partition started at a at least 1MB raw offset. The partition must be FATFS-formatted. Usually, a new SD Card satisfies these requirements by default so most likely no special preparations are required unless the card has been reformatted in some other way in other projects.

Installing Linux to NXP i.MX RT1170 EVK Board

  1. Download the bootable U‑Boot and Linux images from the Emcraft web site:

    where SPL is the U‑Boot SPL prebuilt image; u-boot.img is the U‑Boot TPL prebuilt image; rootfs.uImage is the prebuilt rootfs project image.
  2. Plug in the MicroSD card to the cross-development host.
  3. Find out a /dev/sdX device the system has assigned to your SD Card:
  4. $ dmesg | tail [ 456.470775] usbcore: registered new interface driver usb-storage [ 456.482079] usbcore: registered new interface driver uas [ 457.501716] scsi 3:0:0:0: Direct-Access Generic STORAGE DEVICE 0821 PQ: 0 ANSI: 6 [ 457.508132] sd 3:0:0:0: Attached scsi generic sg2 type 0 [ 457.715113] sd 3:0:0:0: [sdb] 15446016 512-byte logical blocks: (7.91 GB/7.37 GiB) [ 457.733992] sd 3:0:0:0: [sdb] Write Protect is off [ 457.733999] sd 3:0:0:0: [sdb] Mode Sense: 23 00 00 00 [ 457.753808] sd 3:0:0:0: [sdb] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA [ 457.840489] sdb: sdb1 [ 457.840845] sd 3:0:0:0: [sdb] Attached SCSI removable disk

  5. Install U‑Boot to the microSD card:
  6. $ sudo dd if=SPL of=/dev/sdX bs=1k seek=1 conv=notrunc; sync $ sudo dd if=u-boot.img of=/dev/sdb bs=1k seek=128 conv=notrunc; sync

  7. Install the rootfs project to the microSD card:
  8. $ sudo mount /dev/sdX /mnt $ cp roofts.uImage /mnt

  9. Set Boot SW1 as 0010 and SW2.7, insert the micro SD card in the board and power the board. The system should boot up on the board:
  10. U-Boot SPL 2023.04 (Sep 01 2023 - 07:35:13 +0000) Trying to boot from MMC1 U-Boot 2023.04 (Sep 01 2023 - 07:35:13 +0000) Model: NXP imxrt1170-evk board DRAM: 960 KiB (effective 64.9 MiB) Core: 72 devices, 15 uclasses, devicetree: separate MMC: FSL_SDHC: 0 Loading Environment from MMC... OK In: serial@4007c000 Out: serial@4007c000 Err: serial@4007c000 Net: eth0: ethernet@40424000 Hit any key to stop autoboot: 0 8481682 bytes read in 754 ms (10.7 MiB/s) ## Booting kernel from Legacy Image at 80007fc0 ... Image Name: Linux-6.1.22 Image Type: ARM Linux Multi-File Image (uncompressed) Data Size: 8481618 Bytes = 8.1 MiB Load Address: 80008000 Entry Point: 80008001 Contents: Image 0: 8472032 Bytes = 8.1 MiB Image 1: 9574 Bytes = 9.3 KiB Verifying Checksum ... OK ## Flattened Device Tree from multi component Image at 80007FC0 Booting using the fdt at 0x8081c5ec Working FDT set to 8081c5ec Loading Multi-File Image Loading Device Tree to 2032a000, end 2032f565 ... OK Working FDT set to 2032a000 Starting kernel ... Booting Linux on physical CPU 0x0 Linux version 6.1.22 (sasha@workbench.emcraft.com) (arm-none-eabi-gcc (GNU Arm Embedded Toolchain 10.3-2021.10) 10.3.1 20210824 (release), GNU ld (GNU Arm Embedded Toolchain 10.3-2021.10) 2.36.1.20210621) #2 Fri Sep 1 07:28:26 UTC 2023 CPU: ARMv7-M [411fc272] revision 2 (ARMv7M), cr=00000000 CPU: PIPT / VIPT nonaliasing data cache, PIPT instruction cache OF: fdt: Machine model: NXP IMXRT1170 EVK board ..... NET: Registered PF_NETLINK/PF_ROUTE protocol family imxrt1170-pinctrl 400e8000.iomuxc: initialized IMX pinctrl driver imxrt1170-pinctrl 40c08000.iomuxc_lpsr: initialized IMX pinctrl driver imxrt1170-pinctrl 40c94000.iomuxc_snvs: initialized IMX pinctrl driver SCSI subsystem initialized usbcore: registered new interface driver usbfs usbcore: registered new interface driver hub usbcore: registered new device driver usb pps_core: LinuxPPS API ver. 1 registered pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it> PTP clock support registered Bluetooth: Core ver 2.22 NET: Registered PF_BLUETOOTH protocol family Bluetooth: HCI device and connection manager initialized Bluetooth: HCI socket layer initialized Bluetooth: L2CAP socket layer initialized Bluetooth: SCO socket layer initialized clocksource: Switched to clocksource mxc_timer1 NET: Registered PF_INET protocol family ..... usbcore: registered new interface driver btusb sdhci: Secure Digital Host Controller Interface driver sdhci: Copyright(c) Pierre Ossman sdhci-pltfm: SDHCI platform and OF driver helper usbcore: registered new interface driver usbhid usbhid: USB HID core driver NET: Registered PF_PACKET protocol family mmc0 bounce up to 128 segments into one, max segment size 65536 bytes Bluetooth: RFCOMM TTY layer initialized Bluetooth: RFCOMM socket layer initialized Bluetooth: RFCOMM ver 1.11 ARMv7-M VFP coprocessor found VFP: Double precision floating points are supported Loading compiled-in X.509 certificates mmc0: SDHCI controller on 40418000.usdhc [40418000.usdhc] using DMA input: gpio-keys as /devices/platform/gpio-keys/input/input0 cfg80211: Loading compiled-in X.509 certificates for regulatory database cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7' platform regulatory.0: Direct firmware load for regulatory.db failed with error -2 cfg80211: failed to load regulatory.db Freeing unused kernel image (initmem) memory: 3548K This architecture does not have kernel memory protection. Run /init as init process [72] Jan 01 00:00:01 Running in background / # mmc0: host does not support reading read-only switch, assuming write-enable mmc0: new high speed SDHC card at address 59b4 mmcblk0: mmc0:59b4 USD 7.39 GiB mmcblk0: p1 Micrel KSZ8081 or KSZ8091 40424000.ethernet-1:02: attached PHY driver (mii_bus:phy_addr=40424000.ethernet-1:02, irq=POLL) route: ioctl 0x890b failed: Network is unreachable fec 40424000.ethernet eth0: Link is Up - 100Mbps/Full - flow control off / #

Ethernet Driver Support

  1. Power cycle the board. While U‑Boot is coming up, press any key on the serial console to enter the U‑Boot command line interface:
  2. U-Boot SPL 2023.04 (Sep 01 2023 - 07:35:13 +0000) Trying to boot from MMC1 U-Boot 2023.04 (Sep 01 2023 - 07:35:13 +0000) Model: NXP imxrt1170-evk board DRAM: 960 KiB (effective 64.9 MiB) Core: 72 devices, 15 uclasses, devicetree: separate MMC: FSL_SDHC: 0 Loading Environment from MMC... OK In: serial@4007c000 Out: serial@4007c000 Err: serial@4007c000 Net: eth0: ethernet@40424000 Hit any key to stop autoboot: 0 =>

  3. From the U‑Boot command line interface, reset to the default environment:
  4. => env default -a ## Resetting to default environment =>

  5. Set the ipaddr, serverip and netmask U‑Boot environment variables:
  6. => setenv ipaddr 192.168.88.89 => setenv serverip 192.168.88.170 => setenv netmask 255.255.255.0 => setenv gatewayip 192.168.88.1 => saveenv Saving Environment to MMC... Writing to MMC(0)... OK =>

  7. ping the development host from the target board:
  8. => ping 192.168.88.177 Using ethernet@40424000 device host 192.168.88.177 is alive =>

  9. Load rootfs.uImage using the U‑Boot tftp command:
  10. => tftp imxrt1170/rootfs.uImage Using ethernet@40424000 device TFTP from server 192.168.88.170; our IP address is 192.168.88.89 Filename 'imxrt1170/rootfs.uImage'. Load address: 0x80007fc0 Loading: ################################################################# ################################################################# ... ################################################################# ################### 981.4 KiB/s done Bytes transferred = 8481682 (816b92 hex) =>

  11. Reset the board and let it boot up to the Linux shell:
  12. => reset resetting U-Boot SPL 2023.04 (Sep 01 2023 - 09:33:56 +0000) Trying to boot from MMC1 U-Boot 2023.04 (Sep 01 2023 - 09:33:56 +0000) Model: NXP imxrt1170-evk board DRAM: 960 KiB (effective 64.9 MiB) ..... Starting kernel ... Booting Linux on physical CPU 0x0 Linux version 6.1.22 (sasha@workbench.emcraft.com) (arm-none-eabi-gcc (GNU Arm Embedded Toolchain 10.3-2021.10) 10.3.1 20210824 (release), GNU ld (GNU Arm Embedded Toolchain 10.3-2021.10) 2.36.1.20210621) #2 Fri Sep 1 07:28:26 UTC 2023 CPU: ARMv7-M [411fc272] revision 2 (ARMv7M), cr=00000000 CPU: PIPT / VIPT nonaliasing data cache, PIPT instruction cache OF: fdt: Machine model: NXP IMXRT1170 EVK board Reserved memory: created DMA memory pool at 0x83f00000, size 1 MiB ..... Run /init as init process [72] Jan 01 00:00:01 Running in background / # mmc0: host does not support reading read-only switch, assuming write-enable mmc0: new high speed SDHC card at address 59b4 mmcblk0: mmc0:59b4 USD 7.39 GiB mmcblk0: p1 Micrel KSZ8081 or KSZ8091 40424000.ethernet-1:02: attached PHY driver (mii_bus:phy_addr=40424000.ethernet-1:02, irq=POLL) fec 40424000.ethernet eth0: Link is Up - 100Mbps/Full - flow control off / #

  13. From the development host validate that the target board is visible using ping:
  14. $ ping 192.168.88.89 -c 5 PING 192.168.88.89 (192.168.88.89) 56(84) bytes of data. 64 bytes from 192.168.88.89: icmp_seq=1 ttl=63 time=5.51 ms 64 bytes from 192.168.88.89: icmp_seq=2 ttl=63 time=5.10 ms 64 bytes from 192.168.88.89: icmp_seq=3 ttl=63 time=3.99 ms 64 bytes from 192.168.88.89: icmp_seq=4 ttl=63 time=10.8 ms 64 bytes from 192.168.88.89: icmp_seq=5 ttl=63 time=7.08 ms --- 192.168.88.89 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4005ms rtt min/avg/max/mdev = 3.986/6.488/10.773/2.360 ms $

  15. From the target board, validate that the development host is visible using ping:
  16. / # ping 192.168.88.177 -c 5 PING 192.168.88.177 (192.168.88.177): 56 data bytes 64 bytes from 192.168.88.177: seq=0 ttl=64 time=7.008 ms 64 bytes from 192.168.88.177: seq=1 ttl=64 time=2.689 ms 64 bytes from 192.168.88.177: seq=2 ttl=64 time=2.272 ms 64 bytes from 192.168.88.177: seq=3 ttl=64 time=1.539 ms 64 bytes from 192.168.88.177: seq=4 ttl=64 time=2.068 ms --- 192.168.88.177 ping statistics --- 5 packets transmitted, 5 packets received, 0% packet loss round-trip min/avg/max = 1.539/3.115/7.008 ms / #

TCP/IP Stack Support

With uClinux running on the i.MX RT1170, you get the full Linux TCP/IP stack TCP/IP stack (kernel version 6.1.22). Userspace POSIX APIs are provided by the uClibc library. Key user-space networking tools and utilities are available from the multi-call busybox. Additional tools and packages, such as for instance the SSH dropbear server, can be built specifically for uClinux. All in all, you have the powerful Linux TCP/IP stack at your disposal.

  1. From the development host validate that the i.MX RT1170 is visible using ping:
  2. $ ping 192.168.88.89 -c 5 PING 192.168.88.89 (192.168.88.89) 56(84) bytes of data. 64 bytes from 192.168.88.89: icmp_seq=1 ttl=63 time=5.51 ms 64 bytes from 192.168.88.89: icmp_seq=2 ttl=63 time=5.10 ms 64 bytes from 192.168.88.89: icmp_seq=3 ttl=63 time=3.99 ms 64 bytes from 192.168.88.89: icmp_seq=4 ttl=63 time=10.8 ms 64 bytes from 192.168.88.89: icmp_seq=5 ttl=63 time=7.08 ms --- 192.168.88.89 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4005ms rtt min/avg/max/mdev = 3.986/6.488/10.773/2.360 ms $

  3. ping the development host from the i.MX RT1170:
  4. / # ping -c5 192.168.88.177 PING 192.168.88.177 (192.168.88.177): 56 data bytes 64 bytes from 192.168.88.177: seq=0 ttl=64 time=2.310 ms 64 bytes from 192.168.88.177: seq=1 ttl=64 time=4.518 ms 64 bytes from 192.168.88.177: seq=2 ttl=64 time=2.256 ms 64 bytes from 192.168.88.177: seq=3 ttl=64 time=3.548 ms 64 bytes from 192.168.88.177: seq=4 ttl=64 time=2.508 ms --- 192.168.88.177 ping statistics --- 5 packets transmitted, 5 packets received, 0% packet loss round-trip min/avg/max = 2.256/3.028/4.518 ms / #

  5. On the target, start the telnetd daemon to allow connections to the i.MX RT1170:
  6. / # ps | grep telnetd 99 root 848 S telnetd 101 root 848 S grep telnetd

  7. Connect to the target from the development host using telnet. The target is configured to accept the 123 password for root:
  8. $ telnet 192.168.88.89 Trying 192.168.88.89... Connected to 192.168.88.89. Escape character is '^]'. (none) login: root Password: / # ls bin hello.ko lib proc sys var dev httpd linuxrc root tmp etc init mnt sbin usr / # exit Connection closed by foreign host. $

  9. The dropbear SSH daemon starts automatically on the target. Verify that dropbear allows secure connections to the target:
  10. / # ps | grep dropbear 70 root 416 S dropbear -R 98 root 388 S grep dropbear

  11. Connect to the target from the development host using ssh. The first connection takes several seconds to establish as the i.MX RT1170 runs computation-extensive key calculations. Again, enter 123 on the password prompt:
  12. $ ssh root@192.168.88.89 root@192.168.88.89's password: / # ls bin hello.ko lib proc sys var dev httpd linuxrc root tmp etc init mnt sbin usr / # exit Connection to 192.168.88.89 closed. $

  13. On the target, enable access to the Internet by configuring a default gateway. Note also that the system makes use of the public name server provided by Google:
  14. / # route add default gw 192.168.88.1 / # cat /etc/resolv.conf # This configuration makes use of the Google public DNS server. # If you would like to use something else, replace with the IP # of your DNS server nameserver 8.8.8.8 / #

  15. Use ntpd to synchronize the time on the target with the time provided by a public server:
  16. / # date Thu Jan 1 00:32:53 UTC 1970 / # ntpd -p 0.fedora.pool.ntp.org / # sleep 5 / # date Thu Jan 1 00:11:00 UTC 1970 / # ntpd -p 0.fedora.pool.ntp.org / # sleep 5 / # date Fri Sep 1 10:07:58 UTC 2023 / #

  17. Use wget to download a file from a remote server:
  18. / # wget ftp://ftp.gnu.org/README Connecting to ftp.gnu.org (209.51.188.20:21) saving to 'README' README 100% |********************************| 2748 0:00:00 ETA 'README' saved / # / # cat README This is ftp.gnu.org, the FTP server of the the GNU project. ...

  19. Start the HTTP daemon:
  20. / # httpd -h /httpd/html/
    / #

  21. Mount a directory exported by a development host over NFS:
  22. / # mount -o nolock,rsize=1024 192.168.1.99:/srv/nfs /mnt/nfs / # ls /mnt/nfs/ SimpleClass linux-dp test / # cp /bin/busybox /mnt/nfs / # cp /mnt/nfs/busybox /tmp / # md5sum /bin/busybox /tmp/busybox bb39cf3470150200a35c41bd6f78ef92 /bin/busybox bb39cf3470150200a35c41bd6f78ef92 /tmp/busybox

Support USB Host Stack Interface

  1. Attach a USB Flash device to the USB1 or USB2 connector. Verify that it is automatically detected and can be mounted:
  2. ci_hdrc ci_hdrc.0: EHCI Host Controller ci_hdrc ci_hdrc.0: new USB bus registered, assigned bus number 1 ci_hdrc ci_hdrc.0: USB 2.0 started, EHCI 1.00 hub 1-0:1.0: USB hub found hub 1-0:1.0: 1 port detected usb 1-1: new high-speed USB device number 2 using ci_hdrc usb-storage 1-1:1.0: USB Mass Storage device detected scsi host0: usb-storage 1-1:1.0 scsi 0:0:0:0: Direct-Access Generic Flash Disk 8.07 PQ: 0 ANSI: 2 sd 0:0:0:0: [sda] 8228864 512-byte logical blocks: (4.21 GB/3.92 GiB) sd 0:0:0:0: [sda] Write Protect is off sd 0:0:0:0: [sda] No Caching mode page found sd 0:0:0:0: [sda] Assuming drive cache: write through sda: sda1 sd 0:0:0:0: [sda] Attached SCSI removable disk / # mount /dev/sda1 /mnt/usbflash/ / # ls -la /mnt/usbflash/ drwxr-xr-x 3 root root 4096 Jan 1 00:00 . drwxrwxrwx 8 root root 0 Jun 22 2023 .. drwxr-xr-x 2 root root 4096 May 25 2023 System Volume Information -rwxr-xr-x 1 root root 319 Jan 1 1980 data.log / #

  3. Unmount the USB Flash device:
  4. / # umount /mnt/usbflash/ / #

Support Loading / Unloading Kernel Modules

  1. From the Linux shell, load the demo kernel module:
  2. / # insmod hello.ko Hello, world / #

  3. Show the status of the loaded kernel modules:
  4. / # lsmod Module Size Used by Not tainted hello 576 0 / #

  5. Unload the module from the Linux kernel:
  6. / # rmmod hello Goodbye, world / #