16 Commits

Author SHA1 Message Date
Kevin O'Connor
62971c1807 canboot_main: Minor fixes
Wrap defines with expressions in parenthesis.

MAX_OBUF_SIZE is in bytes - divide by 4 for number of words.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-05-09 17:12:24 -04:00
Eric Callahan
beb06d600d canboot_main: use direct addressing
Rather than use indicies, use the desired address when requesting
a block write or read.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-05-09 17:12:24 -04:00
Eric Callahan
047003bf12 canboot_main: switch to little-endian
Simplify the NACK to a single command.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-05-09 17:12:24 -04:00
Eric Callahan
6199e9d107 canboot_main: remove process_state() method
Commands are now executed after decoding, so there is no need to
track any state other than complete.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-05-09 17:12:24 -04:00
Eric Callahan
54dce642f6 canboot_main: rework the protocol
All commands are now framed, where the payload  must
always be included within a frame.  A 16-bit CRC is postfixed
to each frame for validation.  The protocol is now as follows:

 <16-bit header><8-bit command><8-bit payload length in words><payload><16-bit trailer><16-bit CRC>

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-05-09 17:12:24 -04:00
Kevin O'Connor
a84b354cee canboot_main: Change double reset time from 2 seconds to 500ms
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-05-05 15:18:07 -04:00
Kevin O'Connor
66c9853929 canboot_main: Add support for entering the bootloader on a button press
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-05-05 15:18:07 -04:00
Kevin O'Connor
ce580fa8c6 canboot_main: Make entry via double reset a config option
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-05-05 15:18:07 -04:00
Kevin O'Connor
807c1ef0bd led: Move led code to new led.c file
Move the led c code from the buildcommands.py to a new led.c file.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-05-05 15:18:07 -04:00
Kevin O'Connor
5279c33ea0 flash: Autodetect stm32f103 flash page size
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-05-05 14:06:43 -04:00
Kevin O'Connor
23f3c0e1e2 armcm_boot: Add get/set_bootup_code() helper functions
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-05-05 05:32:21 -04:00
Eric Callahan
9b4c95ee9a
canboot: improve bootloader request method
Use a cross platform request signature to enter the
bootloader.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-25 14:20:42 -04:00
Eric Callahan
abb966713e
canboot: fix typo
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-13 17:46:37 -04:00
Eric Callahan
26c89e8b0e
canboot: modify command bytes IDs
This is just to avoid confusion between RX_EOF and the command trailer.
Having both as 0x03 could potential lead to issues.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-12 14:18:22 -04:00
Arksine
1d2ce10dbd canboot: add application code check
Enter the bootloader if the first block of the application area contains 0xFF.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-02-07 14:29:00 -05:00
Arksine
2762299895 canboot: initial source commit
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-02-06 20:04:47 -05:00