Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6170659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:04:37+00:00 2026-05-23T23:04:37+00:00

In the CMSIS definitions for gcc you can find something like this: static __INLINE

  • 0

In the CMSIS definitions for gcc you can find something like this:

static __INLINE void __DMB(void) { __ASM volatile ("dmb"); }

My question is: what use does a memory barrier have if it does not declare “memory” in the clobber list?

Is it an error in the core_cm3.h or is there a reason why gcc should behave correctly without any additional help?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T23:04:38+00:00Added an answer on May 23, 2026 at 11:04 pm

    I did some testing with gcc 4.5.2 (built with LTO). If I compile this code:

    static inline void __DMB(void) { asm volatile ("dmb"); }
    static inline void __DMB2(void) { asm volatile ("dmb" ::: "memory"); }
    
    char x;
    
    char test1 (void)
    {
      x = 15;
      return x;
    }
    
    char test2 (void)
    {
      x = 15;
      __DMB();
      return x;
    }
    
    char test3 (void)
    {
      x = 15;
      __DMB2();
      return x;
    }
    

    using arm-none-eabi-gcc -Os -mcpu=cortex-m3 -mthumb -c dmb.c, then from arm-none-eabi-objdump -d dmb.o I get this:

    00000000 <test1>:
       0:   4b01        ldr r3, [pc, #4]    ; (8 <test1+0x8>)
       2:   200f        movs    r0, #15
       4:   7018        strb    r0, [r3, #0]
       6:   4770        bx  lr
       8:   00000000    .word   0x00000000
    
    0000000c <test2>:
       c:   4b02        ldr r3, [pc, #8]    ; (18 <test2+0xc>)
       e:   200f        movs    r0, #15
      10:   7018        strb    r0, [r3, #0]
      12:   f3bf 8f5f   dmb sy
      16:   4770        bx  lr
      18:   00000000    .word   0x00000000
    
    0000001c <test3>:
      1c:   4b03        ldr r3, [pc, #12]   ; (2c <test3+0x10>)
      1e:   220f        movs    r2, #15
      20:   701a        strb    r2, [r3, #0]
      22:   f3bf 8f5f   dmb sy
      26:   7818        ldrb    r0, [r3, #0]
      28:   4770        bx  lr
      2a:   bf00        nop
      2c:   00000000    .word   0x00000000
    

    It is obvious that __DBM() only inserts the dmb instruction and it takes DMB2() to actually force the compiler to flush the values cached in the registers.

    I guess I found a CMSIS bug.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a PHP CMS like project and I'm trying to find out
Is there a code analyzing utility that can do things like calculate the average
I'm trying to find a form engine that can generate the markup from simpler
cms is generating content in this format. <ul id=slide_nav class=tabs> <a name=ctn2363_2465 id=ctn2363_2465 class=hidden></a><li
I'm looking more toward CMSes as I'd like my clients to be able to
For research purposes, I'd like to compile a list of PHP CMSs and the
Could someone tell me why this isn't working please? $str = preg_replace(<font[^>]*>, '', $str);
This question is a little subjective, however, it aims to give me a bit
This isn't much of an issue with MySQL per-se. The Full Story I'm writing
I've been consulted with on the setup of a project and would like to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.