15 Commits

Author SHA1 Message Date
Kevin O'Connor
4a798a2e3b bootentry: Breakup canboot_main.c to flashcmd.c, bootentry.c, and sched.c
Move command handlers from canboot_main.c to flashcmd.c.  Move startup
code to sched.c.  Rename remaining bootloader entry code to new
bootentry.c file.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-05-13 06:16:08 -04:00
Kevin O'Connor
09a500cf90 canboot_main: Rework "complete" handling
Convert the "complete" command to use a regular task instead of custom
code in enter_bootloader().

Perform the reboot based on a timer so that it is not necessary to
query the low-level code for ack transmission status.

Use jump_to_application() instead of canbus_reboot() to start the user
code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-05-13 06:16:08 -04:00
Kevin O'Connor
83ecbcc01d command: Add command.h file to make importing Klipper code easier
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-05-13 06:16:08 -04:00
Kevin O'Connor
db6a9b4d96 sched: Add sched.c and sched.h files to make importing Klipper code easier
Add the sched.c code and associated DECL_INIT(), DECL_TASK() macros so
that it is easier to import low-level Klipper code into the CanBoot
repo.

These additional code wrappers do not increase the overall binary size
as gcc does a good job of inlining the wrappers and removing unused
code during the compile process.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-05-13 06:16:08 -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
011d3a8f45 generic: add crc16 from klipper
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-05-09 17:12:24 -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
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
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
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
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
26b12a658b
src: update stm32 source
Bring in the latest changes from Klipper.  The STM32F4 variants are
still unsupported at this time.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-11 19:59:56 -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