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.

TMS320F28379D args_main



int _args_main()
{
register int argc = 0;
register char **argv = 0;

#if USE_WEAK_REF
if (&__c_args__ != NULL)
{
argc = __c_args__.argc;
argv = __c_args__.argv;
}
#else
#pragma diag_suppress 1107,173
register ARGS *pargs = (ARGS*)_symval(&__c_args__);
#pragma diag_default 1107,173


if (_symval(&__c_args__) != NO_C_ARGS)
{
argc = pargs->argc;
argv = pargs->argv;
}
#endif

return main(argc, argv);
}

这个函数干什么用的?

_args_main() at args main.c:131 0x085193 (an error occurred:Attempted to read past the end of memory at 0xFFFFFFFFFFFFFF4@DATA )

DEBUG窗口出现这个错误

  • 这个函数一般是在 boot 时使用的,之后会return main(argc, argv);从而跳到main函数来开始执行程序

    /******************************************************************************/
    /* The ARGS data structure is defined according to a convention with linker.  */
    /*                                                                            */
    /* If the user want to pass arguments to loader, "--args=###" option has to   */
    /* be used in linking to generate executable. With this option, the linker    */
    /* will allocate a section starting with __c_args__, and with this "###" many */
    /* bytes. The loader when parses the arguments, will dump the number of       */
    /* arguments, argc as the 1st arguments at address __c_args__, all the actual */
    /* arguments will be dumped after that. The total space for these arguments   */
    /* will not exceed "###" bytes.                                               */
    /*                                                                            */
    /* if "--args="###" is not used as a linker option, linker will put -1 at     */
    /* __c_args__ location.                                                       */ 
    /*                                                                            */
    /* Based on the above convention, the following code implements the access to */
    /* these arguments when main is called.                                       */
    /*                                                                            */
    /* This function is called from boot.asm or boot.c.                           */
    /******************************************************************************/