用IAR 如何在程序空间定义数组? 新闻出处:21ic 发布时间: 2007-05-22 bai4004 发布于 2007-5-17 18:22:00 我用IAR编译器 想在程序空间定义一个数组:如下, flash unsigned char stone[]; 但编译错误,我加了头文件pgmspace.h后还是编译不通过。 请教一下该怎么定义??
-------------------------------------------------------------------------------- bai4004 发布于 2007-5-17 18:48:00 我现在就直接定义const unsigned char stone[];能编译通过,但不知道怎么把他读出来?再请教了!
-------------------------------------------------------------------------------- maomao40 发布于 2007-5-18 10:25:00 用以下方式定义: __flash unsigned char f_test[]={0,1,2,3,4,5}; 通过以下方式读取 unsigned char g_test[]; unsigned char i; for(i=0;i<6;i++) g_test=f_test;
-------------------------------------------------------------------------------- zhangfly 发布于 2007-5-18 14:59:00 The extended keywords that can be used for data control the following: ● For data memory space, keywords that control the placement and type of objects and pointers: __tiny, __near, __far, __huge, and __regvar ● For the EEPROM memory space, keyword that controls the placement and type of objects and pointers: __eeprom ● For the code (flash) memory space, keywords that control the placement and type of objects and pointers: __tinyflash, __flash, __farflash, and __hugeflash ● For the I/O memory space, keyword that controls the placement and type of objects and pointers: __ext_io, __io ● Special pointer that can access data objects in both data and code memory space: __generic ● Other characteristics of objects: __root and __no_init.
-------------------------------------------------------------------------------- bai4004 发布于 2007-5-22 16:16:00 谢谢各位的回答: 我又试了一下,flash unsigned char stone[]; __flash unsigned char f_test[]={0,1,2,3,4,5};都可以了 在comp_a90.h 30 里面有如下定义 #define flash const __flash 因此两种都是可以的。 但是,我还没找到那里定义的__flash,四楼说的原文在哪里? |