<?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: Branches don't work after erasing flash in simulator! in CodeWarrior for MCU</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Branches-don-t-work-after-erasing-flash-in-simulator/m-p/147308#M3417</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hello Alex,&lt;BR /&gt;&lt;BR /&gt;For the 'SH8 device, you will need to run part of the erase code (and also programming code) from RAM.&amp;nbsp; This is because, when the erase process commences, an internal charge pump applies high voltage to the flash array.&amp;nbsp; Whilst this occurs, flash memory is unreadable.&lt;BR /&gt;&lt;BR /&gt;Using the search engine below, you should find numerous code examples for S08 devices within this forum.&amp;nbsp; Some of the methods use a fixed block for the RAM based code, whereas the other possibility is to load the function code to the stack, and run it from there.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Mac&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 29 Jan 2009 21:52:42 GMT</pubDate>
    <dc:creator>bigmac</dc:creator>
    <dc:date>2009-01-29T21:52:42Z</dc:date>
    <item>
      <title>Branches don't work after erasing flash in simulator!</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Branches-don-t-work-after-erasing-flash-in-simulator/m-p/147306#M3415</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi everyone,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am writing an embedded application for the MC9S08SH8. I want to use one page of FLASH memory for non-volatile storage of user settings. I have allocated a 512-byte constant block starting at E030 (the beginning of a FLASH page). However, when I erase this page of FLASH in the simulator, the MCU suddenly ignores all branches, breezing past them and executing data.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The instruction summary says this about BRA:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;BRA rel -- Branch Always (if I = 1)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have tried turning I on, off, off and on, on and off, but whatever I do, branches don't work after erasing FLASH.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am using the FlashErase1 routine from page 60 of the HCS08 Family Reference Manual. Any input would be much appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Alex Dowad&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jan 2009 09:16:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Branches-don-t-work-after-erasing-flash-in-simulator/m-p/147306#M3415</guid>
      <dc:creator>alexd</dc:creator>
      <dc:date>2009-01-29T09:16:23Z</dc:date>
    </item>
    <item>
      <title>Re: Branches don't work after erasing flash in simulator!</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Branches-don-t-work-after-erasing-flash-in-simulator/m-p/147307#M3416</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;I suspect this is because you can't execute code from the flash while writing/erasing to the flash. The solution in that case is to execute the erase code from internal eeprom or RAM.&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jan 2009 16:42:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Branches-don-t-work-after-erasing-flash-in-simulator/m-p/147307#M3416</guid>
      <dc:creator>Lundin</dc:creator>
      <dc:date>2009-01-29T16:42:25Z</dc:date>
    </item>
    <item>
      <title>Re: Branches don't work after erasing flash in simulator!</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Branches-don-t-work-after-erasing-flash-in-simulator/m-p/147308#M3417</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hello Alex,&lt;BR /&gt;&lt;BR /&gt;For the 'SH8 device, you will need to run part of the erase code (and also programming code) from RAM.&amp;nbsp; This is because, when the erase process commences, an internal charge pump applies high voltage to the flash array.&amp;nbsp; Whilst this occurs, flash memory is unreadable.&lt;BR /&gt;&lt;BR /&gt;Using the search engine below, you should find numerous code examples for S08 devices within this forum.&amp;nbsp; Some of the methods use a fixed block for the RAM based code, whereas the other possibility is to load the function code to the stack, and run it from there.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Mac&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jan 2009 21:52:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Branches-don-t-work-after-erasing-flash-in-simulator/m-p/147308#M3417</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2009-01-29T21:52:42Z</dc:date>
    </item>
    <item>
      <title>Re: Branches don't work after erasing flash in simulator!</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Branches-don-t-work-after-erasing-flash-in-simulator/m-p/147309#M3418</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Thanks, but the thing is that I *am* executing out of RAM. I am using the routine given on page 60 of the HCS08 Family Manual. This routine loads the critical code from FLASH onto the stack and then uses a JSR to run it from off the stack.&lt;BR /&gt;&lt;BR /&gt;Alex Dowad&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jan 2009 23:04:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Branches-don-t-work-after-erasing-flash-in-simulator/m-p/147309#M3418</guid>
      <dc:creator>alexd</dc:creator>
      <dc:date>2009-01-29T23:04:26Z</dc:date>
    </item>
    <item>
      <title>Re: Branches don't work after erasing flash in simulator!</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Branches-don-t-work-after-erasing-flash-in-simulator/m-p/147310#M3419</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Still haven't found any way around this problem. I suspect that the CodeWarrior MCU simulator is buggy (but I would be happy to be proved wrong).&lt;BR /&gt;&lt;BR /&gt;Alex Dowad&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 31 Jan 2009 17:18:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Branches-don-t-work-after-erasing-flash-in-simulator/m-p/147310#M3419</guid>
      <dc:creator>alexd</dc:creator>
      <dc:date>2009-01-31T17:18:53Z</dc:date>
    </item>
    <item>
      <title>Re: Branches don't work after erasing flash in simulator!</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Branches-don-t-work-after-erasing-flash-in-simulator/m-p/147311#M3420</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hello Alex,&lt;BR /&gt;&lt;BR /&gt;You seem to be implying that you are using full chip simulation, rather than the real hardware.&amp;nbsp; Is this the case?&amp;nbsp; My understanding is that flash erase and write processes are not simulated.&lt;BR /&gt;&lt;BR /&gt;However, I cannot see why branch instructions should be ignored under this circumstance.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Mac&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 Feb 2009 09:32:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Branches-don-t-work-after-erasing-flash-in-simulator/m-p/147311#M3420</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2009-02-01T09:32:03Z</dc:date>
    </item>
    <item>
      <title>Re: Branches don't work after erasing flash in simulator!</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Branches-don-t-work-after-erasing-flash-in-simulator/m-p/147312#M3421</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;OK, then that answers my question. It's unfortunate, because it means I can't test my code for saving/retrieving user settings in the simulator. Thanks for your help!&lt;BR /&gt;&lt;BR /&gt;Alex&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 Feb 2009 09:51:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Branches-don-t-work-after-erasing-flash-in-simulator/m-p/147312#M3421</guid>
      <dc:creator>alexd</dc:creator>
      <dc:date>2009-02-01T09:51:42Z</dc:date>
    </item>
  </channel>
</rss>

