<?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>CodeWarrior Development Tools中的主题 Re: Can,t make a pointer to a const array.</title>
    <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/Can-t-make-a-pointer-to-a-const-array/m-p/796979#M6985</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Per,&lt;/P&gt;&lt;P&gt;This error is because there are two pointers in the statement pointing to non-equal types.&lt;/P&gt;&lt;P&gt;in your code,&lt;/P&gt;&lt;P&gt;pb is defined as unsigned char *&lt;/P&gt;&lt;P&gt;b is defined as const unsigned char *&lt;/P&gt;&lt;P&gt;these two type are not match.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;casting const to pb can solve the problem:&lt;/P&gt;&lt;P&gt;change&lt;/P&gt;&lt;P&gt;unsigned char *pb;&lt;/P&gt;&lt;P&gt;to&lt;/P&gt;&lt;P&gt;const unsigned char *pb;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;TIC&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 07 Nov 2018 08:05:41 GMT</pubDate>
    <dc:creator>ZhangJennie</dc:creator>
    <dc:date>2018-11-07T08:05:41Z</dc:date>
    <item>
      <title>Can,t make a pointer to a const array.</title>
      <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/Can-t-make-a-pointer-to-a-const-array/m-p/796976#M6982</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Having problem with assign a unsigned char const array to a pointer. Works fine to assign an unsigned char array to a pointer.&lt;/P&gt;&lt;P&gt;What do I wrong. Using Codewarrior version 11.0 with MCU MC9S08QD4. Attached is a little project that illustrate the problem. I have tried to cast the array to unsigned char far but little did it help.&lt;/P&gt;&lt;P&gt;Sincerly Yours&lt;/P&gt;&lt;P&gt;Per Højfeldt&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="DSC_0013.JPG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/17542i11CD55306314D9B1/image-size/large?v=v2&amp;amp;px=999" role="button" title="DSC_0013.JPG" alt="DSC_0013.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 04 Nov 2018 13:09:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-Development-Tools/Can-t-make-a-pointer-to-a-const-array/m-p/796976#M6982</guid>
      <dc:creator>perhojfeldt</dc:creator>
      <dc:date>2018-11-04T13:09:06Z</dc:date>
    </item>
    <item>
      <title>Re: Can,t make a pointer to a const array.</title>
      <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/Can-t-make-a-pointer-to-a-const-array/m-p/796977#M6983</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Per,&lt;/P&gt;&lt;P&gt;Your project use Tiny memory model.&lt;/P&gt;&lt;P&gt;With Tiny model, By default all variables are in the zero page (direct memory access). Variables outside the zero page can be used with pragmas or the far keyword.&lt;/P&gt;&lt;P&gt;To fix this error, one easy solution is to create a new project with Small memory model, then input your code to main file. You will see your project can pass build.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/62911iBCC0181214864D3A/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have verified it from my side.&lt;/P&gt;&lt;P&gt;If you still can't fix it by yourself, please just let me know.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;TIC&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Nov 2018 05:44:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-Development-Tools/Can-t-make-a-pointer-to-a-const-array/m-p/796977#M6983</guid>
      <dc:creator>ZhangJennie</dc:creator>
      <dc:date>2018-11-06T05:44:14Z</dc:date>
    </item>
    <item>
      <title>Re: Can,t make a pointer to a const array.</title>
      <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/Can-t-make-a-pointer-to-a-const-array/m-p/796978#M6984</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp; Jennie,&lt;/P&gt;&lt;P&gt;I tried to make a model in Small instead of Tiny and the error went away. But still come up with an warning. Unsigned char const -&amp;gt; unsigned char. I change the unsigned char pointer to a far pointer and the warning went away. Why? Is a pointer not always an integer in an MCU with 16bit memory? I also change the project.prm file so the ram area is from 0x0060 to 0x015F. Ram area was also tried as 0x0100 to 0x015F but same warning.&lt;/P&gt;&lt;P&gt;Like You said if I use far in Tiny model does warnings and errors away. Looks like that the way.&lt;/P&gt;&lt;P&gt;Thanks for Your help.&lt;/P&gt;&lt;P&gt;Sincerly Yours&lt;/P&gt;&lt;P&gt;Per Højfeldt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Nov 2018 20:58:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-Development-Tools/Can-t-make-a-pointer-to-a-const-array/m-p/796978#M6984</guid>
      <dc:creator>perhojfeldt</dc:creator>
      <dc:date>2018-11-06T20:58:31Z</dc:date>
    </item>
    <item>
      <title>Re: Can,t make a pointer to a const array.</title>
      <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/Can-t-make-a-pointer-to-a-const-array/m-p/796979#M6985</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Per,&lt;/P&gt;&lt;P&gt;This error is because there are two pointers in the statement pointing to non-equal types.&lt;/P&gt;&lt;P&gt;in your code,&lt;/P&gt;&lt;P&gt;pb is defined as unsigned char *&lt;/P&gt;&lt;P&gt;b is defined as const unsigned char *&lt;/P&gt;&lt;P&gt;these two type are not match.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;casting const to pb can solve the problem:&lt;/P&gt;&lt;P&gt;change&lt;/P&gt;&lt;P&gt;unsigned char *pb;&lt;/P&gt;&lt;P&gt;to&lt;/P&gt;&lt;P&gt;const unsigned char *pb;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;TIC&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Nov 2018 08:05:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-Development-Tools/Can-t-make-a-pointer-to-a-const-array/m-p/796979#M6985</guid>
      <dc:creator>ZhangJennie</dc:creator>
      <dc:date>2018-11-07T08:05:41Z</dc:date>
    </item>
    <item>
      <title>Re: Can,t make a pointer to a const array.</title>
      <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/Can-t-make-a-pointer-to-a-const-array/m-p/796980#M6986</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jennie,&lt;/P&gt;&lt;P&gt;Funny though. If you change the unsigned char *pb to unsigned char *far pb the warning disapear. Still the pointers are of none equal types. Well got it to work fine in Tiny model just by changing pointer from unsigned char * to unsigned char *far. A little to think about.&lt;/P&gt;&lt;P&gt;Take care.&lt;/P&gt;&lt;P&gt;Per&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Nov 2018 22:43:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-Development-Tools/Can-t-make-a-pointer-to-a-const-array/m-p/796980#M6986</guid>
      <dc:creator>perhojfeldt</dc:creator>
      <dc:date>2018-11-07T22:43:46Z</dc:date>
    </item>
    <item>
      <title>Re: Can,t make a pointer to a const array.</title>
      <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/Can-t-make-a-pointer-to-a-const-array/m-p/796981#M6987</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi again,&lt;/P&gt;&lt;P&gt;The pointer should be able to handle both const unsigned char arrays in flash for programing and struct in RAM. It works fine by define the pointer as&lt;/P&gt;&lt;P&gt;unsigned char *far ucpPtr. No errors no warnings. All good.&lt;/P&gt;&lt;P&gt;Per&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Nov 2018 22:49:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-Development-Tools/Can-t-make-a-pointer-to-a-const-array/m-p/796981#M6987</guid>
      <dc:creator>perhojfeldt</dc:creator>
      <dc:date>2018-11-07T22:49:26Z</dc:date>
    </item>
    <item>
      <title>Re: Can,t make a pointer to a const array.</title>
      <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/Can-t-make-a-pointer-to-a-const-array/m-p/796982#M6988</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If use tiny mode, if variables outside the zero page(8bits address) , we have to use pragma or far key words to get over this limit.&lt;/P&gt;&lt;P&gt;I know use "far" is also an option, but you need do it for every variable that is over 8bit address.&lt;/P&gt;&lt;P&gt;If your memory space is enough for your code, the advantage of&amp;nbsp; using small mode is that it is easier for programming.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Nov 2018 02:50:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-Development-Tools/Can-t-make-a-pointer-to-a-const-array/m-p/796982#M6988</guid>
      <dc:creator>ZhangJennie</dc:creator>
      <dc:date>2018-11-09T02:50:47Z</dc:date>
    </item>
  </channel>
</rss>

