TMS320 c6000汇编“你好世界”的例子?

时间:2013-12-10 10:34:04

标签: assembly

任何人都有任何TMS320 c6000汇编只有“你好世界”的例子才能分享? 看到大量的C带有内联装配示例......

问候

AP

1 个答案:

答案 0 :(得分:2)

不是众所周知的“hello world”,而是一个字符串副本。也许这有帮助吗?

; hello.asm
;
;  Created on: 11.12.2013
;      Author: turboscrew
;

         .global _main

         .data
hello_str:
         .string "Hello world!"
         .byte 0

txt_buffer:
         .space 16

         .text

_main:
         mvkl hello_str, b0
         mvkh hello_str, b0 ; string pointer to b0
         mvkl txt_buffer, b1
         mvkh txt_buffer, b1


         ; copy to buffer
c_loop:
         ldb *b0++[1], a0
         nop 4
         stb a0, *b1++[1]
|| [a0]  bnop c_loop, 5 ;

         ; idle loop - end of program
i_loop:
         bnop i_loop, 5

用于启动(根据TI的示例修改):

; From TI example
;
;  ======== unused ========
;  plug inifinite loop -- with nested branches to
;  disable interrupts -- for all undefined vectors
;
unused  .macro id

        .global unused:id:
unused:id:
        b unused:id:    ; nested branches to block interrupts
        nop 4
        b unused:id:
        nop
        nop
        nop
        nop
        nop

        .endm

        .sect ".vectors"

        .ref _main             ; entry point

        .align  32*8*4          ; must be aligned on 256 word boundary

RESET:                          ; reset vector
        mvkl _main,b0        ; load destination function address to b0
        mvkh _main,b0
        b b0                    ; start branch to destination function
        mvc PCE1,b0             ; address of interrupt vectors
        mvc b0,ISTP             ; set table to point here
        nop 3                   ; fill delay slot
        nop
        nop

        ;
        ;  plug unused interrupts with infinite loops to
        ;  catch stray interrupts
        ;
        unused 1
        unused 2
        unused 3
        unused 4
        unused 5
        unused 6
        unused 7
        unused 8
        unused 9
        unused 10
        unused 11
        unused 12
        unused 13
        unused 14
        unused 15

链接器控制文件(CCS生成+位编辑):

MEMORY
{
    L2RAM:      o = 0x00800000  l = 0x00200000  /* 2MB L2 Internal SRAM */ 
    L1PRAM:     o = 0x00E00000  l = 0x00008000  /* 32kB L1 Program SRAM/CACHE */ 
    L1DRAM:     o = 0x00F00000  l = 0x00008000  /* 32kB L1 Data SRAM/CACHE */
    EMIFA_CE2:  o = 0xA0000000  l = 0x00800000  /* 8MB EMIFA CE2 */ 
    EMIFA_CE3:  o = 0xB0000000  l = 0x00800000  /* 8MB EMIFA CE2 */ 
    EMIFA_CE4:  o = 0xC0000000  l = 0x00800000  /* 8MB EMIFA CE2 */ 
    EMIFA_CE5:  o = 0xD0000000  l = 0x00800000  /* 8MB EMIFA CE2 */
    DDR2_CE0:   o = 0xE0000000  l = 0x20000000  /* 512MB EMIFB CE0 */ 
} 

SECTIONS
{
    .vectors       >  L2RAM
    .text          >  L2RAM
    .stack         >  L2RAM
    .bss           >  L2RAM
    .cio           >  L2RAM
    .const         >  L2RAM
    .data          >  L2RAM
    .switch        >  L2RAM
    .sysmem        >  L2RAM
    .far           >  L2RAM
    .args          >  L2RAM
    .ppinfo        >  L2RAM
    .ppdata        >  L2RAM

    /* COFF sections */
    .pinit         >  L2RAM
    .cinit         >  L2RAM

    /* EABI sections */
    .binit         >  L2RAM
    .init_array    >  L2RAM
    .neardata      >  L2RAM
    .fardata       >  L2RAM
    .rodata        >  L2RAM
    .c6xabi.exidx  >  L2RAM
    .c6xabi.extab  >  L2RAM
}