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.

TMS320F28377S: Migration COFF to EABI, initialization issue

Part Number: TMS320F28377S

Hi there,

I am working on migration some projects to EABI.

There is the same C++ code, there is the same C++ Standard (03).

The only change is output format COFF => EABI and some new sections are introduced for linker.

Compilation in both cases gives no issues. no warnings.

The problem is that resulting const initialised structure is in EABI not complete. In COFF build all the values are on their places as expected.

To better explain my problem I just post micro-project with important comments inside:

initvariables.h:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#ifndef INITVARIABLES_H_
#define INITVARIABLES_H_
#include <stdint.h>
class init_variables final
{
public:
init_variables();
~init_variables();
// here initialised consts do not generate symbols
static const float c_Pi = 3.14f;
static const float c_2Pi; //initialized in *.cpp, what makes EABI issue
static const float c_3Pi;
static const uint32_t c_beef = 0xDEADBEEF;
static const uint32_t c_var;
};
#endif /* INITVARIABLES_H_ */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

initvariables.cpp

Fullscreen
1
2
3
4
5
6
#include <initvariables.h>
// static initialisation
const float init_variables::c_2Pi = 2 * 3.14f;
const float init_variables::c_3Pi = 9.42477796f;
const uint32_t init_variables::c_var = 0x0A0B;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

usevariables.h

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#ifndef USEVARIABLES_H_
#define USEVARIABLES_H_
#include <initvariables.h>
class use_variables2 final
{
public:
const float local_c_Pi;
const float local_c_2Pi;
const float local_c_3Pi;
const uint32_t local_c_beef;
const uint32_t local_c_var;
};
#endif /* USEVARIABLES_H_ */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

usevariables.cpp  <=== Here is the problem

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <usevariables.h>
volatile static const use_variables2 my_use_variables2a = { init_variables::c_Pi, //EABI 3.14
init_variables::c_2Pi, //EABI 0000
init_variables::c_3Pi, //EABI 0000
init_variables::c_beef, // EABI DEADBEEF
init_variables::c_var }; // goes to .ebss and gets before main initialization, EABI 0000
volatile static const use_variables2 my_use_variables2b = { 3.55f,
6.2f,
9.333f,
7,
8 }; // no symbol, FLASH placement, EABI ok
//COFF: pointed object at 0xAC00, fully initialized,
//EABI not complete!!! c_2Pi, c_3Pi, c_var are all 0
void* p1_use_variables = (void*)(&my_use_variables2a);
//pointed object at 0x00090000 (FLASH), coff ok, eabi ok
void* p2_use_variables = (void*)(&my_use_variables2b);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Both pointers p1_use_variables and p2_use_variables help to find initialized class in memory space as no symbol for classes  is generated in map file.

Why do I get incomplete data (not fully initialized) without any warning from build tools?

Best Regards,

Maciej