<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Declaration of bit using codeWarrior in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Declaration-of-bit-using-codeWarrior/m-p/263845#M8307</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mohamed,&lt;/P&gt;&lt;P&gt;Did you fix your problem?&lt;/P&gt;&lt;P&gt;B.R.&lt;/P&gt;&lt;P&gt;Hector Sanchez&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 06 Feb 2014 15:24:52 GMT</pubDate>
    <dc:creator>hectorsanchez</dc:creator>
    <dc:date>2014-02-06T15:24:52Z</dc:date>
    <item>
      <title>Declaration of bit using codeWarrior</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Declaration-of-bit-using-codeWarrior/m-p/263841#M8303</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;please can you tell me how to declare an array of bits in CodeWarrior?&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Jan 2014 10:44:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Declaration-of-bit-using-codeWarrior/m-p/263841#M8303</guid>
      <dc:creator>mohamedmajdeb</dc:creator>
      <dc:date>2014-01-29T10:44:46Z</dc:date>
    </item>
    <item>
      <title>Re: Declaration of bit using codeWarrior</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Declaration-of-bit-using-codeWarrior/m-p/263842#M8304</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Mohamed,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think that your post is at the wrong place.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then I didn't understand your question.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The declaration of an array of bits depends on the programmation language. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you a programming in C, C++. If you use MQX or not&amp;nbsp; and so on...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you give me more informations I may help you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Guillaume&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Jan 2014 12:58:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Declaration-of-bit-using-codeWarrior/m-p/263842#M8304</guid>
      <dc:creator>guillaumetiffin</dc:creator>
      <dc:date>2014-01-29T12:58:05Z</dc:date>
    </item>
    <item>
      <title>Re: Declaration of bit using codeWarrior</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Declaration-of-bit-using-codeWarrior/m-p/263843#M8305</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Moving the thread to the right place, thanks for your help Guillaume&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Jan 2014 16:01:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Declaration-of-bit-using-codeWarrior/m-p/263843#M8305</guid>
      <dc:creator>hectorsanchez</dc:creator>
      <dc:date>2014-01-29T16:01:33Z</dc:date>
    </item>
    <item>
      <title>Re: Declaration of bit using codeWarrior</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Declaration-of-bit-using-codeWarrior/m-p/263844#M8306</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;give me the right place :smileysad:&lt;BR /&gt;thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Feb 2014 10:11:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Declaration-of-bit-using-codeWarrior/m-p/263844#M8306</guid>
      <dc:creator>mohamedmajdeb</dc:creator>
      <dc:date>2014-02-06T10:11:09Z</dc:date>
    </item>
    <item>
      <title>Re: Declaration of bit using codeWarrior</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Declaration-of-bit-using-codeWarrior/m-p/263845#M8307</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mohamed,&lt;/P&gt;&lt;P&gt;Did you fix your problem?&lt;/P&gt;&lt;P&gt;B.R.&lt;/P&gt;&lt;P&gt;Hector Sanchez&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Feb 2014 15:24:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Declaration-of-bit-using-codeWarrior/m-p/263845#M8307</guid>
      <dc:creator>hectorsanchez</dc:creator>
      <dc:date>2014-02-06T15:24:52Z</dc:date>
    </item>
    <item>
      <title>Re: Declaration of bit using codeWarrior</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Declaration-of-bit-using-codeWarrior/m-p/263846#M8308</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Hector&lt;BR /&gt;it's okay &lt;BR /&gt;thank you&amp;nbsp; :smileyhappy:&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Feb 2014 09:05:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Declaration-of-bit-using-codeWarrior/m-p/263846#M8308</guid>
      <dc:creator>mohamedmajdeb</dc:creator>
      <dc:date>2014-02-07T09:05:47Z</dc:date>
    </item>
    <item>
      <title>Re: Declaration of bit using codeWarrior</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Declaration-of-bit-using-codeWarrior/m-p/263847#M8309</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;'C', in any case, is NOT very 'friendly' to booleans represented as single bits, and even LESS helpful trying to work with a 'array of one-bit booleans' in a bits[x] access fashion.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BUT the Kinetis 'K' family has the ARM bit-banding hardware that DOES allow (the CPU-only!) read and write access to single-bits anywhere in upper-RAM space!&amp;nbsp; BUT I know of NO tools that are 'any help' in using this function.&amp;nbsp; Firstly, you have to make sure the array is allocated in UPPER ram (the half starting at 0x20000000).&amp;nbsp; In general, this means you have to 'make your own allocation' in space you steal from the linker.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, say I take the top 4K away from the IDE tools (making the end-of-RAM in a 128Kram part 0x2000EFFF), and allocate myself some vars out there:&lt;/P&gt;&lt;P&gt;DIGOUT_bits&amp;nbsp;&amp;nbsp; DIGOUT_map @ 0x2000F000u;&amp;nbsp;&amp;nbsp; //Global storage of the current operational bits&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then a macro of this form will calculate the bit-band-alias address for that SRAM address:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #define BITBAND_SRAM_A(Addr,Bit) (0x22000000u + (((uint32_t)(Addr) - (uint32_t)0x20000000u)&amp;lt;&amp;lt;5) + (((uint32_t)(Bit))&amp;lt;&amp;lt;2))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;which you can use, for instance, with a pointer like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; uint32_t * offset;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; offset = (uint32_t *)BITBAND_SRAM_A(&amp;amp;DIGOUT_map,0);&amp;nbsp; //Convert to bit-band address, starting right at the LSB&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *offset = 1;&lt;/P&gt;&lt;P&gt;and pointer-math will allow you to index any other bits in that space.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *(offset+3) = 3F;&lt;/P&gt;&lt;P&gt;The net-result of these two 'writes' is for 0x2000F000 to contain the byte 0x09.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The LSB is all you read or write, irrespective of the size of read or write performed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another way to get there is to pre-compute the bit-band address for the space you've carved out, and just allocate your 'booleans' out there (manually, of course!) for the compiler to address:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; static uint32_t bits[227] @ 0x221E0000u;&amp;nbsp;&amp;nbsp; //Bit-band alias of 0x2000F000, occupies 28-3/8 bytes&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ..or, alternative syntax: static uint32_t bits[227] @ BITBAND_SRAM_A(0x2000F000, 0);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bits[7] = 1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf(" %i %i %i\n",bits[0],bits[1],bits[2]);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ......etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is another case of a 'basic ARM function' for which the Kinetis documentation is 'terse' at best!&amp;nbsp; You have to go right to &lt;A href="http://www.arm.com/"&gt;www.arm.com&lt;/A&gt; to fetch the operational documentation such as DDI0439C_cortex_m4_r0p1_trm.pdf section 3.7 "Bit-banding".&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Feb 2014 19:53:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Declaration-of-bit-using-codeWarrior/m-p/263847#M8309</guid>
      <dc:creator>egoodii</dc:creator>
      <dc:date>2014-02-07T19:53:56Z</dc:date>
    </item>
  </channel>
</rss>

