151 Commits

Author SHA1 Message Date
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
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