Understanding Atomics (i.e. STREX/LDREX) on S32K3

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

Understanding Atomics (i.e. STREX/LDREX) on S32K3

Jump to solution
1,961 Views
kscz
Contributor III

Chapter 17 of the S32K3XX reference manual says that "S32K3 does not support the ARM load- and store- exclusive instructions."

Screenshot From 2026-04-25 13-59-31.pngScreenshot From 2026-04-25 13-59-31.png

But the Errata calls out the use of LDREX/STREX:

Screenshot From 2026-04-25 14-45-02.pngScreenshot From 2026-04-25 14-45-02.png

 are LDREX/STREX usable on the S32K344? Are they safe to use?

0 Kudos
Reply
1 Solution
1,838 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello @kscz,

Edited:

The Reference Manual, specifically Section 17.1.1, is somewhat misleading.
The LDREX and STREX instructions are supported on S32K3xx; however:

  1. These instructions do not operate as global monitors, so they cannot be used for synchronization between multiple cores.
    Instead, a different mechanism must be used, for example SEMA42. 
  2. These instructions can be used locally between two tasks running on the same core.

 

BR, Daniel

View solution in original post

0 Kudos
Reply
5 Replies
1,900 Views
db16122
Contributor IV

it seems the ERR050727 appears at MCXE315_MCXE316_0P98C but not on S32K related document?

0 Kudos
Reply
1,898 Views
kscz
Contributor III

The screenshot is from the document S32K3X4-0P55A-1P55A-ERRATA which I downloaded from https://www.nxp.com/products/S32K3. I assume it is generic errata for all cortex-M7 products so it may not actually imply anything useful for the S32K344 at all.

I would like clarification on what the quoted bit from chapter 17 of the reference manual means: "S32K3 does not support the ARM load- and store- exclusive instructions."

I've tested and LDREX/STREX don't appear to cause any sort of panic and appear to function as I would expect, but I assume there are subtleties I don't understand from my cursory explanation.

0 Kudos
Reply
1,839 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello @kscz,

Edited:

The Reference Manual, specifically Section 17.1.1, is somewhat misleading.
The LDREX and STREX instructions are supported on S32K3xx; however:

  1. These instructions do not operate as global monitors, so they cannot be used for synchronization between multiple cores.
    Instead, a different mechanism must be used, for example SEMA42. 
  2. These instructions can be used locally between two tasks running on the same core.

 

BR, Daniel

0 Kudos
Reply
1,827 Views
kscz
Contributor III

What does "not implemented on the S32K3xx device family" mean? They are not optional features for a cortex-M7 core. The instructions appear to both work (i.e. they do not cause a fault) and do what I expect them to do. Is there something about them which doesn't work?

I know they certainly won't work in a multi-core environment, but will the have the correct behavior in a single-core or a lockstep dual-core environment?

0 Kudos
Reply
1,738 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @kscz,

I edited my answer from yesterday after a discussion with the design team.
I will ask the responsible team whether this can be clarified in the Reference Manual.

 

Regards,

Daniel

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2356117%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EUnderstanding%20Atomics%20(i.e.%20STREX%2FLDREX)%20on%20S32K3%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2356117%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EChapter%2017%20of%20the%20S32K3XX%20reference%20manual%20says%20that%20%22S32K3%20does%20not%20support%20the%20ARM%20load-%20and%20store-%20exclusive%20instructions.%22%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Screenshot%20From%202026-04-25%2013-59-31.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Screenshot%20From%202026-04-25%2013-59-31.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Screenshot%20From%202026-04-25%2013-59-31.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Screenshot%20From%202026-04-25%2013-59-31.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Screenshot%20From%202026-04-25%2013-59-31.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Screenshot%20From%202026-04-25%2013-59-31.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F383569iA326ADBFB4B2CA64%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Screenshot%20From%202026-04-25%2013-59-31.png%22%20alt%3D%22Screenshot%20From%202026-04-25%2013-59-31.png%22%20%2F%3E%3Cspan%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EScreenshot%20From%202026-04-25%2013-59-31.png%3C%2Fspan%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EBut%20the%20Errata%20calls%20out%20the%20use%20of%20LDREX%2FSTREX%3A%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Screenshot%20From%202026-04-25%2014-45-02.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Screenshot%20From%202026-04-25%2014-45-02.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Screenshot%20From%202026-04-25%2014-45-02.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Screenshot%20From%202026-04-25%2014-45-02.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Screenshot%20From%202026-04-25%2014-45-02.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Screenshot%20From%202026-04-25%2014-45-02.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F383570iB3DD76ABAC8A1B56%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Screenshot%20From%202026-04-25%2014-45-02.png%22%20alt%3D%22Screenshot%20From%202026-04-25%2014-45-02.png%22%20%2F%3E%3Cspan%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EScreenshot%20From%202026-04-25%2014-45-02.png%3C%2Fspan%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%E2%80%83are%20LDREX%2FSTREX%20usable%20on%20the%20S32K344%3F%20Are%20they%20safe%20to%20use%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2356618%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Understanding%20Atomics%20(i.e.%20STREX%2FLDREX)%20on%20S32K3%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2356618%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EWhat%20does%20%22not%20implemented%20on%20the%20S32K3xx%20device%20family%22%20mean%3F%20They%20are%20not%20optional%20features%20for%20a%20cortex-M7%20core.%20The%20instructions%20appear%20to%20both%20work%20(i.e.%20they%20do%20not%20cause%20a%20fault)%20and%20do%20what%20I%20expect%20them%20to%20do.%20Is%20there%20something%20about%20them%20which%20doesn't%20work%3F%3CBR%20%2F%3E%3CBR%20%2F%3EI%20know%20they%20certainly%20won't%20work%20in%20a%20multi-core%20environment%2C%20but%20will%20the%20have%20the%20correct%20behavior%20in%20a%20single-core%20or%20a%20lockstep%20dual-core%20environment%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2356302%22%20slang%3D%22en-US%22%20mode%3D%22UPDATE%22%20translate%3D%22no%22%3ERe%3A%20Understanding%20Atomics%20(i.e.%20STREX%2FLDREX)%20on%20S32K3%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2356302%22%20slang%3D%22en-US%22%20mode%3D%22UPDATE%22%3E%3CP%3EHello%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F259211%22%20target%3D%22_blank%22%3E%40kscz%3C%2FA%3E%2C%3C%2FP%3E%0A%3CP%3EEdited%3A%3C%2FP%3E%0A%3CP%3EThe%20Reference%20Manual%2C%20specifically%20Section%2017.1.1%2C%20is%20somewhat%20misleading.%3CBR%20%2F%3EThe%20LDREX%20and%20STREX%20instructions%20are%20supported%20on%20S32K3xx%3B%20however%3A%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EThese%20instructions%20do%20not%20operate%20as%20global%20monitors%2C%20so%20they%20cannot%20be%20used%20for%20synchronization%20between%20multiple%20cores.%3CBR%20%2F%3EInstead%2C%20a%20different%20mechanism%20must%20be%20used%2C%20for%20example%20SEMA42.%26nbsp%3B%3C%2FLI%3E%0A%3CLI%3EThese%20instructions%20can%20be%20used%20locally%20between%20two%20tasks%20running%20on%20the%20same%20core.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CBR%20%2F%3E%0A%3CP%3EBR%2C%20Daniel%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2356119%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Understanding%20Atomics%20(i.e.%20STREX%2FLDREX)%20on%20S32K3%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2356119%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EThe%20screenshot%20is%20from%20the%20document%26nbsp%3BS32K3X4-0P55A-1P55A-ERRATA%20which%20I%20downloaded%20from%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fwww.nxp.com%2Fproducts%2FS32K3%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.nxp.com%2Fproducts%2FS32K3%3C%2FA%3E.%20I%20assume%20it%20is%20generic%20errata%20for%20all%20cortex-M7%20products%20so%20it%20may%20not%20actually%20imply%20anything%20useful%20for%20the%20S32K344%20at%20all.%3CBR%20%2F%3E%3CBR%20%2F%3EI%20would%20like%20clarification%20on%20what%20the%20quoted%20bit%20from%20chapter%2017%20of%20the%20reference%20manual%20means%3A%20%22S32K3%20does%20not%20support%20the%20ARM%20load-%20and%20store-%20exclusive%20instructions.%22%3C%2FP%3E%3CP%3EI've%20tested%20and%20LDREX%2FSTREX%20don't%20appear%20to%20cause%20any%20sort%20of%20panic%20and%20appear%20to%20function%20as%20I%20would%20expect%2C%20but%20I%20assume%20there%20are%20subtleties%20I%20don't%20understand%20from%20my%20cursory%20explanation.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2356118%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Understanding%20Atomics%20(i.e.%20STREX%2FLDREX)%20on%20S32K3%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2356118%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3Eit%20seems%20the%20ERR050727%20appears%20at%26nbsp%3BMCXE315_MCXE316_0P98C%20but%20not%20on%20S32K%20related%20document%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2357632%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Understanding%20Atomics%20(i.e.%20STREX%2FLDREX)%20on%20S32K3%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2357632%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F259211%22%20target%3D%22_blank%22%3E%40kscz%3C%2FA%3E%2C%3C%2FP%3E%0A%3CP%3EI%20edited%20my%20answer%20from%20yesterday%20after%20a%20discussion%20with%20the%20design%20team.%3CBR%20%2F%3EI%20will%20ask%20the%20responsible%20team%20whether%20this%20can%20be%20clarified%20in%20the%20Reference%20Manual.%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3ERegards%2C%3C%2FP%3E%0A%3CP%3EDaniel%3C%2FP%3E%3C%2FLINGO-BODY%3E