f&s i.mx6 linux first steps · qt creator is installed with a cross-compile/debug kit using the...

17
Quickstart with F&S Development Machine Fedora 23 Version 1.2 (2017-05-05) © F&S Elektronik Systeme GmbH Untere Waldplätze 23 D-70569 Stuttgart Germany Phone: +49(0)711-123722-0 Fax: +49(0)711-123722-99

Upload: truongkiet

Post on 13-Sep-2018

240 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: F&S i.MX6 Linux First Steps · Qt Creator is installed with a cross-compile/debug kit using the F&S toolchain and a ... A lot of configuration is already done. Compilation has been

Quickstart

with F&S Development MachineFedora 23

Version 1.2(2017-05-05)

© F&S Elektronik Systeme GmbHUntere Waldplätze 23

D-70569 StuttgartGermany

Phone: +49(0)711-123722-0Fax: +49(0)711-123722-99

Page 2: F&S i.MX6 Linux First Steps · Qt Creator is installed with a cross-compile/debug kit using the F&S toolchain and a ... A lot of configuration is already done. Compilation has been

Table of Contents

1 Welcome 1

2 Import the Appliance 2

3 Using the Virtual Machine 53.1 U-Boot................................................................................................................5

3.2 Login..................................................................................................................5

3.3 Directory Structure.............................................................................................6

3.4 TFTP Server......................................................................................................7

3.5 NFS Server........................................................................................................7

3.6 Keyboard Layout................................................................................................7

3.7 Guest Addition...................................................................................................7

3.8 Compile … in just 3 steps..................................................................................7

3.8.1 Buildroot, Kernel, Device Tree...........................................................................7

3.8.2 U-Boot................................................................................................................8

4 Qt Development 94.1 Introduction........................................................................................................9

4.2 Create a Root File System.................................................................................9

4.3 SSH..................................................................................................................10

4.4 Settings in Qt Creator......................................................................................10

4.5 Running the Application...................................................................................12

4.6 Debugging........................................................................................................12

4.7 Demo Application.............................................................................................12

4.8 U-Boot Settings................................................................................................13

5 Appendix 14List of Figures................................................................................................................14

List of Tables.................................................................................................................14

Listings..........................................................................................................................14

Important Notice............................................................................................................15

Page 3: F&S i.MX6 Linux First Steps · Qt Creator is installed with a cross-compile/debug kit using the F&S toolchain and a ... A lot of configuration is already done. Compilation has been

Welcome

1 Welcome

“Hello and Welcome

to F&S Development Machine –

Fedora 23!”

What’s it all about?

“F&S Development Machine – Fedora 23” is a VirtualBox Appliance based on Fedora 23 pro-vided by F&S.

It contains the installed Board Support Packages for fsimx6, fsimx6sx and fsimx6ul. The F&Stoolchain is installed, the source code is extracted and ready to run. System packages thatare needed are installed too. Besides that it contains a configured environment for Qt Devel-opment. Qt Creator is installed with a cross-compile/debug kit using the F&S toolchain and aconfigured deployment strategy.

Why should I use it?

Because it saves time. A lot of configuration is already done. Compilation has been testedand is working out of the box. Missing packages are installed etc.. Just a few points that be-long to your decision can’t be done beforehand. For example if you want to have ‘your fa-vorite IDE’. By default Qt Creator, vim, emacs, and gedit are preinstalled. Besides that we tryto keep the image as small as possible.

When should I not use it?

There are just two cases not to use this virtual machine. First when you are going for a na-tive development machine. Second when you absolutely want to go with ‘your favorite distri-bution’ and it’s not Fedora.

F&S i.MX6 Linux First Steps 1

Page 4: F&S i.MX6 Linux First Steps · Qt Creator is installed with a cross-compile/debug kit using the F&S toolchain and a ... A lot of configuration is already done. Compilation has been

Import the Appliance

2 Import the Appliance

Let‘s import our new virtual machine. If you haven’t downloaded yet log in at our website https://www.fs-net.de/ and download F_S Development Machine - Fedora 23 V1.2.ova. Openyour VirtualBox Manager and click:

File → Import Appliance

Select your downloaded F_S Development Machine - Fedora 23 V1.2.ova file inthe dialog and click next.

2 F&S i.MX6 Linux First Steps

Figure 1: Import the Appliance

Page 5: F&S i.MX6 Linux First Steps · Qt Creator is installed with a cross-compile/debug kit using the F&S toolchain and a ... A lot of configuration is already done. Compilation has been

Import the Appliance

When you have done this you can see all the details of the virtual machine like name, ver-sion and the hardware configuration. First check if the hardware settings for CPU and RAMcorrespond to your needs and to the performance of your host machine. Second you can ad-just the name if you have imported an appliance with this name before or if you want to useanother name.

F&S i.MX6 Linux First Steps 3

Figure 2: Choose the *.ova file

Page 6: F&S i.MX6 Linux First Steps · Qt Creator is installed with a cross-compile/debug kit using the F&S toolchain and a ... A lot of configuration is already done. Compilation has been

Import the Appliance

Now there is nothing left except for clicking on Import. Depending on your machine it willtake about 10 minutes.

4 F&S i.MX6 Linux First Steps

Figure 3: Adjust appliance settings

Page 7: F&S i.MX6 Linux First Steps · Qt Creator is installed with a cross-compile/debug kit using the F&S toolchain and a ... A lot of configuration is already done. Compilation has been

Using the Virtual Machine

3 Using the Virtual Machine

3.1 U-Boot

After importing start your virtual machine by selecting it on the left and clicking on Show.

3.2 Login

After boot you will be asked for the login. Use the user developer and log in with pass-word developer.

F&S i.MX6 Linux First Steps 5

Figure 5: Login in with password developer

Figure 4: Boot your VM

Page 8: F&S i.MX6 Linux First Steps · Qt Creator is installed with a cross-compile/debug kit using the F&S toolchain and a ... A lot of configuration is already done. Compilation has been

Using the Virtual Machine

3.3 Directory Structure

The fsimx6, fsimx6sx and fsimx6ul releases are located in the home directory of developer.There you will find, documentation, binaries, source code etc.. The source code is extractedto a folder called build. Links to the releases are on the desktop too.

If you want to build a root file system on imx6 go to /home/developer/fsimx6-V3.0/build/buildroot-2016.05-fsimx6-V3.0. The kernel should also be build fromthis directory via Buildroot not in the separate linux-4.1... directory. Handling of kernel mod-ules is much easier when compiling via Buildroot.

In the home directory there is a folder buildroot_dl_packages. All packages down-loaded by Buildroot are stored there. When providing the virtual machine all packages thatare needed for the default configuration have been downloaded already.

6 F&S i.MX6 Linux First Steps

Page 9: F&S i.MX6 Linux First Steps · Qt Creator is installed with a cross-compile/debug kit using the F&S toolchain and a ... A lot of configuration is already done. Compilation has been

Using the Virtual Machine

3.4 TFTP Server

There is a TFTP Server that starts automatically when booting. Simply lay your files in the /tftpboot/ folder.

3.5 NFS Server

An NFS Server is starting automatically when booting. It uses the directories /downloadand /rootfs. You can put your files there or mount a root file system image as loop backdevice. Please consult the ‘First Steps’ manual for detailed information.

3.6 Keyboard Layout

You can change your keyboard layout in the top panel on the right. By default it says enhere.

3.7 Guest Addition

The Guest Addition is already installed on the virtual machine. Features like shared folder or a shared clipboard can be activated in the settings when the virtual machine is not running.

3.8 Compile … in just 3 steps

What about compiling a kernel and root file system or U-Boot for your module in just 3 steps? Here is how it is done:

3.8.1 Buildroot, Kernel, Device Tree

1. Open a terminal by clicking the terminal icon in the top panel.

2. Change directory to the Buildroot directory for your desired processor architecture. E.g. for imx6ul we type:

cd fsimx6ul-V2.0/build/buildroot-2016.05-fsimx6ul-V2.0/

3. Now we will create a .config (e.g. standard defconfig) and start the compilation. The steps in brackets are optional:

make fsimx6ul_std_defconfig //apply standard defconfig for fsimx6ul (make menuconfig) //customize Buildroot configuration(make linux-menuconfig) //customize kernel configurationmake //build

F&S i.MX6 Linux First Steps 7

Page 10: F&S i.MX6 Linux First Steps · Qt Creator is installed with a cross-compile/debug kit using the F&S toolchain and a ... A lot of configuration is already done. Compilation has been

Using the Virtual Machine

3.8.2 U-Boot

1. Open a terminal by clicking the terminal icon in the top panel.

2. Change directory to the U-Boot directory for your desired processor architecture.E.g for imx6ul we type:

cd fsimx6ul-V2.0/build/u-boot-2014.07-fsimx6ul-V2.0/

3. Now we will create a .config and start the compilation:

make fsimx6ul_config //apply config for fsimx6ulmake //build

8 F&S i.MX6 Linux First Steps

Page 11: F&S i.MX6 Linux First Steps · Qt Creator is installed with a cross-compile/debug kit using the F&S toolchain and a ... A lot of configuration is already done. Compilation has been

Qt Development

4 Qt Development

4.1 Introduction

The virtual machine comes with a preconfigured Qt Creator environment. First you’ll find a cross-compile/debug kit based on the F&S toolchain. It is called FS Cross Compile Kitfor ARM. Second there is a project with a small demo application called QT_Test_App us-ing the preconfigured environment.

Nevertheless a few things have to be configured:

• A root file system prepared for debugging

• configuration on that root file system

• Paths and addresses in Qt Creator

The Explanation in this chapter is more general. If there are some basics that are notfaced here and are not clear please have a look at the First Steps documentation.

4.2 Create a Root File System

At the moment there is just a qt5_defconfig for fsimx6. This will change in the next release.To give you an idea our qt5_defconfig contains lots of qt5 packages and no XServer. This isimportant because Qt doesn’t like to have an XServer next to it.

For remote debugging a few additional packages need to be activated:

• Target packages -> Development Tools -> ctest (activates cmake)

• Target packages -> Interpreter languages and scripting -> python

• Target packages -> Debugging, profiling and benchmark –> gdb -> full debugger

• Target packages -> Debugging, profiling and benchmark –> gdb -> Python support

• (Toolchain -> Build Cross gdb for the host -> Python support

After that we have to reconfigure the host-gdb package to face the python changes:

make host-gdb-reconfigure

Otherwise it will say, that no python support is available. After compiling we can write the rootfs image to the module.

F&S i.MX6 Linux First Steps 9

Page 12: F&S i.MX6 Linux First Steps · Qt Creator is installed with a cross-compile/debug kit using the F&S toolchain and a ... A lot of configuration is already done. Compilation has been

Qt Development

4.3 SSH

SSH is needed for deployment and remote debugging. In this example we will setup ssh witha simple configuration using the root user. Make sure that the date is set correctly on yourmodule otherwise we will get trouble with certificates (e.g type: date "2017-04-06 09:50").

Here is what we do:

udhcpc (e.g. got 10.0.0.101)

mount -o remount,rw /

passwd (set password ‘root’ for user root)

vi /etc/ssh/sshd_config

Port 22AdressFamily anyListenAddress 0.0.0.0PermitRootLogin yes

A more detailed explanation:

Fetch an ip address. Mount the root partition read/write able. That is important for deploy-ment later on too. Set a root password. In Qt Creator it has been set to root. In the nextstep edit sshd_config e.g. with vi. The settings written below the vi command must be acti-vated (no # at the beginning of the ine) or initially written by yourself. Now we can start theserver:

/etc/init.d/S50sshd start

And test it from the computer with:

ssh [email protected]

4.4 Settings in Qt Creator

Start Qt Creator and open QT_Test_App. This project was configured for fsimx6 platformso we need to correct some paths. Additionally we need to check network settings and sshconnection. First make sure that you have already build your root file system because it con-tains tools we need.

Click on Tools → Options

On the left there is a tab called Devices. The configured device represents the F&S mod-ule. Check the connection settings e.g. IP address and user name / password that will beused for the SSH connection. With click on Test Qt Creator will try to establish an ssh con-nection. It must show:

Connecting to host...

Checking kernel version...

Linux 4.1.15-F+S armv7l

10 F&S i.MX6 Linux First Steps

Page 13: F&S i.MX6 Linux First Steps · Qt Creator is installed with a cross-compile/debug kit using the F&S toolchain and a ... A lot of configuration is already done. Compilation has been

Qt Development

Checking if specified ports are available...

All specified ports are available.

Device test finished successfully.

Now click on Build & Run on the left. Go through the tabs Cmake, Debuggers, Qt Versions and Kit. In every tab we need to check and maybe adjust the paths of the man-ually added tools. Mostly they are labeled with ...for ARM.

The targets of the paths must exist (root file system was build) and point to the correct plat-form.

It can happen that you open the QT_Test_App project the first time and it shows an error:

This is the case when the root file system hasn’t been build. The project expects an availableqmake tool as the project file says but can’t find it. Close Qt Creator, build a root file system and open the project again.

F&S i.MX6 Linux First Steps 11

Figure 6: First start of QT_Test_App

Page 14: F&S i.MX6 Linux First Steps · Qt Creator is installed with a cross-compile/debug kit using the F&S toolchain and a ... A lot of configuration is already done. Compilation has been

Qt Development

4.5 Running the Application

After these steps we can run the application. The following steps should happen:

• The application compiles

• It is copied due to the custom deployment strategy to /tftpboot/

• Qt Creator starts an ssh connection and downloads the binary via TFTP to the board.

• The QT_Test_App will be started on the module. It shows an empty window on aconnected display.

4.6 Debugging

By clicking on the debugging symbol Qt Creator starts a gdbserver on the module via sshand establishes a connection.

4.7 Demo Application

If you want to create your own application later on there is one important detail. Qt Creatormust know that it should deploy a binary to the module and where it should be deployed.Therefore you need to tell this in the Qt Creator Project file (*.pro). The following lines hadbeen added in the *.pro file for QT_Test_App:

linux-* {target.path = /rootINSTALLS += target}

12 F&S i.MX6 Linux First Steps

Figure 7: Debugging with Qt Creator

Page 15: F&S i.MX6 Linux First Steps · Qt Creator is installed with a cross-compile/debug kit using the F&S toolchain and a ... A lot of configuration is already done. Compilation has been

Qt Development

4.8 U-Boot Settings

To keep the configuration effort small after a reboot settings like static IP address or an rwmount of the root file system can be set in U-Boot.

F&S i.MX6 Linux First Steps 13

Page 16: F&S i.MX6 Linux First Steps · Qt Creator is installed with a cross-compile/debug kit using the F&S toolchain and a ... A lot of configuration is already done. Compilation has been

Appendix

5 Appendix

List of Figures

Figure 1: Import the Appliance...............................................................................................2

Figure 2: Choose the *.ova file...............................................................................................3

Figure 3: Adjust appliance settings........................................................................................4

Figure 4: Boot your VM..........................................................................................................5

Figure 5: Login in with password developer...........................................................................5

Figure 6: First start of QT_Test_App....................................................................................11

Figure 7: Debugging with Qt Creator....................................................................................12

List of Tables

Listings

14 F&S i.MX6 Linux First Steps

Page 17: F&S i.MX6 Linux First Steps · Qt Creator is installed with a cross-compile/debug kit using the F&S toolchain and a ... A lot of configuration is already done. Compilation has been

Appendix

Important Notice

The information in this publication has been carefully checked and is believed to be entirelyaccurate at the time of publication. F&S Elektronik Systeme assumes no responsibility, how-ever, for possible errors or omissions, or for any consequences resulting from the use of theinformation contained in this documentation.

F&S Elektronik Systeme reserves the right to make changes in its products or product speci-fications or product documentation with the intent to improve function or design at any timeand without notice and is not required to update this documentation to reflect such changes.

F&S Elektronik Systeme makes no warranty or guarantee regarding the suitability of its prod-ucts for any particular purpose, nor does F&S Elektronik Systeme assume any liability aris-ing out of the documentation or use of any product and specifically disclaims any and all lia-bility, including without limitation any consequential or incidental damages.

Products are not designed, intended, or authorised for use as components in systems in-tended for applications intended to support or sustain life, or for any other application inwhich the failure of the product from F&S Elektronik Systeme could create a situation wherepersonal injury or death may occur. Should the Buyer purchase or use a F&S Elektronik Sys-teme product for any such unintended or unauthorised application, the Buyer shall indemnifyand hold F&S Elektronik Systeme and its officers, employees, subsidiaries, affiliates, anddistributors harmless against all claims, costs, damages, expenses, and reasonable attorneyfees arising out of, either directly or indirectly, any claim of personal injury or death that maybe associated with such unintended or unauthorised use, even if such claim alleges that F&SElektronik Systeme was negligent regarding the design or manufacture of said product.

F&S i.MX6 Linux First Steps 15