72 Commits

Author SHA1 Message Date
Eric Callahan
87eb491666 stm32: add deployer option for stm32g0
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2025-05-20 19:46:36 -04:00
Eric Callahan
43eb9ad398 stm32: add stm32g4.c from klipper
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2025-05-20 19:46:36 -04:00
Eric Callahan
287c9e1b9d stm32: fix deployer build
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2025-05-20 19:46:36 -04:00
Eric Callahan
a8e44fd308
stm32: remove timer_irq.c from build
Katapult does not depend on Klipper's "timer_irc.c" as it does
not reference the "timer_dispatch_many()" method. Remove
it from the makefile to fix G0 and F0 builds.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2025-05-20 05:32:04 -04:00
Kevin O'Connor
cdb5b56911 stm32: Add support for stm32g431 chips
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-05-19 14:55:00 -04:00
Kevin O'Connor
3f84643130 stm32: Minor organizational change to Makefile
This better matches the Klipper stm32 Makefile layout.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-05-19 14:55:00 -04:00
FrY Sennberg
b734c57d3e stm32 CAN: restricted PH13/14 CAN to stm32h743
Signed-off-by:  Christoph Frei <fryakatkop@gmail.com>
2025-03-27 19:26:44 -04:00
FrY Sennberg
8c86fe02c1 stm32 CAN: Added PH13/14 CAN pin option
Added the option to select PH13/PH14 as CAN pins.

Signed-off-by:  Christoph Frei <fryakatkop@gmail.com>
2025-03-27 19:26:44 -04:00
Ella Fox
081918ad76 stm32/Kconfig: Add option for 32MHz crystals
Certain STM32 Nucleo development boards (eg. F429Zi) come pre-installed with a 32MHz quartz crystal, which is now exposed as an option when selecting STM32 chips.

Signed-off-by: Ella Fox <ella@fox.gal>
2024-10-24 05:22:27 -04:00
bigtreetech
42909f8a0d stm32: dfu-util "make flash" rules for stm32 mcu
Signed-off-by: Alan.Ma from BigTreeTech tech@biqu3d.com
2024-08-24 06:25:21 -04:00
Eric Callahan
562fc2fafb
stm32: enable PB5/PB6 pins for STM32G0B1 CAN
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-08-08 07:49:09 -04:00
Eric Callahan
3e3ca24beb stm32: sync low level code with klipper
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-08-06 19:40:09 -04:00
Eric Callahan
49e93194a4 build: fix build on newer versions of gcc
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-08-06 19:40:09 -04:00
Luke Harrison
6a7ca81e4f stm32g0.c: Disable UCPD on boot
The UCPD is not used with Katapult but it can result in unexpected behaviour on certain pins due to the internal pull resistors unless disabled.

Signed-off-by: Luke Harrison looxonline@gmail.com
2024-01-29 16:51:47 -05:00
Diana
3855b34e94 module: stm32, sync fdcan with upstream klipper code
Syncs the stm32 fdcan and Kconfig to enable BTT U2C and PB12/PB13 FDCAN2 support STM32G0B1 with boards such as the BTT E3EZ.

Signed-off-by: Diana Moore <dmoore@xn4p4lm.com>
2023-12-15 12:18:18 -05:00
Eric Callahan
5e794c05d9
build: rename references from CanBoot to Katapult
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-07-30 10:35:54 -04:00
Robin GAY
25482ba0d8
flash.c: fix write error for STM32H72x (#78)
flash.c: fix write error for STM32H72x

Add a flash lock/unlock sequence after erasing and before writing to the flash
memory

Signed off by: Robin Gay <robingay67@gmail.com>
2023-07-10 16:44:25 -04:00
Eric Callahan
a06bf6158a
stm32: sync can.c with klipper
This pulls in an upstream fix for stm32 devices that use
CAN2.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-03-15 08:18:44 -04:00
Kevin O'Connor
88e208a083
stm32: Add support for flashing stm32h7 boards
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-12-22 12:18:23 -05:00
Kevin O'Connor
bcff5ca488 stm32: Resync stm32 code with upstream Klipper code
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-12-22 12:12:24 -05:00
Kevin O'Connor
da7cc967d0 gpio: Resync gpio code with upstream Klipper code
Add a shutdown() compatibility macro so that the upstream Klipper gpio
code can be used unmodified.  Sync the rp2040, lpc176x, and stm32
gpio.c code with Klipper's code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-12-22 12:12:24 -05:00
Kevin O'Connor
d30ad28f03 canboot: Introduce a new canboot.h header file
Move canboot specific definitions in board/misc.h to new canboot.h
header file.  This makes it a little easier to identify differences
between canboot code and low-level upstream klipper code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-12-22 12:12:24 -05:00
Kevin O'Connor
6a233ff4f5 usb_cdc: Resync USB code with upstream code from Klipper
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-12-22 12:12:24 -05:00
Kevin O'Connor
2b22438c01 canbus: Resync canbus code with upstream Klipper code
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-12-22 12:12:24 -05:00
Kevin O'Connor
f9cd240fb4 armcm_deployer: Rename DEPLOYER_START symbol to FLASH_APPLICATION_ADDRESS
Rename the symbol to be more similar to the symbol used in the
upstream Klipper code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-12-22 12:12:24 -05:00
Kevin O'Connor
41067c6a74 armcm_reset: Rename CONFIG_BOOTLOADER_START to CONFIG_FLASH_BOOT_ADDRESS
Rename the symbol for better consistency with the upstream Klipper
code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-12-22 12:12:24 -05:00
Kevin O'Connor
7db10a048f armcm_canboot: Rename CONFIG_APPLICATION_START to CONFIG_LAUNCH_APP_ADDRESS
Rename the build symbol to better distinguish it from the start
address of the deployer app.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-12-22 12:12:24 -05:00
sh83
c1ae0b4f1e reset: fixed rp2040 bootloader entry point
Signed-off-by: Alex Malishev <malishev@gmail.com>
2022-10-31 07:23:14 -04:00
Kevin O'Connor
f4ac6470bf deployer: Add support for a CanBoot "deployer"
Support building a "flashing application" that one may run from an
existing bootloader.  This flashing application will then flash the
main CanBoot binary to the start of flash.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-07-29 12:20:00 -04:00
Kevin O'Connor
fb50570994 buildbinary: Add support for building lpc176x checksum
The lpc176x internal rom checks that the first 8 words of the flash
sum to zero.  Many flash writing tools for the lpc176x will
automatically add the appropriate checksum.  However, it can be useful
to build the checksum locally so that the image supports direct flash
writing.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-07-29 12:20:00 -04:00
Kevin O'Connor
28628012bf armcm_canboot: New file for CanBoot entry code
Rename the existing armcm_boot.c file to armcm_canboot.c .  This makes
it easier to track changes between CanBoot and Klipper as the CanBoot
entry code is notably different from the Klipper entry code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-07-29 12:20:00 -04:00
Eric Callahan
a8c83c519c stm32g0: add fdcan support from Klipper
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2022-07-01 14:34:30 -04:00
Eric Callahan
8d8ac60256 stm32: remove stm32f4 CAN warning
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-07-01 14:34:30 -04:00
Eric Callahan
8b010a64a1 build: sync Kconfig and Makefile changes with Klipper
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-07-01 14:34:30 -04:00
Eric Callahan
d6a605d6b7 src: add updated can source from Klipper
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-07-01 14:34:30 -04:00
Eric Callahan
8702008265
stm32: use TME bits to determine the can tx mailbox
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-06-02 20:05:56 -04:00
Kevin O'Connor
115582ce88 stm32: Add stm32g0 support
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-05-17 19:29:58 -04:00
Kevin O'Connor
4857a70189 stm32: Improve out-of-bounds check on erase sector index calculation
Avoid wrapping the sector index, as that could potentially result in
erasing the booloader itself.

Also, move the stm32f4_sector_index() inline into erase_page().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-05-17 19:29:58 -04:00
Kevin O'Connor
1e6a2de3b1 stm32: Enable support on other stm32f0 chips
The remaining stm32f0 chips have flash hardware similar to stm32f1.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-05-17 19:29:58 -04:00
Kevin O'Connor
5cbc25d676 stm32: Enable support for stm32f2 - it has same flash interface as stm32f4
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-05-17 19:29:58 -04:00
Kevin O'Connor
d2ea272de0 stm32: Resync stm32f4 with upstream Klipper
There was a Klipper bugfix for STM32F401 clock init.

There was a Klipper build bugfix when building with gcc hardfloat flags.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-05-17 12:00:31 -04:00
Kevin O'Connor
3d924f52ec stm32: Support 16KiB application start on stm32f4
The default remains 32KiB, but a smaller size bootloader may be useful
for testing.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-05-16 20:38:56 -04:00
Kevin O'Connor
9820445b92 stm32: Default to 8KiB application start on stm32f0 and stm32f1
Using 8KiB is a better default for most users.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-05-16 20:38:56 -04:00
Kevin O'Connor
6db366dc3f flash: Report pages written from "eof" command
Commit 4d969764 changed the "eof" command to return the number of
blocks instead of the number of pages written.  Report the number of
pages written again.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-05-16 20:37:54 -04:00
Kevin O'Connor
4d969764f1 flash: Write each block individually
Don't gather "blocks" into flash pages.  Instead, write each "block"
to flash on each flash_write_block() request.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-05-16 19:21:51 -04:00
Kevin O'Connor
7287670002 flash: Move page handling from flashcmd.c to flash.c
Allow the low-level board code to handle each flash page.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-05-16 19:21:51 -04:00
Kevin O'Connor
9f9a872176 stm32: Avoid read-modify-write operations in flash.c
Avoid read-modify-write operations on the FLASH->CR register.  Write
out the desired valid explicitly.

Use writew() and writel() to write the flash bytes out to avoid gcc
reordering the memory write relative to the flash register writes.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-05-16 19:21:51 -04:00
Kevin O'Connor
8316d2f0af armcm_boot: Introduce application_check_valid()
Move application_check_valid() in bootentry.c to armcm_boot.c and make
the check specific to the ARM cortex-m.  On these ARM machines it is
easier to validate the application stack address.

Also rename jump_to_application() to application_jump().

Also rename flash_read_block() to application_read_flash() and move to
armcm_boot.c .

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-05-16 19:21:51 -04:00
Kevin O'Connor
d6c874b0ad stm32: Support 4KiB application start
Allow the application start address to be configurable from "make
menuconfig".

Add a build check to verify the final binary can fit within the
configured size.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-05-16 14:08:54 -04:00
Eric Callahan
1ae63dfbd8 stm32f4: include sched.h
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-05-16 09:04:45 -04:00