首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >TMS320 c6000程序集"hello world“示例?

TMS320 c6000程序集"hello world“示例?
EN

Stack Overflow用户
提问于 2013-12-10 18:34:04
回答 1查看 1.5K关注 0票数 0

谁有任何TMS320 c6000程序集只有"hello world“示例可以分享?我见过很多内联汇编的C语言例子……

问候

接入点

EN

回答 1

Stack Overflow用户

发布于 2013-12-12 17:44:10

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

代码语言:javascript
复制
; 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的示例进行修改):

代码语言:javascript
复制
; 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生成+稍微编辑一下):

代码语言:javascript
复制
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
}
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20492073

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档