Other Parts Discussed in Thread: HALCOGEN, TMS570LC4357, , LAUNCHXL2-RM46
I'm using HALCoGen generated startup code and linker file. I'm using gcc format outputs.
In C++, if I have a class which is instantiated global, the constructor is never called.
static myClass myClassObj;
I was never hitting a breakpoint in the constructor, nor were the member variables being set.
I used some code outlined here in the section Coverage Constructors.
https://mcuoneclipse.com/2014/12/26/code-coverage-for-embedded-target-with-eclipse-gcc-and-gcov/
The linker file already outputted the .init_array all that was needed was the execution of this function.
/* call the coverage initializers if not done by startup code */
void
static_init(
void
) {
void
(**p)(
void
);
extern
uint32_t
__init_array_start, __init_array_end;
/* linker defined symbols, array of function pointers */
uint32_t
beg = (
uint32_t
)&__init_array_start;
uint32_t
end = (
uint32_t
)&__init_array_end;
while
(beg<end) {
p = (
void
(**)(
void
))beg;
/* get function pointer */
(*p)();
/* call constructor */
beg +=
sizeof
(p);
/* next pointer */
}
}
Is the constructor execution supposed to happen automatically in TI code? In the past I've used HALCoGen and I don't recall needing to do this.