Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Loading

Coldfire Inline Assembler issues

Posted by Nobody/Anonymous on January 18, 2005
Dear All,
I am not able to compile the assembly code in port.c file for mcf5272 port. I am compiling using Codewarrior C Compiler. Can anyone guide me as to what can be done.
Some of the code i am listing below.
asm volatile ("move.l %%d1,-8(%%sp) \n\t" \
"clr.l %%d1\n\t"\
"move.w %%sr,%%d1\n\t"\
"ori.l %0,%%d1\n\t"\
"andi.l %1,%%d1\n\t"\
"move.l %%d1,%%sp@-\n\t"\
"move.l -4(%%sp),%%d1\n\t" \
: /* no output */\
: "n" (EXSF_FORMAT(4) | EXSF_VECTOR(VECTOR_TMR0)), \
"n" (~STATUS_I(7)) );


asm volatile ("move.l %d0,%sp@- \n\t"\
"move.l %d1,%sp@-\n\t"\
"move.l %d2,%sp@-\n\t"\
"move.l %d3,%sp@-\n\t"\
"move.l %d4,%sp@-\n\t"\
"move.l %d5,%sp@-\n\t"\
"move.l %d6,%sp@-\n\t"\
"move.l %d7,%sp@-\n\t"\
"move.l %a0,%sp@-\n\t"\
"move.l %a1,%sp@-\n\t"\
"move.l %a2,%sp@-\n\t"\
"move.l %a3,%sp@-\n\t"\
"move.l %a4,%sp@-\n\t"\
"move.l %a5,%sp@-\n\t"\
"move.l %a6,%sp@-\n\t"\
"move.l pxCurrentTCB,%a0\n\t"\
"move.l %sp,(%a0)\n\t" );

Regards
Vivek Agarwal

RE: Coldfire Inline Assembler issues

Posted by Nobody/Anonymous on January 18, 2005
I'm not familiar with the ColdFire port but might be able to help if you can provide some of the compiler error messages.

Which compiler are you using? The port was written with gcc-m68k v2.95.3.

RE: Coldfire Inline Assembler issues

Posted by Nobody/Anonymous on January 18, 2005
I am using Metrowerks Codewarrior IDE and C Compiler for Coldfire for compiling and debugging.

the list of error are :-

Error : illegal use of asm inline function
port.c line 200 ove.l %sp@+,%d2 \n\t" "move.l %sp@+,%d1 \n\t" "move.l %sp@+,%d0 \n\t" );

Error : illegal use of asm inline function
port.c line 204 asm volatile ( "rte" );

Error : illegal use of asm inline function
port.c line 228 asm volatile ( "unlk %fp" );

Error : illegal use of asm inline function
port.c line 233 asm volatile ( "move.l %%d1,-8(%%sp) \n\t" \

Error : ';' expected
port.c line 241 : "n" (EXSF_FORMAT(4) | EXSF_VECTOR(VECTOR_TMR0)), \

Error : call of non-function
port.c line 242 "n" (~STATUS_I(7)) );

Error : illegal use of asm inline function
port.c line 244 %a6,%sp@- \n\t" "move.l pxCurrentTCB,%a0 \n\t" "move.l %sp,(%a0) \n\t" );

Error : illegal use of asm inline function
port.c line 246 ove.l %sp@+,%d2 \n\t" "move.l %sp@+,%d1 \n\t" "move.l %sp@+,%d0 \n\t" );

Error : illegal use of asm inline function
port.c line 248 asm volatile ( "rte" );

Error : illegal use of asm inline function
port.c line 271 asm volatile ( "move.l %%a7,%%d1 \n\t" \

Error : illegal use of asm inline function
port.c line 305 asm volatile ( "unlk %fp" );

Error : illegal use of asm inline function
port.c line 307 %a6,%sp@- \n\t" "move.l pxCurrentTCB,%a0 \n\t" "move.l %sp,(%a0) \n\t" );

Error : illegal use of asm inline function
port.c line 310 ove.l %sp@+,%d2 \n\t" "move.l %sp@+,%d1 \n\t" "move.l %sp@+,%d0 \n\t" );

Error : illegal use of asm inline function
port.c line 312 asm volatile ( "rte" );


RE: Coldfire Inline Assembler issues

Posted by Nobody/Anonymous on January 18, 2005
The syntax is GCC specific and will have to be converted to the syntax for your compiler.

RE: Coldfire Inline Assembler issues

Posted by Nobody/Anonymous on January 18, 2005
Any idea where can i get some info on this conversion. also is there any tools anybody knows of.

Any idea what the last 4 lines of the below inline mean starting from :

asm volatile ( "move.l %%d1,-8(%%sp) \n\t" \
"clr.l %%d1 \n\t" \
"move.w %%sr,%%d1 \n\t" \
"ori.l %0,%%d1 \n\t" \
"andi.l %1,%%d1 \n\t" \
"move.l %%d1,%%sp@- \n\t" \
"move.l -4(%%sp),%%d1 \n\t" \
: /* no output */ \
: "n" (EXSF_FORMAT(4) | EXSF_VECTOR(VECTOR_TMR0)), \
"n" (~STATUS_I(7)) );

also what the last line in below routine mean
asm volatile ("move.l %%a7,%%d1 \n\t"\
"move.l %0,%%a7\n\t"\
"movec.l %%a7,%%vbr\n\t"\
"move.l %%d1,%%a7\n\t"\
: : "n" (VBR) : "d1" );

Basically the use of : in inline assembly is unknow to me.
it would great if u could tell the above. i can then write the same according to my compiler.

RE: Coldfire Inline Assembler issues

Posted by Nobody/Anonymous on January 18, 2005
Maybe this helps:

http://gcc.gnu.org/onlinedocs/gcc-3.4.3/gcc/Constraints.html#index-operand-constraints_002c-_0040code_007basm_007d-1696


Here there is documentation for some of the asm features. I know the arm port uses the 'm' constraint as:

asm volatile ( "LDR R0, %0" : : "m" (pxCurrentTCB) );

to get the address of pxCurrentTCB.

The GCC inline assembler is very powerful and therfore unfortunately complex.

Also:
http://gcc.gnu.org/onlinedocs/gcc-3.4.3/gcc/Extended-Asm.html#Extended-Asm


RE: Coldfire Inline Assembler issues

Posted by Nobody/Anonymous on January 19, 2005
any idea what the below code does
what is fp. it is taken from port.c of mcf5272 port.

#ifndef OMIT_FRAME_POINTER
asm volatile ( "unlk %fp" );
#endif


[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]


Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner