136 Commits

Author SHA1 Message Date
Eric Callahan
25a23cd420
rp2040: modify flash rule
Use the "withclear" version of the katapult uf2 file when
 executing "make flash".

 Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-12-18 05:12:48 -05:00
Kevin O'Connor
aa37e30b71 rp2040: Add rp2350 specific mechanism for checking for double reset tap
It appears the rp2350 disables SRAM power when the RUN pin is pulled
low.  As a result, one can not store a code in regular memory to
detect if the RUN pin is pulled low multiple times.

Add a new CONFIG_HAVE_BOARD_CHECK_DOUBLE_RESET mechanism to allow the
board code to override the standard double reset checking code.
Implement an rp2350 specific check that uses the chip's POWMAN
chip_reset field to store/check a double reset condition.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-12-17 19:27:43 -05:00
Kevin O'Connor
c0014efc4a rp2040: Resynchronize with upstream Klipper code and support rp2350 chips
Synchronize with the latest Klipper code.  This pulls in the latest
lib/ files (needed to use the pico-sdk v2.0.0 version).  It updates to
latest can2040 code (needed for pico-sdk v2.0.0 support).  It
implements USB double buffering (as is now done in Klipper).  It adds
in support for additional UART pins (as is now done in Klipper).  It
adds support for rp2350 chips.

This replaces the execute in ram code previously implemented in
Katapult with the execute in ram code that is now standard in Klipper.

The CONFIG_RP2040_ADD_BOOT_SIGNATURE kconfig symbol was removed and
the build now always produces a katapult.withclear.uf2 file.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-12-17 19:27:43 -05: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
4a1532ef24 flashcmd: add support for reporting software version
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-08-06 19:41:37 -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
Eric Callahan
3e23332eb1
build: use 1000000 canbus bitrate default
This matches the default recommended by Klipper.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-02-10 18:17:37 -05: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
abd154526d
build: create legacy binaries
To help transition users relying on exisiting tutorials copy
katapult.bin and katapult.uf2 to canboot.bin and canboot.uf2
respectively.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-08-01 06:53:10 -04:00
Eric Callahan
e9655732cd
usb_cdc: change USB manufacturer to katapult
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2023-07-31 06:09:14 -04: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
Eric Callahan
d0480d26d6
rp2040: sync usbserial fix from Klipper
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-07-10 16:46:27 -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
6f67a01a60 lpc176x: Resync 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
e3e72b8642 Kconfig: Resync src/Kconfig with upstream Klipper code
This adds a few symbols used by the latest 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
c9469e7038 rp2040: make deployer build optional
Signed-off-by: Alex Malishev <malishev@gmail.com>
2022-11-06 16:22:53 -05:00
sh83
2990480d25 common: misc fixes:
- moved external files to lib folder
 - fixed typos
 - added optional "sudo" to flash command
 - fixed redundant file close in script
 - fixed compilation warning
2022-10-31 07:23:14 -04:00
sh83
0a24cd4502 rp2040: added option to force bootloader before new application flashed
Signed-off-by: Alex Malishev <malishev@gmail.com>
2022-10-31 07:23:14 -04: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
sh83
05b05afd3f build: rp2040 added to the main Kconfig.
Signed-off-by: Alex Malishev <malishev@gmail.com>
2022-10-31 07:23:14 -04:00
sh83
09140ead87 rp2040: Added needed options to Kconfig, cleaned up.
Modified linker script and loader to load whole bootloader to the RAM.
Removed whatchdog.
Fixed gpio.c compilation.

Signed-off-by: Alex Malishev <malishev@gmail.com>
2022-10-31 07:23:14 -04:00
sh83
a253e73116 rp2040: Implemented canboot flash interface.
Implemented canboot timer interface.
Simplified chipid.c to use common flash interface.

Signed-off-by: Alex Malishev <malishev@gmail.com>
2022-10-31 07:23:14 -04:00
sh83
396a18be5e rp2040: modified and renamed pico sdk files.
Signed-off-by: Alex Malishev <malishev@gmail.com>
2022-10-31 07:23:14 -04:00
sh83
cc2a3e3df7 rp2040: Import flash and bootrom related files from pico-sdk
(https://github.com/raspberrypi/pico-sdk/tree/master/src/rp2_common/hardware_flash,
https://github.com/raspberrypi/pico-sdk/tree/master/src/rp2_common/pico_bootrom)
as is.

Signed-off-by: Alex Malishev <malishev@gmail.com>
2022-10-31 07:23:14 -04:00
sh83
65845a8fa3 rp2040: Initial import from klipper as is.
Signed-off-by: Alex Malishev <malishev@gmail.com>
2022-10-31 07:23:14 -04:00
Kevin O'Connor
c85d2cc38a bootentry: Don't consider a reset in less than 10ms a double click
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-08-03 17:06:22 -04:00
Kevin O'Connor
1b71e856a4 deployer: Wait 100ms before overwriting existing bootloader
If the power supply isn't fully stable or the reset line is glitchy
then there may be a few reboots before the mcu becomes stable.  If the
deployer runs during this unstable period, it may erase the existing
bootloader, but not be able to fully write the new bootloader.

Wait a 100ms before erasing the existing bootloader in an effort to
avoid this situation.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-08-03 17:05:41 -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
ed2bf3e8b0 bootentry: Move set_bootup_code() signatures to misc.h
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-07-29 12:20:00 -04:00
Kevin O'Connor
b45941967d lpc176x: Permit flashing to addresses other than CONFIG_APPLICATION_START
Allow flash_write_block() to write to arbitrary addresses as long as
the flash address starts at a 256 byte boundary.

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
555e0e5631
kconfig: display git version in main menu
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-07-21 06:09:07 -04:00
Eric Callahan
88c5107818
armcm_boot: fix array bounds warning
Arm GCC 11.2 generates an array bounds warning when
dereferencing a 64-bit pointer.  Selectively disable the
warning when handling the bootup code.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-07-21 06:03:38 -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