#define sec(x) __attribute__((section(#x),used))
关键字attribute可用于为函数或数据声明属性值,这样可以让编译程序优化处理。比如内核里面经常能看见的section:
#define __exception __attribute__((section(".exception.text")))
1
具有该属性的函数,汇编代码将会放置到.exception.text段中,而不是.text段中。
从事嵌入式软件开发多年,物联网,车联网(前装产品),消费电子方向(蓝牙耳机、智能音箱、穿戴设备等)。