<?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: Going to try writing a USB Bootloader for JM60 in 8-bit Microcontrollers</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Going-to-try-writing-a-USB-Bootloader-for-JM60/m-p/148086#M7625</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;cool,&amp;nbsp; I was thinking that it should work.&lt;BR /&gt;&lt;BR /&gt;I am going to set it up using generic HID,&amp;nbsp; so there are no drivers or even an INF file to worry about.&lt;BR /&gt;&lt;BR /&gt;Thanks for the input.&lt;BR /&gt;&lt;BR /&gt;Bob&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 02 Feb 2009 11:58:01 GMT</pubDate>
    <dc:creator>TurboBob</dc:creator>
    <dc:date>2009-02-02T11:58:01Z</dc:date>
    <item>
      <title>Going to try writing a USB Bootloader for JM60</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Going-to-try-writing-a-USB-Bootloader-for-JM60/m-p/148082#M7621</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Well, I'm going to try to create one.&amp;nbsp; The only issue that has me worried is USB interrupts while in boot mode.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have 2 ideas:&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The first is to build the bootloader with the complete USB stack built in,&amp;nbsp; and not put the stack in the app.&amp;nbsp; The app would call the functions in the boot sector.&amp;nbsp; An array of function pointers in a known spot will take care of the ap being able to find the functions to call.&amp;nbsp; Then the bootloader would forward all interrupts based on a relocated vector table similar to the AN2295 implementation for the HC08AP.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The PC side would relocate the vectors before sending the file to the device.&amp;nbsp;&amp;nbsp; Or the bootloader could handle it.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The second idea would be to use the standard JM60 vector relocation feature,&amp;nbsp; build the USB stack into the bootloader, but also the app (space is not an issue).&amp;nbsp; Then when boot mode is triggered, re-write the vectors to point the USB interupt into the bootloader.&amp;nbsp; Then after loading,&amp;nbsp; reset the vectors to run the ap.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have the HID mode of the CMX stack working reasonably,&amp;nbsp; so I will be using that mode.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any feedback?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Bob&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;(note, most of these ideas came out of various conversations and threads on this board, and with board members.&amp;nbsp; It is not my intention to take any credit.&amp;nbsp; I plan to post the code when done)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 31 Jan 2009 14:30:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Going-to-try-writing-a-USB-Bootloader-for-JM60/m-p/148082#M7621</guid>
      <dc:creator>TurboBob</dc:creator>
      <dc:date>2009-01-31T14:30:29Z</dc:date>
    </item>
    <item>
      <title>Re: Going to try writing a USB Bootloader for JM60</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Going-to-try-writing-a-USB-Bootloader-for-JM60/m-p/148083#M7622</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Dear TurboBob,&lt;BR /&gt;&lt;BR /&gt;The USBDM software contains a In-circuit-programming mode that allows reprogramming of the majority of the flash over USB.&amp;nbsp; This would be easily extracted if it the functionality that you require.&lt;BR /&gt;&lt;BR /&gt;It consists of a minimum USB stack + Flash routines in the protected area of the Flash with the majority of the Flash free for the user code.&lt;BR /&gt;&lt;BR /&gt;See&lt;BR /&gt;&lt;BR /&gt; &lt;A class="subj_read" href="http://forums.freescale.com/message?board.id=OSBDM08&amp;amp;thread.id=511" rel="nofollow" target="_blank"&gt;Combined TBDML/OSBDM Code for the JM16/32/60 (USBDM)&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;if interested.&lt;BR /&gt;&lt;BR /&gt;bye&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 31 Jan 2009 18:11:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Going-to-try-writing-a-USB-Bootloader-for-JM60/m-p/148083#M7622</guid>
      <dc:creator>pgo</dc:creator>
      <dc:date>2009-01-31T18:11:11Z</dc:date>
    </item>
    <item>
      <title>Re: Going to try writing a USB Bootloader for JM60</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Going-to-try-writing-a-USB-Bootloader-for-JM60/m-p/148084#M7623</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;thanks for the input.&amp;nbsp; I will look it over.&lt;BR /&gt;&lt;BR /&gt;I was looking over the AN3561 which incorporates a bootloader.&lt;BR /&gt;&lt;BR /&gt;The source code doesn't appear to be part of the .zip file,&amp;nbsp; but instead its a .lib&lt;BR /&gt;&lt;BR /&gt;Does anyone have the source?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Also,&amp;nbsp; since the cpu will only be doing boot-loader tasks, I wonder if the USB interupt flag could be polled instead of actually using the interupt.&amp;nbsp; The longest latency would be due to a sector erase.&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;This way the vectors can be handled using just the redirection mechanism..&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Bob&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 Feb 2009 02:31:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Going-to-try-writing-a-USB-Bootloader-for-JM60/m-p/148084#M7623</guid>
      <dc:creator>TurboBob</dc:creator>
      <dc:date>2009-02-01T02:31:38Z</dc:date>
    </item>
    <item>
      <title>Re: Going to try writing a USB Bootloader for JM60</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Going-to-try-writing-a-USB-Bootloader-for-JM60/m-p/148085#M7624</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Dear TurboBob,&lt;BR /&gt;&lt;BR /&gt;The USBDM bootloader code uses polling while the main code uses the re-directed interrupts, so yes it is possible &lt;IMG alt=":smileyhappy:" class="emoticon emoticon-smileyhappy" id="smileyhappy" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-happy.gif" title="Smiley Happy" /&gt;&lt;BR /&gt;&lt;BR /&gt;I didn't like the AN3561 code since it wasn't open source and also seemed to require Vista or a specific version of XP service pack.&amp;nbsp; At least I couldn't get the driver to load under XP SP2.&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;bye&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Feb 2009 08:19:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Going-to-try-writing-a-USB-Bootloader-for-JM60/m-p/148085#M7624</guid>
      <dc:creator>pgo</dc:creator>
      <dc:date>2009-02-02T08:19:18Z</dc:date>
    </item>
    <item>
      <title>Re: Going to try writing a USB Bootloader for JM60</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Going-to-try-writing-a-USB-Bootloader-for-JM60/m-p/148086#M7625</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;cool,&amp;nbsp; I was thinking that it should work.&lt;BR /&gt;&lt;BR /&gt;I am going to set it up using generic HID,&amp;nbsp; so there are no drivers or even an INF file to worry about.&lt;BR /&gt;&lt;BR /&gt;Thanks for the input.&lt;BR /&gt;&lt;BR /&gt;Bob&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Feb 2009 11:58:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Going-to-try-writing-a-USB-Bootloader-for-JM60/m-p/148086#M7625</guid>
      <dc:creator>TurboBob</dc:creator>
      <dc:date>2009-02-02T11:58:01Z</dc:date>
    </item>
    <item>
      <title>Re: Going to try writing a USB Bootloader for JM60</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Going-to-try-writing-a-USB-Bootloader-for-JM60/m-p/148087#M7626</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Dear TurboBob,&lt;BR /&gt;&lt;BR /&gt;I can't see the advantage of a generic HID since you presumably need a driver for the device when operating as the application.&amp;nbsp; Can't you just use the same driver when in bootstrap mode?&lt;BR /&gt;&lt;BR /&gt;bye&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Feb 2009 20:48:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Going-to-try-writing-a-USB-Bootloader-for-JM60/m-p/148087#M7626</guid>
      <dc:creator>pgo</dc:creator>
      <dc:date>2009-02-02T20:48:32Z</dc:date>
    </item>
    <item>
      <title>Re: Going to try writing a USB Bootloader for JM60</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Going-to-try-writing-a-USB-Bootloader-for-JM60/m-p/148088#M7627</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;My main ap is Generic HID,&amp;nbsp; so I was planning to use the same driver.&amp;nbsp; (or non-driver in this case.. )&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Considering my tight timeframe ,&amp;nbsp; I may have to just use the UART bootloader (AN2295) for now.&amp;nbsp; And change to the USB loader later.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks for the help!&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Bob&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Feb 2009 22:00:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Going-to-try-writing-a-USB-Bootloader-for-JM60/m-p/148088#M7627</guid>
      <dc:creator>TurboBob</dc:creator>
      <dc:date>2009-02-02T22:00:18Z</dc:date>
    </item>
    <item>
      <title>Re: Going to try writing a USB Bootloader for JM60</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Going-to-try-writing-a-USB-Bootloader-for-JM60/m-p/148089#M7628</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Current status:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Well, I built up&amp;nbsp;the basic bootloader framework using the CMX stack&amp;nbsp;configured for HID.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The project doesn't actually do anything yet, just runs an empty loop.&amp;nbsp; But it fits in&amp;nbsp;6290 bytes&amp;nbsp;of flash.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&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) {  MCU_init(); /* call Device Initialization */  asm SEI;                             /* Disable interrupts */  if(PTBD_PTBD3 != 0)     // if PB is not pushed when powering up. then     {                     //  jump to user ap.    asm       {      ldhx 0xDFFE   ; load vector from user app      jmp ,x       }    }                                                                                          // ------------------------------------initialize USB  usb_cfg_init();  set_mode(dm_generic);  HID_init(500, 0);  out_report=hid_add_report(rpt_out, 0, 64);  //   in_report=hid_add_report(rpt_in, 0, 64);    // //----------------------------------------------------------------------    for(;;) {    /* __RESET_WATCHDOG(); by default, COP is disabled with device init. When enabling, also reset the watchdog. */  if(hid_report_pending(out_report))    {    hid_read_report(out_report, USB_Report_Out);    }  if (!hid_report_pending(in_report))   // if transmitter is not busy.      {                                               //  load up a new message;      }  hid_process(in_report);        if(INTSTAT &amp;amp; INTENB) // USB interrupt bits, detect enabled interupt    {    usb_it_handler(); // this function will service the USB and clear the flag bits    }  } /* loop forever */&lt;/PRE&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;Yes,&amp;nbsp;&amp;nbsp;6290 bytes&amp;nbsp; Way too big, especially considering the application code will have a duplicate USB stack built in.&amp;nbsp; One possibility for improvement would be to create a way for the app to use the bootloader's USB stack.&amp;nbsp; It seems like an uphill battle though.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;It looks like the ICP portion of the OSBDM is very compact.&amp;nbsp; It would make a good standalone bootloader except that I don't know how to talk to it.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;In contrast, I built up the JM version of AN2295 uart bootloader, and its tiny.&amp;nbsp; Got it together in 1/2 hour.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Bob&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 08:49:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Going-to-try-writing-a-USB-Bootloader-for-JM60/m-p/148089#M7628</guid>
      <dc:creator>TurboBob</dc:creator>
      <dc:date>2020-10-29T08:49:44Z</dc:date>
    </item>
    <item>
      <title>Re: Going to try writing a USB Bootloader for JM60</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Going-to-try-writing-a-USB-Bootloader-for-JM60/m-p/148090#M7629</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Well,&amp;nbsp; its obvious to me that my version is way too large.&amp;nbsp; And I don't have a good enough understanding of the USB stuff to write something anywhere near as clean as your ICP routines in the OSBDM.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I used some of the OSBDM ICP stuff, got it in and functioning (checksum, ICP trigger detection and vector tables).&amp;nbsp; Very nice.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I need to get the MCG configured (8 mhz xtal) and my LED I/O.&amp;nbsp; But its a very clean setup.&amp;nbsp; (great work, thanks a ton).&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I need to figure out what I need to publish for the GPL.&amp;nbsp; I also need to figure out how to talk to it.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks pgo,&amp;nbsp; this will really help.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Bob&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Feb 2009 22:30:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Going-to-try-writing-a-USB-Bootloader-for-JM60/m-p/148090#M7629</guid>
      <dc:creator>TurboBob</dc:creator>
      <dc:date>2009-02-04T22:30:00Z</dc:date>
    </item>
    <item>
      <title>Re: Going to try writing a USB Bootloader for JM60</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Going-to-try-writing-a-USB-Bootloader-for-JM60/m-p/148091#M7630</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Another update.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I have the ICP routines integrated into my application.&amp;nbsp; It boots properly either jumping to ICP if I hold the button depressed, or to the main app.&amp;nbsp; The checksum calculation works properly.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I added 3 files to my project,&amp;nbsp; changed user_vectors to match the ProcessorExpert generated vectors.&amp;nbsp; I modified the PRM file.&amp;nbsp; A few other tweaks and it builds.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;When jumping to ICP, it is recognised properly, and Windows will install the driver and seems happy.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Now, on to the Windows side of it.&amp;nbsp; I am trying to integrate the DLL into my Borland C++ Bulider application but am having issues with unrecognised external symbols.&amp;nbsp; I think its a compatibility issue with non-standard name mangling.&amp;nbsp; I will let you know how it goes.&amp;nbsp; Perhaps it would be better to build it as a standalone console app.&amp;nbsp; If you have any suggestions, let me know.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I do have Visual Studio 2002 available for use if that is more compatible with the OSBDM sourcecode.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks!&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Bob&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Feb 2009 01:50:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Going-to-try-writing-a-USB-Bootloader-for-JM60/m-p/148091#M7630</guid>
      <dc:creator>TurboBob</dc:creator>
      <dc:date>2009-02-10T01:50:01Z</dc:date>
    </item>
  </channel>
</rss>

