<?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 for MCU中的主题 Re: HCS08 C: Filling unused program memory with reset codes</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/HCS08-C-Filling-unused-program-memory-with-reset-codes/m-p/196321#M7263</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi again,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;When I check the codes, I saw FILL Command doesn't fill my ROM1 segment.&lt;/DIV&gt;&lt;DIV&gt;"ROM1&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; READ_ONLY&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x1400 TO 0x17FF FILL 0x8D;"&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;This segment is not used by my codes and still seems as 0xFF although fill command.&lt;/DIV&gt;&lt;DIV&gt;ROM and other filled segment are filled properly. What may cause this?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;10x.&lt;/DIV&gt;&lt;DIV&gt;BP.&lt;BR /&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 27 Feb 2008 19:46:05 GMT</pubDate>
    <dc:creator>BasePointer</dc:creator>
    <dc:date>2008-02-27T19:46:05Z</dc:date>
    <item>
      <title>HCS08 C: Filling unused program memory with reset codes</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/HCS08-C-Filling-unused-program-memory-with-reset-codes/m-p/196316#M7258</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;I want to fill unused program memory with opcode of asm("dcb 0x8D" ) .&lt;/DIV&gt;&lt;DIV&gt;How can I do this?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Regards,&lt;/DIV&gt;&lt;DIV&gt;BP.&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Message Edited by BasePointer on &lt;/SPAN&gt;&lt;SPAN class="date_text"&gt;2008-02-26&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN class="time_text"&gt;11:33 AM&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Feb 2008 17:32:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/HCS08-C-Filling-unused-program-memory-with-reset-codes/m-p/196316#M7258</guid>
      <dc:creator>BasePointer</dc:creator>
      <dc:date>2008-02-26T17:32:49Z</dc:date>
    </item>
    <item>
      <title>Re: HCS08 C: Filling unused program memory with reset codes</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/HCS08-C-Filling-unused-program-memory-with-reset-codes/m-p/196317#M7259</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Have a look at FILL in the Codewarrior help, this extract is from the Help under the S12 but I think it should be the same for the 08, and should work for Code space as well:&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;SEGMENTS     RAM_1  = READ_WRITE 0x800 TO 0x8FF              FILL 0xAA 0x55; END&lt;/PRE&gt;&lt;/DIV&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:51:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/HCS08-C-Filling-unused-program-memory-with-reset-codes/m-p/196317#M7259</guid>
      <dc:creator>colinh</dc:creator>
      <dc:date>2020-10-29T09:51:36Z</dc:date>
    </item>
    <item>
      <title>Re: HCS08 C: Filling unused program memory with reset codes</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/HCS08-C-Filling-unused-program-memory-with-reset-codes/m-p/196318#M7260</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV class="text_smallest"&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;MY_STK =  NO_INIT      0x0C60 TO 0x105F FILL 0x55;  // 1024 byte&lt;/PRE&gt;&lt;/DIV&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;Hi,&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I tried it to initialize my stack area to help me to understand stack size used.&lt;/DIV&gt;&lt;DIV&gt;But it doesn't fill the area. So I used that&lt;/DIV&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;  // initialize stack with 0x55 "U"  memset((void*)0x0C60, 0x55, 0x3E0);&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think FILL command is not working for my project. I'm not sure.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;BP.&lt;/P&gt;&lt;DIV&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:51:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/HCS08-C-Filling-unused-program-memory-with-reset-codes/m-p/196318#M7260</guid>
      <dc:creator>BasePointer</dc:creator>
      <dc:date>2020-10-29T09:51:38Z</dc:date>
    </item>
    <item>
      <title>Re: HCS08 C: Filling unused program memory with reset codes</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/HCS08-C-Filling-unused-program-memory-with-reset-codes/m-p/196319#M7261</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&amp;gt;MY_STK =  NO_INIT      0x0C60 TO 0x105F FILL 0x55;

NO_INIT : do not init.
FILL: do init with FF.

Basically that does not work together. FILL only works with segments which are actually containing content.
So to fill the stack, you have to use runtime code as you did.
Using memset on the whole stack except the last 0x10 bytes is a bit problematic too,
as this will suddenly start to fail as soon as main and memset together use more memmory.
Daniel

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:51:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/HCS08-C-Filling-unused-program-memory-with-reset-codes/m-p/196319#M7261</guid>
      <dc:creator>CompilerGuru</dc:creator>
      <dc:date>2020-10-29T09:51:40Z</dc:date>
    </item>
    <item>
      <title>Re: HCS08 C: Filling unused program memory with reset codes</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/HCS08-C-Filling-unused-program-memory-with-reset-codes/m-p/196320#M7262</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Daniel,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;gt;&amp;gt;MY_STK =&amp;nbsp;&amp;nbsp;READ_WRITE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x0C60 TO 0x105F FILL 0x55;&lt;/DIV&gt;&lt;DIV&gt;I had also tried read_write instead of no_init. The result was same.&lt;/DIV&gt;&lt;DIV&gt;My total stack size is 0x400. And I only set first 0x3E0 bytes of it.&lt;/DIV&gt;&lt;DIV&gt;I don't touch last 32bytes at all. Can this cause any problem?&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;void main(void){  __RESET_WATCHDOG();    // initialize stack with 0x55 "U"  memset((void*)0x0C60, 0x55, 0x3E0);...&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my prm file to fill unused program memory with illegal opcode (0x8D):&lt;/P&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;SEGMENTS /* Here all RAM/ROM areas of the device are listed. Used in PLACEMENT below. */        Z_RAM                    =  READ_WRITE   0x0060 TO 0x00FF;  // 160 byte    RAM                      =  READ_WRITE   0x0100 TO 0x085F;  // 1888 byte    NO_INIT_RAM_SEG          =  NO_INIT      0x0860 TO 0x0C5F;  // 1024 byte    MY_STK                   =  NO_INIT      0x0C60 TO 0x105F;  // 1024 byte    NV_SAVE_SEG              =  READ_ONLY    0x1060 TO 0x13FF;  // reserve 928 (512) byte for NV    ROM1                     =  READ_ONLY    0x1400 TO 0x17FF FILL 0x8D;    ROM                      =  READ_ONLY    0x1870 TO 0xFEAF FILL 0x8D;    FLASH_ROUTINE_SEG        =  READ_ONLY    0xFEB0 TO 0xFFAF FILL 0x8D;    ROM2                     =  READ_ONLY    0xFFC0 TO 0xFFD1 FILL 0x8D;/*  INTVECT                  =  READ_ONLY    0xFFD2 TO 0xFFFF; Reserved for Int. Vectors*/END&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;and it seems working.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;BP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:51:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/HCS08-C-Filling-unused-program-memory-with-reset-codes/m-p/196320#M7262</guid>
      <dc:creator>BasePointer</dc:creator>
      <dc:date>2020-10-29T09:51:42Z</dc:date>
    </item>
    <item>
      <title>Re: HCS08 C: Filling unused program memory with reset codes</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/HCS08-C-Filling-unused-program-memory-with-reset-codes/m-p/196321#M7263</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi again,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;When I check the codes, I saw FILL Command doesn't fill my ROM1 segment.&lt;/DIV&gt;&lt;DIV&gt;"ROM1&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; READ_ONLY&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x1400 TO 0x17FF FILL 0x8D;"&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;This segment is not used by my codes and still seems as 0xFF although fill command.&lt;/DIV&gt;&lt;DIV&gt;ROM and other filled segment are filled properly. What may cause this?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;10x.&lt;/DIV&gt;&lt;DIV&gt;BP.&lt;BR /&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Feb 2008 19:46:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/HCS08-C-Filling-unused-program-memory-with-reset-codes/m-p/196321#M7263</guid>
      <dc:creator>BasePointer</dc:creator>
      <dc:date>2008-02-27T19:46:05Z</dc:date>
    </item>
    <item>
      <title>Re: HCS08 C: Filling unused program memory with reset codes</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/HCS08-C-Filling-unused-program-memory-with-reset-codes/m-p/196322#M7264</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;In order for the FILL attribute to work, there should be at least 1 byte allocated in the specified memory area.&lt;/DIV&gt;&lt;DIV&gt;A memory area which is not used at all will not be filled with the fill pattern.&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>Fri, 29 Feb 2008 20:40:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/HCS08-C-Filling-unused-program-memory-with-reset-codes/m-p/196322#M7264</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2008-02-29T20:40:09Z</dc:date>
    </item>
  </channel>
</rss>

