Announcement

Collapse
No announcement yet.

Bootloaders.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Bootloaders.

    Hi,
    I'm looking into getting the DS30 loader working with PBP and I'm getting confused with what exactly the DEFINE LOADER_USED 1 directive actually does.

    In the documentation for the DS30 loader there's the following note:
    You need to make sure there is a goto placed at location 0x00 in your application. In most cases your linker already does this for you. To check if it does you can pick Progam Memory from the View‐menu in MPLAB.
    I did this and without having the DEFINE LOADER_USED 1 in my code the very first instruction (at 0x0000) is a GOTO 0x4 and with the DEFINE it's a GOTO 0x8.

    If I understand the DS30 loader documentation correct it places a GOTO of its own at the top and then, when "my" program is downloaded the loader application or firmware moves the GOTO that PBP originally placed at location 0x0000 to the exit-point of the bootloader so that the execution vectors to the original starting location of "my" program (which is either 0x4 or 0x8 depending on the DEFINE) when the bootloader is finished.

    So what difference does it make having/not having the DEFINE in there? Is it something specific to the MicroCode Loader?

    Thanks!
    /Henrik.

  • #2
    Hi Henrik,

    LOADER_USED just makes sure there's no "Library Code" in the first 4 locations (words).
    If library code got relocated by the bootloader it would "break" the program.

    Different booloaders act differently, and for awhile the ds30 bootloader didn't relocate all 4 locations, and expected the goto to be at address 0. That caused a problem with PBP because the goto is not always first.

    A recent update to the bootloader makes it work better with PicBasic Pro, so make sure you have the latest version.
    PBP3 Manual : Microchip Datasheets - 10F, 12F, 16F, 18F
    Never download a PIC datasheet from anywhere but microchip.com

    Comment


    • #3
      Hi Darrel,
      Thank you for the prompt reply!

      So what you're saying is that just because my small scale test DID have a GOTO placed at location 0 that's not always the case, it (the GOTO) might be preceeded by a branch to a piece of library code?

      What you're also saying is that the DS30 loader does not only move the very first word but the first four words? I did see something regarding this in the DS30 loader forum but it's not mentioned in the docs (as far as I've found anyway). I do have the latest version.

      So, the bottom line is that the DS30 loader should work fine with PBP as long as you DEFINE LOADER_USED 1, no other "re-ORGing" or anything is needed?

      Thanks Darrel!
      /Henrik.

      Comment


      • #4
        Right,

        If you had an LCDOUT or I2CREAD/WRITE statement in your program, the first instruction would be a (clrf FLAGS) and the goto would be next at address 2.

        If using the MCSP ICD, the first instruction will be a NOP, then clrf FLAGS, then the goto.

        To work with PBP, a bootloader needs to relocate the first 4 words.
        And since ds30 does that now, it shouldn't have problems.
        No additional ORGs or defines required, just LOADER_USED.
        PBP3 Manual : Microchip Datasheets - 10F, 12F, 16F, 18F
        Never download a PIC datasheet from anywhere but microchip.com

        Comment


        • #5
          Brilliant, thanks Darrel!
          And thanks Mikael for bringing us the DS30 loader!

          /Henrik.

          Comment


          • #6
            Thank me by reporting bugs

            Comment


            • #7
              Will do, IF I find any....
              First I need to learn how to adapt and use it.

              /Henrik.

              Comment


              • #8
                Hi,
                (This is not directly PBP3 related but it relates to the DS30 loader discussed in the thread.)

                OK, so I've been trying to get this thing (DS30 loader) going on a 25K22 for about a day now without any luck and I can not figure out what I'm doing wrong.

                I'm using UART1 and running the PIC with a 10Mhz x-tal and 4X PLL on a known good board where my original application have been working fine. I'm attaching to COM3 on PC with a baudrate of 115200 - which is also known and verified to work because my application uses the same port and settings.

                After clicking Find Bl in the DS30 loader GUI I reset the PIC but the application doesn't find the bootloader and eventually times out.

                I've changed the settings.inc file in a way that I think is correct but apparently something is wrong, I'm attaching it to this message. In order to enable digital mode on the UART pins on PortC I've also changed the User specific entry code section in ds30loader.asm file to this:
                Code:
                		;----------------------------------------------------------------------
                		; Make uart pins digital
                		;----------------------------------------------------------------------
                		ifdef	ADCON1
                		;		error Do you need to configura uart pins to be digital? If not, remove this line
                		endif
                		movlw 	b'00000000'		;xxx disable 
                		movwf 	ANSELC			;xxx analog on tx/rx
                I'm using v3.0.0 of the loader firmware and 1.4.6 of the GUI.

                Any help, hints or suggestions would be most welcome.

                /Henrik.
                Attached Files

                Comment

                Working...
                X