AXIOMTEK IFB122 Software User Manual

IFB122
Linux Software User’s Manual
ii
This manual has been carefully checked and believed to contain accurate information. Axiomtek Co., Ltd. assumes no responsibility for any infringements of patents or any third partys rights, and any liability arising from such use.
Axiomtek does not warrant or assume any legal liability or responsibility for the accuracy, completeness or usefulness of any information in this document. Axiomtek does not make any commitment to update the information in this manual.
Axiomtek reserves the right to change or revise this document and/or product at any time without notice.
No part of this document may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior written permission of Axiomtek Co., Ltd.
Trademarks Acknowledgments
Axiomtek is a trademark of Axiomtek Co., Ltd. Windows® is a trademark of Microsoft Corporation.
Other brand names and trademarks are the properties and registered brands of their respective owners.
Copyright 2017 Axiomtek Co., Ltd.
All Rights Reserved December 2017, Version A3 Printed in Taiwan
iii
Table of Contents
Disclaimers ..................................................................................................... ii
Chapter 1 Introduction ................................................ 1
1.1 Specifications ...................................................................................... 2
Chapter 2 Getting Started ........................................... 5
2.1 Connecting the IFB122 ....................................................................... 5
2.1.1 Serial Console ............................................................................................. 7
2.1.2 SSH over Ethernet ...................................................................................... 9
2.2 How to Develop a Sample Program ................................ ................. 11
2.2.1 Install Yocto Toolchain ................................................................................ 11
2.2.2 Setting Up the Cross-Development Environment ..................................... 13
2.2.3 Write and Compile Sample Program ......................................................... 13
2.3 How to Put and Run a Sample Program .......................................... 14
2.3.1 Via FTP ..................................................................................................... 14
2.3.2 Via USB Flash Drive .................................................................................. 16
2.3.3 Via TFTP ................................................................................................... 17
2.4 How to Recovery System ................................................................. 18
2.4.1 Via run_rescue System Script (under Linux System) ............................... 18
2.4.2 Via rescue.scr Script (under u-boot) ......................................................... 18
2.5 How to Update System ..................................................................... 19
2.5.1 Via USB Flash Drive .................................................................................. 19
2.6 How to use MFG tool to download image ....................................... 22
Chapter 3 The Embedded Linux ................................ 25
3.1 Embedded Linux Image Managing .................................................. 25
3.1.1 System Version ......................................................................................... 25
3.1.2 System Time .............................................................................................. 25
3.1.3 Internal RTC Time ..................................................................................... 25
3.1.4 External RTC Time .................................................................................... 26
3.1.5 Watchdog timer ......................................................................................... 26
3.1.6 Adjusting System Time .............................................................................. 26
3.1.7 LEDs Control ............................................................................................. 27
3.2 Networking ......................................................................................... 27
3.2.1 FTP – File Transfer Protocol ..................................................................... 27
3.2.2 TFTP – Trivial File Transfer Protocol ......................................................... 27
3.2.3 NFS – Network File System ...................................................................... 28
3.2.4 How to use 3G or 4G module (Optional) ................................................... 28
3.2.5 How to use Wi-Fi module (Optional) ......................................................... 32
iv
Chapter 4 Programming Guide .................................. 33
4.1 librsb10x API Functions ................................................................... 33
4.2 Compile Demo Program ................................................................... 41
4.2.1 Install IFB122 I/O Library .......................................................................... 41
4.2.2 Run demo program ................................................................................... 42
Chapter 5 Board Support Package (BSP) .................. 43
5.1 Host Development System Installation ........................................... 43
5.1.1 Install Host System.................................................................................... 43
5.1.2 Install Yocto Development ......................................................................... 44
5.2 U-Boot for IFB122 .............................................................................. 48
5.2.1 Booting the System with an NFS Filesystem ............................................ 48
5.2.2 Booting the System from eMMC (IFB122 default) .................................... 49
5.2.3 Booting the Rescue System from eMMC .................................................. 49
Appendix Frequently Asked Questions ..................... 51
IFB122 Linux Users Manual
Introduction 1
Chapter 1
Introduction
The extreme compact IFB122 supports the low power RISC-based module (i.MX6UL) processor with extended temperature range of -40°C to +70°C for using in wide range operating environments. Multiple built-in serial ports, high-speed LANs and USB 2.0 ports enable fast and efficient data computation, communication and acquisition. Its digital I/O feature provides users with the convenience of digital devices connection. Besides, Its compact size with Din-rail mounting allows for easy installation into control
This user’s manual is for the embedded Linux preinstalled in IFB122. The embedded Linux is derived from Linux Yocto Board Support Package, which is based on Linux Kernel 3.14.52 and our hardware patches to suit IFB122.
Software structure
The preinstalled embedded Linux image is located in eMMC Flash memory which is partitioned and formatted to accommodate boot loader, kernel and root filesystem. It follows standard Linux architecture to allow user to easily develop and deploy application software that follows Portable Operating System Interface (POSIX).
To facilitate user program in monitoring and controlling I/O device such as DIO, Watchdog Timer, the IFB122 includes librsb10x.so shared library.
In addition to ext3 and ext4 file system, this embedded Linux kernel is compiled with support for NFS, including server-side, client-side functionality and Root file system on NFS. Using an NFS root mount we have several advantages such as:
The root file system is not size-restricted by the devices storage like Flash memory. Change made to application files during development is immediately available to the
target device.
For connectivity, this image includes most popular internet protocols, some servers and utilities not only making it easy for downloading/uploading files (Linux kernel, application program) or for debugging, but also communicating to outside world via Ethernet, WiFi and 3G.
For the convenience of manipulating embedded Linux, this image includes lots of popular packages such as busybox, udev, etc.
IFB122 Linux Users Manual
2 Introduction
1.1 Specifications
OS: Linux
Kernel: 3.14.52 (with NXP and Axiomtek hardware modified patch)
Support Protocol Types
ICMP. TCP/IP. UDP, DHCP, Telnet, HTTP, HTTPS, SSL, SMTP, NTP, DNS, PPP, PPPoE, FTP,
TFTP, NFS.
Shell
Bash
Support storage format
FAT32 /FAT/EXT2/EXT3/EXT4
BSP: IFB122-LINUX-bsp
AxTools Image Yocto patches Toolchain
IFB122 Linux Users Manual
Introduction 3
Daemons
Telnetd: Telnet server daemon FTPD: FTP server daemon
Utilities
Telnet: Telnet client program FTP: FTP client program TFTP: Trivial File Transfer Protocol client
Packages
Busybox(1.23.1): Small collection of standard Linux command-line utilities udev: A device manager for Linux kernel dosfstools : Utilities for making and checking MS-DOS FAT file system e2fsprogs: A set of utilities for maintaining the ext2, ext3 and ext4 file systems ethtool: A Linux command for displaying or modifying the Network Interface
Controller (NIC) parameters
i2c-tools : A heterogeneous set of I2C tools for Linux procps : Utilities to report on the state of the system, including the states of running
processes, amount of memory
wireless-tools: A package of Linux commands (simple text-based utilities/tools)
intended to support and facilitate the configuration of wireless devices using the Linux Wireless Extension
Development Environment
Host OS/ development OS: Ubuntu 14.04 LTS 32/64bit
kernel: version: 4.2.0-42
machine running Ubuntu, the minimum hard disk space required is about 50 GB for
the X11 backend. It is recommended that at least 120 GB is provided, which is enough to compile all backends together.
Toolchain/ cross compiler: ARM, gcc-4.9.2 (Yocto project 1.8.1 Fido)
HWs Lib (Hardwares Library)
Digital I/O
- Read digital input
- Write digital output
COM
- RS-232/422/485 mode setting(Default RS232)
IFB122 Linux Users Manual
4 Introduction
Relay
Note
Set relay high or low.
1. All specifications and images are subject to change without notice..
http://www.axiomtek.com/Default.aspx?MenuId=Products&FunctionId=Prod uctView&ItemId=17865&upcat=134
.
Command
Definition
Example
=>
U-Boot
Ex: => setenv ipaddr 192.168.1.103 Meaning: U-Boot setenv ipaddr
192.168.1.103
~$
Host PC
Ex: ~$ sudo apt-get install subversion Meaning: To command sudo apt-get install subverhsion on host PC
~#
Target
(IFB122):
Ex: ~# /etc/run_rescue Meaning: To command /etc/run_rescue
on IFB122
IFB122 Linux Users Manual
Getting Started 5
Chapter 2
Getting Started
2.1 Connecting the IFB122
The power
Please check you power as below:
1. DC input range 9~48V
2. DC Terminal Block
Pin
DC Signal Name
1
Power+
2
N/A 3 Power-
Console Port
For user setting with debug. You can find TB10 pins for console port as below table. Connected to DIO terminal Block
http://www.axiomtek.com/Default.aspx?MenuId=Products&FunctionId=gSearch&keywor d=IFB122FB122 DIO Terminal Block
TB18 Pin No.
Signal name
Meaning
1
COM+
Plus Common for DIO
2
DI0
Digital Input
3
DI1 4 DO
Digital Output
5
COM-
Minus Common for DIO
6
Relay+
Relay Out
7
Relay-
8
GND
For Console Port
9
Console RX
10
Console TX
IFB122 Linux Users Manual
6 Getting Started
You can connect the IFB122 to personal computer (PC) in two ways:
Serial RS-232 console SSH over Ethernet
Note
Please download below data from Axiomteks website as below list if you have the demand.
- BSP support package.
- http://www.axiomtek.com/Default.aspx?MenuId=Products&Funct
ionId=gSearch&keyword=IFB122
-
IFB122 Linux Users Manual
Getting Started 7
2.1.1 Serial Console
The serial console is a convenient interface for connecting IFB122 to PC. First of all, it is very important to make sure that your desktop connects to IFB122 by console cable. Please set the system as follows:
Baudrate: 115200 bps Parity: None Data bits: 8 Stop bit: 1 Flow Control: None
Here we use PuTTY to setup and link to the IFB122. Learn how to do it with these step by step instructions:
1. Open PuTTY and choose Serial as the connection type.
2. Configure the serial port correctly (see image below). Click Open and power on the IFB122.
IFB122 Linux Users Manual
8 Getting Started
3. The Bootloader default booting system from eMMC.
4. If connection is established successfully, you should see the following image.
5. To login, please enter ‘root’ (without password).
IFB122 Linux Users Manual
Getting Started 9
2.1.2 SSH over Ethernet
Now, we are going to connect the IFB122 to PC over Ethernet. The following illustrations show how to do it under Windows® and Linux environment.
IFB122 LAN2 default IP address is 192.168.0.254.
For Windows
®
users:
1. Here we also use PuTTY to setup and link. Open PuTTY and choose SSH as the connection type. Then set the IP address to 192.168.0.254 and click Open.
2. If connection is established successfully, you should see the following image.
IFB122 Linux Users Manual
10 Getting Started
3. To login IFB122, please enter root (with no password).
For Linux users:
1. Open terminal and keyin ‘ssh’ command. ~$ ssh -l root 192.168.0.254
2. After the connection is established successfully.
IFB122 Linux Users Manual
Getting Started 11
2.2 How to Develop a Sample Program
In this section, learn how to develop a sample program for IFB122 with the following step by step instructions. The sample program is named hello.c.
1. To Create a directory for IFB122 BSP ()(IFB122-Linux-bsp-x.x.x.tar.gz); related to IFB122 file
~$ mkdir project ~$ cd project
2. After extracted the file, you will find a directory IFB122-LINUX-bsp-x.x.x
AxTools : This directory include hardware driver and API library Image : This directory include kernel, rootfilesystem Yocto patches : This directory include IFB122 hardware patches for Yocto Project 1.8.1
Toolchain : This directory include cross compiler toolchain build from Yocto Project 1.8.1 README.txt : This BSP's documentation file
2.2.1 Install Yocto Toolchain
Before you develop and compile sample program, you should install Yocto toolchain into development PC. You can follow below step to install Yocto toolchain or refer to Chapter 5 Board Support Package to build the toolchain for IFB122.
1. To check your Ubuntu version on your host PC. ~$ uname -m
Ubuntu 32-bit (i686):
Ubuntu 64-bit (x86_64):
IFB122 Linux Users Manual
12 Getting Started
2. Copy the toolchain script to home directory. i686 for 32-bit machines or x86_64 for 64-bit machines.
3 Execute the toolchain script and press Enter to install to default directory.
32-bit machines:
~$ bash poky-glibc-i686-meta-toolchain-cortexa7hf-vfp-neon-toolchain-1.8.1.sh
64-bit machines:
~$bash poky-glibc-x86_64-meta-toolchain-cortexa7hf-vfp-neon-toolchain-1.8.1.sh
4 Check the directory.
5 Wait to installation.
6 Install finish.
IFB122 Linux Users Manual
Getting Started 13
2.2.2 Setting Up the Cross-Development Environment
Before you can develop using the cross-toolchain, you need to set up the cross-development environment, and then you can find this script in the directory you chose for installation.
1. To set up cross-toolchain environment. ~$ source /opt/poky/1.8.1/environment-setup-cortexa7hf-vfp-neon-poky-linux-gnueabi
2. To check Cross-Development Environment whether successful or not It is successful, if you can find the information as below. ~$ echo $CC
2.2.3 Write and Compile Sample Program
1. Create a directory on your host PC ~$ mkdir -p example ~$ cd example
2. Use vi to edit hello.c. ~$ vi hello.c
#include<stdio.h> int main() { printf(“hello world\n”); return 0; }
3. To compile the program, please do: ~$ $CC hello.c -o hello
4. After compiling, enter the following command and you can see the hello execution file. ~$ ls -l
Loading...
+ 39 hidden pages