summaryrefslogtreecommitdiff
path: root/software
diff options
context:
space:
mode:
authorChristian Pointner <equinox@mur.at>2013-08-04 17:16:26 +0000
committerChristian Pointner <equinox@mur.at>2013-08-04 17:16:26 +0000
commit3ef3de9d5d7a4937f54e6b9ecc43323796e6e7e5 (patch)
treed13d90e565b7842db3d1a0df3002e1914268a10b /software
parentmoved to 437.525 MHz as assigned by IARU for RDA (diff)
upgraded pic bootloader
git-svn-id: https://svn.spreadspace.org/mur.sat@819 7de4ea59-55d0-425e-a1af-a3118ea81d4c
Diffstat (limited to 'software')
-rw-r--r--software/pic.bootloader/bootloader-BAT.asm6
-rw-r--r--software/pic.bootloader/bootloader-CTR.asm6
-rw-r--r--software/pic.bootloader/bootloader-IDM.asm6
-rw-r--r--software/pic.bootloader/bootloader-IHU.asm6
-rw-r--r--software/pic.bootloader/com-16f1847-spi.inc10
-rw-r--r--software/pic.bootloader/com-16f887-spi.inc10
-rwxr-xr-xsoftware/pic.bootloader/downloader.py8
-rw-r--r--software/pic.bootloader/generic-mainloop.inc7
-rw-r--r--software/pic.bootloader/proto.txt21
9 files changed, 28 insertions, 52 deletions
diff --git a/software/pic.bootloader/bootloader-BAT.asm b/software/pic.bootloader/bootloader-BAT.asm
index b42d4bc..96a7d1f 100644
--- a/software/pic.bootloader/bootloader-BAT.asm
+++ b/software/pic.bootloader/bootloader-BAT.asm
@@ -35,8 +35,8 @@ USERVECT EQU H'100'
ISRVECT EQU USERVECT + H'4'
FLASH_BOUNDARY EQU b'00001111' ; flash write boundary is at 16 bytes boundaries
-VERSION_MAJ EQU .0
-VERSION_MIN EQU .1
+VERSION_MAJ EQU .1
+VERSION_MIN EQU .0
NAME_0 EQU 'B'
NAME_1 EQU 'A'
NAME_2 EQU 'T'
@@ -49,8 +49,6 @@ EEPROM_SIZE_L EQU H'00'
EEPROM_SIZE_H EQU H'01' ; 0x0100 -> 256 Bytes of EEPROM
MESS EQU .64 ; this limit is because of to combuff size and single byte len field for messages
CFG EQU .2 ; anyway this is not read or writable for this chip
-SUPPORTED_H EQU .0
-SUPPORTED_L EQU b'00000110' ; only read/write flash is supported by now
#define HOOK_CMD_RESET cmd_not_impl
#define HOOK_CMD_R_FLASH cmd_r_flash
diff --git a/software/pic.bootloader/bootloader-CTR.asm b/software/pic.bootloader/bootloader-CTR.asm
index fadbf69..e73c22d 100644
--- a/software/pic.bootloader/bootloader-CTR.asm
+++ b/software/pic.bootloader/bootloader-CTR.asm
@@ -35,8 +35,8 @@ USERVECT EQU H'100'
ISRVECT EQU USERVECT + H'4'
FLASH_BOUNDARY EQU b'00001111' ; flash write boundary is at 16 bytes boundaries
-VERSION_MAJ EQU .0
-VERSION_MIN EQU .1
+VERSION_MAJ EQU .1
+VERSION_MIN EQU .0
NAME_0 EQU 'C'
NAME_1 EQU 'T'
NAME_2 EQU 'R'
@@ -49,8 +49,6 @@ EEPROM_SIZE_L EQU H'00'
EEPROM_SIZE_H EQU H'01' ; 0x0100 -> 256 Bytes of EEPROM
MESS EQU .64 ; this limit is because of to combuff size and single byte len field for messages
CFG EQU .2 ; anyway this is not read or writable for this chip
-SUPPORTED_H EQU .0
-SUPPORTED_L EQU b'00000110' ; only read/write flash is supported by now
#define HOOK_CMD_RESET cmd_not_impl
#define HOOK_CMD_R_FLASH cmd_r_flash
diff --git a/software/pic.bootloader/bootloader-IDM.asm b/software/pic.bootloader/bootloader-IDM.asm
index f0a4316..5c1a1fe 100644
--- a/software/pic.bootloader/bootloader-IDM.asm
+++ b/software/pic.bootloader/bootloader-IDM.asm
@@ -35,8 +35,8 @@ ISRVECT EQU USERVECT + H'4'
FLASH_BOUNDARY EQU b'00011111' ; flash write boundary is at 32 bytes boundaries
CONFIG_OFFSET EQU H'07'
-VERSION_MAJ EQU .0
-VERSION_MIN EQU .1
+VERSION_MAJ EQU .1
+VERSION_MIN EQU .0
NAME_0 EQU 'I'
NAME_1 EQU 'D'
NAME_2 EQU 'M'
@@ -49,8 +49,6 @@ EEPROM_SIZE_L EQU H'00'
EEPROM_SIZE_H EQU H'01' ; 0x0100 -> 256 Bytes of EEPROM
MESS EQU .64 ; this limit is because of to combuff size and single byte len field for messages
CFG EQU .2
-SUPPORTED_H EQU .0
-SUPPORTED_L EQU b'00100111' ; only reset, read/write flash and read config is supported by now
#define HOOK_CMD_RESET cmd_reset
#define HOOK_CMD_R_FLASH cmd_r_flash
diff --git a/software/pic.bootloader/bootloader-IHU.asm b/software/pic.bootloader/bootloader-IHU.asm
index c8d6cf7..7726c00 100644
--- a/software/pic.bootloader/bootloader-IHU.asm
+++ b/software/pic.bootloader/bootloader-IHU.asm
@@ -34,8 +34,8 @@ USERVECT EQU H'100'
ISRVECT EQU USERVECT + H'4'
FLASH_BOUNDARY EQU b'00001111' ; flash write boundary is at 16 bytes boundaries
-VERSION_MAJ EQU .0
-VERSION_MIN EQU .1
+VERSION_MAJ EQU .1
+VERSION_MIN EQU .0
NAME_0 EQU 'I'
NAME_1 EQU 'H'
NAME_2 EQU 'U'
@@ -48,8 +48,6 @@ EEPROM_SIZE_L EQU H'00'
EEPROM_SIZE_H EQU H'01' ; 0x0100 -> 256 Bytes of EEPROM
MESS EQU .64 ; this limit is because of to combuff size and single byte len field for messages
CFG EQU .2 ; anyway this is not read or writable for this chip
-SUPPORTED_H EQU .0
-SUPPORTED_L EQU b'00000110' ; only read/write flash is supported by now
#define HOOK_CMD_RESET cmd_not_impl
#define HOOK_CMD_R_FLASH cmd_r_flash
diff --git a/software/pic.bootloader/com-16f1847-spi.inc b/software/pic.bootloader/com-16f1847-spi.inc
index c8c3f1d..e7ae182 100644
--- a/software/pic.bootloader/com-16f1847-spi.inc
+++ b/software/pic.bootloader/com-16f1847-spi.inc
@@ -27,12 +27,14 @@ com_tx_byte
movlb .0
bcf INTPIN
xorwf csum,f
+ movlb .4
com_tx_byte_wait1
- btfsc PORTB,5
+ btfss SSPSTAT,BF
goto com_tx_byte_wait1
-com_tx_byte_wait2
- btfss PORTB,5
- goto com_tx_byte_wait2
+ movlb .0
+com_tx_byte_wait2 ; also wait for SS to go up again
+ btfss PORTB,5 ; this lowers the risk for raise conditions
+ goto com_tx_byte_wait2 ; with next byte (INT pin)
movlb .4
movf SSP1BUF,w
movlb .0
diff --git a/software/pic.bootloader/com-16f887-spi.inc b/software/pic.bootloader/com-16f887-spi.inc
index 4fb41c8..800b1da 100644
--- a/software/pic.bootloader/com-16f887-spi.inc
+++ b/software/pic.bootloader/com-16f887-spi.inc
@@ -25,12 +25,14 @@ com_tx_byte
movwf SSPBUF
bcf INTPIN
xorwf csum,f
+ bsf STATUS,RP0
com_tx_byte_wait1
- btfsc PORTA,5
+ btfss SSPSTAT,BF
goto com_tx_byte_wait1
-com_tx_byte_wait2
- btfss PORTA,5
- goto com_tx_byte_wait2
+ bcf STATUS,RP0
+com_tx_byte_wait2 ; also wait for SS to go up again
+ btfss PORTA,5 ; this lowers the risk for raise conditions
+ goto com_tx_byte_wait2 ; with next byte (INT pin)
movf SSPBUF,w
bsf INTPIN
return
diff --git a/software/pic.bootloader/downloader.py b/software/pic.bootloader/downloader.py
index 12e9644..a371438 100755
--- a/software/pic.bootloader/downloader.py
+++ b/software/pic.bootloader/downloader.py
@@ -23,8 +23,8 @@
'''spreadspace simple pic downloader.'''
-VERSION_MAJ = 0
-VERSION_MIN = 1
+VERSION_MAJ = 1
+VERSION_MIN = 0
### HEX File Magic
@@ -170,9 +170,9 @@ def exec_command(dev, cmd, param, answer):
### low level commands
def cmd_identify(dev, name):
- data = exec_command(dev, 1, '', '<BB3sHHBHBBH')
+ data = exec_command(dev, 1, '', '<BB3sHHBHBB')
id = { 'ver_min': data[0], 'ver_maj': data[1], 'name': data[2], 'devid': data[3],
- 'fs': data[4], 'fss': data[5], 'es': data[6], 'mess': data[7], 'cfg': data[8], 'supported': data[9] }
+ 'fs': data[4], 'fss': data[5], 'es': data[6], 'mess': data[7], 'cfg': data[8] }
if id['ver_maj'] != VERSION_MAJ:
print >> sys.stderr, "incompatible protocol version, expected: %d, got: %d" % (VERSION_MAJ, id['ver_maj'])
diff --git a/software/pic.bootloader/generic-mainloop.inc b/software/pic.bootloader/generic-mainloop.inc
index 1cecf3a..0623446 100644
--- a/software/pic.bootloader/generic-mainloop.inc
+++ b/software/pic.bootloader/generic-mainloop.inc
@@ -115,7 +115,7 @@ cmd_identify
movf combuff,w
call com_tx_byte
- movlw .20
+ movlw .18
call com_tx_byte
movlw E_OK
@@ -155,11 +155,6 @@ cmd_identify
movlw CFG
call com_tx_byte
- movlw SUPPORTED_L
- call com_tx_byte
- movlw SUPPORTED_H
- call com_tx_byte
-
movf csum,w
call com_tx_byte
goto wait_new_cmd
diff --git a/software/pic.bootloader/proto.txt b/software/pic.bootloader/proto.txt
index 61975cf..7353f9c 100644
--- a/software/pic.bootloader/proto.txt
+++ b/software/pic.bootloader/proto.txt
@@ -43,7 +43,7 @@ identify:
1 | len=3 | <csum>
answer:
- 1 | len=19 | <ret> | version | name | devid | fs | fss | es | mess | cfg | supported | <csum>
+ 1 | len=19 | <ret> | version | name | devid | fs | fss | es | mess | cfg | <csum>
version:
2bytes, protocol version
@@ -82,21 +82,6 @@ identify:
cfg:
1byte, number of configuration words.
- supported:
- 2bytes, a bitmap showing supported commands
- The commands 'identify' and 'boot' are always supported by the bootloader,
- others may not (i.e.: not all PICs allow to update the configurtion words)
-
- bit | command
- -----+----------
- 0 | reset
- 1 | read flash
- 2 | write flash
- 3 | read eeprom
- 4 | write eeprom
- 5 | read config
- 6 | write config
-
boot:
~~~~~
@@ -161,7 +146,7 @@ read eeprom:
6 | len=4+<len> | <ret> | data | <csum>
The bootloader reads <len> bytes from eeprom at address <addr> and returns it as
- <data>. len is 1byte long.
+ <data>. len is 1byte long and it's value must not exceed <mess> bytes.
write eeprom:
@@ -174,7 +159,7 @@ write eeprom:
7 | len=4 | <ret> | <csum>
The bootloader writes <data> (which has to contain exactly <len>-4 bytes) to address
- <addr> inside the eeprom. len is 1byte long and the value must not exceed <mess> bytes.
+ <addr> inside the eeprom. len is 1byte long and it's value must not exceed <mess> bytes.
read config: