Open source PBP bootloader


Closed Thread
Results 1 to 40 of 41

Hybrid View

  1. #1
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default Re: Open source PBP bootloader

    The goal is a new one using pure PBP. To get me started, I am attempting to convert the existing Microchip serial one, AN851. For me this does 2 things, it has shown me just how the guts of the BL work, and I thought by starting there, we are able to test the GUI with it.

    To that end, I do have a much better feel for how they work, at least this one. So we can make this work and build onto it, or start over with a completly new one. No matter to me
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

  2. #2
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default Re: Open source PBP bootloader

    If you want to get the code to compile, rem the first 2 @org's. change the last to to 800 and 808. These need to be changed anyway as I think they were not far enough in memory.

    I have been digesting what Steve has pointed to. My understanding is this: I need to let PBP take care of memory!! The first @ORG is un-needed as PBP will place the code at 00 anyway. So that just needs to be deleted. I think the for the interrupt redirect, we just need a
    Code:
     DEFINE INTHAND NewIntLocation
    then in our application code:

    Code:
    DEFINE RESET_ORG 800
       GOTO Start ' or whatever you favorite label is
    NewIntLocation:
       Do your Interrupt thing
    
    Start:
       Code till your hearts content, (or MEM is full)
    So if I am correct, the only thing left is context saving in the real interrupt vector before jumping.

    Now as for the rest of the code, I need some help here. I have a crazy mix of PBP commands and direct register addressing. I want to get rid of the direct addressing. This is really bad in the comm part. Do we want to use HSERIN/OUT or SERIN/OUT. I think using SER would be nicer in the aspect we can then use any pins to do this, and have control over true vs inverted signals. It will also be a trivial matter to use I2C instead of SER using the bit-bang approach.

    Let me just throw in my opinion here, speed is NOT the issue. This is a bootloader, It will not be used often once your app is done.
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

  3. #3
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: Open source PBP bootloader

    I need to create bootloader for PIC18F that program flash from external I2C memory, eg 24lc512.
    I'll probably write bootloader in pbp and asm.

    If I understand correctly how bootloader works, there is 2 ways to implement bootloader.
    -One is to make bootloader that sits on beginning of flash, then on address 4 and 8, need to be GOTO to new int vector. That will add one more GOTO before executing int, PBP already add one. I don't like that GOTO's.
    -Other option is that first instruction in flash is GOTO Bootloader, and to put bootloader on end of flash. Then there is no need to remap interrupt. When bootloader finish job, then GOTO 1
    In main program only need to remap reset vector to 1.
    Am I understand how it works?

    For now I'll create LED blink program, that use bootloader with reset vector at 1.
    And then try to make bootloader that will program that hex to flash. For start hex will be in LOOKUP2, until I get flesh erase and write to work, then comunication...

    Probably I should start with analyzing syntax of hex file.

    Is there anyone interested and willing to help?

  4. #4
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: Open source PBP bootloader

    Edit timeout...
    Address for int are 8 and 24, and GOTO takes 2 program word so, reset org should be 4.

  5. #5
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: Open source PBP bootloader

    Is there way to move RESET_ORG to other address, without moving interrupt vector?
    DEFINE RESET_ORG 004h also move vectors. In .LST file interrupt vector are defined as RESET_ORG+8h or 18h.
    DEFINE LOADER_USED 1 doesn't do anything. I'm looking in disassembled hex file...
    This is test code:
    Code:
        DEFINE NO_CLRWDT 1
        DEFINE LOADER_USED 1
        DEFINE INTHAND myint    ' Define interrupt handler
        DEFINE INTLHAND myint    ' Define interrupt handler
    
    Start:
        PORTD.6=1
        PORTD.6=0
    GOTO Start
    
    @myint bcf PORTB,1
    Name:  disasm.png
Views: 3168
Size:  12.2 KB

    Also I noticed that with or without NO_CLRWDT 1, there is no CLRWDT in hex file.

  6. #6
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,170


    Did you find this post helpful? Yes | No

    Default Re: Open source PBP bootloader

    I have VERY limitted knowledge in this area, but can't you set config fuses from the programmer?

    (NO_CLRWDT is a config fuse right?)

    If input to the programmer is the hex file, wouldn't that mean that fuses are handled separately than the hex file?

    Robert
    Last edited by Demon; - 10th March 2014 at 22:20.

  7. #7
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: Open source PBP bootloader

    PBP should put CLRWDT if there is no defined NO_CLRWDT 1. DEFINE NO_CLRWDT 1 isn't config, it is PBP's define.

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts