VxWorks博客文章

VxWorks培训服务

课程描述

结合实际开发经验和开发工具的使用,详细介绍VxWorks系统开发的基本概念和多种调试手段,让学员深入理解VxWorks、掌握解决实际问题的技巧、真正会用VxWorks

前提知识

具备良好的C编程基础

课程形式

课程讲授和指导学员动手实验并重

开发环境由学员自备,版本不限(Vx5/6/7)

费用

公开课 - 每人每天不高于1500¥,十人开班

企业内训 - 每天不高于15000¥,不限人数

课程大纲

一 系统编程(3天)

1.VxWorks简介

  • 嵌入式系统

  • VxWorks特性

  • 开发方式

2.开发工具

  • 模拟器

  • 工程管理

  • 简单程序的制作

  • Target Server

  • Host Shell

3.多任务开发

  • 多任务概述

  • 任务的调度

  • 任务的使用

4.多任务通信

  • 信号量

  • 任务同步的练习

  • 互斥的练习

  • 消息队列

  • 管道

  • 数据传输的练习

  • Event

5.RTP

  • RTP的基本概念

  • RTP的启动

  • RTP练习

6.Utility

  • 中断与看门狗

  • 看门狗的练习

  • 内存的使用

  • 图形编程

7.调试机制

  • 调试器的使用

  • 调试命令

  • dprintf

  • kprintf

  • 错误检测机制

  • ScopeTools

8.IO系统

  • IO系统的使用

  • IO驱动

9.系统启动流程

  • BSP组成

  • Bootrom执行过程

  • VxWorks执行过程

二 用户态编程(2天)

1.什么是RTP

  • 为什么引入RTP

  • RTP的特点

  • RTP与Task

  • RTP的创建

  • WorkBench中启动RTP

  • ROMFS的使用

  • Code中启动RTP

  • 系统启动时启动RTP

  • RTP的终止

  • RTP的命令

  • 静态库

  • 共享库

2.进程间通信

  • 共享数据区

  • 公共对象

  • 信号量

  • 消息队列

  • 管道

  • 公共任务

  • VxWorks Event

  • 消息通道

  • 信号

  • 系统调用(System Call)

3.应用的移植

  • 移植注意事项

  • 与Kernel应用的区别

三 多核编程(1天)

  • SMP的使用

  • Affinity

  • 自旋锁

  • CPU内互斥

  • 内存屏障

  • 原子操作

  • 调度策略

  • 性能优化

  • 代码移植

VxWorks是啥?

关于实时

关于硬实时

BSP是啥

Task是啥?

RTP是啥?

RTP之启动

Utility之APP自启动

Component之Kernel Shell的命令

Boot之bootrom启动顺序

   加载vxWorks的boot loader有很多种,最常见的就是使用BSP编译的bootrom

它在Target里的执行顺序如下

  • romInit() - $(BSP)/romInit.s,这是bootrom的启动地址,它在ROM(例如Flash、硬盘)中执行最小的初始化,包括:初始化CPU、关中断、清Cache、初始化romStart()的栈STACK_SAVE、调用romStart()

  • romStart() - config/all/bootInit.c,这是bootrom的第一条C指令,它将bootrom镜像中未压缩的文本段与数据段从ROM复制到RAM的RAM_LOW_ADRS,然后将RAM中未占用的空间清零,将bootrom的剩余压缩部分解压到RAM的RAM_HIGH_ADRS,最后跳转到这个RAM_HIGH_ADRS处的usrEntry()执行

  • usrEntry() - config/all/usrEntry.c,RAM中的第一条指令,它的唯一功能就是调用usrInit()

  • usrInit() - config/all/usrConfig.c,主要工作包括:将BSS清零、初始化Cache库、设置中断向量表基址、安装异常向量、调用sysHwInit()、使能Cache、调用usrKernelCorePreInit()初始化Class、对象、信号量等、初始化wdb、调用usrKernelInit()

    • usrKernelInit() - comps/src/usrKernel.c,配置内核使用的数据结构,包括初始化内核的Task库、配置调度策略、初始化Tick队列、初始化wind work队列、记录系统内存池尺寸、调用kernelInit()初始化内

    • kernelInit() - src/wind/kernelLib.c,初始化并启动内核,包括设置中断栈尺寸、设置内存池位置、初始化中断lock-out等级、关闭时间片轮转策略、将系统Tick清零、初始化中断栈、初始化并启动第一个任务tRootTask

  • usrRoot() - config/all/usrConfig.c,这就是系统第一个任务的入口地址,主要负责post-kernel的初始化,逐步加载系统服务,它内部同样由大量初始化函数组成

    • usrKernelCoreInit() - src/config/usrKernelCore.c,初始化内核的一些机制,包括Event、信号量的open机制、消息队列及open机制、看门狗、任务的open机制等

    • memInit() - src/os/mm/memLib.c,初始化系统内存池

    • usrMmuInit() - comps/src/usrMmuInit.c,初始化MMU

    • usrKernelCreateInit() - src/config/usrKernelCore.c,初始化内核对象的creation机制,例如任务、消息队列、看门狗

    • sysClkConnect() - src/drv/timer/xxxTimer.c,挂接系统时钟ISR,调用sysHwInit2()

    • sysHwInit2() - $(BSP)/sysLib.c,挂接中断,配置其它附加信息

    • iosInit() - src/os/io/iosLib.c,初始化IO系统

    • tyLibInit() - src/os/io/tyLib.c,初始化TTY库

    • ttyDrv() - src/os/io/ttyDrv.c,初始化TTY驱动

    • ttyDevCreate - src/os/io/ttyDrv.c,创建TTY设备

    • 初始化其它机制,例如任务级job机制、message logging库、管道驱动、标准IO库、ERF(Event Reporting Framework)库、设备管理、文件系统相关机制、pty(pseudo-terminal)驱动、存储设备加载、Boot Line解析等

    • bootAppShellInit() - src/boot/bootAppShell.c,初始化Boot Shell

    • Boot方式的初始化,例如文件系统、网络

    • bootApp() - src/boot/bootApp.c,启动Boot Loader主任务bootApp

  • bootAppTask() - src/boot/bootApp.c,bootApp的入口地址。它默认先等待7秒,如果Boot Shell接收到命令,则解析执行;如果7秒倒计时结束,则按照Boot Line将vxWorks镜像加载到RAM_LOW_ADRS,然后跳转到这个地址开始执行vxWorks

Boot之VxWorks的镜像类型

Boot之vxWorks启动顺序

Tool之VIP

Tool之DKM

Tool之Debugger

Vx7之VmWare

Vx7之VirtualBox

Component之netstat

Component之抓包工具

Component之Spy

C语言之关键字static

UGL之HelloWorld

UGL之绘制多边形

Net之UDP极简编程

Net之TCP极简编程

Net之MultiCast极简编程

Net之SCTP极简编程

Net之TFTP

Net之NFS

Task之消息队列

Component之CMD的0x10x10个命令

命令 简介
adrsp                Display information  on the address space.
alias                Add an alias or  display alias
arp                  IPNET arp control
bp                   Display, set or unset  a breakpoint
C                    Switch to C  interpreter
cd                   Change current  directory.
cpu                  Set/Get CPU affinity
date                 Show/Set current date
demangle             Display demangled  string
dprintf              Insert a dynamic  printf eventpoint
echo                 Display a line of  text
echoclient           TCP/UDP echo client
echoserver           TCP/UDP echo server
edr clear            Clear ED&R log
edr show             Display ED&R log
edr show  boot        Display ED&R  records caused by a boot
edr show  fatal       Display fatal records  from the ED&R log
edr show  info        Display information  records from the ED&R log
edr show  init        Display ED&R  records caused by initialization
edr show  interrupt   Display ED&R  records caused by an interrupt
edr show  kernel      Display ED&R  records created at the kernel-level
edr show  reboot      Display ED&R  records caused by a reboot
edr show  rtp         Display ED&R  records created by the RTP system
edr show  user        Display ED&R  records created at the user-level
exit                 Exit the shell  session.
expr                 Evaluate expressions
file  concat          Concatenate and  display files.
file copy            Copy files and  directories.
file  create          Create files or  directories.
file list            List the files in a  directory.
file move            Move (rename) files.
file  remove          Remove files or  directories.
ftp                  FTP client
func call            Call a given routine  with parameters.
getenv               Get an environment  variable
history  load         Load an history file  into the current shell session.
history  save         Save the current  shell session history.
ifconfig             IPNET interface  configuration
ipd                  ipd - Interpeak  daemon control
ipversion            Show interpeak  product versions
logout               Logout the shell  session.
lookup               Lookup a symbol
mem                  Memory debug tool
mem block  list       Display information  on allocated blocks.
mem block  mark       Mark allocated  blocks.
mem block  unmark     Unmark allocated  blocks.
mem dump             Display memory
mem info             Display memory  information
mem list             Disassemble and  display a specified number of instructions
mem  modify           Modify memory values
mem part  list        Display information  on memory partition instrumentation.
mem queue  flush      Flush the free queue.
mem rtp block  list   Display information  on allocated blocks.
mem rtp block  mark   Mark allocated  blocks.
mem rtp block  unmark Unmark allocated  blocks.
mem rtp part  list    Display information  on memory partition instrumentation.
mib2                 Print MIB-2  statistics
mmap list            Display information  on memory mapped objects.
module               Display the current  status for all the loaded modules
module  info          Display complete  information for a loaded module
module  load          Load an object module  into kernel memory
module  unload        Unload an object  module from kernel memory
more                 Browse and page  through a text file.
netstat              IPNET socket and  route stats
nslookup             Query Internet name  servers interactively
object  handle        Display the object Id  for an object handle.
object  info          Display information  on specified objects.
pcap                 Packet capture  utility
ping                 IPNET ping utility
pppconfig            ppp config
print  errno          Print a errno value
printf               Write formatted  output
pwd                  Display current  working directory.
qc                   IPNET output queue  configuration
qos                  IPNET Quality of  Service configuration
reboot               Reboot the system
repeat               Repeat a command
ripctrl              RIP daemon control
route                IPNET route table  control
rtp                  Display process list.
rtp  attach           Attach the shell  session to a process.
rtp  background       Run the current or  specified process in the shell background.
rtp  continue         Continue a process.
rtp  delete           Delete a process.
rtp  detach           Detach the shell  session from a process
rtp exec             Execute a process.
rtp  foreground       Bring the current or  specified process into the shell foreground.
rtp hooks            Display the list of  RTP hooks in the system.
rtp info             Display process  information.
rtp list             Display the list of  RTPs in the system.
rtp  meminfo          Display memory  information for a process.
rtp shl              Display the list of  shared libraries in the process.
rtp stop             Stop a RTP.
rtp symbols  add      Add symbols to a RTP  symbol table
rtp symbols  override Overrides RTP symbol  registration policy
rtp symbols  remove   Removes symbols from  a RTP symbol table
rtp task             Display a process  task list.
sd                   Display information  on shared data regions.
sd info              Display detail  information on shared data regions.
set                  Set the value of a  symbol 
set  bootline         Change the boot line
set  config           Set or display shell  configuration variables
set cwc              Set the current  working context of the shell session
set  deploy           Set or display the  system debug flag.
set env              Set or display shell  environment variables
set  history          Set the size of shell  history.
set  prompt           Set the shell session  prompt
set  symbol           Set the value of a  symbol
setenv               Set an environment  variable
shl                  Display information  on shared libraries.
shl info             Display detail  information on an SHL.
show  bootline        Display the boot line
show  devices         Display all  subsystem-known devices.
show  drivers         Display a list of  system drivers
show fds             Display a list of  file descriptor names in the system.
show  history         Display the shell  history events.
show  lasterror       Display the last  error value of a command.
slab                 Print slab cache  information
sleep                Suspend execution for  an interval.
sockperf             Network performance  test tool
socktest             Socket API test tool
spy                  Begin periodic task  activity reports.
spy  clkstart         Start collecting task  activity data.
spy  clkstop          Stop collecting task  activity data.
spy  report           Display task activity  data.
spy stop             Stop spying and  reporting.
string  free          Free a string  allocated within the kernel shell
syscall  hooks        Display the list  system call hooks.
syscall  monitor      Turn on system call  monitor for all system calls.
syscalls             Display system call  group information in the system.
sysctl               IPNET sysctl  configuration
syslog               syslog
sysvar               System variable tool
task                 Display a summary of  each task's TCB
task  continue        Continue from a  breakpoint
task  default         Set or display the  default task
task  delete          Delete a task
task  hooks           Display task hook  functions
task info            Display complete  information from a task's TCB
task regs            Set task register  value
task  resume          Resume a task
task  spawn           Spawn a kernel or an  RTP task with default parameters
task  stack           Display a summary of  each task's stack usage
task step            Single-step a task
task  stepover        Single-step, but step  over a subroutine
task stop            Stop a task
task  suspend         Suspend a task
task  trace           Display a stack trace  of a task
task wait            Display info about  the object a task is pending on
time                 Show/Set current time
tip                  Connect to one or  several remote systems over serial lines.
traceroute           Trace route command  for IPv4
ttcp                 ttcp - standard  performance test
ttcp1                ttcp - min priority
ttcp7                ttcp - max priority
unalias              Remove an alias
unset  config         Remove a shell  configuration variable
user                 User admin command
version              Display VxWorks  version information.
vm  context           Display information  on the virtual memory context.

猜你喜欢

转载自blog.csdn.net/pony12/article/details/115343261