Commit Graph
137 Commits
Author SHA1 Message Date
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>
v0.0.1
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 b267acc6b3.
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
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 e8374ce367 initial_pins: Add compile time check to reduce binary size when not in use
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-05-16 17:01:52 -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
Kevin O'Connor 603ed1b6a9 Makefile: Change default to Python3
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-05-16 13:59:42 -04:00
Kevin O'Connor 24d4eb16c9 initial_pins: Port initial_pins capability from Klipper
Some boards require an initial gpio state in order to start USB.  Port
the initial_pins capability from Klipper to provide that support.

This also synchronizes scripts/buildcommands.py with the latest code
from Klipper.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-05-16 13:59:42 -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
Eric Callahan d36b696ce2 stm32: enable STM32F4 devices in KConfig
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-05-16 09:04:45 -04:00
Eric Callahan c3c794076a stm32: add usbotg.c from klipper
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-05-16 09:04:45 -04:00
Eric Callahan fbf59301b3 stm32: add support for stm32f4 flash operations
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-05-16 09:04:45 -04:00
Kevin O'Connor fc96f0c9bd flash_can: Report errors by default
Change the default log level from CRITICAL to ERROR.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-05-16 06:19:08 -04:00
Kevin O'Connor 92e9174cae flash_can: Fix pyserial exception handling
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-05-16 06:19:08 -04:00