summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2013-07-11 01:33:38 (GMT)
committerChristian Pointner <equinox@spreadspace.org>2013-07-11 01:33:38 (GMT)
commita98d62341d4a72bc9393308421343524c48958c2 (patch)
tree04724d938e8480e14bb91a14a84996b81edd76b7
parent5c682b37051797602971f78d49935c7560568aa9 (diff)
read flash for 16f1847 works
git-svn-id: https://svn.spreadspace.org/pic/trunk@77 a09c6847-51d9-44de-8ef2-e725cf50f3c7
-rw-r--r--bootloader/cmds-16f1847.inc68
1 files changed, 32 insertions, 36 deletions
diff --git a/bootloader/cmds-16f1847.inc b/bootloader/cmds-16f1847.inc
index 4ffb275..d5460c1 100644
--- a/bootloader/cmds-16f1847.inc
+++ b/bootloader/cmds-16f1847.inc
@@ -32,42 +32,38 @@ cmd_resset_wait_ack
;; flash read --------
cmd_r_flash
-;; movlw FSS ; initialize EEADR:EEADRH and FSR
-;; movwf cnt
-;; movlw b'01011000'
-;; movwf STATUS
-;; movlw combuff + .2
-;; movwf FSR
-;; movf INDF,w
-;; movwf EEADR
-;; incf FSR,f
-;; movf INDF,w
-;; movwf EEADRH
-;; read_flash_segment_loop
-;; bsf STATUS,RP0 ; perform the actual read
-;; bsf EECON1,EEPGD
-;; bsf EECON1,RD
-;; nop
-;; nop
-;; bcf STATUS,RP0
-;; movf EEDAT,w ; load code word from EEDAT:EEDATH to combuff
-;; movwf INDF
-;; incf FSR,f
-;; movf EEDATH,w
-;; movwf INDF
-;; incf FSR,f
-;; incfsz EEADR,f ; increment flash address
-;; goto read_flash_segment_next
-;; incf EEADRH,f
-g;; read_flash_segment_next
-;; decfsz cnt,f
-;; goto read_flash_segment_loop
-;; bcf STATUS,RP1
-;; clrf combuff + .2 ; = E_OK
-;; movlw .1 + .2*FSS ; bytes to send
-;; call send_answer
- movlw E_NOT_IMPL
- call ack_cmd
+ movlw FSS ; initialize EEADR:EEADRH and FSR
+ movwf cnt
+ movlb .3
+ movlw combuff + .2
+ movwf FSR
+ movf INDF,w
+ movwf EEADRL
+ incf FSR,f
+ movf INDF,w
+ movwf EEADRH
+read_flash_segment_loop
+ bcf EECON1,CFGS ; perform the actual read
+ bsf EECON1,EEPGD
+ bsf EECON1,RD
+ nop
+ nop
+ movf EEDATL,w ; load code word from EEDAT:EEDATH to combuff
+ movwf INDF
+ incf FSR,f
+ movf EEDATH,w
+ movwf INDF
+ incf FSR,f
+ incfsz EEADRL,f ; increment flash address
+ goto read_flash_segment_next
+ incf EEADRH,f
+read_flash_segment_next
+ decfsz cnt,f
+ goto read_flash_segment_loop
+ movlb .0
+ clrf combuff + .2 ; = E_OK
+ movlw .1 + .2*FSS ; bytes to send
+ call send_answer
goto wait_new_cmd
;; flash write --------