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.
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:
#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_ */
initvariables.cpp
#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;
usevariables.h
#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_ */
usevariables.cpp <=== Here is the problem
#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);
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
Thank you for submitting so much code. Unfortunately, I am unable to reproduce the behavior you describe. Please integrate this source code into a CCS project that has the problem behavior. Try to keep the project as simple as you can. Follow the directions in the article Sharing projects to create a zip of the project, than attach that to your next post.
Thanks and regards,
-George
Hi,
Here is very simply project which can be compiled for both COFF and EABI.
Thank you and best regards,
Maciej
Thank you for submitting the CCS project. I am able to reproduce the same behavior. I filed EXT_EP-11021 to have this investigated. You are welcome to follow it with that link.
Thanks and regards,
-George
Thank you for that information.
How can I get informed when this bug is fixed? I can't subscribe it.
Best regards,
Maciej