This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

SVC Functions in RTX (Arm Compiler v6)

Hi guys,

I've recently adopted the Arm Compiler version 6. I'm using the RTX OS and I need to write some SVC functions as described in the following link:

https://www.keil.com/pack/doc/CMSIS_Dev/RTOS2/html/theory_of_operation.html#CMSIS_RTOS_svcFunctions

In the Arm Compiler v5 it was easier to write a SVC function wrapper as compared to the 6 version.

I'm very little experience in assembler language, is there an application note to understand how to write a SVC function wrapper starting from a SVC Handler (c function) ?

Thanks for your help,

Flavio

Parents
  • Thanks Ronan for your answer.

    I've already read the documentation that you reported me, but I'd like to better understand the syntax meaning.

    For example, in the example reported in the previous link (CMSIS_Dev):

    // SVC Wrapper
    __STATIC_FORCEINLINE uint32_t atomic_inc32 (uint32_t *mem) {
    register uint32_t val;
    
    __ASM volatile (
    "svc 1" : "=l" (val) : "l" (mem) : "cc", "memory"
    );
    return (val);
    }
    
    // SVC Handler
    uint32_t svc_atomic_inc32 (uint32_t *mem) {
      // A protected function to increment a counter. 
      uint32_t val;
       
      __disable_irq();
      val  = *mem;
      (*mem) = val + 1U;
      __enable_irq();
       
      return (val);
    }

    There is a SVC function handler with a pointer and a return value, so in the assambler wrapper include "l" and "cc" symbols, where can I find a documentation that will help me to understand the meaning of this sintax?

    Thanks a lot,


    Flavio

Reply
  • Thanks Ronan for your answer.

    I've already read the documentation that you reported me, but I'd like to better understand the syntax meaning.

    For example, in the example reported in the previous link (CMSIS_Dev):

    // SVC Wrapper
    __STATIC_FORCEINLINE uint32_t atomic_inc32 (uint32_t *mem) {
    register uint32_t val;
    
    __ASM volatile (
    "svc 1" : "=l" (val) : "l" (mem) : "cc", "memory"
    );
    return (val);
    }
    
    // SVC Handler
    uint32_t svc_atomic_inc32 (uint32_t *mem) {
      // A protected function to increment a counter. 
      uint32_t val;
       
      __disable_irq();
      val  = *mem;
      (*mem) = val + 1U;
      __enable_irq();
       
      return (val);
    }

    There is a SVC function handler with a pointer and a return value, so in the assambler wrapper include "l" and "cc" symbols, where can I find a documentation that will help me to understand the meaning of this sintax?

    Thanks a lot,


    Flavio

Children