Other Parts Discussed in Thread: SYSBIOS
Hi,
I'm seeing a strange issue that involves auto_init() going into the weeds when the .cinit section is not 4byte aligned. I searched the forums on this and found that I needed to ensure that I'm using the right version of code gen tools. Well, I just updated to 7.3.0, which is the latest on the site, and I still have the same issue.
After some further debugging, I noticed that the issue would happen when I was initializing an unsigned short static variable in a function in my ethernet.c file. This resulted in a 10 byte long cinit record for ethernet.obj (4 byte length + 4 byte address + 2 bytes of data). See below:
.cinit 0 0082c2e0 000018c2
0082c2e0 00001314 certapp_dsp.p64Pe.obj (.cinit)
0082d5f4 00000004 --HOLE-- [fill = 0]
0082d5f8 00000254 hii.obj (.cinit)
0082d84c 00000004 --HOLE-- [fill = 0]
0082d850 00000104 ipc.obj (.cinit)
0082d954 00000004 --HOLE-- [fill = 0]
0082d958 0000005c rts64pluse.lib : defs.obj (.cinit)
0082d9b4 00000004 --HOLE-- [fill = 0]
0082d9b8 0000005c : lowlev.obj (.cinit)
0082da14 00000004 --HOLE-- [fill = 0]
0082da18 00000048 : cos.obj (.cinit)
0082da60 00000048 : sin.obj (.cinit)
0082daa8 0000003c periphTest.obj (.cinit)
0082dae4 00000004 --HOLE-- [fill = 0]
0082dae8 0000002c rts64pluse.lib : exit.obj (.cinit)
0082db14 00000004 --HOLE-- [fill = 0]
0082db18 0000001c main.obj (.cinit)
0082db34 00000004 --HOLE-- [fill = 0]
0082db38 0000001c rts64pluse.lib : _lock.obj (.cinit)
0082db54 00000004 --HOLE-- [fill = 0]
0082db58 0000001c : atexit.obj (.cinit)
0082db74 00000004 --HOLE-- [fill = 0]
0082db78 0000000c : fopen.obj (.cinit)
0082db84 00000004 --HOLE-- [fill = 0]
0082db88 0000000c : sinit.obj (.cinit)
0082db94 00000004 --HOLE-- [fill = 0]
0082db98 0000000a ethernet.obj (.cinit)
.stack 0 0082dba8 00001000 UNINITIALIZED
0082dba8 00000008 certapp_dsp.p64Pe.obj (.stack)
0082dbb0 00000ff8 --HOLE--
If I were to change the variable type to an unsigned int, then the cinit record changes to 12 bytes long and the issue goes away. See below:
.cinit 0 0082c2e0 000018c4
0082c2e0 00001314 certapp_dsp.p64Pe.obj (.cinit)
0082d5f4 00000004 --HOLE-- [fill = 0]
0082d5f8 00000254 hii.obj (.cinit)
0082d84c 00000004 --HOLE-- [fill = 0]
0082d850 00000104 ipc.obj (.cinit)
0082d954 00000004 --HOLE-- [fill = 0]
0082d958 0000005c rts64pluse.lib : defs.obj (.cinit)
0082d9b4 00000004 --HOLE-- [fill = 0]
0082d9b8 0000005c : lowlev.obj (.cinit)
0082da14 00000004 --HOLE-- [fill = 0]
0082da18 00000048 : cos.obj (.cinit)
0082da60 00000048 : sin.obj (.cinit)
0082daa8 0000003c periphTest.obj (.cinit)
0082dae4 00000004 --HOLE-- [fill = 0]
0082dae8 0000002c rts64pluse.lib : exit.obj (.cinit)
0082db14 00000004 --HOLE-- [fill = 0]
0082db18 0000001c main.obj (.cinit)
0082db34 00000004 --HOLE-- [fill = 0]
0082db38 0000001c rts64pluse.lib : _lock.obj (.cinit)
0082db54 00000004 --HOLE-- [fill = 0]
0082db58 0000001c : atexit.obj (.cinit)
0082db74 00000004 --HOLE-- [fill = 0]
0082db78 0000000c ethernet.obj (.cinit)
0082db84 00000004 --HOLE-- [fill = 0]
0082db88 0000000c rts64pluse.lib : fopen.obj (.cinit)
0082db94 00000004 --HOLE-- [fill = 0]
0082db98 0000000c : sinit.obj (.cinit)
.stack 0 0082dba8 00001000 UNINITIALIZED
0082dba8 00000008 certapp_dsp.p64Pe.obj (.stack)
0082dbb0 00000ff8 --HOLE--
Why is this and what can I do to fix it?
(please don't tell me to only pre-init statics that are unsigned int) :)
I should mention that I am building from the command line using a custom makefile (no CCS involved in building). I'm using SysBIOS as well.
XDCTOOLS: 3.20.08.88
C6000_CGT: 7.3.0
IPC: 1.21.02.23
Thanks,
Dave