From fb48349d438ca3c8af51eecfb94205ab04aad538 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Tue, 2 Jul 2013 17:49:45 +0000 Subject: added return codes for proto definition git-svn-id: https://svn.spreadspace.org/pic/trunk@20 a09c6847-51d9-44de-8ef2-e725cf50f3c7 --- downloader/proto.txt | 60 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 24 deletions(-) (limited to 'downloader') diff --git a/downloader/proto.txt b/downloader/proto.txt index 295cec7..1228811 100644 --- a/downloader/proto.txt +++ b/downloader/proto.txt @@ -18,7 +18,20 @@ Description: Every command consits of one byte command code, a fixed number of bytes as arguments and ends with a XOR checksum over all bytes sent. All data is transferred LSB first. -If the command code is unkown the bootloaders retunrns '??' +Every answer to a command starts with the command code. One byte return value, +optionally some data and a checksum (XOR over all bytes received) +The return codes have the following meaning: + + code | Error + ------+------------- + 0 | OK + 1 | invalid command + 2 | bad checksum + 3 | not implemented + 4 | flash write error + 5 | address invalid + 6 | address prohibited + identify: ~~~~~~~~~ @@ -26,7 +39,7 @@ identify: 'i' | (in this case will always be 'i') answer: - 'i' | version | name | fss | supported | + 'i' | | version | name | devid | fss | supported | version: 2bytes, protocol version @@ -38,6 +51,10 @@ identify: The downloader has to compare this name with the device name supplied via commandline and stop in case they don't match + devid: + 2bytes, device id of the PIC + The downlaoder may use this id to check if it talks to the right bootloader + fss: 1byte, flash segment size The number of words of one flash segment which has to be written at once. @@ -67,8 +84,7 @@ boot: 'b' | (in this case will always be 'b') answer: - 'b' | - + 'b' | | This instucts the bootloader to boot to the user application directly (no reset) @@ -80,8 +96,7 @@ reset: 'r' | (in this case will always be 'r') answer: - 'r' | - + 'r' | | The device performs a reboot. If the boot condition (i.e.: port pin) is not met this instructs the device to boot to the user application. @@ -91,10 +106,10 @@ read flash: ~~~~~~~~~~~ command: - f | addr | + 'f' | addr | answer: - f | data | + 'f' | | data | The bootloader reads words from flash address and returns it as . @@ -104,24 +119,23 @@ write flash: ~~~~~~~~~~~~ command: - F | addr | data | + 'F' | addr | data | answer: - F | (0|1) | + 'F' | | The bootloader writes (which has to contain exactly words) to address - inside the flash. In case of Error '0' is returned, on success the return - code contains '1'. + inside the flash. read eeprom: ~~~~~~~~~~~~ command: - e | addr | len | + 'e' | addr | len | answer: - e | data | + 'e' | | data | The bootloader reads bytes from eeprom at address and returns it as . @@ -131,24 +145,23 @@ write eeprom: ~~~~~~~~~~~~~ command: - E | addr | len | data | + 'E' | addr | len | data | answer: - E | (0|1) | + 'E' | | The bootloader writes (which has to contain exactly bytes) to address - inside the eeprom. In case of Error '0' is returned, on success the return - code contains '1'. + inside the eeprom. read config: ~~~~~~~~~~~~ command: - c | nr | + 'c' | nr | answer: - c | word | + 'c' | | word | The bootloader reads and returns the configuration word number . @@ -157,10 +170,9 @@ write config: ~~~~~~~~~~~~~ command: - C | nr | word | + 'C' | nr | word | answer: - C | (0|1) | + 'C' | | - The bootloader writes onto configuration word number . In case - of an error '0' is returned, on success the return code contains '1'. + The bootloader writes onto configuration word number . -- cgit v1.2.3