EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

Calling Assembly Code Functions from a C Program in IAR

Started by Nafa3 December 24, 2007
Hi all

This C function is calling an assembler function get_cpsr

unsigned long get_cpsr(void);
static inline unsigned asm_get_cpsr(void)
{
unsigned long retval;
retval=get_cpsr();

return retval;
}
The assembler function is in separate .S file it looks as follows

PUBLIC get_cpsr
RSEG CODE:CODE:NOROOT(2)
get_cpsr:

mrs r0, cpsr /* get CPSR */
bx lr /* return to caller */

END

I get an error:
Error: identifier "PUBLIC" is undefined

please help me and thank you in advance

Beginning Microcontrollers with the MSP430

hi
I use ARM assembly code
Yes, I can see that you are using ARM assembly code. You also said
that you are using IAR compiler/assembler/etc. But IAR has many
different compiler/assembler/etc. for different microprocessors
(including ARM and MSP430).

If you intend to use ARM microprocessor, you need to use
compiler/assembler/etc. for ARM.

If you intend to use MSP430, you need to port the code, especially the
ARM assembly code, to MSP430 and then use compiler/assembler/etc. for
MSP430.

--- In m..., "Nafa3" wrote:
>
> hi
> I use ARM assembly code
>

The 2024 Embedded Online Conference