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.

Boot order and board init

From documentation I understand that the boot order is as follows:

device reset -> c_int00 -> BIOS_init -> main -> BIOS_start

Where does the "user init function" in the DSP/BIOS Config (System->Global Settings) get called in the above? Specifically, is it called after the BIOS_init or before? I cannot find a reference in the documentation to cover this point.

I'm having a problem whereby a C++ class instance object that uses CSL to access McBSP/SPI appears to cause problems if its instance is used in the "user init function": The software will not stop immediately but will some time later call SYS_abort which calls UTL_abort. I overrode the latter and put an infinite loop in order to halt from CCS and look at the call stack to see what is causing the abort but could not: Call stack only showed SYS_abort and my override function for UTL_abort.

My user init function sets up the PLL, powers up the domains, sets up DDR2 and then creates the C++ class instance in that order. If BIOS_init is called before the "user init function" then there should be no problem because I have just set up DDR2: The DSP/BIOS Config has been set up for malloc/new to use DDR2 and all other objects to use on chip memory.

I'm using a C6457 under CCS 3.3, DSP/BIOS 5.33.06

  • Rob,

    BIOS_init() is called before the user init function.  But perhaps you could move the function from the user init function to a hook function to make sure everything is properly initialized first?

  • Interesting!

    In that case, is there any restriction upon constructing C++ classes dynamically in the user init function (of course after DDR2 has been set up - I'm using DDR2 for malloc/new heap)?

    Is there a problem with static class pointers being used in the user init function?

    Specifically a C++ class instance (singleton) is constructed that expects that the static class instance pointer has already been initialised to NULL.

    I wonder if C++ static data would be a part of the pinit table or cinit table? Is the pinit table built before or after the user init function?

    A stylised version of what I am doing is as follows:

    static ClassType* ClassObject = NULL;

    ClassType* Instance(void)
    {
        if (!ClassObject)
        {
            ClassObject = new ClassType;
        }
    }

    Will the ClassObject have been initialised to NULL before the user init function is called?

    I'm dynamically creating the class instance in a static class object pointer. The class object initialises the McBSP and GPIO and attempts to use both.

  • Rob,

    Have you found the root cause of your problem?

    I don't know specifics about C++, but I do know that it uses the pinit table for some initialization.  The pinit processing comes after BIOS_init (userinit fxn is called within BIOS_init).  Have you tried just calling your function from main()?

    Or if there are some BIOS dependency on heaps then you might have to have two separate functions.  One which does the heap init and such which is called in the user init function and a second which is called from main which does the c++ stuff.

    Just trying to give ideas on how you might go about resolving the issue.

    Judah

  • Went around problem by using C only code in user init function.

    If pinit processing is called after user init then that would explain why C++ is not liked by the user init function.

    Thanks for the reply.

  • Hello there,

    I was still hoping to find out the answer to one of the questions posed in this thread. I'm not sure whether replying to an answered thread is the most effective way of getting this answer but here goes: I'd like to know whether it is legal for static initialisation code to manipulate the heap? An example of such code is given by Rob above.

    Perhaps I'll get a better response if I rephrase my question: is it allowed to allocate/deallocate on the heap (e.g. calling MEM_alloc) in .cinit's initialisation routines and, hence, before BIOS_init?

    Kind regards, 

    Mark