Section attribute in template classes
Hi All,
I am having a problem with section attributes in template classes. I am writing a reusable library for our company and I am trying to write some generic classes for storage of configuration data in eeprom. For this, I am using template classes, but I am running into a problem with the compiler. It seems that GCC doesn't support section attributes in template classes. Does anybody here know about a work-around? I wrote a small piece of code to illustrate the problem.
In the following piece of code, the section attribute is applied to a static variable in a regular class and in a template class. The variable in the regular class is placed in the proper section(
The result:
arm-none-
200000c4 w O .data 00000004 _ZN17TestClassT
08080008 g O .eepromdata 00000004 _ZN16TestClassR
The code:
#include <sys/types.h>
class TestClassRegular {
public:
static volatile const int32_t regularVar;
};
volatile const int32_t TestClassRegula
template <uint32_t size, typename T>
class TestClassTemplate {
public:
static volatile const int32_t templateVar;
};
template <uint32_t size, typename T>
volatile const int32_t TestClassTempla
int main() {
int32_t blah = TestClassRegula
return blah;
}
Question information
- Language:
- English Edit question
- Status:
- Answered
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask Armin van der Togt for more information if necessary.