17 Commits

Author SHA1 Message Date
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
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
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
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
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
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
1e79868003
canbus: add a clear node id admin command
This broadcasts a command to clear the id for all nodes running
the bootloader, which should prevent ID collisions.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-13 15:04:52 -04:00
Eric Callahan
11e96a8f3e
canbus: remove get_node_id() method
This method isn't necessary as the bootloader shouldnt need to discover
multiple node ids.  Change the decoded node ID offset to 0x200 in an
effort to avoid collisions with nodes assigned by Klipper.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-12 14:16:17 -04:00
Eric Callahan
f5ccbbfaa4
src: change the admin IDs
This will prevent collisions between Klipper's admin
commands and the bootloader's.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-11 20:03:53 -04:00
Eric Callahan
73d7ddd5aa
src: update generic files
Bring up generic files to accommodate the latest version of
Klipper.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-11 17:18:24 -04:00
Arksine
4cd17a6f5e stm32f0: intiial attempt at canboot support
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