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.

Linker Entry Point

Section 7.4.11 of the version 4.7 ARM Assembly Language Tools User's Guide says:

" - The value of symbol _c_int00 (if present).  The _c_int00 symbol must be the entry point if you are linking code produced by the Compiler".

The use of "must" here is confusing to me.  Can you please explain to me some of the implications of the "entry point".  I would think that the linker probably does two things with the entry point - 1) makes sure the code pointed to by the entry point is not removed (since it is typically not referenced elsewhere), 2) puts it into a symbol table somewhere so any loaders (like a debugger, simulator, etc.) can start at the entry point.  Are there other implications of the "entry point".

I have two different programs, both of which are executables and execute assembly code out of reset before calling _c_int00.  One program contains a loader (at label ResetISR) which moves a program from Flash to RAM and then calls its _c_int00.  I have another program which runs some test routines (at label ResetIsrIEC) in assembly before calling _c_int00.

In both cases I set the entry point to the reset routine (ResetISR and ResetIsrIEC).  I get a warning from the linker that an entry-point other than "_c_int00" is specified.

Please help me understand what the implications of the "entry point" are so I can either feel comfortable ignoring this warning, or so I understand why it "must" be "_c_int00".

Thanks.

  • When the -c or -cr linker options are used (for rom or ram model of initialization), the linker assumes a C runtime model. This means that the user should either inform the linker where the entry point of the program is so that it knows where the root of the call graph is, or it will assume that _c_int00 is the entry point. The -e option is available so the entry point can be overridden by the user. Once the linker knows what the entry point is, it can then go about resolving all symbol references. 

    Ivek Engineer said:

    In both cases I set the entry point to the reset routine (ResetISR and ResetIsrIEC).  I get a warning from the linker that an entry-point other than "_c_int00" is specified.

    The warning is expected, but it is ok to set the entry point to your own reset routine.

  • Ivek Engineer said:

    I would think that the linker probably does two things with the entry point - 1) makes sure the code pointed to by the entry point is not removed (since it is typically not referenced elsewhere), 2) puts it into a symbol table somewhere so any loaders (like a debugger, simulator, etc.) can start at the entry point.

    Both of these are correct.

    _c_int00 is the compiler's name for the interrupt handler for interrupt 0, i.e. the RESET interrupt.  It wants you to name the routine that you are presently naming ResetISR or ResetIsrIEC "_c_int00".  This is not strictly necessary; the warning is there to make sure that a user doesn't mistakenly set the entry point to some C function which expects the C environment to already be set up, such as "main".   As long as you arrange for _c_int00 to be called from your real reset handler, or do the work that _c_int00 is supposed to do, you can use your own function as the entry point.  The linker has no way of checking that your reset handler does the work that the C environment needs, so it emits a warning.  Probably the warning should state the "why" behind it.

  • Thank you very much for your answers.

    Perhaps in the next version of the tool's user's guide the "must" can be qualified with what you shared here.  I know there isn't always room in a manual for all such information - it is just that the "must" through me a bit.

    Thanks again.