TI中文支持网
TI专业的中文技术问题搜集分享网站

C6424 Boot的疑问,二级bootloader是不是不支持16bit Nor FLASH?

C6424通过EMIF ROM启动有两种方式,一种是with AIS 一种是without AIS;

第一种是将编译后的out文件转换为AIS格式写入到FLASH中,官方提供的资料中都是这种方式较多,这种应该是支持16位的FLASH接口的。

第二种是自已编写boot.asm,做一个二级bootloader,把ROM中的代码拷到RAM中,再跳到C入口运行,这种方式是不是不支持16位的FLASH?

我找了同系列的c6416、dm6437、6455、6713,看了好多参考设计与boot文件,全都是8 bits的设计,请问通过二级bootloader这种方式是不是不支持16位接口?

我的c6424FLASH接口设计的是16位的,boot.asm文件参考的是6416的代码(附后),EMIF的寄存器设置改为16位,AEM[2:0]设置为010,16bit EMIF模式,程序烧入FLASH后总是不能启动

是二级bootloader不支持16位ROM接口呢?还是程序或硬件上哪里设置的不对?请帮忙分析一下,谢谢

boot.asm

拷贝部分代码如下:

;****************************************************************************
;* Copy code sections
;****************************************************************************
mvkl COPY_TABLE, a3 ; load table pointer
mvkh COPY_TABLE, a3

ldw *a3++, b1 ; Load entry point

copy_section_top:
ldw *a3++, b0 ; byte count ldw *a3++, a4 ; ram start address
nop 3

[!b0] b copy_done ; have we copied all sections?
nop 5

copy_loop:
ldb *a3++,b5
sub b0,1,b0 ; decrement counter
[ b0] b copy_loop ; setup branch if not done
[!b0] b copy_section_top
zero a1
[!b0] and 3,a3,a1
stb b5,*a4++
[!b0] and -4,a3,a5 ; round address up to next multiple of 4
[ a1] add 4,a5,a3 ; round address up to next multiple of 4;****************************************************************************
;* Jump to entry point
;****************************************************************************
copy_done:
mvkl 0x00000100, b0
nop 5
copy_done1:
sub b0,1,b0 [ b0] b copy_done1 ; have we copied all sections? nop 9 b .S2 b1
nop 9

Tony Tang:

EMIFA直接boot是从Nor 直接运行,所以存在NOR中的二级boot要是可执行的内存镜像,也就是说要跟从CCS下载后的内存的内容一样的。

#1. 上电后直接将PC指向EMIFA的地址单步调试,看出现什么情况。

#2. 对比一下NOR flash的内容跟从CCS下载到内存的内容是否一致(这里原工程的cmd文件要将地址设为flash的地址,而CCS可下载的工程要改到RAM)。理解我的意思后自己改一下。

suntds:

回复 Tony Tang:

谢谢回复,但貌似您说的和我问的不是一回事,我通过EMIFA从ROM boot,但应用程序是不是ROM上运行的。这种情况下,怎么会是“NOR中的二级boot要是可执行的内存镜像,也就是说要跟从CCS下载后的内存的内容一样的”

根据Ti的手册,以及其它型号的DSP(6711、6416、6437等)的boot过程,应该是NOR flash前1K字节(0x42000000-0x42000400)存放的是二级bootloader(也就是boot.asm,这段代码的主要功能就是拷贝用户应用程序到RAM中),上电后,DSP内部自带的BootROM会首先把NOR中前1K字节拷到片内RAM的首地址,并开始执行拷贝过程(当然还包括对PLL、DDR、EMIF寄存器的设置),拷完各个section后,程序跳到C程序入口地址_c_int00开始执行用户的应用程序。

这个过程我觉得是没有问题的。但我程序烧到FLASH中后,总是起不来。我现在使用的是16位的EMIF NOR FLASH接口,而能查到的6711、6416、6437等使用的都是8 bit的EMIF接口,因此我怀疑6424是不是也只能用8位,而不支持16位的EMIFA ROM boot without AIS.

PS:16 bit的EMIFA ROM boot with AIS这种模式是能够正常启动的。

Tony Tang:

回复 suntds:

参考datasheet page 75:

EMIFA ROM Fastboot without AIS: (FASTBOOT = 1, BOOTMODE[3:0] = 1001b)– The C64x+ begins execution from the internal bootloader ROM at address 0x00100000.– The bootloader code programs PLLC1 to PLL Mode to speed up the boot process. The PLLmultiplier value is determined by the PLLMS[2:0] configuration as shown in Table 3-5.– The bootloader code then jumps to the EMIFA EM_CS2 space, at which point the C64x+ fetchesthe code directly from address 0x42000000.– EMIFA is configured as Asynchronous EMIF. The user is responsible for ensuring the desirableAsynchronous EMIF pins are available through configuration pins AEM[2:0]. AEM[2:0] must beconfigured to 010b [EMIFA (Async) Pinout Mode 2].

suntds:

回复 Tony Tang:

感谢Tony 的及时回复。这段话的意思看上去很直接,就是bootloader配置PLL后就直接跳到0x42000000的CS2空间去执行程序了。

但我比较怀疑事实是否真是如此。

我只是想确认一下c6424就没有这样一种启动模式:上电后,BootROM把NOR上1K字节(这部分是second bootloader)拷到内部RAM,然后执行second bootloader把其它用户程序再拷到RAM中,再跳转运行。

如果没有这种模式,我觉得挺不可思议的,呵呵~(因为我接触过的很多TI的DSP芯片都是这种boot方式)

以下一段是从“spra999a1_Creating a Second-Level Bootloader for FLASH Bootloading on C6000”摘录的:

The most commonly selected boot configuration is the ROM boot process (also referred to asthe on-chip bootloader in this document). When selected, the ROM boot process copies a fixedamount of memory located at the beginning of the external ROM to address 0 using theDMA/EDMA controller. The transfer is automatically completed as a single frame block transferfrom ROM to address 0. This transfer occurs when the device is released from external resetwhile the CPU is internally stalled. Upon completion of the block transfer the CPU is releasedfrom the stalled state and starts executing from address 0.The ROM boot process differs between specific C6000 devices.• 620x/670x DMA copies 64K bytes from CE1 to address 0• 621x/671x/64x EDMA copies 1K bytes from beginning of CE1 to address 0.Application size determines whether the on-chip bootload facility is sufficient or whether there isa need for a secondary bootloader. If the application size is less than the size copied by theROM boot, then a secondary bootloader (custom boot code) is not required. Typically,621x/671x/64x applications need a secondary bootloader because the application size is greaterthan the 1K bytes of memory copied by the on-chip bootloader.

Tony Tang:

回复 suntds:

Suntds,

C6424是C64+的核,跟以前的C64不是同一代芯片,所以ROM bootloader有区别是正常的,比如说C64没有AIS格式的支持,这也是新加上去的。

不管在datasheet还是在C6424的bootloader手册里都没有提到copy 1Kbyte,这种方式在C6748上称为legacy NOR boot,也就是说这是一种老的boot mode。(这段话只是讲一下历史)

另外,你已经用AISl格式成功了,也没必要纠结在这种copy 1K的模式。如果有兴趣,你可以试一下手册上说的直接从nor运行的方式。注意初始化段放nor上,未初始化段放RAM上。

suntds:

回复 Tony Tang:

Tony,过年好~

感谢你耐心及时的回复,你说的很对,legacy NOR boot是传统的boot方式(当时看文档的时候没在意),假期里又仔细看了一遍 spraak5b_Using the TMS320C642x Bootloader (Rev. B)文档和合众达DM6437的烧写文件到FLASH的代码,C6424的ROM boot without AIS方式确实是没有bootloader先从ROM拷贝1K到RAM这个过程,而是上电后直接在ROM运行,拷贝是通过二级bootloader实现的。我重新看了一下我的代码,之前过程理解的虽有偏差,但其实代码本身应该是没问题的,boot.asm文件参考的是DM6437的,只不过它的FLASH是8位的,我是16位,我把EMIF的总线宽度改成了16位,其它没变(A1CR = 0x3FFFFFFD),只把.text,.cinit,.switch段烧入到FLASH中,结果还是不能启动。

PS:之所以如此纠结,是因为我一开始是想用ROM boot without AIS方式的,搞好一段时间没搞定,转而用AIS方式,虽然成功了,但对于ROM boot without AIS方式还是有种如梗在喉的感觉,暂时先不管它了,呵呵,谢谢~

Tony Tang:

回复 suntds:

Suntds,

看问题是不是cmd里没有把初始化段分配到flash,(不仅仅是烧到flash)。如果做的是正确的,烧写后,就是没有boot起来,也是可以连上仿真器将指针设为flash的首地址进行单步调试的。

suntds:

回复 Tony Tang:

谢谢Tony,

我烧到flash上的都是初始化段(.bootld, .txt, .cinit, .switch )但我没有把这些段分配到flash,如果全分配到flash中,那相当于即使启动起来程序也都是在ROM上运行的,这样对于高速数据处理来讲是不合理的。我理解正常的做法应该是上电后在flash上运行.bootload段代码,它的功能就是把.txt, .cinit, .switch这三个段拷到RAM中,然后再跳转到RAM中的程序入口地址处,接下来在RAM中运行程序。我当时试着想连上仿真器,通过debug-load symbols看看指针停在哪,是否执行拷贝等,但是在bootmode设置为1001(boot from ROM without AIS)这种模式,仿真器都连不上(忘了什么提示信息了)。

作为调试手段,我试试把初始化段分配到flash中,这样的话就不需要.bootld段了(即boot.asm文件),但这种方式最终不是我想要的运行模式。谢谢。

以下是我程序的CMD文件,以及通过hex6x转换成hex文件后生成的map文件,有时间请一起看一下:

link.cmd

-l rts64plus.lib

-stack 0x00000800 /* Stack Size */-heap 0x00000800 /* Heap Size */

MEMORY{ BootLoader: o = 0x00800000 l = 0x00000800 L2RAM: o = 0x00800800 l = 0x0001F800 DDR2: o = 0x80000000 l = 0x10000000}

SECTIONS{ .bootld: > BootLoader

.bss > L2RAM

.cio > L2RAM .const > L2RAM .data > L2RAM .far > L2RAM .stack > L2RAM .sysmem > L2RAM

.text > L2RAM .cinit > L2RAM

.switch > L2RAM}

c6424_boot_LED.map

********************************************************************************TMS320C6x Hex Converter v7.4.4********************************************************************************

INPUT FILE NAME: <c6424_boot_LED.out>OUTPUT FORMAT: ASCII-Hex

PHYSICAL MEMORY PARAMETERS Default data width : 8 Default memory width : 16 Default output width : 8

BOOT LOADER PARAMETERS Table Address: 0x42000400, PAGE 0 Entry Point : 0x802a40

OUTPUT TRANSLATION MAP——————————————————————————–42000000..4200ffff Page=0 Memory Width=16 ROM Width=16 "FLASH"——————————————————————————– OUTPUT FILES: c6424_boot_LED.hex [b0..b15]

CONTENTS: 42000000..420001bf c6424_boot_LED.out(.bootld) 420001c0..420003ff FILL = 00000000 42000400..420028fb BOOT TABLE .text : btad=42000400 dest=00800800 size=00002300 .cinit : btad=4200270c dest=00803300 size=000001bc .switch : btad=420028d0 dest=00803694 size=00000020 420028fc..4200ffff FILL = 00000000

Tony Tang:

回复 suntds:

你是把boot.asm与应用工程在一个工程里吧,这样要把boot.asm单独分配一个段,并把它分配到flash。其它段按你自己的要求放就好了。

简而言之,二级boot是要在flash运行,那么它的链接地址也需要在flash上,不然程序调用跳转的时候就不对了。

赞(0)
未经允许不得转载:TI中文支持网 » C6424 Boot的疑问,二级bootloader是不是不支持16bit Nor FLASH?
分享到: 更多 (0)