This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

6678的emif nor flash固化的疑问?

进行6678的emif nor flash固化。为了简化固化,目前只固化核0,遇到一些问题请专家帮我分析一下:

(1)flash型号为S29GL01GS11DHIV2,是cfi接口的flash,我写了一个测试程序,进行擦除、写、读操作,测试OK。

(2)编写烧写文件,将一个文件的数据写入到flash,然后再读出,测试OK。

(3)通过阅读文档,大体知道6678的emif nor flash的上电启动流程:【1】上电后,6678片内的bootloader(一级bootloader)直接执行flash的起始地址的指令(起始地址为0x70000000),【2】由于应用程序一般都较大,需要用户编写二级bootloader,该代码的作用是将核0的程序搬移到6678的片内存储器或DDR3中。【3】待核0的程序执行后,将其他7个核的代码由flash搬移到相应的存储空间;【4】搬移完成后,核0写各个核的0x1x87fffc的地址为_c_int00的值,然后发送核间中断,唤醒其他核。

为了简化固化,目前只固化核0,所以【3】【4】可以省略。

我在网上查找的二级bootloader代码如下:

.title "Flash bootup utility"
.option D,T
.length 102
.width 140

BOOT_SIZE .equ 0x40000 ;bootup code size in byte
FLASH_START .equ 0x70000400 ;flash start address
BOOT_START .equ 0x10800400 ;L2 sram start address
CODE_SIZE .equ 0x30000 ;application code size in byte
CODE_START .equ 0x400 ;application code start address
.sect ".boot_sect"
.global _boot
.ref _c_int00

_boot:
MVKL BOOT_START,A4 ;ram start address ->A4
MVKH BOOT_START,A4

MVKL FLASH_START,B4 ;flash start address ->B4
MVKH FLASH_START,B4


MVKL BOOT_SIZE,A0 ;0xc000,B0 ;B6 = BOOT_SIZE -1024
MVKH BOOT_SIZE,A0 ;0xc000,B0

_wait_loop: LDH *B4++[1],B5
SUB A0,1,A0
NOP 4
STH B5,*A4++[1]
[A0] B _wait_loop
NOP 5

MVKL .S2 _c_int00, B0
MVKH .S2 _c_int00, B0
B .S2 B0
nop 5
;
; end of the bootup routine

我的程序的.cmd文件如下:

-c
-heap 0x41000
-stack 0xa000

/*--export=boot*/

/* Memory Map 1 - the default */
MEMORY
{
ISRAM : org = 0x10800000, len = 0x400
L2SRAM (RWX) : org = 0x10800400, len = 0x70000
MSMCSRAM (RWX) : org = 0xc0000000, len = 0x200000
}
SECTIONS
{
.csl_vect > L2SRAM
.boot_sect > ISRAM
.text > L2SRAM
GROUP (NEAR_DP)
{
.neardata
.rodata
.bss
} load > L2SRAM
.stack > L2SRAM
.cinit > L2SRAM
.cio > L2SRAM
.const > L2SRAM
.data > L2SRAM
.switch > L2SRAM
.sysmem > L2SRAM
.far > L2SRAM
.testMem > L2SRAM
.fardata > L2SRAM
platform_lib > L2SRAM
}

应用程序编译后,通过工具链转化为.bin文件,其批处理文件的内容为:

hex6x simple0.rmd
b2ccs simple0.hex simple0.dat
ccs2bin simple0.dat simple0.bin

其中simple0.rmd的内容为:

simple0.out
-a
-boot
-e _c_int00
-order L
-memwidth 16
-image
ROMS
{
FLASH: org = 0x70000000, len = 0x10000, romwidth = 16, files = {simple0.hex}
}

生成.bin文件后,通过烧写工程,将.bin烧写到flash中,然后设置板卡的启动管脚。上电后,观察现象,程序没有运行。

x 出现错误。请重试或与管理员联系。