I am using CodeWarrior for StarCore 10.2.10. I wanted to place a part of my code in a new section. The CodeWarrior help tells me:
"The new section attribute lets you place a data object or a function in a specific section. The syntax is: __attribute__((section("section_name"))), where section_name specifies the target section's name.
The target section can be:
- a basic section, such as data, program, bss, rom, or init section
- a custom section, defined in the application file
- a previously undefined section
If the target section is a previously undefined section, the compiler creates a new section, and the section type depends on the current context."
Here is my code:
int main(void)
{
return 1;
}
int test(void) __attribute__ ((section (".my_section")));
int test(void)
{
return 1;
}
When I examined the generated binary using 'readelf', I could not find any section called '.my_section'. Do I need to do anything else?