- /***************************** 错误描述 ******************************************/
- // tft.c中定义内联函数
- #pragma inline = forced //强制inline
- void TFT_Write_Colour(const RGB_COLOUR *rgb)
- {
- //...code....
- }
- // tft.h中声明函数
- void TFT_Write_Colour(const RGB_COLOUR *rgb);
- // main.c中调用函数
- // 编译报错:main中引用了未定义的外部函数TFT_Write_Colour。
- /***************************** 解决办法 ******************************************/
- // tft.h中“定义函数”
- #pragma inline = forced //在IAR EW430中,这里必须用强制inline;用inline可能导致编译器忽略内联,而定义成普通函数而出错。
- void TFT_Write_Colour(const RGB_COLOUR *rgb)
- {
- //...code....
- }
- // main.c中包含tft.h,并调用函数
- // 结果:编译正确
6. 如何把变量定义到flash空间
unsigned char __flash temptab[] = {1,2,3,4,5}; <br>__flash unsigned char a @ 0x8; // 定义变量存放在flash 空间0X08单元
|
7. 关于内存模型
AVR 微控制器的其中一个特点是它有一种存储器访问方法均衡了“cheap access limited to small memory areas”与“more expensive accessmethods that can access any location in memory”。
在AVR_IAR C/C++编译器中,通过选择某种存储模式(memory model),可设置一些访问方法为默认的存储器访问方法(default memory accessmethod)。共有三种可用的存储模式——Tiny,Small 和Large。你的处理器选项决定了哪些模式可以使用。如果你不指定一种存储模式,则编译器自动设定-v0、-v1、-v2、-v3、-v5 选项下的默认方法为Tiny,-v4 和-v6 选项下的访问方法为Small。

8. 关于生成文件格式的设置
如图,在linker -> outpu ->other中可设置相应的输出文件格式.
比如要生成bin格式,选择raw-binary就可以了, 如果是要生成hex格式,那么可以选intel-extern ,不过这个时候文件扩展名是*.a90,可以把"Override default " 打钩,然后修改后缀名为hex就行了.

------------------------------------------------------------------------------------------------------------------
|