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>
Don't requre exactly 8 bytes in a response, as its possible
that some apps may not return a full 8 bytes.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Don't log read exceptions for each iteration, only log when the
exception differs. Log timeout exceptions separately.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>