The integrated VxWorks Target Simulator-vxsim provides a debugging and simulation runtime environment consistent with the real target machine, allows developers to develop and debug without BSP, operating system configurations, and hardware devices of the target machine.
Vxsim indicates the significance of software developers. It is mainly because software development in embedded system development is usually restricted by the hardware development progress. Because software development must lag behind hardware development, vxsim solves this problem to a certain extent, affecting the product R & D progress. This allows users to leave the hardware environment unavailable in the initial stage of engineering development, tornado can be used to design hardware-independent modules.
The following is a simple PC simulation as the target machine for simple development and Debugging Processes, mainly to replace the text description in an image, may provide some help for the preliminary reporters.
1. Create a project
2. Create a bootable VxWorks Image
3. Select a BSP package
4. Generate a project
5. generated project directory
6. Compile a main. C program
#include <stdio.h> int WinMain(void){int nCount = 1234;printf("hello world!\n");printf("This is a demo program!\n");}
7. Add the main. C program (right-click the project)
8. Add the project after main. c
9. Modify usrappinit. C as follows:
/* usrAppInit.c - stub application initialization routine *//* Copyright 1984-1998 Wind River Systems, Inc. *//*modification history--------------------01a,02jun98,ms written*//*DESCRIPTIONInitialize user application code.*/ /******************************************************************************** usrAppInit - initialize the users application*/ void usrAppInit (void) {#ifdefUSER_APPL_INITUSER_APPL_INIT;/* for backwards compatibility */#endifWinMain(); /* add application specific code here */ }
10. Set the dependency (right-click the project)
11. compile all (right-click the project)
Vxrm *. O *. RPO ctdt. c symtbl. c VxWorks **. out *. pl
Vxrm .. \ prjcomps. h .. \ prjparams. h .. \ prjconfig. C .. \ linksyms. c
Vxrm .. \ libs. nm .. \ libs. Size
Wtxtcl c: \ tornado2.2 \ host \ SRC \ hutils \ configgen. TCL... \ demo. wpj
Ccsimpc-C-g-mpentium-ANSI-fno-builtin-fno-defer-pop-I ..-ic: \ tornado2.2 \ target \ conf
IG \ simpc-ic: \ tornado2.2 \ target \ H-ic: \ tornado2.2 \ target \ config \ comps \ Src-ic: \ tornado2.2 \
Target \ SRC \ DRV-dcpu = simnt-dtool_family = GNU-dtool = GNU-dprj_build c: \ tornado2.2 \ target
\ Config \ simpc \ syslib. C-o syslib. o
Ccsimpc-g-mpentium-ANSI-fno-builtin-fno-defer-pop-I ..-ic: \ tornado2.2 \ target \ config \
Simpc-ic: \ tornado2.2 \ target \ H-ic: \ tornado2.2 \ target \ config \ comps \ Src-ic: \ tornado2.2 \ tar
Get \ SRC \ DRV-dcpu = simnt-dtool_family = GNU-dtool = GNU-dprj_build-C .. \ usrappinit. c
Ccsimpc-C-g-mpentium-ANSI-fno-builtin-fno-defer-pop-I ..-ic: \ tornado2.2 \ target \ conf
IG \ simpc-ic: \ tornado2.2 \ target \ H-ic: \ tornado2.2 \ target \ config \ comps \ Src-ic: \ tornado2.2 \
Target \ SRC \ DRV-dcpu = simnt-dtool_family = GNU-dtool = GNU-dprj_build .. \ prjconfig. C-o pr
Jconfig. o
Ccsimpc-C-g-mpentium-ANSI-fno-builtin-fno-defer-pop-I ..-ic: \ tornado2.2 \ target \ conf
IG \ simpc-ic: \ tornado2.2 \ target \ H-ic: \ tornado2.2 \ target \ config \ comps \ Src-ic: \ tornado2.2 \
Target \ SRC \ DRV-dcpu = simnt-dtool_family = GNU-dtool = GNU-dprj_build .. \ linksyms. C-o Lin
Ksyms. o
Ccsimpc-g-mpentium-ANSI-fno-builtin-fno-defer-pop-I ..-ic: \ tornado2.2 \ target \ config \
Simpc-ic: \ tornado2.2 \ target \ H-ic: \ tornado2.2 \ target \ config \ comps \ Src-ic: \ tornado2.2 \ tar
Get \ SRC \ DRV-dcpu = simnt-dtool_family = GNU-dtool = GNU-dprj_build-C .. \ main. c
Vxrm .. \ prjobjs. lst
Generating... \ prjobjs. lst...
Ccsimpc-g-mpentium-ANSI-fno-builtin-fno-defer-pop-I ..-ic: \ tornado2.2 \ target \ config \
Simpc-ic: \ tornado2.2 \ target \ H-ic: \ tornado2.2 \ target \ config \ comps \ Src-ic: \ tornado2.2 \ tar
Get \ SRC \ DRV-dcpu = simnt-dtool_family = GNU-dtool = GNU-dprj_build-C: \ tornado2.2 \ target \
Config \ comps \ SRC \ version. c
Ccsimpc-r-nostdlib-wl, @ .. \ prjobjs. lst \
Version. O-wl, -- start-group \
-LC: \ tornado2.2 \ target \ Lib \ simpc \ simnt \ GNU-LC: \ tornado2.2 \ target \ Lib \ simpc \ simnt \ common
C: \ tornado2.2 \ target \ config \ simpc \ simpcdrv. A-lcplus-lgnucplus-lvxcom-lvxdcom-l
Arch-lcommoncc-ldrv-lgcc-lnet-Los-lrpc-lwdb-lwind-lwindview C: \ tornado2.
2 \ target \ Lib \ libsimntgnuvx. A-wl, -- end-group-O partialimage. o
Nmsimpc-G partialimage. o @ .. \ prjobjs. lst | wtxtcl c: \ tornado2.2 \ host \ SRC \ hutils \ Munch. TCL
-C simpc> ctdt. c
Ccsimpc-C-fdollars-in-identifiers-g-mpentium-ANSI-fno-builtin-fno-defer-pop-I...-I
C: \ tornado2.2 \ target \ config \ simpc-ic: \ tornado2.2 \ target \ H-ic: \ tornado2.2 \ target \ config \ c
OMPs \ Src-ic: \ tornado2.2 \ target \ SRC \ DRV-dcpu = simnt-dtool_family = GNU-dtool = GNU-dprj_bui
LD ctdt. C-o ctdt. o
Ccsimpc-g-mpentium-ANSI-fno-builtin-fno-defer-pop-I ..-ic: \ tornado2.2 \ target \ config \
Simpc-ic: \ tornado2.2 \ target \ H-ic: \ tornado2.2 \ target \ config \ comps \ Src-ic: \ tornado2.2 \ tar
Get \ SRC \ DRV-dcpu = simnt-dtool_family = GNU-dtool = GNU-dprj_build-C: \ tornado2.2 \ target \
Config \ comps \ SRC \ datasegpad. c
Ldsimpc -- subsystem = Windows-E _ winmaincrtstartup c: \ tornado2.2 \ host \ x86-win32 \ i386-pc-min
Gw32 \ Lib \ crt1.o \
Datasegpad. O partialimage. O ctdt. O \
-T c: \ tornado2.2 \ target \ H \ tool \ GNU \ ldscripts \ link. simnt-O VxWorks
Wtxtcl c: \ tornado2.2 \ host \ x86-win32 \ bin \ simpctoexe. TCL VxWorks
Echo-V VxWorks
-V VxWorks
Done.
12. Enable vxsim lauch
13. Download the object file main. O, so that we can debug all the functions of Main. C.
14. Set a breakpoint of 6th rows in Main. C.
15. Run the program. The task starts with the winmain function.
16. After running the program, the program Pointer Points to the start point of the winmain function.
17. Let's take a look at the content in the watch window and vxsim interface at the program pointer operation.
A. Variable Window
B. vxsim content
18. Use the shell program
A. Shell help
->Help
Help print this list
H [N] print (or set) Shell history
I [task] Summary of tasks 'tcbs
Ti task complete info on TCB for task
Sp adr, argS... spawn a task, PRI = 100, opt = 0, STK = 20000
Sps adr, argS... spawn a task, PRI = 100, opt = 0, STK = 20000
And leave it susponded
TD task delete a task
TS task suspend a task
Tr task resume a task
Tw task print info about the object a task is pending on
W Summary of tasks 'pending Information
D [ADR [, nunits [, width] Display memory
M adr [, width] modify memory
Mregs [Reg [, task] modify a task's registers interactively
Version print VxWorks version info, and boot line
Type <CR> to continue, q <CR> to stop:
B display breakpoints
B ADDR [, task [, Count] Set breakpoint
Bd addr [, task] Delete breakpoint
Bdall [task] Delete All Breakpoints
C [task [, ADDR [, addr1] continue from breakpoint
S [task [, ADDR [, addr1] single step
L [ADR [, ninst] list disassembled memory
TT [task] Do stack trace on task
Bh addr [, access [, task [, Count] Set hardware breakpoint
Access: 0-Instruction 1-Write 1 byte
3-read/write 1 byte 5-write 2 bytes
7-read/write 2 bytes D-Write 4 bytes
F-read/write 4 bytes
Syssuspend suspend the system
Sysresume resume the system
Type <CR> to continue, q <CR> to stop:
Devs list Devices
Cd "path" set current working path
PWD print working path
Ls ["path" [, long] list contents of directory
LD [Syms [, noabort] [, "name"] load stdin, or file, into memory
(Syms = add symbols to table:
-1 = none, 0 = globals, 1 = All)
Lkup ["substr"] list symbols in system symbol table
Lkaddr address list symbol table entries near address
Printerrno value print the name of a status value
Period secs, ADR, argS... spawn task to call function periodically
Repeat N, ADR, argS... spawn task to call function n times (0 = forever)
Note: arguments specifying 'task' can be either task id or name.
Value = 0 = 0x0
->
B. view the Directory
-> Ls
The volume in drive C is not labeled.
The serial number of the volume is 782b-c07c.
C: \ vxworks_demo directory
[.] [...] [Default] demo. wpj demo. WSP
Linksyms. C main. c makefile prjcomps. h prjconfig. c
Prjobjs. lst prjparams. h usrappinit. c
10 files in 52,850 bytes
3 directories, 34,592,718,848 available bytes
Value = 0 = 0x0
->
C. Run the winmain function.
-> Winmain
Hello world!
This is a demo program!
Value = 24 = 0x18 = _ major_ OS _version _ + 0x14
->