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.

CCS4.2下的混编问题



最近在CCS4.2下写移植barebox(bootloader),但是每当需要将汇编的返回参数传到c中的临时变量里面,总是无法通过编译,例图下列代码:

u32 get_base(void)

{

u32 val = 0x0;

asm(" mov r0, pc ");

asm(" str r0, val ");

val &= 0xF0000000;

val >>= 28;

return val;

}

报错提示:

[E0001]

        Undefined symbol

str r0, val

[E0001]

        Address must be defined in the current section

str r0, val

[E0004]

        Illegal operand

str r0, val

Assembly Errors, No Assembly Warnings

 val

Errors in Source - Assembler Aborted

又比如:

void noting(void)

{

for(;;);

}

void expection_vectors(void)

{

asm(" ldr pc, =noting ");

}

请相关专家帮忙解决一下,谢谢了!