Go Down

Topic: LibreRTOS with SAMD21 (Read 318 times) previous topic - next topic

mariusl

Hi

I am trying to use the LibreRTOS on a SAMD21. It has examples for the ATMEGA382 but not for the SAMD21. This piece of code is what is confusing to me as I dont have much experience with assembler anymore.

What are they storing for recovery later and how would I do that on the SAMD21 chip.

Any insights welcome here.

Code: [Select]
/* Nested critical section management macros. */
#define CRITICAL_VAL()   uint8_t __istate_val
#define CRITICAL_ENTER() __asm __volatile( \
        "in %0, __SREG__ \n\t"             \
        "cli             \n\t"             \
        :"=r" (__istate_val) ::"memory")
#define CRITICAL_EXIT()  __asm __volatile( \
        "out __SREG__, %0 \n\t"            \
        ::"r" (__istate_val) :"memory")


Rather people think you to be a fool than you open your mouth and confirm it.

westfw

Quote
I am trying to use the LibreRTOS on a SAMD21. It has examples for the ATMEGA382 but not for the SAMD21.
An operating system designed to run on the AVRs isn't likely to run on ARM without a fair amount of attention.
(that said, it looks like there is very little that is actually CPU dependent in libreRTOS.  You can try:
Code: [Select]
/* Nested critical section management macros. */
#define CRITICAL_VAL()   uint32_t __istate_val
#define CRITICAL_ENTER() __istate_val = __disable_irq();
#define CRITICAL_EXIT()  if (!__istate_val) __enable_irq();


See http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0491h/CJAFBCBB.html

Go Up