简体   繁体   English

什么是gcc中的#pragma等效项?

[英]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 ? 我想这是因为这是gcc编译器的不正确语法? What is the equivalent ? 什么是等效的?

Thanks 谢谢

(Context: This is on the raspberry pi in raspian) (上下文:这是在Raspian中的Raspberry Pi上)

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 要注意您的链接描述文件(通常使用gnu工具为“ .ld”):必须定义这些部分并将其映射到正确的内存

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM