Kieron Holt
Kieron Holt

Reputation: 51

What are #pragma equivalencies in gcc?

My compiler is ignoring:

#pragma DATA_SECTION(..., "iram_init");

and

#pragma CODE_SECTION(..., ".icode");

Where ... is a function.

This is causing segmentation errors when I run the program. I suppose this is because this is the incorrect syntax for gcc compiler ? What is the equivalent ?

Thanks

(Context: This is on the raspberry pi in raspian)

Upvotes: 2

Views: 1588

Answers (1)

Garf365
Garf365

Reputation: 3707

The equivalent are:

__attribute__((section(".icode"))) void fct1(int toto) { ... }
__attribute__((section("iram_init"))) int fct2(void) { ... }

__attribute__((section(".var"))) int myvar;

but take care about your linker script (commonly ".ld" with gnu tools): thoses sections have to be defined and mapped to correct memory

Upvotes: 4

Related Questions