Is there a way to expand the base bootloader program?


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2005
    Posts
    96

    Default Is there a way to expand the base bootloader program?

    Is there a way to expand the base bootloader program? I would like to be able to have a portion of my code be resident in the bootloader portion of the code so that it will still work when programming the rest of the pic.

    A simple example would be a program that flashes an LED and performs other functions.

    In this example I would like the LED to flash all the time, even if I am programing using the bootloader. So if I can add a section of code to the bootloader to flash an led while the bootloader is programing I think it would work.

    Let me know if need to better explain myself, I realize I may not be being that clear.

    Thanks for any input

  2. #2
    Join Date
    Apr 2005
    Posts
    96


    Did you find this post helpful? Yes | No

    Default

    any thoughts?

    I'd be happy to clarify my question if I can...I basically want to add my own personal code to the bootloader so I have a default code while programing.

    BTW I am trying to do this on an 877a chip.

    Thanks again

  3. #3
    Join Date
    May 2005
    Posts
    33


    Did you find this post helpful? Yes | No

    Default

    i've seen bootloaders in C , ASM... i post a thraed before asking if it is possible to code in PBP... i've figured out some stuff and tought of mixing it with asm... leave all the org statements in asm and anythign to do with adressing in ASM then just add personal functions like password and stuff in the middle... i also am gonna try using the write and read function after i finish my work... WORK SUX.!!!

  4. #4
    Join Date
    Apr 2005
    Posts
    96


    Did you find this post helpful? Yes | No

    Default Found some code

    I just found this site doing a quick search

    http://www.oshonsoft.com/picbootloader.html

    Looks like this code may be what we need to get started making our own bootloaders with PBP

    ---------------------------------
    Define CONF_WORD = 0x3f72
    StartFromZero

    Dim i As Byte
    Dim num As Byte
    Dim total As Word
    Dim j As Word
    Dim address As Word
    Dim data(4) As Word
    Dim dat As Word
    Dim din As Byte

    ASM: BSF PCLATH,3
    ASM: BSF PCLATH,4
    Goto bootloader_start

    'beginning of user program
    ASM: ORG 0x0004
    user_program:
    Goto user_program

    'beginning of bootloader
    ASM: ORG 0x1E00
    execute_user_program:
    Gosub reset_state
    ASM: CLRF STATUS
    ASM: CLRF PCLATH
    ASM: NOP

    ASM: BCF PCLATH,3
    ASM: BCF PCLATH,4
    ASM: GOTO 0x0004
    ASM: NOP

    bootloader_start:
    Hseropen 19200
    WaitMs 100
    Hserout 0x55
    For i = 1 To 100
    WaitMs 1
    Hserget num
    If num = 0x55 Then
    Goto bootloader_main
    Endif
    Next i
    Goto execute_user_program

    bootloader_main:
    Gosub get_byte
    total.LB = din
    Gosub get_byte
    total.HB = din
    address = 0x0004
    For j = 1 To total
    Gosub get_data
    For i = 0 To 3
    If address <= 0x1e00 Then
    Gosub prepare_write
    Gosub write_flash_memory
    Endif
    address = address + 1
    Next i
    Next j
    address = 0x1e04
    Gosub get_data
    For i = 0 To 3
    Gosub prepare_write
    Gosub write_flash_memory
    address = address + 1
    Next i
    WaitMs 100
    Goto execute_user_program
    End

    get_data:
    Gosub get_word
    data(0) = dat
    Gosub get_word
    data(1) = dat
    Gosub get_word
    data(2) = dat
    Gosub get_word
    data(3) = dat
    Return

    get_word:
    Gosub get_byte
    dat.LB = din
    Gosub get_byte
    dat.HB = din
    Return

    get_byte:
    Hserin din
    Hserout din
    Return

    prepare_write:
    EEADR = address.LB
    EEADRH = address.HB
    dat = data(i)
    EEDATA = dat.LB
    EEDATH = dat.HB
    Return

    write_flash_memory:
    ASM: BSF STATUS,RP0
    ASM: BSF STATUS,RP1
    ASM: BSF EECON1,EEPGD
    ASM: BSF EECON1,WREN
    ASM: MOVLW 0x55
    ASM: MOVWF EECON2
    ASM: MOVLW 0xAA
    ASM: MOVWF EECON2
    ASM: BSF EECON1,WR
    ASM: NOP
    ASM: NOP
    ASM: BCF EECON1,WREN
    ASM: BCF STATUS,RP0
    ASM: BCF STATUS,RP1
    Return

    reset_state:
    RCSTA = 0
    TXSTA = 0
    SPBRG = 0
    EECON1 = 0
    PIR1 = 0
    PIR2 = 0
    Return

    ------------------

  5. #5
    Join Date
    Apr 2005
    Posts
    96


    Did you find this post helpful? Yes | No

    Default

    We will obviously have to rewrite the code in PBP conventions to make it work tho.

  6. #6
    Join Date
    May 2005
    Posts
    33


    Did you find this post helpful? Yes | No

    Default

    my mistake bout read and write... wat i really meant was the READCODE and WRITECODE.. haf alookup on tht. writes to program code memory.. i've got one problem now.. anyone outthere, how do i reset the PIC in PBP? or in assembly? no hardware involve as in pulling the MCLR low with another pin.. thnks

Similar Threads

  1. PIC18F4680 bootloader
    By vinyl_theif in forum General
    Replies: 1
    Last Post: - 29th January 2009, 17:45
  2. 18F4550 Bootloader enter via eeprom setting
    By bradb in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 22nd November 2008, 23:51
  3. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  4. Disabling bootloader under program control
    By Charles Linquis in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 14th March 2007, 15:35
  5. Bootloader Problems
    By rossfree in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 11th February 2005, 17:51

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