打印

请高手帮忙看下这是什么问题?

[复制链接]
1442|0
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
gushiyi|  楼主 | 2011-3-23 21:48 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
ui, GUI, TE, ST, TI
ADS调试UCGUI时,想着利用外部存储器中的字库,但是加了自己的工程文件之后,没有任何结果,但是看到存储器里边有一部分是这样的

ADS调试UCGUI时,想利用GUI外部存储器中的字库,加入自己的工程文件后没有任何结果,但从存储器中观察到有部分如下内容??请问这是什么原因呢?不加自己的那个文件就没有这个问题出现,所以问题肯定是出在所加的文件上,文件附在后边,请大牛帮忙看看??
0x00014240  36 00 00 00 A1 B0 FE F7 20 42 01 00 00 00 00 00 6....... B......
0x00014250  20 00 7F 00 18 42 01 00 44 42 01 00 D4 1C 01 00  ...B..DB......
0x00014260  40 1E 01 00 98 1E 01 00 A4 1E 01 00 80 3A 01 00 @............:..
0x00014270  10 10 01 01 50 42 01 00 00 00 00 00 41 62 6E 6F ....PB......Abno
0x00014280  72 6D 61 6C 20 74 65 72 6D 69 6E 61 74 69 6F 6E rmal termination
0x00014290  00 00 00 41 72 69 74 68 6D 65 74 69 63 20 65 78 ...Arithmetic ex
0x000142a0  63 65 70 74 69 6F 6E 3A 20 00 49 6C 6C 65 67 61 ception: .Illega
0x000142b0  6C 20 69 6E 73 74 72 75 63 74 69 6F 6E 00 00 00 l instruction...
0x000142c0  00 49 6E 74 65 72 72 75 70 74 20 72 65 63 65 69 .Interrupt recei
0x000142d0  76 65 64 00 00 00 00 00 49 6C 6C 65 67 61 6C 20 ved.....Illegal  
0x000142e0  61 64 64 72 65 73 73 00 00 00 00 00 00 00 00 54 address........T
0x000142f0  65 72 6D 69 6E 61 74 69 6F 6E 20 72 65 71 75 65 ermination reque
0x00014300  73 74 00 00 00 00 53 74 61 63 6B 20 6F 76 65 72 st....Stack over
0x00014310  66 6C 6F 77 00 00 00 00 00 00 00 00 00 52 65 64 flow.........Red
0x00014320  69 72 65 63 74 3A 20 63 61 6E 27 74 20 6F 70 65 irect: can't ope
0x00014330  6E 3A 20 00 4F 75 74 20 6F 66 20 68 65 61 70 20 n: .Out of heap  
0x00014340  6D 65 6D 6F 72 79 00 00 00 00 00 55 73 65 72 2D memory.....User-
0x00014350  64 65 66 69 6E 65 64 20 73 69 67 6E 61 6C 20 31 defined signal 1
0x00014360  00 00 55 73 65 72 2D 64 65 66 69 6E 65 64 20 73 ..User-defined s
0x00014370  69 67 6E 61 6C 20 32 00 00 50 75 72 65 20 76 69 ignal 2..Pure vi
0x00014380  72 74 75 61 6C 20 66 6E 20 63 61 6C 6C 65 64 00 rtual fn called.
0x00014390  43 2B 2B 20 6C 69 62 72 61 72 79 20 65 78 63 65 C++ library exce
0x000143a0  70 74 69 6F 6E 00 00 00 00 00 00 00 00 00 00 00 ption...........
0x000143b0  00 00 00 00 E8 43 01 00 00 00 00 30 30 00 00 00 .....C.....00...
0x000143c0  18 44 01 00 00 41 16 30 04 00 00 00 1C 44 01 00 .D...A.0.....D..
0x000143d0  00 00 00 34 00 00 00 00 E8 43 01 00 00 00 00 00 ...4.....C......
0x000143e0  30 00 00 30 D0 40 16 00 01 00 00 00 90 01 00 00 0..0.@..........
0x000143f0  01 00 00 00 FF FF FF FF 9C 3A 01 00 00 00 FF 00 .........:......
0x00014400  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0x00014410  00 00 00 00 00 00 00 00 00 00 00 00 FF FF FF FF ................

/*---------------------------------------------------------------------------*/
/*文件 : GUICharP_EXT.C - UCGUI字符打印扩展文件------------------------------*/
/*编写 : saint  (msn/mail : sainty07@hotmail.com)   (qq : 4498568)-----------*/
/*功能 : 使用UCGUI使用外部任何存储器来读取字库数据---------------------------*/
/*时间 : 2010/04/01----------------------------------------------------------*/
/*------------------------移植请注明来处,谢谢!------------------------------*/
/*示例:                                                                      */
/*GUI_SetFont(&GUI_FontHZ16);                                                */
/*GUI_DispStringHCenterAt("菜 单 选 择", 120, 10);                           */
/*---------------------------------------------------------------------------*/

//#include "common.h"
#include <stddef.h>           /* needed for definition of NULL */
#include "GUI_Private.h"
#include "fs_api.h"
#include "config.h"

FS_FILE *HZX;

//字模数据的暂存数组,以单个字模的可能最大字节数为设定值
//如果是16*16汉字,最大值为2*16=32
//如果是32*32汉字,最大值为4*32=128
#define BYTES_PER_FONT      32
static U8   GUI_FontDataBuf[BYTES_PER_FONT];

static void GUIPROP_DispChar_EXT(U16P c);
static int  GUIPROP_GetCharDistX_EXT(U16P c);
static void GUIPROP_GetFontInfo_EXT(const GUI_FONT GUI_UNI_PTR * pFont, GUI_FONTINFO* pfi);
static char GUIPROP_IsInFont_EXT(const GUI_FONT GUI_UNI_PTR * pFont, U16 c);

/******************************************************************************
函数名称:GUI_X_GetFontData                                                    *
函数功能:从外部存储器取得字模数据,该函数可以放在外部的GUI_X_OS文件中,方便移植 *                                        *
函数返回:无                                                                   *
参数说明:oft - 字模数据在字库中的地址偏移,ptr - 数据BUF,bytes - 字模字节数    *
建立时间:2010/04/01 22:47                                                     *
修改时间:                                                                     *
修改内容:                                                                     *
******************************************************************************/

#define FONT_MEMORY_NOR     0
#define FONT_MENORY_FS      1
#define FONT_MEMORY_ARRAY   0  

void GUI_X_GetFontData(char* font,U32 oft, U8 *ptr, U8 bytes)
{
    #if FONT_MEMORY_NOR             //从外部16BIT NOR FLASH里面读取数据
     //   NorFlash.ROpen(oft/2);
     //   NorFlash.RData((U16*)ptr, bytes/2);
     //    NorFlash.RClose();  
    #endif

    #if FONT_MENORY_FS              //从外部FileSystem读取数据,数据保存在NAND或SD卡中
         FS_Init();
         HZX=FS_FOpen(font,"rb");
         FS_FSeek(HZX, oft, FS_SEEK_SET);   
         FS_FRead(ptr, bytes, 1, HZX);  
         FS_FClose(HZX);
         FS_Exit();
     
     

    #endif

    #if FONT_MEMORY_ARRAY           //从外部数组读取数据,数组可以以绝对地址定位在某个FLASH段

    #endif
}

//16*16汉字库的基本信息
const GUI_CHARINFO GUI_FontHZ16_CharInfo[2] =  
{   
    //xsize - xdist - BytesPerLine - 字库在外部存储器中的起始地址或字模数组的绝对定位地址(字节为单位)     
    {   8,   8,  1, (void *)"flash:\\ascii"  },  //ASC_ROM_8X16
    {  16,  16,  2, (void *)"flash:\\hzk16"  },  //HZ_ROM_16X16      
};

const GUI_FONT_PROP GUI_FontHZ16_PropHZ=  
{
    0xb0a1,                         //啊 - 汉字的第一个内码
    0xf7fe,                         //齄 - 汉字的最后一个内码
    &GUI_FontHZ16_CharInfo[1],      //字模信息
    (void *)0,                      //字库结束  
};

const GUI_FONT_PROP GUI_FontHZ16_PropASC=  
{
    0x0020,                         //第一个ASC码  
    0x007f,                         //最后一个ASC码
    &GUI_FontHZ16_CharInfo[0],      //字模信息
    (void *)&GUI_FontHZ16_PropHZ,   //下一个字库段的地址
};

//汉字库16*16接口
const GUI_FONT GUI_FontHZ16 =  
{
GUIPROP_DispChar_EXT,         
GUIPROP_GetCharDistX_EXT,      
GUIPROP_GetFontInfo_EXT,         
GUIPROP_IsInFont_EXT,            
&GUI_ENC_APIList_SJIS,
16,  
16,  
1,   
1,   
(void *)&GUI_FontHZ16_PropASC,
};

//从外部存储器取得字模数据 - pProp:字库指针, c:字符UNICODE码
static void GUI_GetDataFromMemory(const GUI_FONT_PROP GUI_UNI_PTR *pProp, U16P c)
{
    U8 BytesPerFont;
    U32 oft;
   // base = (U32)pProp->paCharInfo->pData;
   char *font = (char *)pProp->paCharInfo->pData;
    BytesPerFont = GUI_Context.pAFont->YSize * pProp->paCharInfo->BytesPerLine; //每个字模的数据字节数
    if (BytesPerFont > BYTES_PER_FONT){BytesPerFont = BYTES_PER_FONT;}
    if (c < 0x80)                                                               //英文字符地址偏移算法
    {
        oft = (c - 0x20) * BytesPerFont;
    }
    else                                                                        //中文字符地址偏移算法   
    {
        oft =(((c>>8) - 0xb0) * 94 + ((c&0xff) - 0xa1)) * BytesPerFont;   
    }
    GUI_X_GetFontData(font,oft, GUI_FontDataBuf, BytesPerFont);
}

static void GUIPROP_DispChar_EXT(U16P c)  
{
    int BytesPerLine;
    GUI_DRAWMODE DrawMode = GUI_Context.TextMode;
    const GUI_FONT_PROP GUI_UNI_PTR *pProp = GUI_Context.pAFont->p.pProp;
    for (; pProp; pProp = pProp->pNext)     //搜索定位字库数据信息                                       
    {
        if ((c >= pProp->First) && (c <= pProp->Last))break;
    }
    if (pProp)
    {
        GUI_DRAWMODE OldDrawMode;
        const GUI_CHARINFO GUI_UNI_PTR * pCharInfo = pProp->paCharInfo;
        GUI_GetDataFromMemory(pProp, c);    //取出字模数据
        BytesPerLine = pCharInfo->BytesPerLine;
        OldDrawMode  = LCD_SetDrawMode(DrawMode);
        LCD_DrawBitmap(GUI_Context.DispPosX, GUI_Context.DispPosY,
                       pCharInfo->XSize, GUI_Context.pAFont->YSize,
                       GUI_Context.pAFont->XMag, GUI_Context.pAFont->YMag,
                       1,                   /* Bits per Pixel */
                       BytesPerLine,
                       &GUI_FontDataBuf[0],
                       &LCD_BKCOLORINDEX
                       );
        if (GUI_Context.pAFont->YDist > GUI_Context.pAFont->YSize)
        {
            int YMag = GUI_Context.pAFont->YMag;
            int YDist = GUI_Context.pAFont->YDist * YMag;
            int YSize = GUI_Context.pAFont->YSize * YMag;
            if (DrawMode != LCD_DRAWMODE_TRANS)  
            {
                LCD_COLOR OldColor = GUI_GetColor();
                GUI_SetColor(GUI_GetBkColor());
                LCD_FillRect(GUI_Context.DispPosX, GUI_Context.DispPosY + YSize,  
                             GUI_Context.DispPosX + pCharInfo->XSize,  
                             GUI_Context.DispPosY + YDist);
                GUI_SetColor(OldColor);
            }
        }
        LCD_SetDrawMode(OldDrawMode);       /* Restore draw mode */
        GUI_Context.DispPosX += pCharInfo->XDist * GUI_Context.pAFont->XMag;
    }
}

/*********************************************************************
*
*       GUIPROP_GetCharDistX
*/
static int GUIPROP_GetCharDistX_EXT(U16P c)  
{
    const GUI_FONT_PROP GUI_UNI_PTR * pProp = GUI_Context.pAFont->p.pProp;   
    for (; pProp; pProp = pProp->pNext)                                          
    {
        if ((c >= pProp->First) && (c <= pProp->Last))break;
    }
    return (pProp) ? (pProp->paCharInfo)->XSize * GUI_Context.pAFont->XMag : 0;
}

/*********************************************************************
*
*       GUIPROP_GetFontInfo
*/
static void GUIPROP_GetFontInfo_EXT(const GUI_FONT GUI_UNI_PTR * pFont, GUI_FONTINFO* pfi)  
{
      GUI_USE_PARA(pFont);
      pfi->Flags = GUI_FONTINFO_FLAG_PROP;
}

/*********************************************************************
*
*       GUIPROP_IsInFont
*/
static char GUIPROP_IsInFont_EXT(const GUI_FONT GUI_UNI_PTR * pFont, U16 c)  
{
    const GUI_FONT_PROP GUI_UNI_PTR * pProp = pFont->p.pProp;     
    for (; pProp; pProp = pProp->pNext)  
    {
        if ((c>=pProp->First) && (c<=pProp->Last))break;
    }
    return (pProp==NULL) ? 0 : 1;
}

/*************************** End of file ****************************/

相关帖子

发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

0

主题

41

帖子

1

粉丝