BSP concept and development based on VxWorks

xiaoxiao2021-03-17  192

The BSP file is in the VxWorks / Target / All and VxWorks / Target / Config / BSpName folder. Among them, the files in the all folder are all BSP general files, and the files of the BSPName folder are the BSP files customized by the user yourself.

After compiling, link, and under the control of Makefile and Depend.bspname, the source program will generate a mirror. The image of VxWorks can be divided into two categories, downloadable mirroring and bootable mirroring.

Downloadable Mirroring: Actually consists of two parts, one is VxWorks, the second is Boot ROM, and the two are independently created. The Boot ROM includes three types of BootRom_UOTROM_UNCMP and BootRom_UNCMP, and Bootrom_uncmp, and Bootrom_RES.

Bootable image: It is a mirror that integrates the bootries and VxWorks, which is often the final product, including two types of mirroring that do not reside in ROM and the mirror of ROM.

For bootable mirroring in the USRCONFIG.C file, the downloadable image is executed in the bootconfig.c file.

BSP development process

Establish development environment

Mainly based on the BSP file of the target board CPU, create the user's BSP directory BSPName under the Tornado Argetconfig directory.

Copy the files and BSP templates under Tornado Argetconfigal to this directory, select the appropriate VxWorks mirror type according to the specific situation.

Modify template program

Makefile

The Makefile file controls the creation of the image, using nearly 135 macros in the makefile file, the simplest Makefile to include the following macro:

.Cpu

.Tool: MAKE tool for the host, for GNU

.TGT_DIR: Target path, default is $ (wind_base) / Target

.Target_dir: BSP directory name

.Vender: Target board manufacturer

.Board: Target board name

.ROM_TEXT_ADRS: The entry address of bootrom (indicated in 16), and is the same as config.h files)

.Rom_size: ROM size

.RAM_LOW_ADRS: Load VxWorks target address

.Ram_high_adrs: Bootrom Copy to RAM's Target Address

. HEX_FLAGS: Tags of special structures for generating S-record files

.MACH_EXTRA: Extended files, users join their target module

In addition, the Makefile file also needs to include the following files:

. $ (Tgt_dir) /h/make/defs.bsp: VXWORKS system Run standard variable definition

$ (TGT_DIR) / H / Make / Make. $ (CPU) $ (Tool): Provides special goal mechanisms and a compilation tool, such as make.arm7tdmi_tgnu

$ (Tgt_dir) / h / make / defs. $ (Wind_host_type): Provides definitions related to host systems

.Rules.bsp: The rules required when creating a target file

.rules. $ (wind_host_type): Statouts the slave file table required to create a target file

If there is no copy to BSPNAME in the ALL directory, you need to define macros related to these files, such as bootinit = bootinit.c

This will not use the corresponding file in the BSPName directory in the Makefile file without adding "0x" in front of the Makefile file when creating a file in the ALL directory.

BSPName.h

Set serial ports, clocks, and I / O devices, etc. according to specific target boards. The following must be included in this file:

Interrupt vector / level

.I / o device address

Equipment registers meaning

And attached clock parameters (maximum and minimum rate)

Config.h

Configure the macro definition according to the specific situation of the target board, pay attention to ROM_TEXT_ADRS, ROM_SIZE, RAM_LOW_ADRS,

RAM_HIGH_ADRS is consistent with the Makefile file, local_mem_local_adrs and local_mem_size are correct.

Rominit.s

This is the first program running after the system power-on, set the register and CPU according to the specific target board; as an example of the CPU as an example, Rominit.s needs to work:

. Save the boot mode: For the link, if the CPU is configured by high_vectors, set the entry address to 0xffff0000, otherwise the inlet address is 0x00000000;

Mask Interrupt: By setting the CPSR I_bit and f_bit all implementation, set the interrupt register as the off mode, and set the operating mode as SVC32 mode.

Initialization Stack pointer PC and SP: Stack pointer points to stack_adrs, this macro defines when the mirror is residing ROM, the macro value is _SDATA, when the mirror is a non-standing ROM, the macro is _Rominit, these two The address is directed to the target address of the RAM by the copy mirror after the address mapping.

Initialization Cache, shield Cache

Initialize other registers according to the needs of the specific target board

Pointer jumps to the ROMSTART () function and executes

Bootconfig.c

Generally do not require user modification, or proper modification can be made according to the specific situation

Sysalib.s

Similar to the functionality implemented with the Rominit.s file, if the DRAM and the memory controller are initialized here in the Rominit.s file, this work is no longer performed.

Create vxworks mirroring

Based on the specific needs to create a variety of images in a command line environment, you can also select the build boot ROM to create a variety of Bootrom.

In addition, if the system hardware includes serial port, it is necessary to modify the sysserial.c file according to the specific situation. If you include the network section, you want to modify confignet.h; if you include NVRAM, you have to modify the bootnv.h file. In summary, the development of BSP should be carried out according to the hardware of the specific target board.

For the same target board, the BSP of different operating systems is essentially, but different operating systems will provide different support libraries, which may also vary in the BSP structure.

转载请注明原文地址:https://www.9cbs.com/read-129642.html

New Post(0)