VIA Flash 容量 划分

我们的项目D600,用的是16+8的Flash跟Rom,其中16M的Flash分为约12M的程序区,4M的用户数据区.但在加入大字体(20*20)的后,编译出错,提示:Load region FLASH size
(11557344 bytes) exceeds limit (11272192 bytes).

于是要把用户数据区减少,加大CP区的大小.
要修改两个文件,分别是Hwdflash.c cpflash_16_8.LNK(梅红色的为之前的大小)
Hwdflash.c中

static void
FlashInitSector(HwdFlashLowDevT * devP)

{

 if (devP->man_id ==
HWD_FLASH_MANID_AMD)

  {

#ifdef
FLASH_SPANSIONS71PL127N

    SectorLookupTable =
SectorLookupTable16MTB;

    FlashMaxSector = FLASH_SECTOR_69;

    SectionMapToSector[HWD_FLASH_CP_BOOT_CODE_SECTION].StartSector =
FLASH_SECTOR_0;

    SectionMapToSector[HWD_FLASH_CP_BOOT_CODE_SECTION].EndSector =
FLASH_SECTOR_0;

    SectionMapToSector[HWD_FLASH_CP_CODE_SECTION].StartSector = FLASH_SECTOR_4;

SectionMapToSector[HWD_FLASH_CP_CODE_SECTION].EndSector = FLASH_SECTOR_49;//FLASH_SECTOR_46// 49-4+1=46  A

    SectionMapToSector[HWD_FLASH_DSPM_CODE_SECTION].StartSector =
FlashMaxSector + 1; /*Realy no DSPM and DSPV section */

    SectionMapToSector[HWD_FLASH_DSPM_CODE_SECTION].EndSector =
FlashMaxSector + 1;

    SectionMapToSector[HWD_FLASH_DSPV_CODE_SECTION].StartSector =
FlashMaxSector + 1;

    SectionMapToSector[HWD_FLASH_DSPV_CODE_SECTION].EndSector =
FlashMaxSector + 1;

    SectionMapToSector[HWD_FLASH_CP2_CODE_SECTION].StartSector =
FlashMaxSector + 1;

    SectionMapToSector[HWD_FLASH_CP2_CODE_SECTION].EndSector = FlashMaxSector
+ 1;

    SectionMapToSector[HWD_FLASH_CP3_CODE_SECTION].StartSector =
FlashMaxSector + 1;

    SectionMapToSector[HWD_FLASH_CP3_CODE_SECTION].EndSector = FlashMaxSector
+ 1;

SectionMapToSector[HWD_FLASH_FSM_USER_SECTION].StartSector = FLASH_SECTOR_53;//50

    SectionMapToSector[HWD_FLASH_FSM_USER_SECTION].EndSector = FLASH_SECTOR_65;
    SectionMapToSector[HWD_FLASH_FSM_DATA_SECTION].StartSector = FLASH_SECTOR_1;
    SectionMapToSector[HWD_FLASH_FSM_DATA_SECTION].EndSector = FLASH_SECTOR_3;

    SectionMapToSector[HWD_FLASH_ALL_SECTION].StartSector =
FLASH_SECTOR_0;

    SectionMapToSector[HWD_FLASH_ALL_SECTION].EndSector = FlashMaxSector;

    SectionMapToSector[HWD_FLASH_PRI_SECTION].StartSector = FlashMaxSector +
1;

    SectionMapToSector[HWD_FLASH_PRI_SECTION].EndSector = FlashMaxSector +
1;

    SectionMapToSector[HWD_FLASH_FAULT_DATA_SECTION].StartSector =
FLASH_SECTOR_66;   /*64 k bytes is
ok.*/

    SectionMapToSector[HWD_FLASH_FAULT_DATA_SECTION].EndSector =
FLASH_SECTOR_69;

SectionMapToSector[HWD_FLASH_UI_WALL_PAPPER_SECTION].StartSector = FLASH_SECTOR_50;//47

SectionMapToSector[HWD_FLASH_UI_WALL_PAPPER_SECTION].EndSector = FLASH_SECTOR_50;//47

SectionMapToSector[HWD_FLASH_UI_MAIN_TOPIC_SECTION].StartSector = FLASH_SECTOR_51;//48

SectionMapToSector[HWD_FLASH_UI_MAIN_TOPIC_SECTION].EndSector = FLASH_SECTOR_52;//49

#endif
/*FLASH_SPANSIONS71PL127N */

     }
}

/* Top Bottom type
16M, Spansion S71PL127N, 128 + 64 */

#ifdef
FLASH_SPANSIONS71PL127N

static const uint32
SectorLookupTable16MTB[] = {

  /* 0 – 3 */

  0x00000000, 0x00010000,
0x00020000, 0x00030000, /* 4 blocks of 64K bytes size
= =  FLASH_SECTOR_0 */

  /* 4 – 10 */

  0x00040000, 0x00080000,
0x000C0000, 0x00100000, /* 62 blocks of 256k bytes size
=FLASH_SECTOR_1~4*/

  0x00140000, 0x00180000, 0x001C0000,
  /* 11 – 34 */

  0x00200000, 0x00240000, 0x00280000,
0x002C0000,

  0x00300000, 0x00340000, 0x00380000,
0x003C0000,

  0x00400000, 0x00440000, 0x00480000,
0x004C0000,

  0x00500000, 0x00540000, 0x00580000,
0x005C0000,

  0x00600000, 0x00640000, 0x00680000,
0x006C0000,

  0x00700000, 0x00740000, 0x00780000,
0x007C0000,

  /* 35 – 58 */

  0x00800000, 0x00840000, 0x00880000,
0x008C0000,

  0x00900000, 0x00940000, 0x00980000,
0x009C0000,

  0x00A00000, 0x00A40000,
0x00A80000, 0x00AC0000,

/
* FLASH_SECTOR_43 */A+2=48 == 0x00B40000

  0x00B00000, 0x00B40000, 0x00B80000, 0x00BC0000,

  0x00C00000, 0x00C40000, 0x00C80000,
0x00CC0000,

  0x00D00000, 0x00D40000, 0x00D80000,
0x00DC0000,

  /* 59 – 65 */

  0x00E00000, 0x00E40000, 0x00E80000,
0x00EC0000,

  0x00F00000, 0x00F40000, 0x00F80000,
  /* 66 – 69 */

  0x00FC0000, 0x00FD0000, 0x00FE0000,
0x00FF0000, /* 4 blocks of 64K bytes size */

  0x01000000, 0x01000000
};

#endif
/*FLASH_SPANSIONS71PL127N */

cpflash_16_8.LNK文件中:

FLASH  0x00040000 0x00B80000 // 0x00AC0000
{
   FLASH 0x00040000 0x00B40000
   {
      copy.o     (+RO, +FIRST)
      *          (+RO)
   }
}

Hwdflash.c 中貌似可以根据需要任意调整FLASH_SECTOR的大小(不要超过最大值),关键的是LNK文件中数值大小的确定:方法为

FLASH_SECTOR_49FLASH_SECTOR_4+1=46; (1是因为包含此分块) 所以在SectorLookupTable16MTB表中查找到第46块,然后再加2(因为0 – 3 对应了FLASH_SECTOR_1 ,4开始对应FLASH_SECTOR_2所以46对应了第48组数,即为0x00B40000,又因为LNK文件中的第二个数是大小,而非终止位置,所以要填第49组数0x00B80000)
以上只是以UI的观点来看驱动调整,不对之处还请指证:)

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.