summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2013-07-04 02:55:29 +0000
committerChristian Pointner <equinox@spreadspace.org>2013-07-04 02:55:29 +0000
commitf41d3630ca2521d182176efcda53f93467ff998b (patch)
tree4b79225189f582ff887408b60c9e60186787aa3f
parentidentify works now (diff)
added command 'boot'
added command 'reset' (not working...) git-svn-id: https://svn.spreadspace.org/pic/trunk@34 a09c6847-51d9-44de-8ef2-e725cf50f3c7
-rw-r--r--bootloader/bootloader.asm53
1 files changed, 35 insertions, 18 deletions
diff --git a/bootloader/bootloader.asm b/bootloader/bootloader.asm
index ed65ed1..f21e789 100644
--- a/bootloader/bootloader.asm
+++ b/bootloader/bootloader.asm
@@ -90,8 +90,8 @@ current_cmd EQU H'0070'
current_cmdlen EQU H'0071'
csum EQU H'0072'
-cnt1 EQU H'0070'
-cnt2 EQU H'0071'
+cnt1 EQU H'007E'
+cnt2 EQU H'007F'
;; -------------------------------------
;; Boot test
@@ -115,6 +115,18 @@ uart_tx_byte
xorwf csum,f
return
+ack_cmd
+ clrf csum
+ movf inbuff,w
+ call uart_tx_byte
+
+ movlw E_OK
+ call uart_tx_byte
+
+ movf csum,w
+ call uart_tx_byte
+ return
+
translate_cmd_codes
xorlw CCMD_IDENTIFY
btfsc STATUS,Z
@@ -137,12 +149,12 @@ translate_cmd_codes
xorlw CCMD_W_EEPROM ^ CCMD_R_EEPROM
btfsc STATUS,Z
retlw CMD_W_EEPROM
- xorlw CCMD_R_CONFIG ^ CCMD_W_EEPROM
- btfsc STATUS,Z
- retlw CMD_R_CONFIG
- xorlw CCMD_W_CONFIG ^ CCMD_R_CONFIG
- btfsc STATUS,Z
- retlw CMD_W_CONFIG
+ ;; xorlw CCMD_R_CONFIG ^ CCMD_W_EEPROM
+ ;; btfsc STATUS,Z
+ ;; retlw CMD_R_CONFIG
+ ;; xorlw CCMD_W_CONFIG ^ CCMD_R_CONFIG
+ ;; btfsc STATUS,Z
+ ;; retlw CMD_W_CONFIG
retlw CMD_INVALID
get_cmdlen
@@ -154,8 +166,8 @@ get_cmdlen
retlw .3 + .2*FSS ; write flash: addr | data | <csum>
retlw .5 ; read eeprom: addr | len | <csum>
retlw .5 ; write eeprom: addr | len | data | <csum> (minimal)
- retlw .2 ; read config: nr | <csum>
- retlw .4 ; write config: nr | word | <csum>
+ ;; retlw .2 ; read config: nr | <csum>
+ ;; retlw .4 ; write config: nr | word | <csum>
get_name
addwf PCL,f
@@ -286,8 +298,8 @@ dbgcnt2
goto cmd_w_flash
goto cmd_r_eeprom
goto cmd_w_eeprom
- goto cmd_r_config
- goto cmd_w_config
+ ;; goto cmd_r_config
+ ;; goto cmd_w_config
goto wait_new_cmd
cmd_identify
@@ -336,10 +348,15 @@ cmd_identify_send_name
cmd_boot
- goto wait_new_cmd
+ call ack_cmd
+ goto USERVECT
cmd_reset
- goto wait_new_cmd
+ call ack_cmd
+ movlw b'00000001'
+ movwf WDTCON ; why does this not work?????
+cmd_reset_wait
+ goto cmd_reset_wait
cmd_r_flash
goto wait_new_cmd
@@ -353,11 +370,11 @@ cmd_r_eeprom
cmd_w_eeprom
goto wait_new_cmd
-cmd_r_config
- goto wait_new_cmd
+;; cmd_r_config
+;; goto wait_new_cmd
-cmd_w_config
- goto wait_new_cmd
+;; cmd_w_config
+;; goto wait_new_cmd
;; -------------------------------------
;; dummy user code