I am using CCS 4.1.3 and targeting a LM3S6432 Cortex M3 processor. I am trying to build FreeRTOS for this processor and the interface layer of the port uses a lot of inline assembly code in their C modules. I have started to modify these but I can not find a definitive reference of what the compiler supports. It seems to support some features as described in the gcc documentation though little from the ARM SDT compiler documentation. I can not find any TI documentation that describes what the compiler will support so that I may modify the macros. I started some trial and error but that is taking too long. Does anyone know of a Compiler Reference for the Arm Compiler in CCS that will describe exactly what the compiler will support in the __asm block?
Thank You!
Paul
The string in an __asm statement appears verbatim in the output assembly file. There is no processing done on the string by the compiler.
Thanks for the reply. I thought that was the case but
__asm volatile \ ( \ " mov r0, #(5 << 5) \n" \ " msr basepri, r0 \n" \ :::"r0" \ )works and :::"r0", which is described in the GCC version of the compiler, does not show up in the output so it is being filtered somewhere. If I add
int mask;
...
__asm volatile \ ( \ " mov r0, #(5 << 5) \n" \ " msr basepri, r0 \n" \ ::"i"(mask):"r0" \ )
the ::"i"(mask):"r0" is again filtered out of the assembler file with no warnings or errors, if i change #(5 << 5) to %0 the %0 parameter reference is not modified and the assembler fails with an error. Adding a parameter name as in
__asm volatile \ ( \ " mov r0, #(5 << 5) \n" \ " msr basepri, r0 \n" \ ::[assmblerMask]"i"(mask):"r0"
)
does cause the compiler to issue an error saying that it is expecting a "(". That is why I think that it supports some limited amount assembler preprocessing but not all.
Regards,
I can't get the TI ARM compiler to accept any of these. Are you sure you're passing this code to the TI compiler? What are your command line options? Could you post a cutdown (but compilable) C file?
Header File
#ifndef PORTMACRO_H#define PORTMACRO_H#ifdef __cplusplusextern "C" {#endif#define portSET0() \ __asm volatile \ ( \ " mov r0, #(5 << 5) \n" \ " msr basepri, r0 \n" \ :::"r0" \ )#define portSET1() \ __asm volatile \ ( \ " mov r0, #(5 << 5) \n" \ " msr basepri, r0 \n" \ ::"i"(interruptMask):"r0" \ )#define portSET2() \ __asm volatile \ ( \ " mov r0, %0 \n" \ " msr basepri, r0 \n" \ ::"i"(interruptMask):"r0" \ )#define portSET3() \ __asm volatile \ ( \ " mov r0, #(5 << 5) \n" \ " msr basepri, r0 \n" \ ::"i"(interruptMask):"r0" \ )#define portSET4() \ __asm volatile \ ( \ " mov r0, #[mask] \n" \ " msr basepri, r0 \n" \ ::[mask]"i"(interruptMask):"r0" \ )#ifdef __cplusplus}#endif#endif /* PORTMACRO_H */
and the C File
#include "portmacro.h"void foo(){ int interruptMask = (5 << 5); portSET0(); portSET1(); portSET2(); portSET3(); portSET4();}
The command line is
E:/Program Files/Texas Instruments/ccsv4/tools/compiler/tms470/bin/cl470" -mv7M3 -g -O2 --gcc --define=ccs --define=PART_LM3S6432 --include_path="E:/Program Files/Texas Instruments/ccsv4/tools/compiler/tms470/include" --include_path="E:/Projects/CCS4/LuminaryMicro/include" --diag_warning=225 -me --gen_func_subsections --abi=eabi --code_state=16 -k --ual --preproc_with_compile --preproc_dependency="source/port.pp" --obj_directory="source" "../source/port.c"
The compiler fails on the line portSET4().
Generated asm output
.dwpsn file "../source/port.c",line 6,column 2,is_stmt mov r0, #(5 << 5) msr basepri, r0 .dwpsn file "../source/port.c",line 7,column 2,is_stmt mov r0, #(5 << 5) msr basepri, r0 .dwpsn file "../source/port.c",line 8,column 2,is_stmt mov r0, %0 msr basepri, r0 .dwpsn file "../source/port.c",line 9,column 2,is_stmt mov r0, #(5 << 5) msr basepri, r0 .dwpsn file "../source/port.c",line 11,column 1,is_stmt$C$DW$2 .dwtag DW_TAG_TI_branch .dwattr $C$DW$2, DW_AT_low_pc(0x00) .dwattr $C$DW$2, DW_AT_TI_return BX LR
If portSET4() is commented out then it fails in the assembler. "port.asm", ERROR! at line 60: [E0200] Bad term in expression mov r0, %0
Generated asm output is identical.
I think I'm stumped at this point. As far as I know, the compiler shouldn't (and in fact for me doesn't) accept any of those. I get two errors on each of the five invocations, "expected '('" and "expected ')'", just as I expect.
Just getting back to my original question. What is the definitive reference for this compiler?
-Paul
PaulT What is the definitive reference for this compiler? -Paul
What is the definitive reference for this compiler?
The TMS470 C/C++ Optimizing Compiler User's Guide
This page lists the compiler user's guides for the various targets.
Thank You, I just never ran across that page.
Paul,
We do not currently support the GCC "Extended Asm" feature, but our implementation fails to reject it. Our asm statement is supposed to behave as Archaeologist and the manual say, but when the --gcc option is used, the compiler accepts the GCC extended asm syntax and then ... does nothing with it. Needless to say, this will be fixed in a future release. By "fixed" I mean the Extended Asm will be rejected; possibly not what you were hoping for, but better than leading you on by swallowing the syntax.