Skip to main content
User16769744555524169921
Associate II
November 4, 2010
Question

bit banding warning #170

  • November 4, 2010
  • 2 replies
  • 711 views
Posted on November 04, 2010 at 12:16

bit banding warning #170

    This topic has been closed for replies.

    2 replies

    picguy2
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 14:13

    Because your program works perfectly I would not worry.  (Else I would have asked you to carefully inspect the generated code - stepping one assembly instruction at a time.)  Although I use IAR tools and do not know for sure, I suspect that the compiler knows that addresses in the 0x22000000 range are not valid addresses.

    Guessing here but you *may* have two ways of getting rid of the message.  Disable warning: #170-D or find out (and correct) where the compiler the compiler “knows�? about valid RAM and I/O addresses.
    User16769744555524169921
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 14:13

    I got a solution by KEIL support which works

    unsigned long bf;

    #define BITBAND_SRAM(a,b) ((SRAM_BB_BASE + (a-SRAM_BASE)*32 + (b*4)))

    #define _bf0 *((volatile unsigned int *)(BITBAND_SRAM((unsigned long)(unsigned char*)&bf,0)))

    #define _bf1 *((volatile unsigned int *)(BITBAND_SRAM((unsigned long)(unsigned char*)&bf,1)))

    I cannot see too much differences - but no more warnings and it still works solid.