Cortex-M0 Atomic/integral access

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Cortex-M0 Atomic/integral access

1,243 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by JoWi on Wed May 14 01:02:13 MST 2014
Hi.
I am currently mirgrating from 8051 to M0.

For simple IRQ<->UserSoftware comunication the 8051 had 1-bit flags. What is the smallest way (without disabling IRQs) to replace this on the M0 or do I have to use 32-bit ints?

Thanks, Jo
0 Kudos
Reply
3 Replies

1,016 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by rocketdawg on Wed May 14 09:26:53 MST 2014
variable access may not be atomic and M0 do not have bit band
start some where near here
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dai0321a/BIHBIHDF.html
0 Kudos
Reply

1,016 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by JoWi on Wed May 14 06:44:57 MST 2014
Ok, Thx ;-)
0 Kudos
Reply

1,016 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by wmues on Wed May 14 05:45:58 MST 2014
You might use any 8bit, 16bit or 32bit memory location to replace "flag bits".

Do not use C bitfields!

Don't forget to add the "volatile" keyword if you want interrupt communication!


volatile unsigned char/short/int this_is_a_flag;

0 Kudos
Reply