<?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: local allocation of array and external reference to it in Classic/Legacy CodeWarrior</title>
    <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/local-allocation-of-array-and-external-reference-to-it/m-p/137312#M1017</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;If you create your project for a HCS08RE16 MCU from the wizard, there is a memory area called RAM, which is outside of the zeropage.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;default PRM file specifies:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;PLACEMENT&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DEFAULT_RAM&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; INTO&amp;nbsp; RAM;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;So with this configuration the stack will go into RAM area (where DEFAULT_RAM is located.&lt;/DIV&gt;&lt;DIV&gt;If you wish to keep DEFAULT_RAM into zeropage and only the stack outside of zeropage,&lt;/DIV&gt;&lt;DIV&gt;just write:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;PLACEMENT&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;SSTACK&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; INTO&amp;nbsp; RAM;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; _DATA_ZEROPAGE, MY_ZEROPAGE, DEFAULT_RAM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; INTO&amp;nbsp; Z_RAM;&lt;BR /&gt;&amp;nbsp; ...&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;CrasyCat&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 25 Jun 2007 14:36:46 GMT</pubDate>
    <dc:creator>CrasyCat</dc:creator>
    <dc:date>2007-06-25T14:36:46Z</dc:date>
    <item>
      <title>local allocation of array and external reference to it</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/local-allocation-of-array-and-external-reference-to-it/m-p/137303#M1008</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm not too experienced at C yet and have a question on (possibly) the use of pointers and arrays. I wish to allocate a temporary area of memory in a routine to hold 256 bytes of data. I then wish to access this block of memory in another routine called from this routine. I cant quite get my head around what is required to do this. Could someone help me out here, please?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm using an 8 bit uP (9S08RE16) and want to use the RAM space efficiently so want to have this 256 bytes available for use later in the program.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Steve&lt;/SPAN&gt;&lt;BR /&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jun 2007 15:40:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/local-allocation-of-array-and-external-reference-to-it/m-p/137303#M1008</guid>
      <dc:creator>stevec</dc:creator>
      <dc:date>2007-06-19T15:40:12Z</dc:date>
    </item>
    <item>
      <title>Re: local allocation of array and external reference to it</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/local-allocation-of-array-and-external-reference-to-it/m-p/137304#M1009</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;First you need to define a stack which is big enough to contain your 256 bytes array.&lt;/DIV&gt;&lt;DIV&gt;In that purpose just open the .prm from your application and increase stack size.&lt;/DIV&gt;&lt;DIV&gt;define it as 0x130 for example&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Then define the array in the calling function and pass the symbol to the called function. Make sure to have a prototype for the called function prior to implementation of the calling function.&lt;/DIV&gt;&lt;DIV&gt;See example below:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;void foo2(char*param);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;void foo(void) {&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; char tab[256];&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; /*Insert code here */&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; foo2(tab);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;}&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Memory area for the&amp;nbsp;array can then be used for further parameters and local variables.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;That should be it&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;CrasyCat&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jun 2007 18:06:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/local-allocation-of-array-and-external-reference-to-it/m-p/137304#M1009</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2007-06-19T18:06:42Z</dc:date>
    </item>
    <item>
      <title>Re: local allocation of array and external reference to it</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/local-allocation-of-array-and-external-reference-to-it/m-p/137305#M1010</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Thanks,&lt;BR /&gt;So variables are allocated stack space. This is my first time with hcs08. Most experience on&amp;nbsp; 8051 where stack is limited to 128 bytes or 256 at best so using a stack over this (i.e more than 8 bits) is a novelty.&lt;BR /&gt;&lt;BR /&gt;Steve&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jun 2007 14:15:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/local-allocation-of-array-and-external-reference-to-it/m-p/137305#M1010</guid>
      <dc:creator>stevec</dc:creator>
      <dc:date>2007-06-20T14:15:43Z</dc:date>
    </item>
    <item>
      <title>Re: local allocation of array and external reference to it</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/local-allocation-of-array-and-external-reference-to-it/m-p/137306#M1011</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Hi&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Automatic variables are allocated space on the stack as CrasyCat says. When you leave the scope of the function or block where the variable was declared it will be deleted automatically.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;You can allocate variables yourself using malloc() or whatever equivalent your C runtime library offers. These are allocated on the heap and remain there untile your explicitly free them.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;You can also create static variables, either declared within the scope of a function or block; or declared outside all functions and blocks. These are usually allocated space in the BSS section by the linker and are part of your runtime image.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Pointers and arrays are a very important part of the C language. IMHO they are the _most_ important thing to understand properly. If you come from an assembler background they are usually easy to understand, but newer languages which try to be more type safe tend to hide the gory details so pointers can be hard to follow.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;K&amp;amp;R The C Programming Language is not a bad place to start, but you should learn as much as you can about pointers, dereferencing pointers, pointers to pointers, arrays, arrays of pointers, multi-dimensional arrays, pointers to arrays of pointers, etc, etc!&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Cheers,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Paul.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Edit:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;PS I say all this having absolutely no experience with the 8 bit CPU or compiler that you are using but with 20 years of other C experience.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;Message Edited by mccp on &lt;SPAN class="date_text"&gt;2007-06-20&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;10:00 AM&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jun 2007 15:58:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/local-allocation-of-array-and-external-reference-to-it/m-p/137306#M1011</guid>
      <dc:creator>mccPaul</dc:creator>
      <dc:date>2007-06-20T15:58:50Z</dc:date>
    </item>
    <item>
      <title>Re: local allocation of array and external reference to it</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/local-allocation-of-array-and-external-reference-to-it/m-p/137307#M1012</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;CrasyCat,&lt;BR /&gt;the function&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; void foo2(char*param);&lt;BR /&gt;&lt;BR /&gt;defines param as a pointer to char. How do I use this in the function? Something like&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; byte = param[i];&lt;BR /&gt;?&lt;BR /&gt;Haven't got my head quite round this yet.&lt;BR /&gt;&lt;BR /&gt;Steve&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jun 2007 20:21:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/local-allocation-of-array-and-external-reference-to-it/m-p/137307#M1012</guid>
      <dc:creator>stevec</dc:creator>
      <dc:date>2007-06-20T20:21:40Z</dc:date>
    </item>
    <item>
      <title>Re: local allocation of array and external reference to it</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/local-allocation-of-array-and-external-reference-to-it/m-p/137308#M1013</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The ANSI C standard defines that a pointer to char is compatible to an array of char.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;That means inside of the function foo2 you can use param as a pointer or as an array.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;For example you can write&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;#define SIZE 256&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;void foo2(char*param) {&lt;BR /&gt;&amp;nbsp; int i;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp; for (i = 0; i&amp;lt;SIZE; i++) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; param[i]= i;&lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt;}&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV&gt;or you can write&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;#define SIZE 256&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;void foo2(char*param) {&lt;BR /&gt;&amp;nbsp; int i;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp; for (i = 0; i&amp;lt;SIZE; i++) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; *param++= i;&lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt;}&lt;BR /&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;It just depends how you prefer to write it &lt;IMG alt=":smileywink:" class="emoticon emoticon-smileywink" id="smileywink" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-wink.gif" title="Smiley Wink" /&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;CrasyCat&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jun 2007 20:40:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/local-allocation-of-array-and-external-reference-to-it/m-p/137308#M1013</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2007-06-20T20:40:26Z</dc:date>
    </item>
    <item>
      <title>Re: local allocation of array and external reference to it</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/local-allocation-of-array-and-external-reference-to-it/m-p/137309#M1014</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Crasy,&lt;BR /&gt;&lt;BR /&gt;I've increased STACKSIZE from0x50 to 0x150 to allow for my 256 bytes of buffer and now the compiler throws up a link error "L1102&lt;IMG alt=":smileysurprised:" class="emoticon emoticon-smileysurprised" id="smileysurprised" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-surprised.gif" title="Smiley Surprised" /&gt;ut of allocation space in segment Z_RAM at address 0x41".&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Z_RAM&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; =&amp;nbsp; READ_WRITE&amp;nbsp;&amp;nbsp; 0x0040 TO 0x00FF;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _DATA_ZEROPAGE, MY_ZEROPAGE, DEFAULT_RAM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; INTO&amp;nbsp; Z_RAM;&lt;BR /&gt;&lt;BR /&gt;These are the only references to Z_RAM in the .prm file.&lt;BR /&gt;&lt;BR /&gt;Putting STACKSIZE back to 0x50 makes the error disappear but of course the code doesnt work!!!&lt;BR /&gt;&lt;BR /&gt;I'm sure there's a simple explaination (apart from my own ignorance of course).&lt;BR /&gt;&lt;BR /&gt;Steve&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Jun 2007 23:10:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/local-allocation-of-array-and-external-reference-to-it/m-p/137309#M1014</guid>
      <dc:creator>stevec</dc:creator>
      <dc:date>2007-06-22T23:10:18Z</dc:date>
    </item>
    <item>
      <title>Re: local allocation of array and external reference to it</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/local-allocation-of-array-and-external-reference-to-it/m-p/137310#M1015</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Is this because the stack by default is in Z_RAM and I need to move it to another area? If so how do I define where the stack goes? The Help files allude to this but their examples are confusing.&lt;BR /&gt;&lt;BR /&gt;steve&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Jun 2007 23:19:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/local-allocation-of-array-and-external-reference-to-it/m-p/137310#M1015</guid>
      <dc:creator>stevec</dc:creator>
      <dc:date>2007-06-22T23:19:31Z</dc:date>
    </item>
    <item>
      <title>Re: local allocation of array and external reference to it</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/local-allocation-of-array-and-external-reference-to-it/m-p/137311#M1016</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Why don't you try an alternative approach that doesn't use the stack? If you declare the array statically, the linker will create space for it the BSS section and the array will be around for the life of the program. Or you can use malloc() to create the array on the heap if you want to free it. You can leave your stack as it is.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Cheers,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Paul.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Jun 2007 23:28:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/local-allocation-of-array-and-external-reference-to-it/m-p/137311#M1016</guid>
      <dc:creator>mccPaul</dc:creator>
      <dc:date>2007-06-22T23:28:42Z</dc:date>
    </item>
    <item>
      <title>Re: local allocation of array and external reference to it</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/local-allocation-of-array-and-external-reference-to-it/m-p/137312#M1017</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;If you create your project for a HCS08RE16 MCU from the wizard, there is a memory area called RAM, which is outside of the zeropage.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;default PRM file specifies:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;PLACEMENT&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DEFAULT_RAM&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; INTO&amp;nbsp; RAM;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;So with this configuration the stack will go into RAM area (where DEFAULT_RAM is located.&lt;/DIV&gt;&lt;DIV&gt;If you wish to keep DEFAULT_RAM into zeropage and only the stack outside of zeropage,&lt;/DIV&gt;&lt;DIV&gt;just write:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;PLACEMENT&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;SSTACK&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; INTO&amp;nbsp; RAM;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; _DATA_ZEROPAGE, MY_ZEROPAGE, DEFAULT_RAM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; INTO&amp;nbsp; Z_RAM;&lt;BR /&gt;&amp;nbsp; ...&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;CrasyCat&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jun 2007 14:36:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/local-allocation-of-array-and-external-reference-to-it/m-p/137312#M1017</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2007-06-25T14:36:46Z</dc:date>
    </item>
    <item>
      <title>Re: local allocation of array and external reference to it</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/local-allocation-of-array-and-external-reference-to-it/m-p/137313#M1018</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;Thanks for the suggestions.&lt;BR /&gt;&lt;BR /&gt;mccp, I am trying your suggestion first. I have declared an array of 256 bytes. I have assigned my DEFAULT_RAM&amp;nbsp; INTO RAM in the placement area of the .prm file. But now I'm getting another error "&lt;A target="_blank"&gt;Fixup overflow in wait, to timeout type 1 at offset 0x6"&amp;nbsp;&amp;nbsp; and also "........ at offset 0xD.&amp;nbsp;&amp;nbsp; "wait" is a function that uses variable "timeout" as a parameter.&lt;BR /&gt;&lt;BR /&gt;Still struggling against the tide here.&lt;BR /&gt;&lt;BR /&gt;Steve&lt;BR /&gt;&lt;/A&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jun 2007 23:00:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/local-allocation-of-array-and-external-reference-to-it/m-p/137313#M1018</guid>
      <dc:creator>stevec</dc:creator>
      <dc:date>2007-06-25T23:00:38Z</dc:date>
    </item>
    <item>
      <title>Re: local allocation of array and external reference to it</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/local-allocation-of-array-and-external-reference-to-it/m-p/137314#M1019</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; How is variable timeout defined? Is it located in a user default segment or in DEFAULT_RAM?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; Which memory model are you using (or what is your current compiler command line)?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;CrasyCat&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jun 2007 13:28:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/local-allocation-of-array-and-external-reference-to-it/m-p/137314#M1019</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2007-06-26T13:28:13Z</dc:date>
    </item>
    <item>
      <title>Re: local allocation of array and external reference to it</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/local-allocation-of-array-and-external-reference-to-it/m-p/137315#M1020</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;'timeout' is define in the calling files header file as an unsigned char and is referenced as an extern in the called function. I believe I am using the 'tiny' memory model which is probably causing no end of problems (now you mention it). How do I change the memory model within CW to 'small'. Also how can I identify a particular variable as being used in zero page (for speed critical stuff)?&lt;BR /&gt;&lt;BR /&gt;Steve&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jun 2007 14:30:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/local-allocation-of-array-and-external-reference-to-it/m-p/137315#M1020</guid>
      <dc:creator>stevec</dc:creator>
      <dc:date>2007-06-26T14:30:26Z</dc:date>
    </item>
    <item>
      <title>Re: local allocation of array and external reference to it</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/local-allocation-of-array-and-external-reference-to-it/m-p/137316#M1021</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;Ok, found how to change the memory model. Now get error L1401: incompatible memory model&lt;IMG alt=":smileyfrustrated:" class="emoticon emoticon-smileyfrustrated" id="smileyfrustrated" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-frustrated.gif" title="Smiley Frustrated" /&gt;MALL in previous file (main.c.o) and TINY in ASSERT.C.o (ansitis.lib). I get 17 of these referencing the TINY model in various ansitis.lib files.&lt;BR /&gt;Assuming that this is memory size related (and I'm assuming it is) am I best just starting a new project with the right definitions and importing the files I've writen so far?&lt;BR /&gt;&lt;BR /&gt;Steve&lt;BR /&gt;&lt;A target="_blank"&gt;&lt;BR /&gt;&lt;/A&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jun 2007 14:52:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/local-allocation-of-array-and-external-reference-to-it/m-p/137316#M1021</guid>
      <dc:creator>stevec</dc:creator>
      <dc:date>2007-06-26T14:52:22Z</dc:date>
    </item>
    <item>
      <title>Re: local allocation of array and external reference to it</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/local-allocation-of-array-and-external-reference-to-it/m-p/137317#M1022</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Your project is linking against small memory model versions of the libraries so you either need to change the library dependencies or start a new project using the small memory model.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Paul.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jun 2007 15:10:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/local-allocation-of-array-and-external-reference-to-it/m-p/137317#M1022</guid>
      <dc:creator>mccPaul</dc:creator>
      <dc:date>2007-06-26T15:10:16Z</dc:date>
    </item>
    <item>
      <title>Re: local allocation of array and external reference to it</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/local-allocation-of-array-and-external-reference-to-it/m-p/137318#M1023</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;I've started a new project with SMALL memory and imported my source files. Seems a lot better now. Also I've discovered the .map file so I can see where things are allocated.&lt;BR /&gt;Thanks for your help. I can now go away on holiday without this problem waiting for me when I get back!&lt;BR /&gt;&lt;BR /&gt;Steve&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jun 2007 16:27:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/local-allocation-of-array-and-external-reference-to-it/m-p/137318#M1023</guid>
      <dc:creator>stevec</dc:creator>
      <dc:date>2007-06-26T16:27:08Z</dc:date>
    </item>
    <item>
      <title>Re: local allocation of array and external reference to it</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/local-allocation-of-array-and-external-reference-to-it/m-p/137319#M1024</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Nice one!&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jun 2007 16:28:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/local-allocation-of-array-and-external-reference-to-it/m-p/137319#M1024</guid>
      <dc:creator>mccPaul</dc:creator>
      <dc:date>2007-06-26T16:28:35Z</dc:date>
    </item>
  </channel>
</rss>

