Rtems 4.11 Start-up process (arm, Beagle)

Source: Internet
Author: User

Please refer to the official BSP_HOWTO documentation, for ARM, the first file to execute is start. S

Start. S

C/src/lib/libbsp/arm/shared/start/start. S

1, from the _start start execution
2, off the CPU interrupt, initialize the register, set the stack of each mode, call Bsp_start_hook_0 (), note: At this time the exception vector table is not configured
3. Then copy the vector to the real position (but not set CP15)
4. Call Bsp_start_hook_1 ()
5, Last Call Boot_card (), this function should not return, if unfortunate return, will call Bsp_reset () restart

According to the BSP_HOWTO documentation, the things you should do before calling Boot_card () are as follows:
1. Init stack
2, zero. BSS
3. Disable IRQ
4. Copy. Data to RAM
Among them, items 2nd and 4 are not at start. s, where are they? Let's take a look at Beagle's bsp_start_hook_0 () and Bsp_start_hook_1 (), which are

C/SRC/LIB/LIBBSP/ARM/BEAGLE/STARTUP/BSPSTARTHOOKS.C

Bsp_start_hook_0() didn't do anything.

Bsp_start_hook_1()
Arm_a8core_start_hook_1 () =c/src/lib/libbsp/arm/include/arm-a8core-start.hTell Cp15 where the interrupt vector is.
Bsp_start_copy_sections () =c/src/lib/libbsp/arm/include/start.hCopy standard sections to memory, including. Data to initialize to memory
Beagle_setup_mmu_and_cache () =c/src/lib/libbsp/arm/beagle/startup/bspstartmmu.cSet up the MMU of the board
BSP_START_CLEAR_BSS () =c/src/lib/libbsp/arm/include/start.hClear 0. BSS segment

All the tasks before Boot_card () in Bsp_howto have been completed, then take a look at Boot_card ()

Boot_card ()

The default implementation of Boot_card () is c/src/lib/libbsp/shared/bootcard.c, and the implementation is simple:
1. Off interrupt
2. Log the command line (if Bootloader is uboot, there may be a command line)
3, call Rtems_initialize_executive () into the core of the Rtems zone ~

Rtems_initialize_executive () in cpukit/sapi/src/exinit.c
Call all registered Rtems_sysinit_item (initializers) once, and then the operating system officially starts running

Where does Rtems_sysinit_item come from? Speaking here we also have to think about the BSP_HOWTO manual in the said Bsp_work_area_initialize/bsp_start/bsp_predriver_hook where, look back to BOOTCARD.C bar, in Boot_card ( ) above the function, there are also these definitions

Rtems_sysinit_item (  bsp_work_area_initialize,  rtems_sysinit_bsp_work_areas,  rtems_sysinit_order_ Middle); Rtems_sysinit_item (  Bsp_start,  Rtems_sysinit_bsp_start,  rtems_sysinit_order_middle); Rtems_sysinit_item (  Bsp_predriver_hook,  rtems_sysinit_bsp_pre_drivers,  

That's what Rtems_sysinit_item defines! So what's the order of them, and see if cpukit/score/include/rtems/sysinit.h is probably in the order of the definition, and how to do it in the order of definition, I don't know now, dig a hole first.

Bsp_work_area_initialize () in c/src/lib/libbsp/shared/bspgetworkarea.c, the default implementation is generally used
Bsp_start () in c/src/lib/libbsp/arm/beagle/startup/bspstart.c call bsp_interrupt_initialize () = Bsp_ Interrupt_facility_initialize () Initialize the interrupt controller (as described in the Bsp_howto Manual) (in c/src/lib/libbsp/arm/beagle/irq.c )
Bsp_predriver_hook () default implementation nothing is done in c/src/lib/libbsp/shared/bsppredriverhook.c .

Other

Bsp_reset () The main function in c/src/lib/libbsp/arm/beagle/startup/bspreset.c is to restart the system.

Beagle_setup_mmu_and_cache () initializes the MMU, initializes the MMU based on the section configuration table, and the table is mostly armv7_cp15_start_default_sections, defined in c/src/ The Lib/libbsp/arm/shared/include/arm-cp15-start.h !

At this point, the initialization steps of the Rtems operating system are generally clear ^_^

Rtems 4.11 Start-up process (arm, Beagle)

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.