qnx education program training day 1 (i) getting started with qnx march 15, 2012
TRANSCRIPT
QNX Education Program TrainingDay 1 (I)
Getting Started with QNX
March 15, 2012
QNX Software Systems is a subsidiary of Research In Motion. 2 QNX Confidential. All content copyright QNX Software Systems.
Who are we?
QNX – at a glance
Headquarters: Ottawa, Ontario, Canada
Global presence: North America, Europe, Asia
Markets: Auto, medical , industrial, networking, consumer, mil-aero
History: 1980-2004 Privately owned
2004-2010 Harman International
2010-Present Research In Motion
QNX Software Systems is a subsidiary of Research In Motion. QNX Software Systems Confidential
Our Markets
Military Industrial Automation
NetworkingAutomotive Consumer Medical
QNX Software Systems is a subsidiary of Research In Motion.
BlackBerry PlayBook
4 QNX Confidential. All content copyright QNX Software Systems.
QNX Software Systems is a subsidiary of Research In Motion.
Services
Expedite your
success with:
Custom Engineering
Custom Service Plans
Customizable Certification
Support Packages for Medical
Priority Support
Trainingand Consulting
services
Development tools
Static Analysis (Grammatech)
C/C++ Memory analysis
Code coverage
System profiler
Application profiler
Graphics
QT Photon Flash ScreenAirWebKit
OpenGL 2.0
Input
Audio / video codec support
Streaming media
Composition manager
Video capture
OpenVG SGX Touch
Reliability
Microkernel Fast boot PPS CPMAdaptive Partioning
System logger
Software update
SIL3 POSIX
Connectivity
CD/DVD DOS/FAT NTFS HFS+ NFS CIFS
Connectivity File Systems
IPv4IPv6
WiFi I2C
Embedded webserver
USB 2.0
SPISDIOBluetooth Zigbee
Data SecurityPowersafe / fault tolerant file systems
NAND NOR eMMC HDD SDC libssl openssllibcrypto
Encryption libraries
CCEAL4+
Debugger Target system info
BSPbuilder
Eclipse
Systembuilder
Middleware
Button Keyboard Mouse
Scalability
Platform development
Multicore Transparent distributed processing
Certified Product
Continua Device Connectivity
Bluetooth USBMedical device profile
Personal health device
Wireless
Hardware support
Freescale Advantech Texas Instruments Atmel
5INTERNAL Use Only -- QNX Confidential. All content copyright QNX Software
Systems.
QNX Software Systems is a subsidiary of Research In Motion.
QNX Momentics at a Glance
Choose your hostWindows, LinuxQNX Neutrino (Command line)
Choose your languageC, C++, Embedded C++
Choose your targetARM, MIPS, PowerPC, SH4, x86
Choose your BSPsBSPs for many popular boards and reference platforms
Choose command line or IDEIDE and command linetools interoperate
Choose 3rd party toolsGrowing ecosystem of tools vendors supporting Eclipse
QNX Software Systems is a subsidiary of Research In Motion. 7 QNX Confidential. All content copyright QNX Software Systems.
Visualization galore
QNX Software Systems is a subsidiary of Research In Motion.
QNX host view
8 QNX Confidential. All content copyright QNX Software Systems.
Getting started with QNX Installation
QNX Software Systems is a subsidiary of Research In Motion.
Quick start
Installation
Development system:
self-hosted ;Windows 7;Windows Vista; Windows 2000; Windows XP; or Linux development host
Target System
Development Board
Virtual machine: You can install and run the QNX Neutrino RTOS as a virtual machine in a VMware session. Vmware doesn’t necessarily support hard realtime.
10 QNX Confidential. All content copyright QNX Software Systems.
Communications Channels
Development host Target system
QNX Software Systems is a subsidiary of Research In Motion.
Virtual Machine as a target
The installation DVD includes a VMware image that’s compatible with VMware Workstation 7 or Player 3.
If you don’t have an installation DVD, you can down- load the VMware image from http://www.qnx.com/products/evaluation/eval-target.html.
You can also boot a virtual machine from an ISO image of QNX Neutrino: go to the CD/DVD drive settings page within VMware, select Use an ISO image, browse to the ISO image, reboot your virtual machine, and install QNX Neutrino.
11 QNX Confidential. All content copyright QNX Software Systems.
QNX Software Systems is a subsidiary of Research In Motion.
Login page
After rebooting, your hardware will automatically be detected. Once you select the graphics mode, you can log in as root without a password. Note your machine’s IP address on the right side of the screen; you’ll need it later.
12 QNX Confidential. All content copyright QNX Software Systems.
QNX Software Systems is a subsidiary of Research In Motion.
Networking
With a DHCP server available, your QNX Neutrino RTOS machine will receive an IP address automatically.
You can view it or change it using the ifconfig command, as described in the Utilities Reference
Open a cmd window and use ping IP_address to check that your Windows development host and your QNX Neutrino RTOS system (target) on the network can reach each other
Note: If your host machine uses a firewall, you might not be able to ping it from the target. On Windows XP you might have to enable Allow incoming echo request in the ICMP settings.
13 QNX Confidential. All content copyright QNX Software Systems.
QNX Software Systems is a subsidiary of Research In Motion.
Creating a program project
14 QNX Confidential. All content copyright QNX Software Systems.
QNX Software Systems is a subsidiary of Research In Motion.
Create New Project
Naming your project Selecting Build Variant
15 QNX Confidential. All content copyright QNX Software Systems.
QNX Software Systems is a subsidiary of Research In Motion.
QNX C project comes with a predefined Makefile structure
16 QNX Confidential. All content copyright QNX Software Systems.
QNX Software Systems is a subsidiary of Research In Motion.
Communicating with the QNX Neutrino RTOS
target system must be able to respond to requests from the development environment, there are 2 ways:
From a terminal window (on a PC running the QNX Neutrino RTOS),start the program “qconn”
From the IDE: create a target project
Open the System Information perspective
In the Window menu, select : Open Perspective > QNX System Information
In the empty Target Navigator view, press the right mouse button and select New QNX Target from the context menu.
17 QNX Confidential. All content copyright QNX Software Systems.
QNX Software Systems is a subsidiary of Research In Motion.
Here you see what’s going on inside your QNX Neutrino RTOS system.
18 QNX Confidential. All content copyright QNX Software Systems.
QNX Software Systems is a subsidiary of Research In Motion.
Compiling and linking
Creation of the QNX C Project
QNX-made directory structure with Makefiles was generated
To create a binary: right-click the project name, and then select Build Project
The QNX library libc.so, which contains many basic functions, is linked dynamically to your binary by default
You can add other libraries later: type the name of the library, without the lib prefix or the extension, e.g. libm.so
19 QNX Confidential. All content copyright QNX Software Systems.
QNX Software Systems is a subsidiary of Research In Motion.
Preparing to launch the program
To run and debug the newly built program on your target system, you need to create a launch configuration
Various settings that affect how the program starts (e.g. command-line parameters, environment variables)
Now create your own launch configuration: from the dropdown menu beside the “bug” icon on the toolbar, select Debug Configurations. . .
Select C/C++ QNX QConn (IP): This type of launch configuration is meant for network-based (cross) development using the ”qconn”
Click on the New launch configuration icon:
20 QNX Confidential. All content copyright QNX Software Systems.
QNX Software Systems is a subsidiary of Research In Motion.
Debug Configuration
21 QNX Confidential. All content copyright QNX Software Systems.
QNX Software Systems is a subsidiary of Research In Motion.
Starting and debugging
22 QNX Confidential. All content copyright QNX Software Systems.
1. In the Debug launch configuration dialog, click Debug
2. The IDE now switches to the Debug perspective and transfers your program from your development machine across the network to your target QNX Neutrino RTOS system, and then starts it under the control of the debugger.
3. Note: The debugger keeps the project’s files open while the program is running. Be sure to terminate the debug session before you try to rebuild your project, or else the build will fail.
4. It’s also possible to leave the binary on a shared network drive in your WINDOW host, mount the drive on your QNX Neutrino target by using fs-cifs (see the entry for fs-cifs in the QNX Neutrino RTOS Utilities Reference), and run the binary from target.
QNX Software Systems is a subsidiary of Research In Motion.
Help Document
23 QNX Confidential. All content copyright QNX Software Systems.
Understand QNX BSP
QNX Software Systems is a subsidiary of Research In Motion.
OMAP35x:QNX Board Support Package (BSP) Component Map
BSP Component Map
CORE:Core OS and library supportInitial Program LoaderStartup ModulePower ManagementDMA libraryWatchdog timer
CONNECTIVITY:Serial driver (debug UART)I2C Bus driverSPI Bus driverWired Ethernet driver (full stack support)Dual USB Host Resource Manager
External Storage:eMMC/SD support (Fault tolerant / power safe, POSIX semantics filesystem)NOR filesystem (Fault tolerant / power safe, POSIX semantics filesystem)
Graphics / Multimedia / Audio:Display controller driver (LCD interface)openGLES / openVG supportTouchscreenAudio drivers
QNX Software Systems is a subsidiary of Research In Motion.
Understand QNX BSP
Download a QNX BSP
Example: TI-Beagleboard 3530 BSP
Go to BSP homepage
http://community.qnx.com/sf/wiki/do/viewPage/projects.bsp/wiki/BSPAndDrivers
Find out TI-Beagleboard 3530 BSP and download it to your computer
Use QNX Momentics to open this BSP file
26 QNX Confidential. All content copyright QNX Software Systems.
QNX Software Systems is a subsidiary of Research In Motion.
Import a BSP
27 QNX Confidential. All content copyright QNX Software Systems.
QNX Software Systems is a subsidiary of Research In Motion.
Build a project with this BSP
28 QNX Confidential. All content copyright QNX Software Systems.
QNX Software Systems is a subsidiary of Research In Motion.
Build Project
29 QNX Confidential. All content copyright QNX Software Systems.
QNX Software Systems is a subsidiary of Research In Motion.
BSP structure
30 QNX Confidential. All content copyright QNX Software Systems.
QNX Software Systems is a subsidiary of Research In Motion.
BSP Structure
Includes the following subdirectories:
Images : contains the resultant boot images
prebuilt: contains prebuilt binaries, and header files that are shipped with the BSP
install: All the files in the prebuilt directory are copied, then all generated binaries are installed here as they’re compiled. The files stored in the install directory are taken first when mkifs executes.
src: contains the BSP-specific source code
31 QNX Confidential. All content copyright QNX Software Systems.
QNX Software Systems is a subsidiary of Research In Motion.
IFS Image file
OS image 是由 mkifs (make image f ilesystem) 生成, buildfile 说明了如何去生成Image file 的扩展名一般为 *.ifs, *.bin, *.raw
在 BSP 的 images 目录中的 Makefile 中有一个” rule” 是产生 IFS image的,本 OMAP3530 例中的具体代码为:
ifs-omap3530-beagle.bin: omap3530.beagle.build
$(HOST_MKIFS) -r../install -vvv $(MKIFSFLAGS) $^ $@
32 QNX Confidential. All content copyright QNX Software Systems.
QNX Software Systems is a subsidiary of Research In Motion.
mkifs 与 buildfile
33 QNX Confidential. All content copyright QNX Software Systems.
此处的 Omap3530.beagle.build 就是 buildfile
QNX Software Systems is a subsidiary of Research In Motion.
buildfile consists of these sections:
bootstrap — starting with [virtual=armle,srec]
包括 Kernel , startup
a script — starting with [+script]
a sequence of commands that you want procnto to execute when it’s completed its own startup – 启动哪些文件包括 driver 、 utility 、 shell 等如果有应用程序,那么在这部分的最后应该就是启动应用程序 (例如在smart energy 参考程序中执行的是“ startup.sh” 脚本文件)
a list of links and files to include in the image — starting with [type=link]
包括 library, binary ( 二进制代码文件)或是其它的 configuration 的文件
34 QNX Confidential. All content copyright QNX Software Systems.
QNX Software Systems is a subsidiary of Research In Motion.
Download IFS image to target
Set UBoot environment to boot from MMCSD card# setenv bootdelay 1
– This command sets a one second boot delay.
# setenv bootcmd 'mmc init 1;fatload mmc 1 0x80100000 beagle.ifs;go 0x80200000'
– where beagle.ifs is the OMAP 3530 (Beagle) IFS file that was installed on the SD card
– match the Uboot bootcmd loading address with buildfile starting address
– 本 OMAP3530 BSP 例子中 buildfile 中给出的起始地址为:[image=0x80100000]
# saveenv
– 保存设置
可参阅文件 : - BSP release note”
- boot information link:
http://community.qnx.com/sf/wiki/do/viewPage/projects.bsp/wiki/AM_OMAP_boot_resources
35 QNX Confidential. All content copyright QNX Software Systems.
QNX Software Systems is a subsidiary of Research In Motion. 2010/06/01 R03 36
Boot sequence
Boot sequence:
– IPL code:• does chip selects and sets up RAM, then jumps to startup code
– startup code:• sets up some hardware and prepares environment for procnto
– procnto:• sets up kernel and runs boot script
– the boot script contains:• drivers and other processes, including your applications
IPL code(Initial Program
Loader)
startupcode
procnto(Process manager
plusmicrokernel)
bootscript Done!Start OR
CPU
BIOS andextension
ROMmonitor
QNX Software Systems is a subsidiary of Research In Motion. 2010/06/01 R03 37
– the IPL and startup code:• are board specific• are part of the Board Support Package (BSP)
IPL and startup code
IPL and startup code:
IPL code(Initial Program
Loader)
startupcode
procnto(Process manager
plusmicrokernel)
bootscript Done!Start OR
CPU
BIOS andextension
ROMmonitor
QNX Software Systems is a subsidiary of Research In Motion. 2010/06/01 R03 38
OS image file
Much of this is in an OS image file:
OS image file (or called IFS image)
IPL code(Initial Program
Loader)
startupcode
procnto(Process manager
plusmicrokernel)
bootscript Done!Start OR
CPU
BIOS andextension
ROMmonitor
QNX Software Systems is a subsidiary of Research In Motion. 2010/06/30 R08 39
Creating an OS Image - Creating the Project
First, you must have a System Builder Project:
from the System Builder perspective:
1 menu-click in System Builder Projects view, choose New
2 choose QNX System Builder Project
3 a wizard will come up, provide a name for the project
4 click Next…
QNX Software Systems is a subsidiary of Research In Motion. 2010/06/30 R08 40
Creating an OS Image - Creating the Project
Creating a System Builder Project (continued):
select a build file to start with:
you can import an existing buildfile
Or,start from scratch
…then click Finish
QNX Software Systems is a subsidiary of Research In Motion. 2010/06/30 R08 41
Creating an OS Image - Creating the Project
Done!
System Builder Project and its contents
some related views
System Builder Editor
QNX Software Systems is a subsidiary of Research In Motion. 2010/06/30 R08 42
Creating an OS Image - Building the image
To build the image:
menu-click on the project
the Console gives progress information
1
2 select Build Project
QNX Software Systems is a subsidiary of Research In Motion. 2010/06/30 R08 43
Creating an OS Image - Building the image
Result of doing ‘Build Project’:
the resulting OS imagefile for the target (.ifs)is generated/regenerated
QNX Software Systems is a subsidiary of Research In Motion. 2010/06/30 R08 44
Creating an OS Image - Image level properties
To open the System Builder editor (if necessary):
double-clickon build-file System Builder Editor will open
QNX Software Systems is a subsidiary of Research In Motion. 2010/06/30 R08 45
Creating an OS Image - Image level properties
Image level properties:
properties for the boot image as a whole, e.g.
default permissions
image compression
what address in RAM should the image be loaded into
etc
select image in the editorlook at Properties view
QNX Software Systems is a subsidiary of Research In Motion. 2010/06/30 R08 46
Creating an OS Image - The boot script
Editing the boot script:
double-click on it
QNX Software Systems is a subsidiary of Research In Motion. 2010/06/30 R08 47
Creating an OS Image - The boot script
Example script:
display_msg Starting serial driver
devc-ser8250 -e -b115200 &
waitfor /dev/ser1 # don’t continue until /dev/ser1 exists
display_msg Starting pseudo-tty driver
devc-pty &
display_msg Setting up consoles
devc-con &
reopen /dev/con2 # set stdin, stdout and stderr to /dev/con2
[+session pri=27r] PATH=/proc/boot esh &
reopen /dev/con1 # set stdin, stdout and stderr to /dev/con1
[+session pri=10r] PATH=/proc/boot esh &
QNX Software Systems is a subsidiary of Research In Motion. 2010/06/30 R08 48
Creating an OS Image - Putting things in the image
The image file contains a filesystem:
startup code
startup header
...
– once booted, image contents are visible as a read-only filesystem
– note that the OS supports overlapping filesystems
– e.g. /etc/hosts can be part of an image filesystem and /etc/passwd can be part of an embedded filesystem
QNX Software Systems is a subsidiary of Research In Motion. 2010/06/30 R08 49
Creating an OS Image - Putting things in the image
The two panes of the System Builder Editor:
Filesystem:what things willlook like afterthe system has booted
Images:a categorized view what’s inthe image(s)
QNX Software Systems is a subsidiary of Research In Motion. 2010/06/30 R08 50
Creating an OS Image - Putting things in the image
To add items to image:
select imageto add to
1click one of the ‘Add new…’ buttons below
2
binary
shared libdll symlink file dir
QNX Software Systems is a subsidiary of Research In Motion. 2010/06/30 R08 51
Creating an OS Image - Putting things in the image
Add item wizard:
choose item (e.g. name of binary)
where should the item show up in the targets filesystem?
2 ways
should the item be named something different in the targets filesystem?
QNX Software Systems is a subsidiary of Research In Motion. 2010/06/30 R08 52
Creating an OS Image - Where things are found
When building your image:
files are found either using:
a search path
– find the file by walking through a list of possible paths
an absolute path
– look in a specific directory only
QNX Software Systems is a subsidiary of Research In Motion. 2010/06/30 R08 53
Creating an OS Image - Where things are found
When you added an item...
…you were given a choice here
QNX Software Systems is a subsidiary of Research In Motion. 2010/06/30 R08 54
Creating an OS Image - Where things are found
To view/modify the search path:
select the project andright-click for the
menu
1
select Properties2
select Search Paths
3
view/modify thesearch paths
4
QNX Software Systems is a subsidiary of Research In Motion. 2010/06/30 R08 55
Putting the Image on the Target: TFTP
TFTP - The IDE contains a TFTP server:
many boards have ROM monitors that have TFTP clients for downloading to RAM or flash
the TFTP server automatically detects TFTP requests and looks for the requested files in System Builder projects Images directories
change where it looks using Window > Preferences
QNX Software Systems is a subsidiary of Research In Motion. 2010/06/30 R08 56
Putting the Image on the Target - 1. TFTP
The TFTP Server view shows its state:
– initiate the download from your target
Thanks