<?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: Bootloader for S12P128 in S12 / MagniV Microcontrollers</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Bootloader-for-S12P128/m-p/170238#M5652</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;AN3275 is not compatible with S12P. Compared to "classic" S12, flash module is different, no INITRM register, different memory map etc.&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 28 Jan 2010 19:48:59 GMT</pubDate>
    <dc:creator>kef</dc:creator>
    <dc:date>2010-01-28T19:48:59Z</dc:date>
    <item>
      <title>Bootloader for S12P128</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Bootloader-for-S12P128/m-p/170234#M5648</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to implement a bootloader for S12P. I downloaded the AN3275SW which claims to work for all S12 microcontrollers. But when I flash my microcontroller with the code provided, it hangs in the startup file itself. I modified the code to make it deliberately jump to main. It does so but then it hangs as soon as it comes across any function call. Can you tell me what could be wrong? Are there any software updates for AN3275 or are there any changes I need to do in the Standard Settings in CodeWarrior?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;--&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cmux&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jan 2010 15:07:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Bootloader-for-S12P128/m-p/170234#M5648</guid>
      <dc:creator>Cmux</dc:creator>
      <dc:date>2010-01-27T15:07:53Z</dc:date>
    </item>
    <item>
      <title>Re: Bootloader for S12P128</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Bootloader-for-S12P128/m-p/170235#M5649</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As designed, CodeWarrior points the reset vector to the _Startup routine, whose code is located in Start12.c. _Startup's purpose is to set up the stack, initialize key processor registers, and other stuff that sets up the C run time environment. After that, _Startup calls main(). If you by-pass that routine, none of the crucial initializations take place, and the MCU soon goes out into the weeds. You are dying on a function call because the stack and its pointer have not been set up.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;---Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jan 2010 21:55:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Bootloader-for-S12P128/m-p/170235#M5649</guid>
      <dc:creator>J2MEJediMaster</dc:creator>
      <dc:date>2010-01-27T21:55:06Z</dc:date>
    </item>
    <item>
      <title>Re: Bootloader for S12P128</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Bootloader-for-S12P128/m-p/170236#M5650</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oh I am sorry for the confusion. I flashed the AN3275SW code as it was provided on the freescale site also. That too used to hang. I ran the code in the debugger one step at a time and found that it used to hang in the Start12.c file before it could jump to main(). Did anyone else too face this problem when implementing the bootloader?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;--&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cmux&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jan 2010 00:29:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Bootloader-for-S12P128/m-p/170236#M5650</guid>
      <dc:creator>Cmux</dc:creator>
      <dc:date>2010-01-28T00:29:38Z</dc:date>
    </item>
    <item>
      <title>Re: Bootloader for S12P128</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Bootloader-for-S12P128/m-p/170237#M5651</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;
 #if defined(__SET_RESET_VECTOR__)
void __interrupt 0 _Startup(void) {
#else
void _Startup(void) {
#endif
/*  purpose:    1)  initialize the stack
                2)  initialize the RAM, copy down init data etc (Init)
                3)  call main;
    parameters: NONE
    called from: _PRESTART-code generated by the Linker
                 or directly referenced by the reset vector */

  /* Enable the Digital input buffer for bit0 */
  ATD0DIEN = 0x01;
  /* wait 2 cycles */
  asm PSHA;
  asm PSHA;
 
  if(PORTAD0_BIT0)
  //if(PORTE &amp;amp; 0x20)
  {
    asm JMP [0xFFFE-BootBlkSize,pcr]/* Run user Program */
  }
  else
  {
    _DISABLE_COP();
    /* My Working RAM is from 0x5000 - 0x57FF */
    INITRM = 0x50;
    INITEE = 0x21;   /* EEPROM if available is located from 0x2000 */
   /* initialize the stack pointer */
   INIT_SP_FROM_STARTUP_DESC(); /*lint !e522 asm code */ /* HLI macro definition in hidef.h */

//   Init(); /* zero out, copy down, call constructors */
   __asm {
ZeroOut:
             LDX   _startupData.pZeroOut    ; *pZeroOut
             LDY   _startupData.nofZeroOuts ; nofZeroOuts
             BEQ   CopyDown                 ; if nothing to zero out

NextZeroOut: PSHY                           ; save nofZeroOuts
             LDY   2,X+                     ; start address and advance *pZeroOut (X = X+4)

             LDD   2,X+                     ; byte count
NextWord:    CLR   1,Y+                     ; clear memory byte
             DBNE  D, NextWord              ; dec byte count

             PULY                           ; restore nofZeroOuts
             DEY                            ; dec nofZeroOuts
             BNE  NextZeroOut
CopyDown:

             LDX   _startupData.toCopyDownBeg ; load address of copy down desc.

NextBlock:
             LDD   2,X+                     ; size of init-data -&amp;gt; D
             BEQ   funcInits                ; end of copy down desc.


             LDY   2,X+                     ; load destination address

Copy:        MOVB  1,X+,1,Y+                ; move a byte from ROM to the data area
             DBNE  D,Copy                   ; copy-byte loop

             BRA   NextBlock
funcInits:                                  ; call of global construtors is only in c++ necessary
   }
   /* Jump to main(); Use JMP instead of CALL to not use space on Stack*/
   asm JMP main;
  }
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the Start12.c file that is included with the AN3275SW. When I run my code the microcontroller just hangs. I then set a breakpoint at &lt;FONT face="courier new,courier"&gt;asm JMP main&lt;/FONT&gt; and ran the code, it never reached the breakpoint and just hung. I am using S12P128. Are there any device-specific changes I need to make in the code to get it working?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;--&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cmux&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:18:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Bootloader-for-S12P128/m-p/170237#M5651</guid>
      <dc:creator>Cmux</dc:creator>
      <dc:date>2020-10-29T09:18:45Z</dc:date>
    </item>
    <item>
      <title>Re: Bootloader for S12P128</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Bootloader-for-S12P128/m-p/170238#M5652</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;AN3275 is not compatible with S12P. Compared to "classic" S12, flash module is different, no INITRM register, different memory map etc.&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jan 2010 19:48:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Bootloader-for-S12P128/m-p/170238#M5652</guid>
      <dc:creator>kef</dc:creator>
      <dc:date>2010-01-28T19:48:59Z</dc:date>
    </item>
    <item>
      <title>Re: Bootloader for S12P128</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Bootloader-for-S12P128/m-p/170239#M5653</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oh if that is the case, is there a bootloader software provided by Freescale for S12P or will I have to write it myself?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;--&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cmux&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jan 2010 19:53:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Bootloader-for-S12P128/m-p/170239#M5653</guid>
      <dc:creator>Cmux</dc:creator>
      <dc:date>2010-01-28T19:53:38Z</dc:date>
    </item>
    <item>
      <title>Re: Bootloader for S12P128</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Bootloader-for-S12P128/m-p/170240#M5654</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would begin by creating a project for the S12P and use the start12.c file it produces. Unless the app note does something very special in the startup code, the start12.c file generated by the wizard should work. If something must be modified to support the bootloader, you would edit this startup file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;---Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Jan 2010 22:21:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Bootloader-for-S12P128/m-p/170240#M5654</guid>
      <dc:creator>J2MEJediMaster</dc:creator>
      <dc:date>2010-01-29T22:21:01Z</dc:date>
    </item>
  </channel>
</rss>

