The latest development version of this page may be more current than this released 1.14.0 version.

UP Squared

Overview

UP² (UP Squared) is an ultra compact single board computer with high performance and low power consumption. It features the latest Intel® Apollo Lake Celeron™ and Pentium™ Processors with only 4W of Scenario Design Power and a powerful and flexible Intel® FPGA Altera MAX 10 onboard.

UP Squared

Up Squared (Credit: https://up-board.org)

This board configuration enables kernel support for the UP Squared board, along with the following devices:

  • High Precision Event Timer (HPET)
  • Serial Ports in Polling and Interrupt Driven Modes
  • GPIO
  • I2C

Note

This board configuration works on all three variants of UP Squared boards containing Intel® Pentium™ SoC, Intel® Celeron™ SoC, or Intel® Atom™ SoC.

Note

This board configuration works only with the default BIOS settings. Enabling/disabling LPSS devices in BIOS (under Advanced -> HAT Configurations) will change the MMIO addresses of these devices, and will prevent the drivers from communicating with these devices. For drivers that support PCI enumeration, CONFIG_PCI and CONFIG_PCI_ENUMERATION will allow these drivers to probe for the correct MMIO addresses.

Hardware

General information about the board can be found at the UP Squared website.

Supported Features

This board supports the following hardware features:

  • HPET
  • Advanced Programmed Interrupt Controller (APIC)
  • Serial Ports in Polling and Interrupt Driven Modes
  • GPIO
  • I2C
Interface Controller Driver/Component PCI Enumeration
HPET on-chip system clock Not Supported
APIC on-chip interrupt controller Not Supported
UART on-chip serial port-polling; serial port-interrupt Supported
GPIO on-chip GPIO controller Not Supported
I2C on-chip I2C controller Supported

The Zephyr kernel currently does not support other hardware features.

Serial Port Polling Mode Support

The polling mode serial port allows debug output to be printed.

Serial Port Interrupt Mode Support

The interrupt mode serial port provides general serial communication and external communication.

Interrupt Controller

This board uses the kernel’s static Interrupt Descriptor Table (IDT) to program the Advanced Programmable Interrupt Controller (APIC) interrupt redirection table.

IRQ Remarks Used by Zephyr Kernel
2 HPET timer driver
4 UART_0 serial port when used in interrupt mode
5 UART_1 serial port when used in interrupt mode
14 GPIO GPIO APL driver
27 I2C_0 I2C DW driver
28 I2C_1 I2C DW driver
29 I2C_2 I2C DW driver
30 I2C_3 I2C DW driver
31 I2C_4 I2C DW driver
32 I2C_5 I2C DW driver
33 I2C_6 I2C DW driver
34 I2C_7 I2C DW driver

HPET System Clock Support

The SoC uses HPET timing with legacy-free timer support. The board configuration uses HPET as a system clock timer.

GPIO

GPIOs are exposed through the HAT header, and can be referred using predefined macros such as UP2_HAT_PIN3. The physical pins are connected to the on-board FPGA acting as level shifter. Therefore, to actually utilize these GPIO pins, the function of the pins and directions (input/output) must be set in the BIOS. This can be accomplished in BIOS, under menu Advanced, and option HAT Configurations. When a corresponding pin is set to act as GPIO, there is an option to set the direction of the pin. This needs to be set accordingly for the GPIO to function properly.

Connections and IOs

Refer to the UP Squared website and UP Squared Pinout website for connection diagrams.

Memory Mappings

This board configuration uses default hardware memory map addresses and sizes.

Programming and Debugging

Use the following procedures for booting an image on a UP Squared board.

Creating a GRUB2 Boot Loader Image from a Linux Host

If you are having problems running an application using the preinstalled copy of GRUB, follow these steps to test on supported boards using a custom GRUB.

  1. Install the requirements to build GRUB on your host machine.

    On Ubuntu, type:

    $ sudo apt-get install bison autoconf libopts25-dev flex automake \
    pkg-config gettext autopoint
    

    On Fedora, type:

    $ sudo dnf install gnu-efi bison m4 autoconf help2man flex \
    automake texinfo gettext-devel
    
  2. Clone and build the GRUB repository using the script in Zephyr tree, type:

    $ cd $ZEPHYR_BASE
    $ ./boards/x86/common/scripts/build_grub.sh x86_64
    
  3. Find the binary at $ZEPHYR_BASE/boards/x86/common/scripts/grub/bin/grub_x86_64.efi.

Build Zephyr application

  1. Build a Zephyr application; for instance, to build the hello_world application on UP Squared:

    Using west:

    west build -b up_squared samples/hello_world
    

    Using CMake and ninja:

    # On Linux/macOS
    cd $ZEPHYR_BASE/samples/hello_world
    mkdir build && cd build
    
    # On Windows
    cd %ZEPHYR_BASE%\samples\hello_world
    mkdir build & cd build
    
    # Use cmake to configure a Ninja-based build system:
    cmake -GNinja -DBOARD=up_squared ..
    
    # Now run ninja on the generated build system:
    ninja
    

    Note

    A stripped project image file named zephyr.strip is automatically created in the build directory after the application is built. This image has removed debug information from the zephyr.elf file.

Preparing the Boot Device

Prepare a USB flash drive to boot the Zephyr application image on a UP Squared board.

  1. Refer to the UP Squared Serial Console Wiki page for instructions on how to connect for serial console.

  2. Format the USB flash drive as FAT32.

    On Windows, open File Explorer, and right-click on the USB flash drive. Select Format.... Make sure in File System, FAT32 is selected. Click on the Format button and wait for it to finish.

    On Linux, graphical utilities such as gparted can be used to format the USB flash drive as FAT32. Alternatively, under terminal, find out the corresponding device node for the USB flash drive (for example, /dev/sdd). Execute the following command:

    $ mkfs.vfat -F 32 <device-node>
    

    Important

    Make sure the device node is the actual device node for the USB flash drive. Or else you may erase other storage devices on your system, and will render the system unusable afterwards.

  3. Create the following directories

    efi

    efi/boot

    kernel

  4. Copy the kernel file zephyr/zephyr.strip to the $USB/kernel folder.

  5. Copy your built version of GRUB to $USB/efi/boot/bootx64.efi

  6. Create $USB/efi/boot/grub.cfg containing the following:

    set default=0
    set timeout=10
    
    menuentry "Zephyr Kernel" {
       multiboot /kernel/zephyr.strip
    }
    

Booting the UP Squared Board

Boot the UP Squared board from the boot device using GRUB2 via USB flash drive.

  1. Insert the prepared boot device (USB flash drive) into the UP Squared board.

  2. Connect the board to the host system using the serial cable and configure your host system to watch for serial data. See https://wiki.up-community.org/Serial_console.

    Note

    On Windows, PuTTY has an option to set up configuration for serial data. Use a baud rate of 115200.

  3. Power on the UP Squared board.

  4. When the following output appears, press F7:

    Press <DEL> or <ESC> to enter setup.
    
  5. From the menu that appears, select the menu entry that describes that particular type of USB flash drive.

    GRUB2 starts and a menu shows entries for the items you added to the file grub.cfg.

  6. Select the image you want to boot and press Enter.

    When the boot process completes, you have finished booting the Zephyr application image.

    Note

    You can safely ignore this message if it appears:

    WARNING: no console will be available to OS
    

Booting the UP Squared Board over network

Build Zephyr image

  1. Follow Build Zephyr application steps to build Zephyr image.

Prepare Linux host

  1. Follow Creating a GRUB2 Boot Loader Image from a Linux Host steps to create grub binary.

  2. Install DHCP, TFTP servers. For example dnsmasq

    $ sudo apt-get install dnsmasq
    
  3. Configure DHCP server. Configuration for dnsmasq is below:

    # Only listen to this interface
    interface=eno2
    dhcp-range=10.1.1.20,10.1.1.30,12h
    
  4. Configure TFTP server.

    # tftp
    enable-tftp
    tftp-root=/srv/tftp
    dhcp-boot=grub_x86_64.efi
    

    grub_x86_64.efi is a grub binary created above.

  5. Create the following directories inside TFTP root /srv/tftp

    $ sudo mkdir -p /srv/tftp/EFI/BOOT
    $ sudo mkdir -p /srv/tftp/kernel
    
  6. Copy the Zephyr image zephyr/zephyr.strip to the /srv/tftp/kernel folder.

    $ sudo cp zephyr/zephyr.strip /srv/tftp/kernel
    
  7. Copy your built version of GRUB to /srv/tftp/grub_x86_64.efi

  8. Create /srv/tftp/EFI/BOOT/grub.cfg containing the following:

    set default=0
    set timeout=10
    
    menuentry "Zephyr Kernel" {
       multiboot /kernel/zephyr.strip
    }
    
  9. TFTP root should be looking like:

    $ tree /srv/tftp
    /srv/tftp
    ├── EFI
    │   └── BOOT
    │       └── grub.cfg
    ├── grub_x86_64.efi
    └── kernel
        └── zephyr.strip
    
  10. Restart dnsmasq service:

    $ sudo systemctl restart dnsmasq.service
    

Prepare UP Squared board for network boot

  1. Enable PXE network from BIOS settings.

    Advanced -> Network Stack Configuration -> Enable Network Stack -> Enable Ipv4 PXE Support
    
  2. Make network boot as the first boot option.

    Boot -> Boot Option #1 : [Network]
    

Booting UP Squared

  1. Connect the board to the host system using the serial cable and configure your host system to watch for serial data. See https://wiki.up-community.org/Serial_console.

  2. Power on the UP Squared board.

  3. Verify that the board got an IP address:

    $ journalctl -f -u dnsmasq
    dnsmasq-dhcp[5386]: DHCPDISCOVER(eno2) 00:07:32:52:25:88
    dnsmasq-dhcp[5386]: DHCPOFFER(eno2) 10.1.1.28 00:07:32:52:25:88
    dnsmasq-dhcp[5386]: DHCPREQUEST(eno2) 10.1.1.28 00:07:32:52:25:88
    dnsmasq-dhcp[5386]: DHCPACK(eno2) 10.1.1.28 00:07:32:52:25:88
    
  4. Verify that network booting is started:

    $ journalctl -f -u dnsmasq
    dnsmasq-tftp[5386]: sent /srv/tftp/grub_x86_64.efi to 10.1.1.28
    dnsmasq-tftp[5386]: sent /srv/tftp/EFI/BOOT/grub.cfg to 10.1.1.28
    dnsmasq-tftp[5386]: sent /srv/tftp/kernel/zephyr.strip to 10.1.1.28
    
  5. When the boot process completes, you have finished booting the Zephyr application image.