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.

UCD3138A: UCD3138A about auto-initialized variable in .Cinit section

Part Number: UCD3138A

 Dear Mr. Lan

I am still confused about .cinit section

.cinit definition:Tables for explicitly initialized global and static variables.

 .cinit     0    000065d0    0000004c     
                  000065d0    00000018     UART_Auto_Baud.obj (.cinit)
                  000065e8    00000018     fault_handler.obj (.cinit)
                  00006600    00000018     standard_interrupt.obj (.cinit)
                  00006618    00000004     --HOLE-- [fill = 0]

 .bss       0    0001901c    000006cc     UNINITIALIZED
                  0001901c    0000020b     main.obj (.bss)
                  00019227    00000001     uart.obj (.bss)
                  00019228    00000100     main.obj (.bss:_xn_bins)
                  00019328    00000080     main.obj (.bss:_program_area)
                  000193a8    00000058     main.obj (.bss:_pmbus_dcdc_config)
                  00019400    00000058     main.obj (.bss:_pmbus_dcdc_config_translated)
                  00019458    0000004c     main.obj (.bss:_filter0_cp_pmbus_regs)
                  000194a4    0000004c     main.obj (.bss:_filter0_pmbus_regs)
                  000194f0    0000004c     main.obj (.bss:_filter0_start_up_pmbus_regs)
                  0001953c    0000004c     main.obj (.bss:_filter1_pmbus_regs)
                  00019588    00000034     main.obj (.bss:_adc_values)
                  000195bc    00000034     main.obj (.bss:_adc_values_avg)
                  000195f0    00000034     main.obj (.bss:_fiq_data)
                  00019624    00000034     main.obj (.bss:_pmbus_buffer)
                  00019658    00000030     main.obj (.bss:_pmbus_dcdc_config_nonpaged)
                  00019688    00000030     main.obj (.bss:_pmbus_dcdc_config_nonpaged_translated)
                  000196b8    00000020     UART_Auto_Baud.obj (.bss)
                  000196d8    00000008     fault_handler.obj (.bss)
                  000196e0    00000008     standard_interrupt.obj (.bss)

The auto-initialized variable in .cinit  section are variables in UART_Auto_Baud.obj  ,fault_handler.obj and standard_interrupt.obj .

There are many global and static variables in many .C file, Why auto-initialized variable are choosen from the above three C files? Do they have any special purpose?

Do we have to copy this auto-initialized variable  to RAM in load.asm?  why?

Best Wishes

LEI

  • Hi Lei,

    I have contacted the UCD team, an engineer should reply to your post today.

    Regards

    Peter
  • Auto-initialized variables are ones where the declaration includes a value, like this:

    int32 otto = 1234;

    Most variables in our code are non auto-initialized, like this:

    int32 diesel;

    We take advantage of the fact that load.asm initializes the RAM to all zeroes, in effect initializing all uninitialized variables to zero.

    So all of the variables that say uninitialized are going to have zero values, but they do not need entries in the cinit table.