IAR for STM8 编译选项 Target/code、small解释

    阅读模式

在 IAR  C/C++ Development Guide 里描述
DATA MODEL
One of the characteristics of the STM8 microcontroller is a trade-off in how memory is
accessed, ranging from cheap access to small memory areas, up to more expensive
access methods that can access any location.
In the compiler, you can set a default memory access method by selecting a data model.
These data models are supported:
?In the small data model, variables are placed in the 8-bit address range
?In the medium data model, all data is placed in the 16-bit address range
?In the large data model, constants are placed in the 24-bit address range.
The chapter Data storage covers data models in greater detail and how to override the
default access method for individual variables.
For guidelines about the choice of data model and efficient use of memory types, see
Efficient use of memory types, page 213.

CODE MODEL
The compiler supports code models that control which function calls are generated by
default, which determines the size of the linked application. These code models are
available:
?In the small code model, all functions are placed in the 16-bit address range
?In the medium code model, all functions are placed in the 24-bit address range.
Functions are not allowed to cross 64-Kbyte section boundaries.
?In the large code model, all functions are placed in the 24-bit address range.
Functions are allowed to cross 64-Kbyte section boundaries.
For detailed information about the code models, see the chapter Functions.
For guidelines about the choice of data model and efficient use of memory types, see
Efficient use of memory types, page 213.

总结下:
Code的small是64K byte寻址范围,medium是16M byte范围,但函数不允许跨越64K byte边界, large模式下是16M byte寻址范围,函数不存在跨界限制,随便放
Date的small是256 byte寻址范围,medium是64K byte范围,large是16M范围。

IAR 快捷键列表 嵌入式开发

IAR 快捷键列表

*Ctrl+Shift+V 列出剪切板中所有的字符串供选择粘贴 Ctrl+B 智能选择光标所在括弧内的区域,多次使用可选更大的区域 Ctrl+T 对选择区域进行自动缩进 Ctrl+K 注释掉选择区域 ...
IAR更改代码字体 嵌入式开发

IAR更改代码字体

在IAR Option选项里,可供选择的字体太少,大多数还是不好看的。其实是可以通过配置文件调用所有系统字体的。如下: 首先在你的系统盘里找到这个文件,地址是: C:\Users\你的用户名\AppD...
IAR常用快捷键和使用小技巧 嵌入式开发

IAR常用快捷键和使用小技巧

这篇文章主要是我在IAR使用过程中用到的一些很方便的快捷键和小技巧,方便自己查阅而使用。 1、复制和粘贴几行的部分代码 需求:有时候我们需要复制几行代码的后半部分,不需要复制前半部分。 方法:按住Al...
8位单片机的程序优化 嵌入式开发

8位单片机的程序优化

1、采用短变量 一个提高代码效率的最基本的方式就是减小变量的长度。使用 C 编程时,我们都习惯于对循环控制变量使用 int 类型,这对 8 位的单片机来说是一种极大的浪费,你应该仔细考虑你所声明的变量...