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

2020-01-03 19:08发布

如题,IAR for STM8 编译选项 Target 里
code 有Small, Medium, Large
Data 也有Small, Medium, Large
这几个选项,不同选择会影响编译出来代码的大小,但是一直不明白这几个选项的意义,百度没搜出来,有没有人知道的?
23条回答
hd12
1楼 · 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范围。
walker
2楼-- · 2020-01-05 18:36
 精彩回答 2  元偷偷看……
faduo2012
3楼-- · 2020-01-05 21:42
这几天遇到代码空间不够的问题,将middle改为small代码变小,不过有时代码貌似不正常。。,有待继续测试
summarize
4楼-- · 2020-01-06 03:11
设计要看文档,有相关文档的,可以先百度。
llww30402048
5楼-- · 2020-01-06 08:20
DATA 我试过430的,选large 是flash寻址范围大于64k,才选 large,要不然,寻址不对
hd12
6楼-- · 2020-01-06 13:49
summarize 发表于 2015-3-6 08:25
设计要看文档,有相关文档的,可以先百度。

没有把编译器的所有文档看过,好像有3个,全英文,每个至少200页,遇到问题第一是百度,再google。
hd12
7楼-- · 2020-01-06 15:40
 精彩回答 2  元偷偷看……

一周热门 更多>