VxWorks boot program (BIOS/BootLoader/Bootrom)

Foreword: Some files of vxworks, such as usrconfig.c, appear in the config and comp directories. A certain file is selected due to the compilation method. The command line mode uses the config directory file, and the tornado graphical interface configuration selects the comp directory file. Here, the command line method is used to compile.
 
Bootrom completes the basic boot work before starting vxworks, such as minimally initializing the hardware, downloading the image file and decompressing it to RAM. It is worth mentioning that some types of processors have special requirements for the initialization of components such as cache, which may require special processing in the bootrom.
 
One, vxworks image type
Bootrom and vxworks are two images.
Bootrom is used to boot vxworks, and its functions are as described above. The image is directly burned in FLASH, and it can also be replaced by UBoot.
Vxworks multitasking system image file.
 
Two, Bootrom startup strategy
There are three types: bootrom, bootrom_uncmp, bootrom_res.
 
1. Bootrom compression type, occupying a small amount of flash space, most of which have been compressed, to complete the operation of decompressing itself from FLASH and transporting it to RAM, after this step is completed, it will jump to RAM to continue the bootrom program (it sounds magical) , Looks pretty). Advantages: occupies a small flash, the program segment code segment is executed in RAM, and the speed is fast.
 
2. The bootrom_uncmp non-compressed type, which occupies a larger flash than the bootrom type, completes the process of transporting itself from flash to ram without decompression, and it is the same as the bootrom method afterwards. Personally think that the speed will be busier than bootrom mode, because the speed of reading flash is slower and uncompressed, the time to read more flash may exceed the decompression time of bootrom mode.
 
3. The bootrom_res resides in the flash type. Because it is not compressed, it occupies the same flash space as the bootrom_uncmp size. The code segment is executed consistently in the flash during runtime, resulting in a slower speed than the previous two; the data segment will be moved to RAM. Advantages: less RAM; Disadvantages: more flash space than 1 and slower execution speed than 1 and 2.
 
Note: The relationship between bootrom and vxworks is confusing. Vxworks is a real system runtime image. Because it supports multiple startup strategies, it is loaded by other modules (bootrom, uboot). The bootrom will no longer be executed after completing the loading task.
 
Three, bootrom startup process
The bootrom described here is compiled by command line mode.
 
1. The execution sequence after power-on
romInit () (romInit.s)
-->
romStart() (bootInit.c)
-->
usrInit() (bootConfig.c)
    -->
    excVecInit() (target\lib\arm\ARMARCH4\common\libarch.a)
    -->
    sysHwInit() (bootConfig.c)
    -->
    usrKernelInit() (target\src\config\usrKernel.c)
                    (included by bootConfig.c)
    -->
    kernelInit() (target\lib\arm\ARMARCH4\common\libwind.a)
        -->
        usrRoot() (bootConfig.c)
 
2 、 romInit () (romInit.s) 
Initialize interrupts, clocks, system buses, and memory. For non-bootrom_res type bootrom, the romInit function segment of bootrom is also transferred from flash to ram, and the address is mapped, and then the execution of this function will be carried out in ram. For bootrom_res type bootrom will always be executed in flash. After the vxworks system is started, all hardware needs to be re-initialized, this function only does the essential initialization part.
Note: This function is mapped to RAM_HIGH_ADRS in ld. as follows:
ldarm -X -EL -N  -e romInit \
    -Ttext 0C500000  -o bootrom_uncmp romInit.o bootInit_uncmp.o version.o \
    bootConfig.o sysALib.o sysLib.o ne2000End.o  --start-group  -LC:\Tornado2.2_
ARM\target/lib/arm/ARMARCH4/gnu -LC:\Tornado2.2_ARM\target/lib/arm/ARMARCH4/comm
on \
        -lcplus  -lgnucplus  -lvxcom  -larch  -lcommoncc  -ldcc  -ldrv  -lgcc  -
lnet  -los  -lrpc  -ltffs  -lvxfusion  -lvxvmi  -lwdb  -lwind  -lwindview C:\Tor
nado2.2_ARM\target/lib/libARMARCH4gnuvx.a --end-group  -T C:\Tornado2.2_ARM\targ
et/h/tool/gnu/ldscripts/link.RAM
 
3、romStart() (bootInit.c)
Bootrom type: Copy the code segment and data segment from flash to ram, clear the memory, and then decompress the code segment.
bootrom_uncmp type: copy the code segment and data segment from flash to ram, and clear the memory.
bootrom_res type: copy the data segment from flash to ram.

Guess you like

Origin blog.csdn.net/pony12/article/details/115344006