本帖最后由 zhanggan009 于 2019-6-24 15:51 编辑
各位大侠好!
最近正在写一个通过USB口更新DSP的固件的程序。刚开始就碰到了问题。运行官方的例子是没问题的。但我自己稍微修正一下就可能出错,现在只能几句几句的增加。非常困惑,主要体现在以下几个方面。
基本的CMD文件的部分,这样是正常的:
PAGE 0: /* Program Memory */
/* Memory (RAM/FLASH/OTP) blocks can be moved to PAGE1 for data allocation */
ZONE0 : origin = 0x002000, length = 0x002000 /* XINTF zone 0 */
ZONE1 : origin = 0x004000, length = 0x002000 /* XINTF zone 1 */
RAML0 : origin = 0x008000, length = 0x001000 /* on-chip RAM block L0 */
RAML1 : origin = 0x009000, length = 0x001000 /* on-chip RAM block L1 */
ZONE2 : origin = 0x080000, length = 0x080000 /* XINTF zone 2 */
ZONE6 : origin = 0x100000, length = 0x080000 /* XINTF zone 6 */
OTP : origin = 0x3D7800, length = 0x000800 /* on-chip OTP */
FLASHJ : origin = 0x3D8000, length = 0x002000 /* on-chip FLASH */
FLASHI : origin = 0x3DA000, length = 0x002000 /* on-chip FLASH */
FLASHH : origin = 0x3DC000, length = 0x004000 /* on-chip FLASH */
FLASHG : origin = 0x3E0000, length = 0x004000 /* on-chip FLASH */
FLASHF : origin = 0x3E4000, length = 0x004000 /* on-chip FLASH */
FLASHE : origin = 0x3E8000, length = 0x004000 /* on-chip FLASH */
FLASHD : origin = 0x3EC000, length = 0x004000 /* on-chip FLASH */
FLASHC : origin = 0x3F0000, length = 0x004000 /* on-chip FLASH */
FLASHB : origin = 0x3F4000, length = 0x002000 /* on-chip FLASH */
FLASHA : origin = 0x3F6000, length = 0x001F80 /* on-chip FLASH */
CSM_RSVD : origin = 0x3F7F80, length = 0x000076 /* Part of FLASHA. Program with all 0x0000 when CSM is in use. */
BEGIN : origin = 0x3F7FF6, length = 0x000002 /* Part of FLASHA. Used for "boot to Flash" bootloader mode. */
CSM_PWL : origin = 0x3F7FF8, length = 0x000008 /* Part of FLASHA. CSM password locations in FLASHA */
......
Flash28_API:
{
-lFlash2812_API_V210.lib(.econst)
-lFlash2812_API_V210.lib(.text)
} LOAD = FLASHD,
RUN = RAML0,
LOAD_START(_Flash28_API_LoadStart),
LOAD_END(_Flash28_API_LoadEnd),
RUN_START(_Flash28_API_RunStart),
PAGE = 0
ramfuncs : LOAD = FLASHD,
RUN = RAML1,
LOAD_START(_RamfuncsLoadStart),
LOAD_END(_RamfuncsLoadEnd),
RUN_START(_RamfuncsRunStart),
PAGE = 0
.cinit : > FLASHA PAGE = 0
.pinit : > FLASHA, PAGE = 0
.text : > FLASHA PAGE = 0
.econst : > FLASHA PAGE = 0
.switch : > FLASHA PAGE = 0
IQmath : > FLASHC PAGE = 0 /* Math Code */
IQmathTables : > ROM PAGE = 0, TYPE = NOLOAD /* Math Tables In ROM */
.........
对应的map文件的部分内容如下:
PAGE 0: ZONE0 00002000 00002000 00000000 00002000 RWIX ZONE1 00004000 00002000 00000000 00002000 RWIX RAML0 00008000 00001000 00000575 00000a8b RWIX RAML1 00009000 00001000 000001ab 00000e55 RWIX ZONE2 00080000 00080000 00000000 00080000 RWIX ZONE6 00100000 00080000 00000000 00080000 RWIX OTP 003d7800 00000800 00000000 00000800 RWIX FLASHJ 003d8000 00002000 00000000 00002000 RWIX FLASHI 003da000 00002000 00000000 00002000 RWIX FLASHH 003dc000 00004000 00000000 00004000 RWIX FLASHG 003e0000 00004000 00000000 00004000 RWIX FLASHF 003e4000 00004000 00000000 00004000 RWIX FLASHE 003e8000 00004000 00000000 00004000 RWIX FLASHD 003ec000 00004000 00000720 000038e0 RWIX FLASHC 003f0000 00004000 00000000 00004000 RWIX FLASHB 003f4000 00002000 00000000 00002000 RWIX FLASHA 003f6000 00001f80 00001365 00000c1b RWIX CSM_RSVD 003f7f80 00000076 00000000 00000076 RWIX BEGIN 003f7ff6 00000002 00000002 00000000 RWIX CSM_PWL 003f7ff8 00000008 00000000 00000008 RWIX ROM 003ff000 00000fc0 00000000 00000fc0 RWIX RESET 003fffc0 00000002 00000000 00000002 RWIX VECTORS 003fffc2 0000003e 00000000 0000003e RWIX
PAGE 1: RAMM0 00000000 00000400 00000400 00000000 RWIX RAMM1 00000400 00000400 00000400 00000000 RWIX DEV_EMU 00000880 00000180 000000d6 000000aa RWIX FLASH_REGS 00000a80 00000060 00000008 00000058 RWIX CSM 00000ae0 00000010 00000010 00000000 RWIX XINTF 00000b20 00000020 00000020 00000000 RWIX CPU_TIMER0 00000c00 00000008 00000008 00000000 RWIX CPU_TIMER1 00000c08 00000008 00000008 00000000 RWIX CPU_TIMER2 00000c10 00000008 00000008 00000000 RWIX PIE_CTRL 00000ce0 00000020 0000001a 00000006 RWIX PIE_VECT 00000d00 00000100 00000100 00000000 RWIX ECAN_A 00006000 00000100 00000034 000000cc RWIX ECAN_AMBOX 00006100 00000100 00000100 00000000 RWIX SYSTEM 00007010 00000020 00000020 00000000 RWIX SPI_A 00007040 00000010 00000010 00000000 RWIX SCI_A 00007050 00000010 00000010 00000000 RWIX XINTRUPT 00007070 00000010 00000010 00000000 RWIX GPIOMUX 000070c0 00000020 00000020 00000000 RWIX GPIODAT 000070e0 00000020 00000020 00000000 RWIX ADC 00007100 00000020 0000001a 00000006 RWIX EV_A 00007400 00000040 00000032 0000000e RWIX EV_B 00007500 00000040 00000032 0000000e RWIX SCI_B 00007750 00000010 00000010 00000000 RWIX MCBSP_A 00007800 00000040 00000025 0000001b RWIX CSM_PWL 003f7ff8 00000008 00000008 00000000 RWIX RAMH0 003f8000 00002000 00000e7d 00001183 RWIX
随着代码的增加,flashA不够用了。我稍微一修改就错了,程序就会停在0x003FFC00这个地址附近,不再动作,可是这个区域从map文件中看是没有使用的。
修改比如:
1.扩大FLASHA
/* FLASHB : origin = 0x3F4000, length = 0x002000 */ /* on-chip FLASH */
FLASHA : origin = 0x3F4000, length = 0x003F80 /* on-chip FLASH */
2.或将上述5个使用FLASHA的段,部分定义到其他段
3.或只将.text指向其他FLASH区,哪怕根本没有占用多少字节,理解就运行不下去了。
以上三种修改立即就要出错,程序就会停在0x003FFC00这个地址附近,不再动作,实在是让人无法理解。
后来又发觉,当擦除SECTORA的时候会出错,我只能躲开FLASHA,擦除SECTORC又能成功了。
还请各位高手,指点一下小弟。
|