⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 boot.asm

📁 BOOT V5.11 - C startup routine for TMS3203x/4x。 笔者使用TMS320VC33芯片的BOOT汇编源代码程序。
💻 ASM
字号:
        .length 85
        .width  132 
        .copy "c3x.inc"
***************************************************************
* BOOT V5.11 - C startup routine for TMS3203x/4x
* Copyright (c) 1992-1999 Texas Instruments Incorporated
***************************************************************
*
* This is the initial boot routine for TMS320C30/C40 C Programs.
* It must be linked and loaded with all C programs.  The
* entry point for C programs is called "_c_int00", defined
* in this module.
*
* This module performs the following actions:
*    1) Allocate and initialize the system stack
*    2) Perform auto-initialization
*    3) Call the function _main to start the user's program
***************************************************************
FP          .set  AR3             ;frame pointer
STACK_SIZE	.set  0100h
MMR1		.set  4040H		      ;Left-shift 9-bit 808000H
STRB        .set  64H
__stack      .usect  ".stack",STACK_SIZE

            .global cinit, .bss, _cmdargs, _exit, _init_io, _main
            .global _c_intend
            .global _c_int00
	        .global __stack
	        .global stack_addr
	        .global SYSINIT
;
; Allocate space for the system stack.
; Initialize the first words in .text to point to the stack
; and initialization tables
;
            .data
stack_addr  .word  __stack        ;address of stack
init_addr   .word  cinit          ;address of init tables
ZERO		.word  000000000H    ;the zero
MASKH24 	.word  0FFFFFF00H    ;the data for mask other data
STRB_CTRL	.word  0000006f8H    ;the strb0 bus control data
SYSINIT     .word  00040013eH    ;the address of the PCI local mailbox
            .sect  ".boot"
***************************************************************
* _C_INT00 - C entry point function
***************************************************************
_c_int00:
;
; Set up the initial stack pointer
;
        LDP     stack_addr        ;get page of stored address
        LDI     @stack_addr,SP    ;load the address into SP
        LDI     SP,FP             ;and into FP too
        
        OR  6,IOF               ;forbiden the PCI interruption	 
		LDI	MMR1,AR0
		LSH	9,AR0
		LDI	@STRB_CTRL,R0		;Init STRB Control Register
		STI	R0,*+AR0(STRB)
		LDI @SYSINIT,AR0
		LDI 0,R0
		STI R0,*AR0
		IACK @ZERO
		AND 0,ST                ;forbiden all interruption
        AND 0,IF
		OR (GIE),ST
		AND 0,IE        
        OR EINT1_CPU,IE			 
         
;
; Do autoinitialization
;
        LDP     init_addr         ;get page of stored address
        LDI     @init_addr,AR0    ;get address of init tables
        CMPI    -1,AR0            ;if RAM model, skip init
        BEQ     done
        LDI     *AR0++,R1         ;get first count
        BZD     done              ;if 0, nothing to do
        LDI     *AR0++,AR1        ;get dest address
        LDI     *AR0++,R0         ;get first word
        SUBI    1,R1              ;count - 1
do_init:
        RPTS    R1                ;block copy
        STI     R0,*AR1++
    ||  LDI     *AR0++,R0
        LDI     R0,R1             ;move next count into R1
        BNZD    do_init           ;if there is more, repeat
        LDI     *AR0++,AR1        ;get next dest address
        LDI     *AR0++,R0         ;get next first word
        SUBI    1,R1              ;count - 1
done:
;
; For the small model, set up the DP to point to the .bss section
;
        LDP     .bss
;
; Call main()
;
***     CALL    _init_io
***     CALL    _cmdargs
        LDI     0,AR2           ;make sure argc=0 with register
        PUSH    AR2             ;and stack parameter passing
        CALL    _main
        CALL    _exit
        RETI
             .text
_c_intend:   .end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -