<?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: Bug in Codewarrior for HC12? in CodeWarrior for MCU</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Bug-in-Codewarrior-for-HC12/m-p/132853#M1322</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hi rocco!&lt;BR /&gt;&lt;BR /&gt;I found the same random generator at &lt;A href="http://pubpages.unh.edu/~cmg/ece612/CMG3.LST" target="test_blank"&gt;http://pubpages.unh.edu/~cmg/ece612/CMG3.LST&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;;Random number generator&lt;BR /&gt;1051 b6 30 00 RANDOM: LDAA $3000&lt;BR /&gt;1054 45 ROLA&lt;BR /&gt;1055 45 ROLA&lt;BR /&gt;1056 45 ROLA&lt;BR /&gt;1057 b8 30 00 EORA $3000 ;XOR 4TH &amp;amp; 7TH BITS&lt;BR /&gt;105a 41 COMA ;COMPLEMENT A&lt;BR /&gt;105b 45 ROLA ;7TH BIT INTO CARRY&lt;BR /&gt;105c b6 30 00 LDAA $3000 ;RESTORE THE NUMBER&lt;BR /&gt;105f 45 ROLA ;RESULT IS THE NEW RND #&lt;BR /&gt;1060 7a 30 00 STAA $3000 ;SAVE THE CURRENT RND&lt;BR /&gt;1063 3d RTS&lt;BR /&gt;&lt;BR /&gt;But when it works, it's randomly enough for that job :smileyhappy:&lt;BR /&gt;&lt;BR /&gt;notting&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 21 Apr 2006 19:42:19 GMT</pubDate>
    <dc:creator>notting</dc:creator>
    <dc:date>2006-04-21T19:42:19Z</dc:date>
    <item>
      <title>Bug in Codewarrior for HC12?</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Bug-in-Codewarrior-for-HC12/m-p/132850#M1319</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm currently adapting a small static "multi-tasking OS" for the HC12 written in C. It was created by other students of my university with ICC12. My job is to make it work with Codewarrior (so it can be compiled there with chc12.exe (I'm currently using V-5.0.24 Build 4047) and VisualStudio can be used as editor). It is working nearly perfect - except of one little thing.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;There are four modes: Round-Robin and Lottery, each with and without priorities.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;In Round-Robin mode it works perfectly. In Lottery, there is a random number generator as assembler code in the C code. It creates a number from 0 to (the number of threads - 1). After that, a for-slope decrements that value to 0. Every time it decrements that value by 1, it also set the pointer from the current thread to the next one (thread number + 1; if the next thread number doesn't exists -&amp;gt; thread number = 0) so the next thread is chosen randomly.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;---- piece of C code ----&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;asm(" LDAA random\n ROLA\n ROLA\n ROLA\n EORA random\n COMA\n ROLA\n LDAA random\n ROLA\n STAA random"); /* Generate random number */&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;jumps=random%NUMBER_OF_THREADS;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for(;jumps&amp;gt;0;jumps--){ /* Chose next thread randomly */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ThreadRunPtr=ThreadRunPtr-&amp;gt;Next;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;---- piece of C code ----&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But that doesn't work! One thread is chosen at the very beginning which runs all the time.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Now the funny thing: With a "NOP" for example as first instruction within the for-slope it works perfectly!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The disassembled programs without and with that NOP are looking pretty similar, at least at the beginning. But there is also a significant difference: In first case there is a "bset" and in second case at the same address there is a "call".&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Could that be the reason for the problem? A bug in Codewarrior?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But I don't know how I should update. I can't find that page with Codewarrior for HC12 and the link to the 32k student license on &lt;A href="https://community.nxp.com/www.metrowerks.com" target="test_blank"&gt;www.metrowerks.com&lt;/A&gt; anymore. And the updater doesn't show suitable updates as far I understand that (and sometimes it doesn't work although I really don't have any problems with my internet connection).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Because I don't know if you prefere the complete C code or the disassembled program, please tell me if and what you need to tell me more.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;TIA!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Apr 2006 20:54:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Bug-in-Codewarrior-for-HC12/m-p/132850#M1319</guid>
      <dc:creator>notting</dc:creator>
      <dc:date>2006-04-19T20:54:11Z</dc:date>
    </item>
    <item>
      <title>Re: Bug in Codewarrior for HC12?</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Bug-in-Codewarrior-for-HC12/m-p/132851#M1320</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;HC12 V4.5 can be downloaded from the Freescale web site.&lt;BR /&gt;This version contains the "HC12 V-5.0.30 Build 6037, Feb 7 2006" compiler.&lt;BR /&gt;&lt;BR /&gt;About your problem, I'm not sure its a bug. The best would be a as simple as possible, compilable and runnable sample with a description what you see, and what you expect.&lt;BR /&gt;&lt;BR /&gt;Daniel&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Apr 2006 05:33:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Bug-in-Codewarrior-for-HC12/m-p/132851#M1320</guid>
      <dc:creator>CompilerGuru</dc:creator>
      <dc:date>2006-04-21T05:33:06Z</dc:date>
    </item>
    <item>
      <title>Re: Bug in Codewarrior for HC12?</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Bug-in-Codewarrior-for-HC12/m-p/132852#M1321</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hi, notting:&lt;BR /&gt;&lt;BR /&gt;It looks like a mistake in your asm code. The first seven instructions do a good job of juggling bits, but the eighth instruction undoes what the first seven did, rendering the first seven instructions as a long, drawn-out nop.&lt;BR /&gt;&lt;BR /&gt;The net result is:&lt;BR /&gt;&lt;BR /&gt;LDAA random&lt;BR /&gt;ROLA&lt;BR /&gt;STAA random&lt;BR /&gt;&lt;BR /&gt;. . . which isn't very random at all.&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Apr 2006 05:54:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Bug-in-Codewarrior-for-HC12/m-p/132852#M1321</guid>
      <dc:creator>rocco</dc:creator>
      <dc:date>2006-04-21T05:54:58Z</dc:date>
    </item>
    <item>
      <title>Re: Bug in Codewarrior for HC12?</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Bug-in-Codewarrior-for-HC12/m-p/132853#M1322</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hi rocco!&lt;BR /&gt;&lt;BR /&gt;I found the same random generator at &lt;A href="http://pubpages.unh.edu/~cmg/ece612/CMG3.LST" target="test_blank"&gt;http://pubpages.unh.edu/~cmg/ece612/CMG3.LST&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;;Random number generator&lt;BR /&gt;1051 b6 30 00 RANDOM: LDAA $3000&lt;BR /&gt;1054 45 ROLA&lt;BR /&gt;1055 45 ROLA&lt;BR /&gt;1056 45 ROLA&lt;BR /&gt;1057 b8 30 00 EORA $3000 ;XOR 4TH &amp;amp; 7TH BITS&lt;BR /&gt;105a 41 COMA ;COMPLEMENT A&lt;BR /&gt;105b 45 ROLA ;7TH BIT INTO CARRY&lt;BR /&gt;105c b6 30 00 LDAA $3000 ;RESTORE THE NUMBER&lt;BR /&gt;105f 45 ROLA ;RESULT IS THE NEW RND #&lt;BR /&gt;1060 7a 30 00 STAA $3000 ;SAVE THE CURRENT RND&lt;BR /&gt;1063 3d RTS&lt;BR /&gt;&lt;BR /&gt;But when it works, it's randomly enough for that job :smileyhappy:&lt;BR /&gt;&lt;BR /&gt;notting&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Apr 2006 19:42:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Bug-in-Codewarrior-for-HC12/m-p/132853#M1322</guid>
      <dc:creator>notting</dc:creator>
      <dc:date>2006-04-21T19:42:19Z</dc:date>
    </item>
    <item>
      <title>Re: Bug in Codewarrior for HC12?</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Bug-in-Codewarrior-for-HC12/m-p/132854#M1323</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hi CompilerGuru!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;CompilerGuru wrote:&lt;BR /&gt;HC12 V4.5 can be downloaded from the Freescale web site.&lt;BR /&gt;This version contains the "HC12 V-5.0.30 Build 6037, Feb 7 2006" compiler.&lt;BR /&gt;&lt;BR /&gt;About your problem, I'm not sure its a bug. The best would be a as simple as possible, compilable and runnable sample with a description what you see, and what you expect.&lt;BR /&gt;&lt;BR /&gt;Daniel&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Ok, then I'll try the new version if there is no other way (I hope I'll find it on the website until then...).&lt;BR /&gt;&lt;BR /&gt;Because it is probably too much, I uploaded it on the web. That link is valid until May, 21st:&lt;BR /&gt;&lt;A href="http://service.gmx.net/mc/lwLILADLF7QzM7vsiLol8er2xI2ta9" target="test_blank"&gt;http://service.gmx.net/mc/lwLILADLF7QzM7vsiLol8er2xI2ta9&lt;/A&gt;&lt;BR /&gt;Click on the image button "GMX MediaCenter starten" (I don't know if that service is able to "speak" other languages) and then click on the icon of that file (notting.zip).&lt;BR /&gt;&lt;BR /&gt;I compiled everything with this command line:&lt;BR /&gt;C:\Programme\Metrowerks\CodeWarrior CW12_V3.1\prog\chc12.exe -prod=D:\1 -ObjN=%(OBJPATH)\main.o main.c&lt;BR /&gt;&lt;BR /&gt;(also all threads)&lt;BR /&gt;&lt;BR /&gt;Linker:&lt;BR /&gt;C:\Programme\Metrowerks\CodeWarrior CW12_V3.1\prog\linker.exe -b -prod=D:\1 -add(main.o thread1.o thread2.o thread3.o thread4.o) D:\1\prm\RAM.prm&lt;BR /&gt;&lt;BR /&gt;Every thread sends its thread number (1...4) via SCI to the terminal. I uploaded the version with NOP. The result looks like this in the terminal:&lt;BR /&gt;&lt;BR /&gt;&amp;gt;load&lt;BR /&gt;**&lt;BR /&gt;&amp;gt;g 829&lt;BR /&gt;44444444444444443333333333333333222222222222222211111111111111113333333333333333333333333333333333333333333333344444444444444443333333333333331111111111111111111111111111111111111111111111111111111111111111111111111111111222222222222222244444444444444444444444444444441111111111111111444444444444444422222222222222223333333333333332222222222222222111111111111111133333333333333334444444444444443333333333333333222222222222222244444444444444444444444444444441111111111111111444444444444444422222222222222222222222222222222222222222222222333333333333333311111111111111112222222222222222444444444444444444444444444444444444444444444441111111111111111333333333333333333333333333333344444444444444442222222222222222222222222222222333333333333333322222222222222221111111111111111444444444444444333333333333333322222222222222224444444444444444444444444444444111111111111111144444444444444443333333333333333111111111111111111111111111111122222222222222224444444444444444444444444444444444444444444444444444444444444441111111111111111444444444444444333333333333333311111111111111112222222222222222444444444444444444444444444444444444444444444444444444444444444111111111111111333333333333333344444444444444442222222222222222333333333333333111111111111111122222222222222224444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444111111111111111133333333333333334444444444444444333333333333333222222222222222244444444444444441111111111111111333333333333333444444444444444422222222222222222222222222222222333333333333333111111111111111111111111111111111111111111111111222222222222222211111111111111144444444444444443333333333333333111111111111111111111111111111111111111111111111111111111111111222222222222222244444444444444444444444444444444444444444444444111111111111111133333333333333344444444444444443333333333333333111111111111111111111111111111122222222222222224444444444444444111111111111111144444444444444422222222222222223333333333333333222222222222222244444444444444411111111111111114444444444444444333333333333333322222222222222211111111111111114444444444444444333333333333333311111111111111122222222222222221111111111111111444444444444444433333333333333311111111111111112222222222222222111111111111111133333333333333344444444444444442222222222222222333333333333333322222222222222211111111111111114444444444444444222222222222222222222222222222233333333333333331111111111111111222222222222222244444444444444444444444444444441111111111111111444444444444444422222222222222222222222222222223333333333333333222222222222222244444444444444411111111111111113333333333333333444444444444444422222222222222223333333333333332222222222222222444444444444444444444444444444444444444444444444444444444444444111111111111111144444444444444442222222222222222222222222222222333333333333333311111111111111111111111111111112222222222222222444444444444444411111111111111114444444444444443333333333333333222222222222222211111111111111113333333333333334444444444444444222222222222222233333333333333332222222222222224444444444444444111111111111111133333333333333333333333333333334444444444444444333333333333333322222222222222224444444444444441111111111111111444444444444444422222222222222222222222222222222222222222222222333333333333333322222222222222221111111111111113333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333334444444444444444333333333333333322222222222222221111111111111114444444444444444222222222222222222222222222222222222222222222223333333333333333222222222222222244444444444444444444444444444444444444444444444444444444444444444444444444444441111111111111111333333333333333333333333333333344444444444444443333ÿ&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;But without NOP in the for-slopes, it looks like this:&lt;BR /&gt;&lt;BR /&gt;&amp;gt;load&lt;BR /&gt;**&lt;BR /&gt;&amp;gt;g 829&lt;BR /&gt;44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444þ&lt;BR /&gt;&lt;BR /&gt;TIA!&lt;BR /&gt;&lt;BR /&gt;notting&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Apr 2006 20:50:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Bug-in-Codewarrior-for-HC12/m-p/132854#M1323</guid>
      <dc:creator>notting</dc:creator>
      <dc:date>2006-04-21T20:50:03Z</dc:date>
    </item>
    <item>
      <title>Re: Bug in Codewarrior for HC12?</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Bug-in-Codewarrior-for-HC12/m-p/132855#M1324</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Oops, sorry notting, I didn't look close enough. my bad.&lt;BR /&gt;&lt;BR /&gt;The result of the first seven instructions is actually in the carry bit, and is then propagated into the final result in the ninth instruction.&lt;BR /&gt;&lt;BR /&gt;It really helps when the code is commented.&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 22 Apr 2006 11:44:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Bug-in-Codewarrior-for-HC12/m-p/132855#M1324</guid>
      <dc:creator>rocco</dc:creator>
      <dc:date>2006-04-22T11:44:45Z</dc:date>
    </item>
  </channel>
</rss>

