如何强制IAR使用所需的Cortex-M0 +指令(此功能将禁用优化.) [英] How to force IAR to use desired Cortex-M0+ instructions (optimization will be disabled for this func.)

查看:480
本文介绍了如何强制IAR使用所需的Cortex-M0 +指令(此功能将禁用优化.)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在用C编码时,我需要强制IAR tp在我的代码的某些部分中使用某些Cortex-M0 +指令.

I need to force IAR tp use certain Cortex-M0+ instruction in some part of my code while codding with C.

请不要提供纯asm函数或内联asm等.

Please do not offer pure asm functions or inline asm etc.

我已经设法完成了51条指令,但是不能执行; ADR,BLX,RSBS,SBCS,SXTH指令.

I have managed to do this for 51 instruction but could not for ; ADR, BLX, RSBS, SBCS, SXTH instructions.

此功能的优化已禁用(#pragma Optimization = none)

Optimization is disabled for this function (#pragma optimization=none)

我通过考虑指令行为尝试了很多事情. 但是IAR倾向于使用具有不同指令的相同功能.

I have tried many things by considering instruction behaviour. But IAR preferred to same function with different instructions.

有人有没有遇到过这样不必要的事情?或者有人有想法吗?

Did anyone else struggle with such a unnecessary thing before or has anyone an idea?

推荐答案

请不要提供纯asm函数或内联asm等.

Please do not offer pure asm functions or inline asm etc.

但是,这是不依赖于编译器版本的唯一问题解决方案.

But these are the only solution to your problem that won't depend on compiler version.

您可能有

设法执行51条指令

managed to do this for 51 instruction

..但是即使优化器处于关闭状态,下一个(主要的)编译器版本在如何为C代码生成指令方面也可能有一个非常不同的想法. GCC的BTDT.

..but the next (major) compiler version could have a vastly different idea on how to generate instructions for your C code, even when the optimizer is off. BTDT for GCC.

使用汇编语言编码的东西直接完全消除了此编译器版本的依赖性.您甚至应该有一些示例代码,因为大多数C-startup(重置处理程序)代码都是作为汇编语言文件提供的.

Coding stuff in assembly language directly eliminates this compiler version dependecy altogether. You should even have some example code, as most C-startup (reset handler) code is shipped as assembly language file.

这篇关于如何强制IAR使用所需的Cortex-M0 +指令(此功能将禁用优化.)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆