Kevin O'Connor
702bd5f949
protocol: Fix minor spelling error
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-05-09 17:12:24 -04:00
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
7db2911aed
protocol: update for latest changes
...
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2022-05-09 17:12:24 -04:00
Eric Callahan
5e7d632c4f
flash_can: protocol updates
...
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
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
9762327ac3
protocol: add protocol documentation
...
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2022-05-09 17:12:24 -04:00
Eric Callahan
c9d326928c
flash_can: update to support new protocol
...
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
Eric Callahan
011d3a8f45
generic: add crc16 from klipper
...
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2022-05-09 17:12:24 -04:00
Eric Callahan
849b81dce5
led: introduce a short delay before reading initial time
...
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
00a65c1570
Makefile: Resync main makefile with Klipper's main makefile
...
The latest Klipper main Makefile has bugfixes for proper rebuilding on
a change during "make menuconfig".
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-05-05 12:28:44 -04:00
Kevin O'Connor
9c6e72e3a5
armcm_boot: Introduce cross-platform boot to application code
...
It's a good idea to reset the cpu before starting the main application
code. However it is difficult to reliably reset the cpu in software.
This changes the software to actually do a cpu hardware reset prior to
launching the main application - after each bootup the code checks to
see if the application should be started before entering the main
bootloader code. This helps ensure the application code is started in
a "pristine" cpu state.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-05-05 05:32:21 -04:00
Kevin O'Connor
726e6e62fa
armcm_boot: No need to reset cpu state on bootup
...
The bootloader is only called after a reset - it doesn't need to worry
about another bootloader launching it. This reduces the code size by
a small amount.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-05-05 05:32:21 -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
Kevin O'Connor
34e14386ed
Makefile: Build with -Os instead of -O2
...
Build size is likely more important than CPU performance for a
bootloader. So, instruct gcc to optimize for size by default.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-05-05 05:23:45 -04:00
Kevin O'Connor
da0f92f721
README: Use Klipper3d github http address
...
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-05-05 05:23:15 -04:00
Kevin O'Connor
794ccd69c0
canbus: Use Klipper's nodeid to canbus_id scheme
...
Use Klipper's nodeid to canbus_id scheme (canbus_id = nodeid * 2 +
0x100). Instead, use a nodeid offset of 128 to avoid collisions with
Klipper.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-05-05 05:22:55 -04:00
Eric Callahan
95e8a707ca
flash_can: attempt to reset the mcu if an error is encountered
...
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2022-04-26 12:12:46 -04:00
Eric Callahan
c5163674ed
src: remove references to the magic key
...
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2022-04-26 08:26:45 -04:00
Eric Callahan
76474d6efd
flash_can: update for latest changes
...
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2022-04-26 08:20:24 -04:00
Eric Callahan
76b1de0574
canbus: send the node ID command in the query response
...
This is use to identify the application
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2022-04-26 08:12:13 -04:00
Eric Callahan
e2c58fb6a6
arm: make sure the signature is aligned
...
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2022-04-26 08:04:04 -04:00
Eric Callahan
b5303fa5f7
flash_can: fix error in uuid reporting
...
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2022-04-25 20:06:57 -04:00
Eric Callahan
f0d7bb7f9c
flash_can: add retries to verification
...
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2022-04-25 17:18:35 -04:00
Eric Callahan
f754ae2746
flash_can: update for latest changes
...
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2022-04-25 17:14:02 -04:00
Eric Callahan
6351e2b1be
canbus: use Klipper's admin ids
...
Rather than use different admin IDs from Klipper, use different commands.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2022-04-25 17:14:02 -04:00
Eric Callahan
b944d094b3
arm: add canboot signature to request handler
...
Implement through inline assembly as recommended by Kevin O'Connor.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2022-04-25 15:26:02 -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
3541dd1f2f
.gitignore: add build files
...
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2022-04-25 13:45:45 -04:00
Eric Callahan
b6572909b2
readme: suggest a full chip erase
...
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2022-04-17 19:29:58 -04:00
Eric Callahan
8313f425d0
readme: add clarification to notes
...
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2022-04-15 08:05:20 -04:00
Eric Callahan
65667f8516
readme: clarify flash page size
...
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2022-04-14 17:27:15 -04:00
Eric Callahan
b5ff2ce29b
kconfig: fix page size description
...
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2022-04-14 17:22:51 -04:00
Eric Callahan
2ac0f6be56
readme: add note about alternative methods of flashing
...
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2022-04-14 15:15:16 -04:00
Eric Callahan
c464b63a99
readme: note that stm32f0x2 devices are supported
...
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2022-04-14 14:13:36 -04:00
Eric Callahan
0f1bd588a8
kconfig: fix stm32f072 flash size
...
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2022-04-14 09:15:32 -04:00
Eric Callahan
3a29a4d0da
kconfig: disable stm32f4 choices
...
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2022-04-14 08:55:09 -04:00
Eric Callahan
9dc0f90d21
readme: add flash_can usage
...
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2022-04-14 08:21:59 -04:00
Eric Callahan
db1123d69d
flash_can: add query option
...
It is possible that a user will flash the bootloader before
ever having flashed Klipper. In this case they would be
unable to supply a UUID.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2022-04-14 08:21:58 -04:00
Eric Callahan
0838d844e9
flash_can: make executable
...
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2022-04-13 19:34:50 -04:00
Eric Callahan
f42f6c5090
readme: update can docs
...
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2022-04-13 19:30:07 -04:00
Eric Callahan
a6afacea62
scripts: remove the canserial service files
...
This service is no longer necessary to communicate with
can devices running Klipper.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2022-04-13 18:25:54 -04:00
Eric Callahan
3686db10fd
flash_can: add interface argument
...
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2022-04-13 18:23:44 -04:00