找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開始

搜索
查看: 3585|回復(fù): 5
打印 上一主題 下一主題
收起左側(cè)

Keil環(huán)境中怎么替代#pragra

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
ID:272602 發(fā)表于 2019-9-9 18:19 | 只看該作者 回帖獎(jiǎng)勵(lì) |倒序?yàn)g覽 |閱讀模式
88黑幣
本帖最后由 thinkingpadcui 于 2019-9-10 16:24 編輯


#pragma location="LCD_region"
char lcd_buffer[8][256];
#pragma location="BG_region"
long lcd_points[8*256*8]
這段代碼在IAR下能正常運(yùn)行,移植到keil5上面就報(bào)warning;
keil環(huán)境下可以用什么代碼代替這四段代碼!在線等
gui\LCD\lcd.c(18): warning:  #161-D: unrecognized #pragma
這兩個(gè)數(shù)組應(yīng)該是定義12864LCD RAM的
void drawPoint(short x, short y, char value)
{
        unsigned short location;

        assert( (x<132));assert((y<64));
        assert( x>=0); assert((y>=0));
        location= y&0x7;
        location +=(y>>3)<<11;
        location += (x<<3);
        lcd_points[location]=value;
}
void paintRect(short x0, short y0, short x1, short y1)
{
        char *pchar;
        char temp_x0;
        y0 =y0>>3;
        y1 =(y1+7)>>3;
        
        for(;y0<=y1;y0++)
        {
                 WriteCommand(0xb0 | (y0));
                WriteCommand(0x10 | (x0>>4));
                WriteCommand(0x0F & (x0));
                WriteCommand(0xE0);
               
                pchar = &lcd_buffer[y0][x0];
                temp_x0=x0;
                for(;temp_x0<=x1;temp_x0++){
                        WriteData(*pchar++);
                }
        }
}這個(gè)兩個(gè)數(shù)組只用在這兩個(gè)函數(shù)里面  然后這兩個(gè)函數(shù)被LCD底層驅(qū)動(dòng)函數(shù)調(diào)用

下面是IAR .icf文件內(nèi)容  在keil里面 應(yīng)該怎么實(shí)現(xiàn)
#define symbol __ICFEDIT_region_RAM_LCD_start__ = 0x20004000;
#define symbol __ICFEDIT_region_RAM_LCD_end__   = 0x20004FFF;
#define symbol __ICFEDIT_region_RAM_BG_start__  = 0x22080000;
#define symbol __ICFEDIT_region_RAM_BG_end__    = 0x2208FFFF;


#define region LCD_region = mem:[from __ICFEDIT_region_RAM_LCD_start__   to __ICFEDIT_region_RAM_LCD_end__];
#define region BG_region = mem:[from __ICFEDIT_region_RAM_BG_start__   to __ICFEDIT_region_RAM_BG_end__];


分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享淘帖 頂 踩
回復(fù)

使用道具 舉報(bào)

沙發(fā)
ID:235200 發(fā)表于 2019-9-9 22:17 | 只看該作者
去掉兩行,然后
char lcd_buffer[8][256];

long lcd_points[8*256*8];
這兩行根據(jù)自己的存儲(chǔ)器可定義為:
char xdata lcd_buffer[8][256];

long xdata lcd_points[8*256*8];
這樣編譯就不會(huì)出錯(cuò)了
回復(fù)

使用道具 舉報(bào)

板凳
ID:272602 發(fā)表于 2019-9-10 12:18 | 只看該作者
csmyldl 發(fā)表于 2019-9-9 22:17
去掉兩行,然后
char lcd_buffer[8][256];

gui\LCD\lcd.c(18): warning:  #161-D: unrecognized #pragma
這兩個(gè)數(shù)組應(yīng)該是定義12864LCD RAM的
void drawPoint(short x, short y, char value)
{
        unsigned short location;

        assert( (x<132));assert((y<64));
        assert( x>=0); assert((y>=0));
        location= y&0x7;
        location +=(y>>3)<<11;
        location += (x<<3);
        lcd_points[location]=value;
}
void paintRect(short x0, short y0, short x1, short y1)
{
        char *pchar;
        char temp_x0;
        y0 =y0>>3;
        y1 =(y1+7)>>3;
       
        for(;y0<=y1;y0++)
        {
                 WriteCommand(0xb0 | (y0));
                WriteCommand(0x10 | (x0>>4));
                WriteCommand(0x0F & (x0));
                WriteCommand(0xE0);
               
                pchar = &lcd_buffer[y0][x0];
                temp_x0=x0;
                for(;temp_x0<=x1;temp_x0++){
                        WriteData(*pchar++);
                }
        }
}這個(gè)兩個(gè)數(shù)組只用在這兩個(gè)函數(shù)里面  然后這兩個(gè)函數(shù)被LCD底層驅(qū)動(dòng)函數(shù)調(diào)用
回復(fù)

使用道具 舉報(bào)

地板
ID:272602 發(fā)表于 2019-9-10 12:36 | 只看該作者
csmyldl 發(fā)表于 2019-9-9 22:17
去掉兩行,然后
char lcd_buffer[8][256];

謝謝!不太明白您的意思 我的問題加了補(bǔ)充了  麻煩看一下  謝謝
回復(fù)

使用道具 舉報(bào)

5#
ID:272602 發(fā)表于 2019-9-10 22:41 | 只看該作者
看了很多資料問題已解決,下面兩行代碼完美解決
char lcd_buffer[8][256]__attribute__((at(0x20004000)));

long lcd_points[8*256*8]__attribute__((at(0x22080000)));
回復(fù)

使用道具 舉報(bào)

6#
ID:272602 發(fā)表于 2019-9-10 22:42 | 只看該作者
查了很多資料,問題已解決。替換成下面兩行代碼。完美解決
char lcd_buffer[8][256]__attribute__((at(0x20004000)));

long lcd_points[8*256*8]__attribute__((at(0x22080000)));
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

手機(jī)版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表