IAR for STM8 编译选项 Target 里 code small 什么意思

2020-01-03 19:08发布

如题,IAR for STM8 编译选项 Target 里
code 有Small, Medium, Large
Data 也有Small, Medium, Large
这几个选项,不同选择会影响编译出来代码的大小,但是一直不明白这几个选项的意义,百度没搜出来,有没有人知道的?
24条回答
hd12
2020-01-06 19:27 .采纳回答
本帖最后由 hd12 于 2015-3-6 10:46 编辑
walker 发表于 2015-3-5 21:53
搜索--code_model (compiler option)   --data_model (compiler option) 有详细参数


在 IARC/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范围。

一周热门 更多>