1、安装SDP

QNX_SDP分为Windows版和Linux版的,个人习惯Linux下开发,所以这里只记录Linux的安装。

开发环境:Ubuntu12.04-32bit

刚好有一个32位的Ubuntu系统,所以省略了安装32位库的步骤了,如果是64位的,还需要安装下面的32位的库文件

sudo apt-get install libgtk2.0-0:i386 libXtst6:i386 \
libcanberra-gtk-module:i386 \
gtk2-engines-murrine:i386 libdbus-glib-1-2:i386

然后在 http://www.qnx.com/download/group.html?programid=26071 下载Linux的安装bin文件:qnx-sdp-6.6-nnnnnnnnnnnn.bin

点击运行,会出现图像安装界面,一直点下一步就好,到最后需要输入License Key。

安装成功后会出现一个:~/qnx660目录

其中包括什么编译工具,所需要的各个库文件,一个安装就全搞定了,只需要编译前运行下 :source~/qnx660/qnx660-env.sh

$ qconfig
QNX Installations
    Installation Name: QNX Software Development Platform 6.6
              Version: 6.6.0
       Base Directory: /home/my_userid/qnx660
             QNX_HOST: /home/my_userid/qnx660/host/linux/x86
           QNX_TARGET: /home/my_userid/qnx660/target/qnx6

输入qconfig进行检测,如果出现版本信息,说明安装成功了


2、BSP编译

在对BSP进行编译之前,先了解下QNX大致的软件结构。在启动过程中QNX和其他系统有一些区别,流程是:

芯片固化程序--->IPL(Initial Program Loader)--->启动程序(Startup)--->微内核和进程管理器(procnto)--->驱动和应用程序


IPL的始任务是对硬件进行最低配置(配置时钟,设置堆栈等),以创建一个环境,允许启动程序,进而使微内核运行。这部分的工作可以由QNX的BSP中自带的IPL源码来完成,也可以用uboot代替

②Startup的任务是拷贝镜像并解压,配置处理器和硬件,检测系统资源,并启动操作系统。这里的硬件处理并不包括像配置串口波特率,以太网和磁盘控制等,这些工作都是后面驱动自己完成的


源码目录下三大主分支,在定制自己的板卡时,需要修改最多的地方就这三个了。


QNX支持的板卡还是挺多的,可以在http://community.qnx.com/sf/wiki/do/viewPage/projects.bsp/wiki/BSPAndDrivers

选择和自己最接近的板卡BSP,这里选择   i.MX6Q SabreSmart


下载解压到工作目录 $ unzip bspname.zip

解压后目录结构如下:


①生成内核文件

在bsp_working_dir :

# source ~/qnx660/qnx660-env.sh
# make

完事!生成好的二进制文件 ifs-mx6q-sabresmart.raw 就在 bsp_dir/images 中 


②生成IPL文件

# cd bsp_dir/images
# ./mkflashimge

会在当前文件夹生成一个: ipl-mx6q-sabresmart.bin


3、启动板子

①将板子设置成SD卡启动,按下面流程格式化一张SD卡

8. Build a new DOS disk label:
$ sudo fdisk /dev/sdd
Command (m for help): u
Changing display/entry units to cylinders (DEPPRECATED!)
Command (m for help): o
Building a new DOS disklabel with disk identifier 0xcdd1b702.
Changes will remain in memory only, until you decide to write
them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be
corrected by write.
WARNING: cylinders as display units are deprecated. Use command
'u' to change units to sectors.
Command (m for help): d
Selected partition 1
9. Remove the existing partitions. Keep entering the d command until no partitions
are left:
Command (m for help): d
No partition is defined yet!
10. Create a new partition:
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
11. Set the partition as the primary partition:
Select (default p): p
Partition number (1-4, default 1): 1
First cylinder (1-240, default 1): 1
Last cylinder, (100-240, default 240): <ENTER>
Using default value 240
© 2015, QNX Software Systems Limited 17
Building and installing the BSP
12. Set the active partition:
Command (m for help): a
Partition number (1-4): 1
13. Set the partition type:
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): c
Changed system type of partition 1 to c (W95 FAT32 (LBA))

14. Write the changes:
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
15. Format the SD card. Note that the number 1 at the end of the mountpoint must
be included:
$ sudo mkfs.vfat /dev/sdd1
mkfs.msdos 3.0.12 (29 Oct 2011)
$


②将IPL拷贝到SD中

$ sudo dd if=ipl-mx6q-sabresmart.bin of=/dev/sdd bs=512 seek=2 skip=2
37+1 records in
37+1 records out
19268 bytes (19 KB) copied, 0.0178466s, 1.1 MB/s
$ sync


③将IFS拷贝到SD中

$ mount  /dev/sdx1  /media/074B-DAC7
$ mv ifs-mx6q-sabresmart.raw  QNX-IFS
$ cp QNX-IFS /media/074B-DAC7
$ sync


这里需要将编译好的 ifs-xxx-xxx.raw 更名为 QNX-IFS,因为IPL已经设置了读取的镜像文件名称为:QNX-IFS


④上电启动

Welcome to QNX Neutrino Initial Program Loader for Freescale i.MX6Q Sabre-Smart (ARM Cortex-A9 MPCore)
SDMMC download...
load image done.
Found image               @ 0x18000008
Jumping to startup        @ 0x108068F8
SCU_CONFIG = 00005503, 4 cpus
L2 cache enabled
CPU0: L1 Icache: 1024x32
CPU0: L1 Dcache: 1024x32 WB
CPU0: VFP-d32 FPSID=41033094
CPU0: NEON MVFR0=10110222 MVFR1=01111111
CPU0: 412fc09a: Cortex A9 MPCore rev 10 792MHz

Detected i.MX6 Dual/Quad, revision Unknown Revision

PLL1 - System     : 792MHz
PLL2 - System Bus : 528MHz
PLL3 - OTG USB    : 480MHz
PLL4 - Audio      : 36MHz
PLL5 - Video      : 339MHz
PLL7 - Host USB   : 480MHz
PLL8 - Enet       : 50MHz
IPG clock     : 66000000Hz
IPG per clock : 66000000Hz
UART clock    : 80000000Hz
CSPI clock    : 60000000Hz
AHB clock     : 132000000Hz
AXI clock     : 264000000Hz
EMI_SLOW clock: 29333333Hz
DDR clock     : 528000000Hz
USDHC1 clock  : 198000000Hz
USDHC2 clock  : 198000000Hz
USDHC3 clock  : 198000000Hz
USDHC4 clock  : 198000000Hz
ENFC clock    : 24000000Hz

decompressing...done
CPU1: L1 Icache: 1024x32
CPU1: L1 Dcache: 1024x32 WB
CPU1: VFP-d32 FPSID=41033094
CPU1: NEON MVFR0=10110222 MVFR1=01111111
CPU1: 412fc09a: Cortex A9 MPCore rev 10 792MHz
CPU2: L1 Icache: 1024x32
CPU2: L1 Dcache: 1024x32 WB
CPU2: VFP-d32 FPSID=41033094
CPU2: NEON MVFR0=10110222 MVFR1=01111111
CPU2: 412fc09a: Cortex A9 MPCore rev 10 792MHz
CPU3: L1 Icache: 1024x32
CPU3: L1 Dcache: 1024x32 WB
CPU3: VFP-d32 FPSID=41033094
CPU3: NEON MVFR0=10110222 MVFR1=01111111
CPU3: 412fc09a: Cortex A9 MPCore rev 10 792MHz
cpu_startnext: cpu1 -> fc411d58
cpu_startnext: cpu2 -> fc411d58
cpu_startnext: cpu3 -> fc411d58

System page at phys:10023000 user:fc410000 kern:fc410000
Starting next program at vfe054e3c
cpu_startnext: cpu0 -> fe054e3c
Welcome to QNX Neutrino 6.6.0 on the i.mx6 Smart-Device (ARM Cortex-A9 MPCore)
Starting watchdog...
 
Starting I2C1,2,3 driver (/dev/i2c1,2,3)...
Starting SD3 memory card driver...
Starting SD2 (microSD connector) memory card driver...
Unable to access "/dev/sd20" (2)
Starting Emmc Nand Flash driver
Starting USB host 1 OTG driver (host mode)
Starting Ethernet driver
setting env variables.
Starting Screen Graphics...
Mempool Map addr range[28000000-2c600000]
Mempool Map paddr range[4b100000-4f700000]
[Interrupt] Attached irqLine 41 with id 13.
[Interrupt] Attached irqLine 42 with id 14.
Attached resmgr to /dev/galcore with id:0.
Memory fault 
done.
Launching devb-umass...
done
# 
# 







Logo

更多推荐