diff options
Diffstat (limited to 'bootloader')
-rw-r--r-- | bootloader/bootloader-887.asm | 36 | ||||
-rw-r--r-- | bootloader/bootloader-947.asm | 20 | ||||
-rwxr-xr-x | bootloader/downloader.py | 8 | ||||
-rw-r--r-- | bootloader/generic-mainloop.inc | 7 | ||||
-rw-r--r-- | bootloader/proto.txt | 21 |
5 files changed, 34 insertions, 58 deletions
diff --git a/bootloader/bootloader-887.asm b/bootloader/bootloader-887.asm index 889a8ac..e29136b 100644 --- a/bootloader/bootloader-887.asm +++ b/bootloader/bootloader-887.asm @@ -29,15 +29,15 @@ ;; ------------------------------------- ;; DEFINES (chip/com specific) -;; #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 +#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 -VERSION_MAJ EQU .0 -VERSION_MIN EQU .1 +VERSION_MAJ EQU .1 +VERSION_MIN EQU .0 NAME_0 EQU '8' NAME_1 EQU '8' NAME_2 EQU '7' @@ -50,8 +50,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 @@ -69,19 +67,19 @@ flags EQU H'007D' cnt EQU H'007F' ;; Boot Macro -;; 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 +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 + ;; ------------------------------------- ;; DEFINES (defines) #include "generic-defines.inc" @@ -92,8 +90,8 @@ bootmacro macro ; use this for com-spi ;; ------------------------------------- ;; 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/bootloader-947.asm b/bootloader/bootloader-947.asm index 2bbea92..ce7862b 100644 --- a/bootloader/bootloader-947.asm +++ b/bootloader/bootloader-947.asm @@ -29,14 +29,14 @@ ;; ------------------------------------- ;; DEFINES (chip/com specific) -#define INTPIN PORTB,3 ; use this for com-spi +;; #define INTPIN PORTB,3 ; use this for com-spi USERVECT EQU H'200' 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 '9' NAME_1 EQU '4' NAME_2 EQU '7' @@ -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 @@ -86,17 +84,17 @@ bootmacro macro preinit movlb .3 - ;; bcf ANSELB,ANSB1 ; use this for com-uart - bcf ANSELB,ANSB5 ; use this for com-spi + bcf ANSELB,ANSB1 ; use this for com-uart + ;; bcf ANSELB,ANSB5 ; use this for com-spi movlb .0 - ;; btfsc PORTB,1 ; use this for com-uart - btfsc PORTB,5 ; use this for com-spi + btfsc PORTB,1 ; use this for com-uart + ;; btfsc PORTB,5 ; use this for com-spi goto USERVECT goto com_init ;; ------------------------------------- ;; Bootloader (com specific subroutines and init) -;; #include "com-16f1847-uart.inc" -#include "com-16f1847-spi.inc" +#include "com-16f1847-uart.inc" +;; #include "com-16f1847-spi.inc" ;; ------------------------------------- ;; Bootloader (generic init/body) diff --git a/bootloader/downloader.py b/bootloader/downloader.py index 12e9644..a371438 100755 --- a/bootloader/downloader.py +++ b/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/bootloader/generic-mainloop.inc b/bootloader/generic-mainloop.inc index 1cecf3a..0623446 100644 --- a/bootloader/generic-mainloop.inc +++ b/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/bootloader/proto.txt b/bootloader/proto.txt index 61975cf..7353f9c 100644 --- a/bootloader/proto.txt +++ b/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: |