Title: Bring up VxWorks on MIPS Core
1Bring up VxWorks on MIPS Core
2Self-intro
???/Rockins Chen SOHO Line/Network
Dept./TP-LINK ybc2084_at_gmail.com http//rockins.inf
o
3Why VxWorks?
- Pro
- Simplicity
- High quality code
- Document everything
- Con
- Proprietary
- Less existed packages
- Inactive community
4Actually
Code merge
5Basic OS Service of VxWorks
- Multi-Tasking
- Preemptive priority scheduling
- Task control
- Shared addr space
- Inter-Task Communication
- Shared data
- Mutual exclusion
- Semaphore
- Message queue
- Pipe
- Network facilities socket, RPC
- signal
6Basic OS Service of VxWorks (cont.)
- Memory Mgmt. (MM)
- Programmers responsibility to alloc stack for
task - Simple heap allocator First-Fit
- I/O system
- UNIX-like file/dir/device
- Buffered I/O stdio
- Formatted I/O printf(),
- POSIX AIO
7Basic OS Service of VxWorks (cont.)
- File System (FS)
- dosFs FAT12/FAT16/FAT32
- rawFs
- tapeFs
- cdromFs
- TSFS access file on host
- TrueFFS for Flash memory devices
8Network Support of VxWorks
- TCP/IP
- 802.1X
- IPSec IKE
- Learning bridge
- NAT/NAPT
- OSPF v2/v3
- Radius
- Firewall
- PPP
9Network Support of VxWorks (cont.)
- IPv4
- TCP/UDP
- ICMP
- IGMP v1/v2
- IPv6
- TCPv6/UDPv6
- ICMPv6
- Neighbor Discovery
(Network APP) DNS TFTP RIP FTP SNTP NFS FTP6
Proxy ARP MIB-II Telnet DHCP
10A Glance of VxWorks
11Board Support Package (BSP)
BSP boot code basic device driver
libarch.a libos.a libwind.a BSP
vxWorks
12sysLib.c The Framework of BSP
- HW driver initialization
- Mem/addr space/MMU/cache routines
- Bus interrupt mgmt. routines
- Clock/timer routines
13Boot code arch dependent
- Cache
- TLB
- GRs in CPU
- CP0s registers
- PLL
- DDR
- Watchdog
- Exception/Interrupt
- RTC
- GPIO
14Case Study 1 slow loop on SPI Flash
15Case Study 1 slow loop on SPI Flash (cont.)
16Case Study 1 slow loop on SPI Flash (cont.)
32 byte boundary
17Case Study 1 slow loop on SPI Flash (cont.)
32 byte boundary
18Case Study 1 slow loop on SPI Flash (cont.)
The straightforward way - padding
19Case Study 1 slow loop on SPI Flash (cont.)
- Deficiency of the straightforward way
- The loop must be kept LESS THAN 32 bytes
- Anytime you changed the boot code, youd have to
inspect your code to ensure ALL loops are fitted
into 32 bytes boundary. Thats absolutely BORING!
20Case Study 1 slow loop on SPI Flash (cont.)
My solution part 1
21Case Study 1 slow loop on SPI Flash (cont.)
My solution part 2
22Case Study 2 busy stuck of intr.
IP-QoS need high resolution timer
Sys clk
unused
Thats it
unused
CPU has 4 general purpose timer
23Case Study 2 busy stuck of intr. (cont.)
- GP timer 1
- Set up timer value (interval)
- Counting down to 0
- Generate timer intr.
- Reload
24Case Study 2 busy stuck of intr. (cont.)
0x0000BABE (delay)
Timer value reg.
25Case Study 2 busy stuck of intr. (cont.)
- Issue phenomenon
- System boot up
- LED blink
- UART output
- HALT. (No UART output No LED status change)
26Case Study 2 busy stuck of intr. (cont.)
The reason under the iceberg
Timer value reg.
Reload
Timer reload value reg.
27Case Study 2 busy stuck of intr. (cont.)
How to fix
Timer value reg.
0x0000BABE (delay)
0xFFFFFFFF (about 21s)
Timer reload value reg.
28Case Study 3 load delay slot on MIPS R3000
The red dot denote a breakpoint settled by an
ICE debugger
29Case Study 3 load delay slot on MIPS R3000
(cont.)
(see MIPS run, 2ed, pp. 28)
30Case Study 3 load delay slot on MIPS R3000
(cont.)
The fix
31Case Study 4 stochastically stuck when jumping
to VxWorks
32Case Study 4 stochastically stuck when jumping
to VxWorks
ltpseudo code snippet 1gt Decompress(compressed
vxWorks image on Flash, RAM to hold decompressed
vxWorks image) Jump to decompressed vxWorks
entry point
33Case Study 4 stochastically stuck when jumping
to VxWorks (cont.)
34Case Study 4 stochastically stuck when jumping
to VxWorks (cont.)
35Case Study 4 stochastically stuck when jumping
to VxWorks (cont.)
ltpseudo code snippet 2gt Decompress(compressed
vxWorks image on Flash, RAM to hold decompressed
vxWorks image) Flush data cache Invalidate
instruction cache Jump to decompressed vxWorks
entry point
36Case Study 5 stochastically soft-reboot failure
due to PLL switch
37Case Study 5 stochastically soft-reboot failure
due to PLL switch (cont.)
- Set up PLL and then switch
- Fail in 1/20 1/10
38Atheros solution increase PLL output gradually
(25MHz -gt 150MHz -gt 400MHz)
39My solution Enable watchdog Switch PLL to
400MHz Disable watchdog
40Case Study 5 stochastically soft-reboot failure
due to PLL switch (cont.)
HW teams solution
41Thats all
42Importance of BSP
Availability Reliability Stability Performance
43Things BSP engineer need to know
- Arch Inst., Pipeline, cache, exception/interrupt
- Mem SDRAM, DDR, NOR/NAND
- Bus UART, JTAG, SPI
- Misc PLL, Timer, GPIO, watchdog, DMA
- OS toolchain
- Debugging tool ICE, debugger
44Ad one
45Ad two
TP-LINK is hiring!
46The End
QA