Chinaunix首页 | 论坛 | 博客
  • 博客访问: 938986
  • 博文数量: 173
  • 博客积分: 3436
  • 博客等级: 中校
  • 技术积分: 1886
  • 用 户 组: 普通用户
  • 注册时间: 2009-01-07 09:29
文章分类

全部博文(173)

文章存档

2016年(6)

2015年(10)

2014年(14)

2013年(8)

2012年(36)

2011年(63)

2010年(19)

2009年(17)

分类: 嵌入式

2010-08-28 10:00:10

2010 0901 实现了DM648 PCI boot
 
相关技术总结:
1:控制编译生成合适的COFF文件,需要控制程序入口地址1K字节对齐,入口地址为中断向量;
2:COFF文件转成可执行文件格式,理解COFF文件格式,采用DSP boot tool 辅助格式转变,DSP host boot image均采用此文件格式;
3:DSP boot address 及boot complete,启动停止控制;
需要注意这些寄存器的正确读写方式,采用PCI的话,一定要选用合适的基址窗口,并且注意对寄存器的访问,需要整形字的方式。
 
流程:
Halt the DSP by setting LRST bit in MDCTL33 register to 0 (described in sprueu6)
Reset the BC (bootcomplete) Bit in BOOTCMPLT register (described in sprs372)
Set DSPBOOTADDR register to 0x00800000 - the base adress of the DM648 on chip bootloader (described in spraaj1)
Activate the DSP (on chip bootloader) by writing MDCTL to 0x0103 (setting LRST Bit to 1 and NEXT to 3 ('enable')
after that the content of the initApp.out file can be written to the DSPs (internal) memory
when finished, write the entry adress of the initApp to DSPBOOTADDR
set BC Bit in BOOTCMPLT to 1
 
can not write program entry to BOOTADDR?
can not write DSP BOOTCMPL to complete! 
why?
 
1. out 文件编译控制

Boot Process of C Program on TI C55x DSP

1. 程序入口地址(Entry Point)
Linker赋予entry point的值有4种,按顺序是:
1) linker option -e指定的值,语法是:-e global_symbol
2) 如果存在_c_int00 symbol(使用C55x C/C++ compiler),使用_c_int00的值
3) 如果存在_main symbol,使用_main的值
4) 默认值是0
如果是前3种情况,赋予entry point的symbol应是symbol table中的external symbol。

2. 运行支持库(rts.lib)
_c_int00在rts55.lib或rts55x.lib中定义。

所有的C/C++程序开始运行时,首先执行_c_int00的代码,其功能是:
1) 设置数据栈(SP)和系统栈(SSP)
2) 使用全局变量的初始化表中的值来初始化全局变量(in ROM Model)
3) 设置状态寄存器
4) 设置中断向量寄存器IVPH, IVPD
5) 调用main函数

根据全局变量在load时初始化还是在runtime时初始化,分为RAM Model或者ROM Model。
1) RAM Model,全局变量在load时初始化,loader直接使用Object File中的.cinit section来初始化Memory中的.bss section。在runtime时,在Memory中不存在.cinit section,boot不执行初始化动作
2) ROM Model,全局变量在runtime时初始化,在Memory有.cinit section,由boot初始化.bss section

3. 例子

以C5510为例,cmd文件设置如下:

------------------------------------------------------------
-stack    0x2000    /* 数据栈 0x2000 bytes  */
-sysstack 0x1000    /* 系统栈 0x1000 bytes */

/* SPECIFY THE SYSTEM MEMORY MAP */

MEMORY

PAGE 0:  /* ---- Unified Program/Data Address Space ----
*/

  RAM    (RWIX) : origin = 0x002000, length = 0x01e000  /* RAM, 56KB DARAM and 64KB SARAM 字节地址 */
  ROM    (RWIX) : origin = 0x020000, length = 0x020000  /* ROM, 128KB page of SARAM 字节地址 */
}

/* SPECIFY THE SECTIONS ALLOCATION INTO MEMORY */

SECTIONS
{
   .text      > ROM    PAGE 0  /* Code                       */
   .data      > RAM    PAGE 0  /* Initialized vars           */
   .bss       > RAM    PAGE 0  /* Global & static vars       */
   .stack     > RAM    PAGE 0  /* Primary system stack       */
   .sysstack  > RAM    PAGE 0  /* Secondary system stack     */
   .cinit     > RAM    PAGE 0  /* Auto-initialization tables */

   ......余下省略......
}
------------------------------------------------------------

查看第一段汇编代码,即c_int00,即entry point。
AMAR *(#02000h),XSP
MOV #2800h,SSP

设置数据栈(SP)和系统栈(SSP),使SP指向数据栈的栈顶,SSP指向系统栈的栈顶,察看Memory来确认,注意以下显示的是字地址 = 字节地址 / 2。
stack
0x001000 
......
sysstack
0x002000  <-- SP
......
bss
0x002800  <-- SSP

接下来的代码,设置4个ST寄存器。
AND #F91Fh,mmap(@ST1_55)
OR #4100h,mmap(@ST1_55)
AND #FA00h,mmap(@ST2_55)
OR #8000h,mmap(@ST2_55)
BCLR ST3_SATA
BSET ST3_SMUL

随后,初始化所有的地址指针。
AMAR *(#02800h),XAR0
MOV XAR0,XAR1
MOV XAR0,XAR2
MOV XAR0,XAR3
MOV XAR0,XAR4
MOV XAR0,XAR5
MOV XAR0,XAR6
MOV XAR0,XAR7
MOV XAR0,XCDP
MOV XAR0,XDP

阅读(1823) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~