硬汉嵌入式论坛

 找回密码
 立即注册
查看: 3126|回复: 3
收起左侧

[IAR] IAR中的__root和MDK中的__attribute__((used))等效

[复制链接]

1万

主题

7万

回帖

11万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
115679
QQ
发表于 2020-3-27 18:35:25 | 显示全部楼层 |阅读模式

https://www.iar.com/support/tech-notes/linker/the-linker-removing-functions-and-variables-or-external-not-found/

  1. #ifdef __ICCARM__        //IAR
  2. #define KeepInCompilation __root
  3. #elif __CC_ARM          //MDK-ARM
  4. #define KeepInCompilation __attribute__((used))
  5. #elif TASKING         //TrueStudio
  6. #define KeepInCompilation __attribute__((used))
  7. #endif
复制代码


1.png
回复

使用道具 举报

80

主题

1330

回帖

1570

积分

至尊会员

积分
1570
发表于 2020-3-27 21:15:45 | 显示全部楼层
看不懂啊
回复

使用道具 举报

218

主题

1105

回帖

1769

积分

至尊会员

More we do, more we can do.

积分
1769
发表于 2020-3-29 22:04:59 | 显示全部楼层
变量倒是用过used,但函数什么情况下要这么用呢,没被调用又要保留?
回复

使用道具 举报

1万

主题

7万

回帖

11万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
115679
QQ
 楼主| 发表于 2020-3-30 00:58:43 | 显示全部楼层
emwin 发表于 2020-3-29 22:04
变量倒是用过used,但函数什么情况下要这么用呢,没被调用又要保留?

这个是一个群友咨询的,我帮他找了下。

可能是想做一个函数更新功能。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|Archiver|手机版|硬汉嵌入式论坛

GMT+8, 2025-5-11 20:34 , Processed in 0.215561 second(s), 27 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表