FMUSER Wirless Transmit Video And Audio More Easier !

[email protected] WhatsApp +8618078869184
Language

    RT-THREAD startup process analysis RT-THREAD automatic initialization mechanism analysis

     

    I believe that many engineers will often see the macro definition shown below, according to the macro definition, and these macro definitions seem to have some initialization functions. Some statements. . As shown in the figure above, through the trace discovery of the source code, these init_xxx_export's macro definition is ultimately calling the init_export macro definition, and this macro definition is to put the initialization function in the custom RTI_FN symbol section, the source code is The RTDef.h header file is shown below. Place the initialization function in a custom symbol section, what effect? The answer is that in this way, these initialization functions can be implicitly called without manually adding the function to the initialization of RT-Thread. What is implicit call? Implicit call means that when we add a system component or external device to the project code, this component or device needs to perform initialization, and this initialization function, we don't need to start the main function or RT-Thread. Directly add calls in the function, which avoids the modification of the startup process code of RT-Thread. Let's take a look at the RT-Thread's launch function call process, pay attention to the contents of the red box, as shown below. Inside the start function, RT_Components_Board_init () and RT_Components_init () These two functions are specifically used to process the prototypes and comments of automatic initialization, the two functions, as shown below. As can be seen from the above function prototype, these two functions are from the symbol segment interval, which continues to traverse the initialization function in the symbol segment via the for loop, and get the pointer to these initialization functions, and then call to achieve the device or The purpose of the components initialization. The RT_Components_Board_init () function is executed first, this function is used to initialize the hardware related to the chip, which traverses the list of functions declared with the init_board_export (fn). The RT_Components_Init () function is that after the system is started, this function is used in the MAIN thread, which is used to initialize other functions lists with init_xxx_export (fn) declaration. At present, the RT-THREAD core is used to implement the macro definition interface of the automatic initialization function, as shown in the following figure. In summary, the automatic initialization process to be used in RT-THREAD can be summarized as follows. Why can I be automatically called after the initialization function adds a symbolic segment? What is the symbol section? What is the benefit of using this way? Add a function to the symbol section, in fact, using the __attribute __((X))) keyword using the MDK compiler, declares the function, and the function declared through the section keyword, when the compiler is linked, These functions will be collected automatically and put them in a centralized area to view the following. Map files can be seen. As shown in the red box above, RT_HW_PIN_INIT and RT_HW_USART_INIT are functions that use the init_board_export (fn) declared, so they are stored in the interval in which the orange vertical line is located, using the rt_components_board_init () function to traverse this range. As shown in the blue box and green box above, they are functions that use init_component_export (fn) and init_app_export (fn), which are stored in the range where red vertical line is located, using the rt_components_init () function to this interval Traverse. From the above analysis, it can be seen that the way the initialization function is stored in the way, the advantage is that when I need to add a new initialization function, I don't need to change the startup code of RT-Thread, directly through the section keyword. , Add the initialization function to the corresponding symbol section. The above is the automatic initial mechanism analysis of RT-Thread, is because of this mechanism, so when we cut the kernel or component, it is not necessary to modify the initialization function of RT-Thread, or initialize the components. . Editor: lq, Read full text, original text title: [RT-THREAD topic 3] RT-THREAD startup process analysis RT-THREAD automatic initialization mechanism analysis Article Source: [Micro Signal: RTTHREAD, WeChat public number: Lilda Terrain] Welcome to add attention! Please indicate the source of the article.

     

     

     

     

    List all Question

    Nickname

    Email

    Questions

    Our other product:

    Professional FM Radio Station Equipment Package

     



     

    Hotel IPTV Solution

     


      Enter email  to get a surprise

      fmuser.org

      es.fmuser.org
      it.fmuser.org
      fr.fmuser.org
      de.fmuser.org
      af.fmuser.org ->Afrikaans
      sq.fmuser.org ->Albanian
      ar.fmuser.org ->Arabic
      hy.fmuser.org ->Armenian
      az.fmuser.org ->Azerbaijani
      eu.fmuser.org ->Basque
      be.fmuser.org ->Belarusian
      bg.fmuser.org ->Bulgarian
      ca.fmuser.org ->Catalan
      zh-CN.fmuser.org ->Chinese (Simplified)
      zh-TW.fmuser.org ->Chinese (Traditional)
      hr.fmuser.org ->Croatian
      cs.fmuser.org ->Czech
      da.fmuser.org ->Danish
      nl.fmuser.org ->Dutch
      et.fmuser.org ->Estonian
      tl.fmuser.org ->Filipino
      fi.fmuser.org ->Finnish
      fr.fmuser.org ->French
      gl.fmuser.org ->Galician
      ka.fmuser.org ->Georgian
      de.fmuser.org ->German
      el.fmuser.org ->Greek
      ht.fmuser.org ->Haitian Creole
      iw.fmuser.org ->Hebrew
      hi.fmuser.org ->Hindi
      hu.fmuser.org ->Hungarian
      is.fmuser.org ->Icelandic
      id.fmuser.org ->Indonesian
      ga.fmuser.org ->Irish
      it.fmuser.org ->Italian
      ja.fmuser.org ->Japanese
      ko.fmuser.org ->Korean
      lv.fmuser.org ->Latvian
      lt.fmuser.org ->Lithuanian
      mk.fmuser.org ->Macedonian
      ms.fmuser.org ->Malay
      mt.fmuser.org ->Maltese
      no.fmuser.org ->Norwegian
      fa.fmuser.org ->Persian
      pl.fmuser.org ->Polish
      pt.fmuser.org ->Portuguese
      ro.fmuser.org ->Romanian
      ru.fmuser.org ->Russian
      sr.fmuser.org ->Serbian
      sk.fmuser.org ->Slovak
      sl.fmuser.org ->Slovenian
      es.fmuser.org ->Spanish
      sw.fmuser.org ->Swahili
      sv.fmuser.org ->Swedish
      th.fmuser.org ->Thai
      tr.fmuser.org ->Turkish
      uk.fmuser.org ->Ukrainian
      ur.fmuser.org ->Urdu
      vi.fmuser.org ->Vietnamese
      cy.fmuser.org ->Welsh
      yi.fmuser.org ->Yiddish

       
  •  

    FMUSER Wirless Transmit Video And Audio More Easier !

  • Contact

    Address:
    No.305 Room HuiLan Building No.273 Huanpu Road Guangzhou China 510620

    E-mail:
    [email protected]

    Tel / WhatApps:
    +8618078869184

  • Categories

  • Newsletter

    FIRST OR FULL NAME

    E-mail

  • paypal solution  Western UnionBank OF China
    E-mail:[email protected]   WhatsApp:+8618078869184   Skype:sky198710021 Chat with me
    Copyright 2006-2020 Powered By www.fmuser.org

    Contact Us