Click here to load reader

read.pudn.comread.pudn.com/downloads82/doc/317894/%D6%D0%CE…  · Web viewVxWorks中文FAQ. 前言(Surface): 随着国内使用VxWorks的用户越来越多,为了方便VxWorkers少走一些弯路,特别推出了中文FAQ,其中

Embed Size (px)

Citation preview

VxWorksFAQ

Surface:

VxWorksVxWorkersFAQ

FAQcomp.os.vxworksFAQ

FAQ7

1.FAQ

2.TornadoFAQ

3.BSP FAQ

4. FAQ

5. FAQ

6.VxWorks FAQ

7. FAQ

Tornado/VxWorks

BEMAIL

Current Version:

version 0.1

History:

2002-08-27 wys205 create 0.1 version

Content:

1.FAQ

2.TornadoFAQ

2.1

2.2

2.3 FTP

2.4

2.5

2.6 MAKEFILE

2.7

2.8

2.9 Shell

2.10 Telnet

2.11 Tornado

2.12

2.13

2.14 Windsh

2.15 WindView

3.BSP FAQ

3.1 BSP

3.2

3.2.1 Power PC

3.2.2 I960

3.2.3 MIPS

3.2.4 ARM

3.2.5 x86

3.3 Bootstrap

3.4 VxWorks

3.5 VME

3.6 VxWorks environment

3.6.1 usrSerial.c

3.6.2 prj_vxworks.tcl

3.7 PCI

4. FAQ

4.1 Dos

4.2 Flash

4.3 Floppy-disk

4.4 RAM-disk

4.5

5. FAQ

5.1

5.2 ARP

5.3 DHCP

5.4 FTPTFTP

5.5 PPP

5.5.1 PPP on Windows 95

5.5.2 PPP on Windows NT

5.5.3 PPP on Solaris

5.6 Sockets

5.7 Telnet

5.8 SNMP

5.9

6.VxWorks FAQ

6.1 C++ issues

6.2 Communication problems

6.3 Interrupts

6.4 LoadModule problems

6.5 pthreads

6.6 Reboot

6.7 Semaphores

6.8 Simulator (VxSim)

6.9 Task related items

6.10 Time/timer related items

6.11 Wind Web Server related items

6.12 Zinc/windML related items

6.13 Other items

6.14 VxWorks AE issues

7. FAQ

7.1 Hard delay

7.2 Memory leaks

7.3 Corba engines

7.4 Web servers

7.5 NTP usage

7.6 Performace / Benchmarks

7.7 SNMP

7.8 Lint

7.9 Encryption

7.10

A.

B.

1.FAQ

1.1

1.1.1 VXWORKS

1)BSPbootImageVxWorksImageBSPBootImageVxWorksImage

VxWorks Image?

2)VxWorksVxworksImage

romflash

A:BSP , VxWorksImg.

ROM, BootImgROM,

. ROM,

VxWorksImg, .

BSP(CPU)VxWorksKernel

()

(by )

bsp

Bootimageboot

OSvxworksimage vxworksimage-vxworks

object imagesbootimage

(by hongwind )

1.1.2 VXWORKPSOS?

A:51

MINIXUNIX

VXWORKSPSOS

WINDOWS (by bruin)

1.2

1.2.1 tornadocpu??

tornadocpu??

A: Windows NT, Sun Solaris, SunOS, HP-UX, Win95

: x86, 68k, PPC, CPU 32, i960, SPARC, SPARCLite, SH, ColdFire, R3000, R4000,

C16X, ARM, MIPS ...

1.3

1.3.1 vxworks,bsp,

MAMR_PTA_SHIFT

A:h/drv/multi/ppc860Siu.hSource Insight

(by vxfree)

2.TornadoFAQ

2.1

2.1.1

ldppc:built in linker script:43: syntax error

A-r

(From: [email protected])

2.1.2

APPC

http://www.newgcc4vxworks4ppc.cjb.net/

2.1.3 GCC

A-WallC++

-x c++.(From: Claudio Ortega, [email protected])

-WallBruce Evans

FreeBSDBDECFLAGS

# BDECFLAGS are a set of gcc warning settings that Bruce Evans has suggested

# for use in developing FreeBSD and testing changes. They can be used by

# putting "CFLAGS+=${BDECFLAGS}" in /etc/make.conf. -Wconversion is not

# included here due to compiler bugs, eg: mkdir()'s mode_t argument.

#

BDECFLAGS= -W -Wall -ansi -pedantic -Wbad-function-cast -Wcast-align \

-Wcast-qual -Wchar-subscripts -Winline \

-Wmissing-prototypes -Wnested-externs -Wpointer-arith \

-Wredundant-decls -Wshadow -Wstrict-prototypes -Wwrite-strings

This set of flags is *much* pickier than -Wall alone.

(From: W Gerald Hicks)

2.1.4 missing symbol "__eabi"

AmainPPC "extended Application Binary Interface" (eabi)

main__eabi

GNUmain __eabi

TornadomainVxWorks

main

(From: Ilia, [email protected])

2.1.5 2.95.2

ctdt

ctdt.o(.data+0x3c):fake: undefined reference to `global constructors keyed to

_constructor_name_

...

A: gccver2.7.2-2.95.2

vxworks

gcc 2.95.2

in [source code dir]/gcc/config/arm/vxarm.h, at the very end, add:-

/* More DK patches: we undef these two in order to force the */

/* compiler to output our static constructors and destructors */

/* in the fashion to which it is accustomed.... */

#undef ASM_OUTPUT_CONSTRUCTOR

#undef ASM_OUTPUT_DESTRUCTOR

/* This one is so that GLOBAL_THING gets a $ in it's name */

#undef NO_DOLLAR_IN_LABEL

make clean

PPCmaking munchable constructors

(From: Dave Korn)

2.1.6

nm386 -g partialImage.o @B:\Sources\Components\Common\Common_Geni_Test\Src\prjObjs.lst | \

wtxtcl D:\Tornado\host\src\hutils\munch.tcl -asm 386 > ctdt.c

...

cc386 -nostdlib -r -Wl,-X partialImage.o ctdt.o -o VxWorksGeniServerTestExe.out

(linking partialImage.o to ...out)

A: munching,

munch"grep GLOBAL"

nm386 -g partialImage.o @B:\Sources\Components\Common\Common_Geni_Test\Src\prjObjs.lst

| grep GLOBAL | \

wtxtcl D:\Tornado\host\src\hutils\munch.tcl -asm 386 > ctdt.c

(From: Dave Korn)

2.1.7

Q: How do define a structure without holes in it?

A: vxworksGNU

struct ex {

INT8 source;

INT32 txSize;

INT32 datSize;

INT16 cmd;

} __attribute__ ((packed));

typedef struct ex PackedStruct;

-fpack-structC++

30%-100%

__attribute__ ((packed))

(From: Mark Fanara, [email protected], and Francisco Pataro, [email protected])

2.1.8 CC++

A: CC++C++extern "C";

(From: Dave Korn)

2.1.9 -fvolatile

A: WRSkernel/BSP-fvolatiletarget/h/make/

-fvolatiletornadomakefile

BUG

-fvolatileconservative(p->x++)

(68k example):

addql #1,a0@(8)

-fvolatile

movel a0@(8),d0

addql #1,d0

movel d0,a0@(8)

movel a0@(8),d0

You can imagine what a C++ application using the "this" pointer everywhere gets compiled into!

(From: Chris Varlese, [email protected])

2.1.10

A:

1$(LIBS)$(LD_PARTIAL) -o vxWorks.tmp $(MACH_DEP) usrConfig.o version.o

$(LIBS) (target/h/rules.bsp) Now LD_PARTIAL is ccxxx, so you need to specify -Wl,

--group-start to get cc to pass the argument to ld.

2Try adding a -Usymbol for each symbol that has to be pulled in early.

32 make ld.s

4UNIXld

/*

1$(LIBS) is substituted into: $(LD_PARTIAL) -o vxWorks.tmp $(MACH_DEP) usrConfig.o version.o

$(LIBS) (in target/h/rules.bsp for a non-project build). Now LD_PARTIAL is ccxxx, so you need

to specify -Wl,--group-start to get cc to pass the argument to ld.

2Try adding a -Usymbol for each symbol that has to be pulled in early.

3If (2) make the ld line too unwieldy, generate a .s file that contains: .extern symbol for

each undefined symbol and include that into the link before the libraries

4If your building on unix, it ought to be possible get ld to generate the required list of

undefines! You need to add a loop! Something like this might work:

*/

[ ! -f undefs.s ] && echo "#" >undefs.s

while

$(CC) -c $(CFLAGS) undefs.s

$(LD_PARTIAL) -o vxWorks.tmp $(MACH_DEP) usrConfig.o version.o \

undefs.o $(LIBS)

$(NM) vxWorks.tmp | grep ' __' | $(MUNCH) > ctdt.c

$(MAKE) CC_COMPILER="-fdollars-in-identifiers" ctdt.o

do

$(LD) $(LDFLAGS) -e $(SYS_ENTRY) $(LD_LOW_FLAGS) -o vxWorks \

dataSegPad.o vxWorks.tmp ctdt.o tad_hook_list.o 2>&1 | tee ld.errs |

while read file undef ref to symbol

do

[ "$undef" = "undefined" ] || continue

[ "$ref" = "reference" ] || continue

[ "$to" = "to" ] || continue

oifs="$IFS"

IFS="'/`"

symbol="`echo $symbol`"

IFS="$oifs"

echo "\t.extern\t$symbol"

done | sort -u - undefs.s >undefs.new

cmp -s undefs.s undefs.new && break

mv undefs.new undefs.s

done

cat ld.errs

ESC; \make

(rules.bspvxWorks)

(From: David Laight, [email protected])

2.1.11 "trigraphs occured"?

A: TornadoVxoworks

--K&R (Kernighan & Ritchie; A12.1 -

ANSI -- GNU"You don't want to know about this brain-damage..."

-ansi-trigraphs'??X' (K&RX

)

(From: [email protected])

2.1.12

.out

1) partialImage.o

2) partialImage.omunch

3) (ctdt.o)

4) ctdt.oobjpartialImage.o

.out10Msize3861M

5Step #1-335step #4

530

A: step #4partialImage.o 45s.

(ld386)

tornado\target\h\make\rules.vxApp

step $4:

$(LD_PARTIAL) $(LD_PARTIAL_LAST_FLAGS) partialImage.o ctdt.o -o $@

$(LD_PARTIAL) $(PRJ_OBJS_FOR_LD_PARTIAL) $(PRJ_LIBS) ctdt.o -o $@

(From: Ole Asbjorn Fadum, [email protected])

Some more information.

For a variety of reasons I've had to do a few build on a slow system. One bit that seemed

exceptionally slow is the 'binToAsm' call (just after the 'deflate' generating vxWorks.Z.s).

This is done by

od -bv $infile |

sed -e "s/^[0-9]*[ ]*//;

s/ /, 0/g;

/^[0-9a-fA-F][0-9a-fA-F]/s/^/ .byte 0/"

(ie use od to generate a list of octal bytes, remove the offset, change the spaces to comma,

add the directive - an extra 0 is added to each number to ensure they are octal).

The above is terribly slow... Slightly faster (under solaris) is:

od -An -v -tu1 $infile | tr ' ' ',' |

sed -e 's/,00*\([0-9]\)/,\1/g;s/^,/ .byte /'

However it is clear that a C program would be even faster... It was still sluggish using

printf, so...

char map[256][4];

for (count = 0; count optionsdebuggeralways halt after attaching a taskAuto Attach to

task -> Always

(Shift F9)mainTask

(From: Chacha Hindustani, [email protected])

2.2.3 SHELL

A: shell

d()l()

magic code

The shell is an unbreakable task, so all the time it is running the breakpoints are not

installed. When a context switch causes a breakable task to run, the breakpoints will be

resinstated.

So, to see the breakpoint in memory simply spawn the d() command or l() command. That will

then run in a breakable task, and you should see the magic code inserted to cause

an exception.

(From: John, [email protected])

2.3 FTP

5.4

2.4

2.4.1 romVxWorks(vxWorks_rom),elftobinbin

(vxworks_rom.bin),

C:\project\Project3\default\elftobin vxWorks_rom.bin

seg1 : Expected load address 0xfff00100 but file address is 0x00111670

A: PPCSPR#8845. elftobin

2.4.2 WTX

A: Tornado 1.0.1 Windows NT 4.0WTXTornado API

build.VC++6

$(WIND_BASE)\host\src\wtxtest

(includes,)

C/C++, Preprocessor:

include

C:\Tornado_03\share\src\wtx,C:\Tornado_03\host\include

HOST

Link,General

C:\Tornado_03\host\x86-win32\lib\wtxapidll-d.lib

WIND_REGISTRY

wtxEnvironSet()Windsurf

WIND_REGISTRYTornado

Set it and poof

wtxProbe()

##http://www.xs4all.nl/~borkhuis/vxworks/wtxSample.c

(From: Christopher A Leddy, [email protected])

2.4.3 wtxwishinit.tcl

A: TCL_LIBRARYTK_LIBRARY $(WIND_BASE)/host/tcl/tcl and

$(WIND_BASE)/host/tcl/tk. init.tclTCL_LIBRARYtk.tcl

$(WIND_BASE) TCL/TK

wtxwish

(From: DrDiags, [email protected])

2.4.4 windows NT4.0 SP5Tornado2.0vxsys "the system

try to access directly to the disk, this is not possible ....."

A: vxsysDOSwindowsDOS

(From: Andray Kaganovsky, [email protected])

2.4.5

A: Tornadovxencrypt

sum( p[i] * i ^ i )) * 0x1e3a1d5HEXASCII2^32

loginEncryptInstall()[1]KEY

UNIXDESTEAhttp://vader.brad.ac.uk

[1] problematical since you have difficulty protecting the password file as none of the

vxWorks filesystems support user-ids.

(From: David Laight)

2.5

2.5.1 GNUaux.h:permission denied

A SW"AUX""AUX."

"LPT1.TXT"

2.5.2 TornadoCTornado

ATornado.reg

windows95NT982000

View->Options->File Types."C""C"

c-files.reg20

[HKEY_CLASSES_ROOT\c_source_file]

COPYc-files.regvimBTWvim

http://www.vim.org

: c-files.reg##http://www.xs4all.nl/~borkhuis/vxworks/c-files.reg

2.5.3 Tornado.Tornado

A

Tornado

: TornadoFileTypes.reg##http://www.xs4all.nl/~borkhuis/vxworks/TornadoFileTypes.reg

2.5.4 CPU

A

Tornado 2.0.1 for ARM

2.02.0.2MIPSidts134 BSP

1)host\resource\tcl\wtxcore.tcl

toolsfgnugnu.iftoolsfgnu.MIPS

MIPS

2)host\resource\tcl\app-config\Browser:

line 138 obj...sfgnuvxCPUobj...gnuvx.

This problem can be solved by replacing this line with the follwoing lines:

if { $cpuType($cpuId) == "RC32364" } {

set name [wtxPath target lib obj$cpuType($cpuId)sfgnuvx]spyLib.o

} else {

set name [wtxPath target lib obj$cpuType($cpuId)gnuvx]spyLib.o

}

RC32364

2.6 MAKEFILE

2.6.1 MakeINCLUDE

AC/C++-Ibuild

VPATH

$(filter-out -I.,$(filter -I%,$(CFLAGS)))

includeVPATH

Bob Baker ([email protected]):

Tornado 2'No rule to make target'

:":"VPATH" :"": "" : ""\","/","\\"

(E.G. using ':' for VPATH separators instead of spaces. Using 'space :' or ': space' or

'space : space', changing the order of the macro's, forward slashes, back slashes, double

slashes, pointing the PC screen south at dawn etc the problem turned out to be incompatibility

between tornado 2 and win95/98. )Tornado2WIN95/98

NTbuild

win95win98build

VPATHNT

2.6.2 makeBSP(sysSerial.c)?

A: TornadoincludeBSP(target\config)

BSP""

"Read-only dependency path".....\target\config

BSP

(From: [email protected])

.....\target\config\compsBSP

comps

2.6.3 (linker list)

A: buildmakemakebuild

Macros: Name: LD_PARTIAL_FLAGS_FOR_PARTIALIMAGE

Value: -Wl,-Map,$(basename $(notdir $(PRJ_FILE))).link

$(PROJECT_OUT)rules.vxAppLD_PARTIAL

$(LD_PARTIAL) $(LD_PARTIAL_FLAGS_FOR_PARTIALIMAGE) \

$(PRJ_OBJS_FOR_LD_PARTIAL) $(PRJ_LIBS) -o partialImage.o

linker--.link.o

partialImage.opartialImage.o

2.6.4 C

A: makefile

%.out: %.o

@objdump$(TOOLENV) -S $< < $@

This will generate a file called .out containing C and assembly code. You need to have

the -g flag for the compiler to get debug informtion in the output file. This information is

needed by objdump.

But this is probably not enough. By default VxWorks puts a name in the object file. This name

consists of the absolute path of the project directory with the complete path of the file name

appended to it. (This can be seen with the command "objdump$(TOOLENV) --debugging

", in the first few lines the filename is given.) This is caused by the fact that

the compiler is called with the complete path of the sourcefile. This can be changed to ".." in

the Makefile. But the Makefile is generated each time the configuration is changed.

To correct this the file prj_vxApp.tcl can be changed to write ".." to the Makefile istead of

the complete path. This is done in the function makeGen. The original line in this function is:

puts $fd "PRJ_DIR = [file dir [prjInfoGet $hProj fileName]]"

This should be changed to:

puts $fd "PRJ_DIR = .."

(With assistance from Bill Pringlemeir, [email protected])

2.6.5 .o

A: EXTRA_MODULES

../make clean

rebuild

2.6.6 make manBSPsysLib.c

BSP MakefileDOC_FILES

AmakeDOC_FILES

1) makefileDOC_FILES

DOC_FILES= sysLib.c sysTffs.c tycoDrv.c myFile.c

2) rules.x86-win32DOC_FILES

from:

docs:

@echo Processing

@for %f in (sysLib sysTffs tyCoDrv) do @if exist %f.c @echo %f.c & \

$(CPP) $(CASFLAGS) -C $(DOCFLAGS) %f.c > %f.i & \

to:

docs:

@echo Processing

@for %f in ($(basename $(DOC_FILES))) do @if exist %f.c @echo %f.c & \

$(CPP) $(CASFLAGS) -C $(DOCFLAGS) %f.c > %f.i & \

windowsunix

2.6.100 MAKEFIEL

$(WIND_BASE)/host/include/make/generic2.mh[! -d ./$(HOST) ]

.....

objdircre:

if [! -d ./$(HOST) ]; then \

mkdir ./$(HOST); \

fi

....

HOST=x86-win32

A:makefiletornadohostcygwinshell

tornadohostcygwinunix

(by bestracer)

2.7

2.7.1 usrConfig.c

ATornado 2.0usrConfig.c,target/config/comps

usrConfig.cmake target/config/yourBsp Makefile

(From: Roie Geron, [email protected])

2.7.2 Tornado?

A: bootable:

wtxtcl /host/src/hutils/configGen.tcl .wpj

Tornadobuild

downloadableconfigGenmakeGen.tcl

(#http://www.xs4all.nl/~borkhuis/vxworks/makeGen.tcl#),../host/src/hutils

Makefile

wtxtcl /host/src/hutils/makeGen.tcl .wpj

.wpj

2.7.3 Tornadoinclude-I

VPATH

A#include "xxx\xxx\xxx.h"#include "xxx/xxx/xxx.h",

(From: [email protected])

2.8

2.8.1 Tornadotarget server?

A:DOSTornadotarget server,

DOS

(From: John Finley, [email protected])

2.8.2

Atarget serverCache,1M

(From: Wade Oram, [email protected])

2.8.3 target serverWTX

Aregistry,target server,IP

registry

"localhost"Windows registryregistryWTX

localhost127.0.0.1,,127.0.0.1

WindowsIP

routeNetAdd

(From: Markus Mitterer, [email protected] and [email protected])

2.8.4 SHELL"The target system is not initialized yet. Can't roceed."

A"Core filea""vxWorks"(core file),

"vxWorks_rom""synchronize host/target symbol table"

2.9 Target Shell

2.9.1 shelldosFsDevInitshell

DOSFS

AwierddosFsLibRAMHASH

hashLib

INCLUDE_STAT_SYM_TBL

INCLUDE_STAT_SYM_TBL dosFsInithashLibInit()

(From: Leonid Rosenboim, [email protected])

2.9.2 windshell windsh.tcl.wind

Awindshellbug,TornadoC:,

windsh.tclc:\.wind

2.9.3 ping "myHost"shell

Ashellshell

ping

pingaddress = "myHost"

memShow

ping pingaddress

memShow

(From: Urban Lindberg, [email protected])

2.9.4

A/target/src/usr/usrLib.c repeat

(From: Werner Schiendl,[email protected])

2.9.5 "lkup"2

Alkup "^[a-z][a-z]$"3lkup "^[a-z][a-z][a-z]$"

From: [email protected])

2.9.6 SHELL128

A

128

(From: Don Small, [email protected])

2.9.7 SHELL

ASHELLSHELLSHELL

/*******************************************************/

shelltid = taskNameToId("tShell");

taskDelete(shelltid);

for( ; ; )

{

// read

}

shellInit(0,TRUE);

/*******************************************************/

(From: Mridul Gupta, [email protected])

2.9.8 shell

Ahttp://www.xmission.com/~bgeer/bgsh.html: BGSH: A VxWorks Shell With Command Line

Editing.

(From: Pekka Taipale, [email protected])

2.9.9 SHELL

A

-> shellToFile("ifShow","ifShow.out")

//

//

// This function runs a shell command and captures the output to the

// specified file

//

extern int consoleFd;

typedef unsigned int (*UINTFUNCPTR) ();

extern "C" int shellToFile(char * shellCmd, char * outputFile)

{

int rtn;

int STDFd;

int outFileFd;

outFileFd = creat( outputFile, O_RDWR);

printf("creat returned %x as a file desc\n",outFileFd);

if (outFileFd != -1)

{

STDFd=ioGlobalStdGet(STD_OUT);

ioGlobalStdSet(STD_OUT,outFileFd);

rtn=execute(shellCmd);

if (rtn !=0)

printf("execute returned %d \n",outFileFd);

ioGlobalStdSet(STD_OUT,STDFd);

}

close(outFileFd);

return (rtn);

}

(From: RonnoBonno, [email protected])

2.9.10

Anmxyz,

#> nmppc vxWorks | grep ftpsActive

0023dc60 d ftpsActive

(From: Toni Kurzberger, [email protected])

2.10 Telnet

5.7

2.11 Tornado

2.12

2.13

2.14 Windsh

2.15 WindView

3.BSP FAQ

3.1 BSP

3.2

3.2.1 Power PC

3.2.1.1 MPC860BSP

lis r3, 0x0090

ori r3, r3, 0x0000 #plp=9, 50M clk

stw r3, PLPRCR(r4) #PLPRCR

LISORISTW

APowerPC

lis r3, 0x0090 ;0x0090r3

Rejoicer:r30

ori r3, r3, 0x0000 #plp=9, 50M clk ;""r3

Rejoicer:r30x00

stw r3, PLPRCR(r4) #PLPRCR ;PLPRCR(r4)#PLPRCR,r3

Rejoicer: r3 r4 + PLPRCR (PLPRCR)r4IMMR

3.2.1.2 mpc860

A

3.2.1.3 mpc860,veisionice

CLKOUT125M5MMODCK [1-2] 10[MF+1]8

40MCLKOUT5M

A:clkoutCLK860860

3.2.1.4 860,860BSP romInit.s, romStart(),

romstart() .

romstart= romstart - romInit + ROM_TEXT_ADRS

,,C,\

.,,C

who can help me ? thanks

AROM_TEXT_ADRS=romInit,romstart=romstart,ROM_TEXT_ADRS

romInit,romstart. C.

.romstart.

bootrom.binromInit,romStart,ROM_TEXT_ADRS

.romIinit.sNVRAM

romStart,romInit

ROM_TEXT_ADRS,bootRomromStart

(romStart - romInit) + ROM_TEXT_ADRS

3.2.1.5 vxworksapimac

A1MPC860,

char macBuffer[8]; // MAC

sysCpmEnetAddrGet(0, macBuffer);

MAC.

A2api

860 scc 8260 FccPADDR1_H,-M -L

BSPunsigned char sysFccEnetAddr [6]

syslib.c

A3:vxworksBSPsysCpmEnetAddrGet

BSP

3.2.2 I960

3.2.3 MIPS

3.2.4 ARM

3.2.5 x86

3.2.4.1 Vxworks for x86BIOS,

Vxworks for x86BIOS

CPUADLINKNuPP0-760,

BIOS

A:

BIOSVxWorksVxWorksBIOS

(by vxfree)

sysinbyte()sysoutbyte()BIOS,0X700X71,.

(by dongdd)

3.3 Bootstrap

3.4 VxWorks

3.5 VME

3.6 VxWorks environment

3.6.1 usrSerial.c

3.6.2 prj_vxworks.tcl

3.7 PCI

3.7.1 PCIPCIpciFindDevicePCI

PCI

A:pciFindDevicepciConfigInByte/Word/Long, pciConfigOutByte/Word/Long

sysLib.c::sysPhysMemDesc[]pciIntConnectPCI

intConnect

4. FAQ

4.1 Dos

4.1.100 dosroot directory32

fat16root directory16

16

A:32,16H2=*2048+*32++2

18H2=-1980*512+*32+

(by zongj)

4.2 Flash

4.3 Floppy-disk

4.4 RAM-disk

4.5

5. FAQ

5.1

5.100 VxWorks

A:NE2000

NE200050X320NE200090X300

BSP

bsp\config.h:

#define IO_ADRS_ENE 0x320

#define INT_LVL_ENE 0x05

#define IO_ADRS_ENE1 0x300

#define INT_LVL_ENE1 0x9

#define INT_VEC_ENE1 (INT_VEC_GET (INT_LVL_ENE1))

bsp\confignet.h:

#ifdef INCLUDE_ENE_END

{0,END_ENE_LOAD_FUNC,END_ENE_LOAD_STRING,END_ENE_BUFF_LOAN, NULL, FALSE},

{1, END_ENE_LOAD_FUNC,END_ENE_LOAD_STRING, END_ENE_BUFF_LOAN, NULL, FALSE},

#endif /* INCLUDE_ENE_END */

bsp\sysNe2000End.c

if (pParamStr[0] == '0')

sprintf (cp, ne2000ParamTemplate,

IO_ADRS_ENE,

INT_VEC_ENE,

INT_LVL_ENE,

ENE_BYTE_ACCESS,

ENE_USE_ENET_PROM,

ENE_OFFSET);

else if (pParamStr[0] == '1')

sprintf (cp, ne2000ParamTemplate,

IO_ADRS_ENE1,

INT_VEC_ENE1,

INT_LVL_ENE1,

ENE_BYTE_ACCESS,

ENE_USE_ENET_PROM,

ENE_OFFSET);

printf ("ne2000EndLoad: %s.\n", paramStr);

if ((pEnd = ne2000EndLoad (paramStr)) == (END_OBJ *)ERROR)

{

printf ("Error: NE2000 device failed ne2000EndLoad routine.\n");

}

In the Project Menu, find the object name IP_MAX_UNITS, change it to 2. and build it .

ipAttachusrNetIfConfig setup the second network cards.

5.2 ARP

5.3 DHCP

5.4 FTPTFTP

5.5 PPP

5.5.1 PPP on Windows 95

5.5.2 PPP on Windows NT

5.5.3 PPP on Solaris

5.6 Sockets

5.7 Telnet

5.8 SNMP

5.8.1 snmp,snmpmib

client

AMIB,OEM,,SNMPSNMP

(IP),(..),(...).

,.,,

.,().IP,.

SNMPOID

A

OIDMIB,1.3.6.1.2.1.....MIB,.

MIB,MIB,MIB-1,MIB-2,RFC,MIB,

.

5.9

5.9.100 VxWorksping?

Tornado2 prototyper for NT,NT4ULIP"90.0.0.254".

bootable Imag project,PING

shellping "90.0.0.254",4,0 ping "90.0.0.1",4,0 ping

A: ping,ULIP,ROUTE ADD,,

IP FORWARDING.(by besea)

TCP/IP

168.8.8.6255.255.0.0 168.8.8.66

ULIP90.0.0.254,255.255.255.0 :168.8.8.6

VxWorkping 168.8.8.66,Sniffer

source address: 90.0.0.1

destination address: 168.8.8.66

ECHO REPLAY

(by explore)

6.VxWorks FAQ

6.1 C++ issues

6.1.100 Vxworks:

,,

Errors while downloading D:/Tornado/target/proj/simtest/SIMNTgnu/simfun.out:

___6mytest

__$_6mytest

.

extern"C" {

class mytest

{

public:

mytest();

~mytest();

int add(int x,int y)

{

return (x+y);

}

};

mytest tmyt;

}

Acpp() extern"C" ,.cpp!

6.1.101 c and c++,tornadoc and c++ ,c++test.cpp

srAppinit.cmyFuc();test.cpptest.c

A.cppC++C

Cextern "C"C.

6.2 Communication problems

6.2.100 (Message Queues)

msgQReseive()msgQSend()

1.

2.

A:FIFO

msgQReceive

(by bruin)

6.3 Interrupt

6.3.1 VxWorksISR

VxWorksMUX

cpu(by superme )

MACCPUCPU

MACMACMACCPU

ISRMACISRintConnect()

MACVxWorksISR

MUXISR

(by moonlight )

>1CPU

>2x86CPU

> PowerPC0x5000x500

>3CPUstub

> stubintConnect()

> ISRPowerPCstubBSP

>

> intConnect()

>

>4ISRstub

>

>END driverxxEndLoad()xxEndStart()

>MUXmuxDevLoad()muxDevStart()BSP

>

> muxLibInit();

> muxDevLoad(xxEndLoad,...);

> muxDevStart(pXxEndObj);

>

>muxDevLoad()xxEndLoad

>xxEndLoadEND

>muxDevStart()xxEndStartxxEndStart

>intConnect, intEnable

>

>mux

>END drivermux

(by moonlight )

6.3.2 ,ADSARMIRQ0x18

0x00000018 B IRQ_HandlerIRQ_Handler

enable

A

Install_Handler

unsigned Install_Handler (unsigned routine, unsigned *vector)

{ unsigned vec, oldvec;

vec = ((routine - (unsigned)vector-0x8)>>2);

if (vec & 0xff000000)

{

printf ("Installation of Handler failed");

exit(1);

}

vec = 0xea000000 | vec;

oldvec = *vector;

*vector = vec;

return (oldvec);

}

A

1)INTST1IRQ1

IRQenable,ISR

2)IRQIRQ

FIQARMFIQIRQ,IRQ

INTMR1IRQFIQ,disableFIQ.

6.4 LoadModule problems

6.5 pthreads

6.6 Reboot

6.7 Semaphores

6.8 Simulator

6.8.1 simulator

simulatorISR

TIA (by wys205)

A:vxworksISR

simulator

mail

#include "vxWorks.h"

#include "intLib.h"

#include "iv.h"

#include "taskLib.h"

#include "logLib.h"

#include "stdio.h"

#include "semLib.h"

void myISR(int);

void myTask();

SEM_ID myBinary;

#define MY_INUM 0xC011 /* Windows message, in fact */

/*-----------------------------------------------------------------------*/

void vxmain()

{

printf("inum = 0x%x, ivec = 0x%x\n", MY_INUM, INUM_TO_IVEC(MY_INUM));

myBinary = semBCreate(SEM_Q_FIFO, SEM_EMPTY);

taskSpawn("tMyTask", 80, 0, 20000, (FUNCPTR)myTask,

0,0,0,0,0,0,0,0,0,0);

if (intConnect((VOIDFUNCPTR *)INUM_TO_IVEC(MY_INUM),

(VOIDFUNCPTR)myISR, 0) != OK)

perror("intConnect()");

}

/*-----------------------------------------------------------------------*/

void myISR(int param)

{

logMsg("task is %s\n", (int)taskName((int)taskIdCurrent), 0, 0, 0, 0, 0);

semGive(myBinary);

}

void myTask()

{

int count = 0;

while (1) {

semTake(myBinary, WAIT_FOREVER);

printf("myTask: semaphore taken, count = %d\n\n", count++);

}

}

(by vxfree)

simulator

simulator,vxfree

void CAboutDlg::OnButton1()

{

// TODO: Add your control notification handler code here

HWND hwnd ;

hwnd= ::FindWindow(NULL,"VxWorks Simulator for Windows");

if(hwnd!=NULL)

::SendMessage (hwnd,0xC011,0,0);

}

(by wys205)

6.8.2 vxworksvxworkstornado

.......

int teststdio()

{

char buffer[10];

char *tn = "tmpxxx"; //

FILE *pf = NULL;

int result = 0;

/*fpos_t fp1;

long off;*/

/* opening a file for both reading and writing */

result += ASSERT((pf = fopen(tn, "w+")) != NULL);

/* closing the file */

result += ASSERT(fclose(pf) == 0);

/* reopening the file and attaching the standard input stream to the file */

result += ASSERT(freopen(tn, "r", stdin) == stdin);

.....

/

A:char *tn = "tmpxxx"; //

simNT"host:"

char *tn="host:/myFile";

(by wys205)

6.9 Task related items

6.10 Time/timer related items

6.11 Wind Web Server related items

6.12 Zinc/windML related items

6.13 Other items

6.13.100 vxworksErrNo,

A:

-> printErrno(0x0001)

0x1 = S_errno_EPERM

value = 0 = 0x0

-> malloc(0x7fffffff)

value = 0 = 0x0

-> printErrno

0x110001 = S_memLib_NOT_ENOUGH_MEMORY

value = 0 = 0x0

(by vxfree)

6.14 VxWorks AE issues

6.15 I/O

6.15.1 serial device

shell

-> pDevHdr = iosDevFind ("/tyCo/0",0)

Exception number 0: Task: 0x4bbc8e8 (t1)

General Protection Fault

Program Counter: 0x0041eba5

Status Register: 0x00010202

......

void tyShow

(

TY_DEV * pTyDev

)

{

/* read - ring buffer and semaphores */

printf ("Address of pTyDev->rdBuf = 0x%08x.\n", &pTyDev->rdBuf);

printf ("Address of pTyDev->rdSyncSem = 0x%08x.\n", &pTyDev->rdSyncSem);

printf ("Address of pTyDev->mutexSem = 0x%08x.\n\n", &pTyDev->mutexSem);

/* rdState */

printf ("pTyDev->rdState.xoff = 0x%02x.\n", pTyDev->rdState.xoff);

printf ("pTyDev->rdState.pending = 0x%02x.\n", pTyDev->rdState.pending);

printf ("pTyDev->rdState.canceled = 0x%02x.\n", pTyDev->rdState.canceled);

printf ("pTyDev->rdState.canceled = 0x%02x.\n", pTyDev->rdState.canceled);

/* write - ring buffer and semaphores */

printf ("Address of pTyDev->wrtBuf = 0x%08x.\n", &pTyDev->wrtBuf);

printf ("Address of pTyDev->wrtSyncSem = 0x%08x.\n\n", &pTyDev->wrtSyncSem);

.....

A:

->buf=malloc(100)

->pDevHdr=iosDevFind("/tyCo/0", buf)

(by vxfree)

7. FAQ

7.1 Hard delay

7.2 Memory leaks

7.3 Corba engines

7.4 Web servers

7.5 NTP usage

7.6 Performace / Benchmarks

7.7 SNMP

7.8 Lint

7.9 Encryption

7.10

7.10.1 VxWorks(by vxfree)

1)TornadoCinb(), outb()

TornadoGNUANSI/ISO C, C++AT&TIntelC++

C++GNUC++

inb(),outb()Turbor C/DOSCTornado

BSPsysInByte(),sysOutByte()BSPsysALib.s

2CDOSsigh B.GateD.Ritchie

2) VxWorksA:C:PC

A:,C:M$PC VxWorks/fd0/ata0

3)printf()

PC

telnet

C3STD_IN, STD_OUT, STD_ERRstdin, stdout, stderr

C++cin, cout, cerr

4) VxWorks:

VxWorks for X86

*(unsigned short *)0xb8000 = 0xAA55; Video RAM

8086,DOS

5) ISRprintf()

VPGprintf()

logMsg()

6)I/O

open()/close()read()/write()

-

- ;)

-

APPring-buffer

select

USB

open()/close()CI/O

8250SCC

7)fopen(),fread()open(),read()

fwrite

LINE_MODE

8)

select()watchdog

9)malloc()/free()

user

user

VxWorksmalloc()/free()

/

OSEK/VDXOSEKWorks

OSEKWorksmalloc()NULL

""

7.10.2 tornado 2 :

Linking the application with VxWorks is really a two-step process. You must add an entry point

to the application in usrConfig.c, and you must modify the makefile to link the application

statically with VxWorks.

To start your application during system initialization, add code to the usrRoot( ) routine in

usrConfig.c. You can call application initialization routines, create additional I/O devices,

spawn application tasks, and so on, just as you do from the Tornado shell during development.

An example is provided in usrConfig.c. This file includes and initializes a simple demo if the

preprocessor constant INCLUDE_DEMO is defined in one of the configuration files. In that

situation, usrRoot( ) spawns usrDemo( ) as a task as the last step in booting the system. You

can simply insert the appropriate initialization of your application after the conditional

code to start the demo. For example:

/* spawn demo if selected */

#if defined(INCLUDE_DEMO)

taskSpawn ("demo", 20, 0, 2000, (FUNCPTR)usrDemo, 0,0,0,0,0,0,0,0,0,0);

#endif

taskSpawn ("myMod", 100, 0, 20000, (FUNCPTR)myModEntryPt,

0,0,0,0,0,0,0,0,0,0);

To include your application modules in the bootable system image, add the names of the

application object modules (with the .o suffix) to MACH_EXTRA in Makefile. For example, to

link the module myMod.o, add a line like the following:

MACH_EXTRA = myMod.o

...

Building the system image with the application linked in is the final part of this step. In

the target directory, execute the following command:

make vxWorks

tornado 2rebuild AllvxWorks,bootrom.sys

vxWorks;vxWorks

: zhangjiaxue 02-8-21 18:09:18

Re:vxWorks