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

__schedule_barrier function creates NOPs

Using uvision4 to build project for Cortex-M3. When I look at assembly listing I notice that the __schedule_barrier() call generates two NOPs instead of using one of the ARM memory barrier instructions. Is this correct?

Thanks

Parents
  • Thanks for responding Scott.

    From the Keil documentation from __schedule_intrinsic():

    "This intrinsic creates a sequence point where operations before and operations after the sequence point are not merged by the compiler. A scheduling barrier does not cause memory to be updated. If variables are held in registers they are updated in place, and not written out.

    This intrinsic is similar to the __nop intrinsic, except that no NOP instruction is generated."

    I was assuming that an ARM memory barrier instruction would be generated but instead two NOPs are generated.

    My intent was to ensure that pending interrupts were cleared prior to exiting an ISR, e.g. in order to prevent an issue where I popped right back into the ISR but the pending interrupt bits were cleared (apparently somewhere between the return from the ISR and the reentry).

    isr()
    {

    ...
    ...

    clearpendingbits()

    _schedule_intrinsic()

    }

    In any case, I have found a way to get around the issue without the __schedule_intrinsic() call but was wondering why it was implemented as such at least by the tools I am using.

Reply
  • Thanks for responding Scott.

    From the Keil documentation from __schedule_intrinsic():

    "This intrinsic creates a sequence point where operations before and operations after the sequence point are not merged by the compiler. A scheduling barrier does not cause memory to be updated. If variables are held in registers they are updated in place, and not written out.

    This intrinsic is similar to the __nop intrinsic, except that no NOP instruction is generated."

    I was assuming that an ARM memory barrier instruction would be generated but instead two NOPs are generated.

    My intent was to ensure that pending interrupts were cleared prior to exiting an ISR, e.g. in order to prevent an issue where I popped right back into the ISR but the pending interrupt bits were cleared (apparently somewhere between the return from the ISR and the reentry).

    isr()
    {

    ...
    ...

    clearpendingbits()

    _schedule_intrinsic()

    }

    In any case, I have found a way to get around the issue without the __schedule_intrinsic() call but was wondering why it was implemented as such at least by the tools I am using.

Children