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.

RTOS/CC2642R: SYS/BIOS Startup Sequence_"C/C++ runtime initialize"

Part Number: CC2642R

Tool/software: TI-RTOS

Hi

Please tell me about the TI-RTOS Kernel (SYS/BIOS) User's Guide.

and refer to "rtsc.eclipse.org/.../Using_xdc.runtime_Startup".

Question

In Chapter 3.1 As SYS/BIOS Startup Sequence (URL), There is a process called C/C++ runtime initialize,

please tell me what  "C/C++ runtime initialize," is doing for detail.

 

I am glad to your answer!!

  • What is the background for the question:

    I found this:

    Purpose of the C Runtime Environment

    There are several things the C Runtime Environment startup code must do before your application's code can run.

    • Allocate space for a software stack and initialize the stack pointer
      On 8-bit devices that have a hardware based return address stack, the software stack is mostly used for parameter passing to and from functions. On 16- and 32-bit devices the software stack also stores the return address for each function call and interrupt.
    • Allocate space for a heap (if used)
      A heap is a block of RAM that has been set aside as a sort of scratchpad for your application. C has the ability to dynamically create variables at runtime. This is done in the heap.
    • Copy values from Flash into variables declared with initial values
      Variables declared with initial values (e.g. int x=10;) must have those initial values loaded into memory before the program can use them. The initial values are stored in flash program memory (so they will be available after the device is power cycled) and are copied into each RAM location allocated to an initialized variable for its storage.
    • Clear uninitialized RAM
      Any RAM (file register) not allocated to a specific purpose (variable storage, stack, heap, etc.) is cleared so that it will be in a known state.
    • Disable all interrupts
    • Call main(), where your application code starts

    You can also see the startup_ccs.c or startup_gcc.c in the SDK