VxWorks Study Notes

Source: Internet
Author: User

1. VxWorks Development Method: Cross-development, which divides development into two parts: Host and target.
Similar to the Development of C language programs in DOS.
Advantages of combined development: simple
Disadvantages: high resource consumption, CPU support, and non-standard system support
Host (tornado) Target (vxwork) applet Module
VxWorks actually adopts the Development Mode
Tornado provides: editing, compilation, debugging, and performance analysis tools. It is a VxWorks development tool.
VxWorks: an operating system that can be tailored to objects
2. VxWorks Startup Mode
<1> Rom mode (vxwork_rom)
Run VxWorks directly into Rom.
<2> ROM Boot Mode (bootrom + VxWorks)
Bootrom is burned into Rom, and VxWorks can be downloaded from the serial port, network port, hard disk, Flash, etc! Bootrom is not a bootable in the development environment. In the development environment, bootable refers to VxWorks and downloadable refers to application.
3. debugging
<1> attach
Used to bind a debugging object to a task during multi-task debugging.
<2> attach taskname)
Debugging a single task does not affect the running of other tasks. It is mainly used to call users' applications.
Global breakpoint: When you call another task or this task, the system stops when it runs this task. All tasks must be used together.
Task breakpoint: When you call this task, the system stops when it runs to the task breakpoint. It does not work if the attach task fails.
One-time breakpoint: it is automatically deleted once.
<3> system-level debugging (attach System)
It regards all tasks, system cores, and interruptions as a whole and can be used to debug the system and interrupt. For interrupted debugging, if it is not a system-level debugging, neither the breakpoint nor the breakpoint will work.
! Wdbagent is not in the debugging scope. When task-level debugging is performed, the system-level debugging is performed in polling mode.
! However, for debugging using the command line method, see the crosswind tutorial.
4. Scheduling
Priority Scheduling (unconditional)
Time slice: same priority. If the time slice is not enabled, the task runs first, and the CPU is handed over after running. If the time slice is enabled, the CPU is used in turn.
! An endless loop prevents tasks with lower priority from running.
5. Inter-Task Communication
Semaphores, global variables, pipelines, signal, message queue, socket
Semaphores: Mutual Exclusion, synchronization (Binary), and count. Resource management is mutually exclusive. Multi-task sharing of memory is prohibited. Its advantage is that it is fast. If a task has been taken, it will be successful again.
! Global variables must be protected by semaphores.
Message Queue: encapsulates global variables and semaphores. The advantage is: fast; there are many operation items (send more Recv less: messages can be queued, with the priority_urgent option added to the queue header. Send has more than one Recv: supports FIFO and priority when obtaining, that is, when a message arrives, it is assigned to a high-priority task or a task first blocked by Recv)
Signal: The emergency communication mechanism, second only to interruption, relies on System Scheduling and does not rely on time slices (interruption depends on hardware time). Therefore, signal is also called Soft Interrupt.
! Exeption: Internal interrupt, which is a hard interrupt (for example, Division Error ). Its relationship with signal is as follows:
TASKA taskb Soft Interrupt Processing signal taskc taskb user's tasks exception signal Soft Interrupt Processing exception Interrupt Processing History 1. query the TCB (task control block) to obtain information about the task being executed. 2. if the signal is registered, the task is suspended. print exception number, PC pointer, reg value 4. if you have registered this signal, send the signal to the task
6. Memory Allocation
In config. H, it is specified by the macro definition.
User_reserved MEM (save some parameters during Hot Start) final layout of system memory pool wdb poll VxWorks memory local_mem_local_adrsram_low_adrs free_ram_adrs wdb_pool_size sysmemtop () sysphymemtop () bootrom {rominit () romstart ()} bootrom {usrinit () usrroot ()} VxWorks Rom Ram rom_sizerom_base_sizerom_text_adrsram_high_adrsram_low_adrs ROM and ram layout at startup
! In bootrom, the memory driver is in config/scr/drv/MEM and can directly include *. C to use the functions. For flash, you must add the type definition in config. H, and change the macro definition such as the control word in Flash ***. h.
7. Interruption
There are three levels of interruptions:
Interrupt PIN number (or obtained from the Interrupt Controller) (Interrupt Level) *** _ Level
Interrupt number (Interrupt number) int_vec_get (*** _ Level)
Interrupt vector (for x86 is the interrupt Number * 4) (interrupt vector) inum_to_ivec (int_vec_get (*** _ Level)
! The interrupt handler and interrupt vector can be activated only after connect and enable. sysintenablepic () is used for x86, and intenable () is used for MIPS, arm, PPC, etc ().
! The interrupt cannot contain function interfaces that may block the interrupt. (For example, printf won't work. Use logmsg)
8. Timer
VxWorks uses three timers for system clock, secondary clock, and time scale respectively.
Timer0: used for system clock. You can use sysclkrateset () to change the rate. The default value is 60 times/second.
! Watchdog in VxWorks is based on timer0 because it is at the interrupt scale and must be used with caution. Otherwise, the system efficiency will be reduced.
Timer1: Used for the auxiliary clock (Auxiliary clock). The maximum rate, minimum rate, and initial value of the actual rate are defined in BSP. h. You can use sysauxclkrateset () to change the speed. Use sysauxclkconnect () to define scheduled tasks for the secondary clock.
Timer2: timestamp ). It increases progressively from the start of the system and can be used to obtain the system running time, which is used in the windview tool. The user program can also get the running time through iimestamp.
9. *. O, *. Out, And VxWorks
You can run multiple boards *. O and *. out (similar to the application in the window) and there is only one VxWorks (similar to the window operating system), but these *. O and *. the out compilation must be based on the same CPU as VxWorks.
! Bootrom is partially copied to ram during startup and is running. This part will download VxWorks to ram, however

Then jump to the VxWorks entry to run, and then VxWorks re-divides this part of bootrom into the system pool.
10. symbol table)
The symbol table is an array that defines the correspondence between functions and global variables and their addresses. By default, the symbol table is placed on the host. If standalone symbol table is defined, there is also a symbol table on the target machine, which is usually bound to the target shell.
11. Some configurations
Automatic configuration is used for PCI configuration by default. If you want to manually configure the configuration, you must define the PCI configuration.
The driver of the keyboard and display is classified into the serial port. The default input and output are the display and keyboard, which can be redirected to the serial port.
12. Use watchdog to generate periodic call routines
Main Program: watchdog (func, Param, tick)
Program called by watchdog: func (PARAM)
{
Watchdog (func, Param, tick );
......
}
13. Task switching speed: the cache speed increases to 10 us when the cache is disabled.
For example, for x86, 233 MHz, cache enabled, and interrupt response, the typical value is 3.5us. Among them, the C function is mounted to 0.7us, And the interrupted launch + task rescheduling 2.5us
14. Tornado file structure
You need the following directories:
Tornado/Host: TCL control statement, exe running on the host
Tornado/docs: helper file, which provides an overview of books.html
Tornado/Target: header file, library file, BSP
Modifying BSP mainly modifies the files in the target directory. The modification of BSP affects bootrom and VxWorks. The following describes the bootrom and VxWorks created using the engineering method.
15. bootrom startup sequence and source code location
Function: rominit

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.