157 Commits

Author SHA1 Message Date
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
600967e293 readme: added rp2040 specific notes
Signed-off-by: Alex Malishev <malishev@gmail.com>
2022-11-06 16:23:26 -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
Eric Callahan
a89db2442e
readme: add contributing guidelines
Fix a couple of minor documentation errors.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-11-04 16:48:31 -04: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
Eric Callahan
98844eac24
readme: add deployer documentation
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-08-25 16:40:01 -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
Eric Callahan
8d0f9ec269 usb_cdc: include misc.h
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
446ff1794b
flash_can: report missing pyserial
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-06-08 08:24:53 -04:00
Eric Callahan
cf62ff7a8d
makefile: disable null pointer checks
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-06-07 11:59:39 -04:00
Eric Callahan
b8c6893309
build: update CanBoot USB device ID
Use Device ID 0x6177 granted by OpenMoko for CanBoot.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-06-04 05:30:14 -04:00
Eric Callahan
084632749e
readme: update documentation to include lpc devices
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-06-03 17:04:22 -04:00
Eric Callahan
7574bcffa1
Revert "flash_can: support entering the usb bootloader"
This reverts commit b267acc6b3fcadab07f9755f9a6f409c298870f7.
2022-06-03 14:07:06 -04:00
Eric Callahan
b267acc6b3
flash_can: support entering the usb bootloader
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-06-03 08:21:36 -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
Eric Callahan
f85b985cac lpc1768: decrease RAM size
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-05-31 06:04:52 -04:00
Eric Callahan
90970f9f7a lpc176x: reduce ram size in kconfig
This moves the stack so that it is located in an area of SRAM
not modified by the system boot rom.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-05-31 06:04:52 -04:00
Eric Callahan
821a44eb8b lpc176x: implement IAP in flash.c
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-05-31 06:04:52 -04:00
Eric Callahan
7fe51a9de2 lib: fix lpc176x flash accelerator config
According to the datasheet it is necessary to set the flash
accelerator value to 5 CPU clocks for 100-120MHz .

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-05-31 06:04:52 -04:00
Eric Callahan
c1b8886c0f kconfig: add choice for lpc176x
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-05-31 06:04:52 -04:00
Eric Callahan
365c3bbc91 lpc176x: remove code specific to Klipper
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-05-31 06:04:52 -04:00
Eric Callahan
c055ff1812 lpc176x: add source from Klipper
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-05-31 06:04:52 -04:00
Eric Callahan
1d8ea99389 lib: add lpc176x dependencies
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-05-31 06:04:52 -04:00
Eric Callahan
604d74a005
readme: fix incorrect instructions for installing pyserial
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-05-25 12:48:33 -04:00
Eric Callahan
b24857259a
armcm_boot: fix vector table assignment
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-05-19 16:57:23 -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