Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

Compiler: How to emulate __get_IPSR() from CMSIS for gcc

$
0
0

Tool/software: TI C/C++ Compiler

Hi,

I am currently testing an in-house firmware for the MSP432 with TI's armcl compiler. I have unfortunately hit a problem: I cannot find a builtin or helper to extract the contents of the IPSR register (the current interrupt number). I have tried re-using the version from CMSIS for gcc

__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_IPSR(void)
{
  uint32_t result;

  __ASM volatile ("MRS %0, ipsr" : "=r" (result) );
  return(result);
}

In the following way:

 uint32_t __get_IPSR(void) {
   uint32_t result;

   __asm("MRS %0, ipsr" : "=r"(result));
   return result;
 }

But unfortunately the compiler terminates with "error #18: expected a ")" " (about the line containing the __asm statement).

Is someone more familiar with TI's assembly syntax and could help me out please?

Thanks in advance,

Dan


Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>