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

    Ok, just got done reading AN851. This doesn't seem too hard to implement in PBP. Is anyone intrested? If so, what do you think of this as a starting point?
    -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
    Jan 2006
    Location
    Toronto
    Posts
    109


    Did you find this post helpful? Yes | No

    Default Re: Open source PBP bootloader

    I was planning on making a PBP Serial/USB/I2C/SD/Ethernet Bootloader but never got around to starting it yet. I guess now is a good time

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


    Did you find this post helpful? Yes | No

    Default Re: Open source PBP bootloader

    PJALM, That sounds pretty awesome, and aggressive!

    After doing some googling, There is at least 1 open source python interface out there to talk to AN851 BL. I like that approach, Python I mean, then we have multiplatform available.

    Ok, we have 2 responses so far. I have no idea how to tend to the logistics of this - meaning making it a group effort- or if we just contribuite code until we get something working. Baring any other suggestions, I will start to port AN851 to PBP.

    We will also need TESTERS!!!
    -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!

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


    Did you find this post helpful? Yes | No

    Default Re: Open source PBP bootloader

    This is where I am so far. I am sure there are some errors, but what are friends for?
    Code:
    ' *****************************************************************************
    '        Software License Agreement				    
    '		 						    
    ' The software supplied herewith by PBP forum members 	    
    ' (the “Company”) for Microchip's PICmicro® Microcontroller's is 
    ' intended and supplied to you, the Company’s customer, for use     
    ' solely and exclusively on Microchip PICmicro Microcontroller	    
    ' products. The software is owned by the Company and/or its         
    ' supplier, and is protected under applicable copyright laws. All   
    ' rights are reserved. Any use in violation of the foregoing 	     
    ' restrictions may subject the user to criminal sanctions under	    
    ' applicable laws, as well as to civil liability for the breach of  
    ' the terms and conditions of this license.			    
    '								    
    ' THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES, 
    ' WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED 
    ' TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 	    
    ' PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT, 
    ' IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR 	    
    ' CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.		    
    '								    
    '					 			    
    ' This software has been ported from Microchip's AN851 bootloader
    ' Changes have been made and will be made as the company sees fit.
    ' This version is for 16F's, there is another version for 18F's
    '
    '
    ' Memory Map
    '	-----------------
    '	|    0x0000	|	Reset vector
    '	|        	|
    '   |    0x0004	|	Interrupt vector
    '	|    		|	
    '	|		    |
    '	|Boot Block |	(this program)
    ' 	|		    |
    '	|    0x0200	|	Re-mapped Reset Vector
    '	|    0x0204	|	Re-mapped High Priority Interrupt Vector
    '	|		    |
    '	|   	    |	
    '	|		    |
    '   |Code Space |	User program space
    '	|		    |
    '	|		    |
    '	|		    |
    '	|    0x3FFF |
    '	-----------------
    '
    ' Incomming data format:
    '
    '       <STX><STX><DATA><CHKSUM><ETX>
    '                               /    \
    '	 ________/      \____________________________
    '	/	                                         \
    '	<COMMAND><DLEN><ADDRL><ADDRH><ADDRU><DATA>...
    '
    ' Definitions:
    '
    ' 	STX  	-	Start of packet indicator
    '	ETX 	-	End of packet indicator
    ' 	LEN 	-	Length of incomming packet
    ' 	DATA	-	General data up to 255 bytes
    ' 	CHKSUM 	- 	The 8-bit two's compliment sum of LEN & DATA
    ' 	COMMAND - 	Base command
    ' 	DLEN	-	Length of data associated to the command
    ' 	ADDR	-	Address up to 24 bits
    ' 	DATA 	-	Data (if any)
    '
    '
    ' Commands:
    '
    ' 	RD_VER		0x00	Read Version Information
    ' 	RD_MEM		0x01	Read Program Memory
    ' 	WR_MEM		0x02	Write Program Memory
    ' 	ER_MEM		0x03	Erase Program Memory (NOT supported by PIC16)
    ' 	RD_EE		0x04	Read EEDATA Memory 
    ' 	WR_EE		0x05	Write EEDATA Memory 
    ' 	RD_CONFIG	0x06	Read Config Memory (NOT supported by PIC16)
    ' 	WT_CONFIG	0x07	Write Config Memory (NOT supported by PIC16)
    '
    ' ****************************************************************************
    
    ' *****************************************************************************
    CHKSUM		VAR	BYTE		' Checksum accumulator
    COUNTER		VAR	BYTE		' General counter
    ABTIME		VAR	BYTE
    RXDATA		VAR	BYTE
    TXDATA		VAR	BYTE
    TEMP		VAR	BYTE
    
    PCLATH_TEMP	VAR	BYTE		' Interrupt context
    STATUS_TEMP	VAR	BYTE		' save/restore registers
    W_TEMP		VAR	BYTE
    
    ' Frame Format
    '
    '  <STX><STX>[<COMMAND><DATALEN><ADDRL><ADDRH><ADDRU><...DATA...>]<CHKSUM><ETX>
    
    DATA_BUFF	VAR	BYTE		' Start of receive buffer SAME ADDRESS AS COMMAND
    	
    COMMAND		VAR	BYTE		' Data mapped in receive buffer SAME ADDRESS AS DATA_BYTE
    DATA_COUNT	VAR	BYTE	
    ADDRESS_L	VAR	BYTE
    ADDRESS_H	VAR	BYTE
    ADDRESS_U	VAR	BYTE
    PACKET_DATA	VAR	BYTE	     'THIS SHOULD BE AN ARRAY I THINK**************
    ' *****************************************************************************
    
    
    '  This is the remapping section, note the interrupt also saves context
    ' *****************************************************************************
    @	ORG	0x0000			' Re-map Reset vector **Not sure how to set the address to start at
    VReset:
    	PCLATH = 0
    	goto	Setup								
    
    @	ORG	0x0004			'standard interrupt vector **again not sure of the PBP equal for ORG
    VInt:
    	W_TEMP = W			   'I am assuming this will be the "W" register			
    	STATUS_TEMP = STATUS   'We may have trouble here. ASM uses SWAP so as not to affect the status
    	STATUS = 0
    	PCLATH_TEMP = PCLATH
    	PCLATH = 0
    	goto	RVInt	    ' Re-map Interrupt vector		
    
    ; *****************************************************************************
     *****************************************************************************
    ; Setup the appropriate registers.
    Setup:
    	clrwdt
    	READ $ff,temp		         'get the value of last EEPROM location
    	IF temp = $ff then goto SRX  'BL startup
    	goto	RVReset			     ' If not 0xFF then normal reset	
    
    SRX:
    	RCSTA = b'10000000'		' Setup rx and tx, CREN disabled
    	TRISC.6 = 0 			' Setup tx pin		
    	TXSTA = b'00100110'			
    	STATUS.IRP = 1
    ; *****************************************************************************

    Well it formats much better in notepad++. well I tried to attach the code, but had some issues there. but for now, the code is as I wrote it, just the comments are messed up.
    Last edited by cncmachineguy; - 2nd March 2011 at 05:00.
    -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!

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