This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

HALCoGen 3.06.00 change for TMS570LS3137 global variable initialization

Other Parts Discussed in Thread: TMS570LS3137, HALCOGEN

__TI_auto_init and gcc questions for tms570ls3137:


As a basic understanding the __TI_auto_init should initialize all the global variables, constructors and stack.

While searching in the library files, I found definition for "__TI_auto_init" which is invoked from sys_startup.c.

1. Can you please briefly tell me what the below functions does

run_binit

run_cinit

run_pinit

What I understood is that it compares the Base and Limit addresses and invokes handler(load_addr, run_addr);

I could not find the definition of handler function. Can you please help me what this function does so that I can write my own implementation to initialize the data.

2. Where do I find the __TI_BINIT_Limit/__TI_CINIT_Limit/PINIT_LIMIT and the respective base addresses or do let me know which section they refer to so that I can take the values from linker file.

  • Hello,

    Please refer to the document on the ARM Code Generation Tools here:
    processors.wiki.ti.com/.../ARM_Code_Generation_Users_Guides

    Specifically the SPNU118 document describes the different sections that are defined by the linker and how to manage them. All these functions are defined in the real-time source library (RTS).

    Regards,
    Sunil
  • Hi,
    Thatnk for your quick reply.
    can you please tell me how do i initialize the constructors in link command file.
    the below function i am calling in main function
    inline void static_init()
    {
    for (void (**p)() = __init_array_start; p < __init_array_end; ++p)
    (*p)();
    }

    from the documents i understood that SHT$$INIT_ARRAY$$Limit address from the *_linkinfo.xml.
    Can you please help how do i initialize these constructors. Or please suggest me the better approach to initialize.
  • I am moving your question to the CCS forum.

    Regards,
    Sunil
  • I have no expertise with Halcogen.  It may or may not be the case that Halcogen has some changes in the startup code provided with the TI ARM compiler.  If such changes are present, I do not know about them.  What I describe here is the startup code as supplied with the TI ARM compiler version 18.1.x.LTS.  

    Please start by searching the TI ARM compiler manual for the sub-chapter titled System Initialization.  Though it is wrong in one detail.  The source code to the compiler RTS is now located in the directory install_root/lib/src .  

    Someswararao malla said:

    1. Can you please briefly tell me what the below functions does

    run_binit

    run_cinit

    run_pinit

    These functions are located in the source file autoinit.h .  As you read through the source, you will see a number of #if preprocessing statements.  When built for ARM, the preprocessor symbols __TI_EABI__ and __ARM_ARCH are defined.  All other preprocessor symbols are not defined.

    Someswararao malla said:
    I could not find the definition of handler function.

    There is no function named handler.  It is a function pointer.  One way to indirectly call a function is with syntax similar to ...

    function_pointer(arg1, arg2);

    Someswararao malla said:
    Where do I find the __TI_BINIT_Limit/__TI_CINIT_Limit/PINIT_LIMIT and the respective base addresses

    These symbols are automatically defined by the linker.  The linker and the startup code are designed and tested to work together.

    Someswararao malla said:
    Can you please help me what this function does so that I can write my own implementation to initialize the data.

    There is not enough information in the documentation, or this post, to help you do that.  You are welcome to customize the startup code to your system.  But such customization is typically limited to adding code to initialize peripherals, external memory, and other parts of the system outside of the core CPU.  The parts of the startup code you mention rarely (probably never) need modification.

    Thanks and regards,

    -George