Open source PBP bootloader


Results 1 to 40 of 41

Threaded View

  1. #25
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default Re: Open source PBP bootloader

    Well, there's an easy alternative. Compile your bootloader without ORG, see how much code space it needs. Once you know it, add an ORG at the END of your bootloader + Label. Your bootloader must jump to this Label when it exit.

    Code:
    'bootloader code here
    Goto GetOutOfHere
    
    @ ORG WhateverYouDecide 
    GetOutOfHere:
    Now when you want to use the bootloader, in your application code you need to use DEFINE RESET_ORG... and Period.

    Code:
    DEFINE RESET_ORG WhateverYouDecide
    ' and your application code goes there
    Now go figure how interrupt will work and how to integrate it, have fun!
    http://www.picbasic.co.uk/forum/show...1662#post31662

    Readme.txt:
    ORG Define

    It may sometimes be useful to move the start of the generated code to a
    location other than 0. This can be used to move the program code beyond
    a boot loader, for example. A Define has been added to the compiler to
    allow a different reset address to be specified for the 14-bit core PIC
    MCUs and the PIC18 parts.

    Define RESET_ORG 100h

    This Define moves the starting location of the program, the reset vector,
    to the specified address. The interrupt vector(s) follow at their usual
    offset, followed by the library and program code.

    For 14-bit core devices with more than 2K of code space, only interrupts
    in assembler may be used. On Interrupt will not work properly if the
    device has more than 2K of code space and RESET_ORG is not 0. For
    assembler interrupts in a device with more than 2K of code space and
    RESET_ORG something other than 0, the values of W, STATUS and PCLATH must
    be saved by whatever program now resides at the PIC MCU's fixed vector
    locations before the jump to the new vector location. In general, the
    save locations are named wsave, ssave and psave. The information on these
    save locations should be provided with the boot loader or whatever program
    requires the altered origination so that the register values may be restored
    at the end of interrupt processing.

    For 14-bit enhanced core devices with more than 2K of code space,
    On Interrupt may be used but the values of W, STATUS and PCLATH must not be
    changed to get to the interrupt vector as they will not be restored upon
    return from the interrupt. This usually means bra will be used to jump to
    the new interrupt vector location. Interrupts in assembler do not require
    any special treatment.

    Either 14-bit core PBP library must fit into the first 2K of code space.
    The PIC18 PBP library must fit into the first 32K of code space. It is best
    for RESET_ORG to start on an even 256 word boundary.
    Last edited by mister_e; - 7th March 2011 at 04:05. Reason: link
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

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