summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2013-07-20 13:26:47 (GMT)
committerChristian Pointner <equinox@spreadspace.org>2013-07-20 13:26:47 (GMT)
commit5510e238ce1a88b779f4d183a8b6dbd17e35ddca (patch)
treeeb05d4ade4ff84ae6ae1f26aac7c82042ac1c2f2
parentaf8feeb684d4242aabce4652d1386181be5920e6 (diff)
com spi for 887 now fits within flash boundary
TODO: test this - not sure if this works... git-svn-id: https://svn.spreadspace.org/pic/trunk@89 a09c6847-51d9-44de-8ef2-e725cf50f3c7
-rw-r--r--bootloader/bootloader-887.asm21
-rw-r--r--bootloader/com-16f1847-uart.inc2
-rw-r--r--bootloader/com-16f887-spi.inc13
-rw-r--r--bootloader/com-16f887-uart.inc2
4 files changed, 22 insertions, 16 deletions
diff --git a/bootloader/bootloader-887.asm b/bootloader/bootloader-887.asm
index 9d1f564..8a34635 100644
--- a/bootloader/bootloader-887.asm
+++ b/bootloader/bootloader-887.asm
@@ -29,7 +29,9 @@
;; -------------------------------------
;; DEFINES (chip/com specific)
-#define BOOTPIN PORTC,7
+;; #define BOOTPIN PORTC,7 ; use this for com-uart
+#define BOOTPIN PORTA,5 ; use this for com-spi
+#define INTPIN PORTA,4 ; use this for com-spi
USERVECT EQU H'100'
ISRVECT EQU USERVECT + H'4'
FLASH_BOUNDARY EQU b'00001111' ; flash write boundary is at 16 bytes boundaries
@@ -67,9 +69,16 @@ flags EQU H'007D'
cnt EQU H'007F'
;; Boot Macro
-bootmacro macro
- ;; btfsc BOOTPIN
- ;; goto USERVECT
+;; bootmacro macro ; use this for com-uart
+;; btfsc BOOTPIN
+;; goto USERVECT
+;; goto com_init
+;; endm
+
+bootmacro macro ; use this for com-spi
+ bsf STATUS,RP0
+ bsf STATUS,RP1
+ bcf ANSEL,ANS4 ; RA5/SS as digital input -> BOOTPIN
goto com_init
endm
@@ -83,8 +92,8 @@ bootmacro macro
;; -------------------------------------
;; Bootloader (com specific subroutines and init)
-#include "com-16f887-uart.inc"
-;; #include "com-16f887-spi.inc"
+;; #include "com-16f887-uart.inc"
+#include "com-16f887-spi.inc"
;; -------------------------------------
;; Bootloader (generic init/body)
diff --git a/bootloader/com-16f1847-uart.inc b/bootloader/com-16f1847-uart.inc
index 1d1ebef..b509bb2 100644
--- a/bootloader/com-16f1847-uart.inc
+++ b/bootloader/com-16f1847-uart.inc
@@ -54,7 +54,7 @@ uart_rx_fe ; recover from framing error
movf RCREG,w
goto com_rx_byte
- ;; ----- initialize com (not a subroutine, com_init is called by generic_init
+ ;; ----- initialize com (this is called by bootmacro, it's not a subroutine - no return at the end)
com_init
movlb .1
movlw b'01110000' ; 8 MHz
diff --git a/bootloader/com-16f887-spi.inc b/bootloader/com-16f887-spi.inc
index e4b8d2a..08a3b84 100644
--- a/bootloader/com-16f887-spi.inc
+++ b/bootloader/com-16f887-spi.inc
@@ -20,8 +20,6 @@
;; along with spreadspace pic utils. If not, see <http://www.gnu.org/licenses/>.
;;
-#define INTPIN PORTA,4
-
;; --- transmit byte and add it to csum
com_tx_byte
movwf SSPBUF
@@ -53,12 +51,11 @@ com_rx_got_byte
movf SSPBUF,w
return
- ;; ----- initialize com (not a subroutine, com_init is called by generic_init
+ ;; ----- initialize com (this is called by bootmacro, it's not a subroutine - no return at the end)
com_init
- ;; bank 3
- bsf STATUS,RP0
- bsf STATUS,RP1
- bcf ANSEL,ANS4 ; RA5/SS as digital input
+ ;; bank 3 - we are already there, see bootmacro
+ btfsc BOOTPIN
+ goto USERVECT
;; bank 1
bcf STATUS,RP1
@@ -68,7 +65,7 @@ com_init
movwf SSPSTAT
bcf TRISC,5 ; RC5(SDO) = out
bcf INTPIN ; interrupt line to master
-
+
;; bank 0
bcf STATUS,RP0
movlw b'00100100' ; SSPEN=1,CKP=0,SSPM=0100(SPI Slave with SS)
diff --git a/bootloader/com-16f887-uart.inc b/bootloader/com-16f887-uart.inc
index fb4575e..d4603a9 100644
--- a/bootloader/com-16f887-uart.inc
+++ b/bootloader/com-16f887-uart.inc
@@ -48,7 +48,7 @@ uart_rx_fe ; recover from framing error
movf RCREG,w
goto com_rx_byte
- ;; ----- initialize com (not a subroutine, com_init is called by generic_init
+ ;; ----- initialize com (this is called by bootmacro, it's not a subroutine - no return at the end)
com_init
;; bank 3
bsf STATUS,RP0