[En-Nut-Discussion] NutEnterCritical vs NutEnterCriticalAccess()

Nathan Moore nategoose at gmail.com
Tue Nov 17 16:05:09 CET 2015

On Tue, Nov 17, 2015 at 9:48 AM, Ole Reinhardt <ole.reinhardt at embedded-it.de
> wrote:

> even with this solution, the variable update itself would still be
> non-atomic (load and store), wouldn't it?


> Further this adds a lot of extra code that Uwe wanted to avoid?

The extra code is all compile-time removed.
They could be replaced with macros operations for each word size.  I decided
against pairs of critical enter and leave macros for each size because it
might not
be easy to make it clear that they would only work for storing since any
load and
store operation would not be atomic.  Operations such as:

              X |= 0x02;

and many others would require a different approach.  These can be done
on some architectures when X is the right size, but they would need much
complicated access macro functions.

> Btw:
> Uwe, what exactly is you intention here? Do you need to save CPU cycles?
> Or do you want to avoid global (or local?) interrupt disabling?

I personally think that CPU cycles, interrupt disabling, and code size are
valid concerns.


More information about the En-Nut-Discussion mailing list