This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Mixing Assembly & C code for Cortex A8 (Beagleboard)



I'm trying to compile C/ASM mixed code (spnu151e.pdf, page 126) with 4.6.3 CGT in Code Composer Studio.

There is the test project (for ARM core in Beagleboard):

 

=========== CORTEXA8.cmd ===========

/* SPECIFY THE SYSTEM MEMORY MAP */

MEMORY
{
    DDR    : org = 0x80000000   len = 0x04000000  /* 64MB (assume IVA to use other half) */
}

/* SPECIFY THE SECTIONS ALLOCATION INTO MEMORY */

SECTIONS
{
    .bss     : {} > DDR              /* GLOBAL & STATIC VARS              */
    .sysmem  : {} > DDR              /* DYNAMIC MEMORY ALLOCATION AREA    */
    .stack   : {} > DDR              /* SOFTWARE SYSTEM STACK             */
    .data    : {} > DDR
    .text    : {} > DDR              /* CODE                              */
    .cinit   : {} > DDR              /* INITIALIZATION TABLES             */
    .const   : {} > DDR              /* CONSTANT DATA                     */
    .pinit   : {} > DDR              /* TEMPLATE INSTANTIATION TABLES     */
}

 

=========== main.c ===========

#include <stdio.h>

extern "C"
{
extern int asmfunc(int a); /* declare external asm function */
int gvar = 0;                         /* define global variable */
}

 

void main()
{
    int I = 5;   

    while(1)
    {
         I = asmfunc(I);   /* call function normally */
    }
}

=========== test.asm ===========

                .global _asmfunc
                .global _gvar
_asmfunc:
                LDR r1, gvar_a
                LDR r2, [r1, #0]
                ADD r0, r0, r2
                STR r0, [r1, #0]
                MOV pc, lr
gvar_a   .field _gvar, 32

=============================

 

Compiler didn't understand "extern "C" directive (in main.c) and gvar_a symbol (in test.asm).

Could you give me some advices how to link .asm procedure with C/C++ code in CCS 4.1 IDE?

[there is no problem with a similar task on c64x cores].