Commit Graph
146 Commits
Author SHA1 Message Date
Eric Callahan 2df22db77b stm32: add initial sdio support
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-06-27 07:13:13 -04:00
Eric Callahan a7d3b3cfc4 sdcard_spi: minor fixes
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-06-18 08:21:32 -04:00
Eric Callahan de9ab7c5e8 lpc176x: add sdcard configuration to build
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-06-08 12:39:55 -04:00
Eric Callahan d30928281f lpc176x: add spi_set_rate method
This slightly modifies the method used to set SPI rate

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-06-08 12:39:54 -04:00
Eric Callahan f6e783d825 lpc176x: allow 16 bit SPI length requests
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-06-08 12:39:54 -04:00
Eric Callahan a357d04b05 lpc176x: add spi source from klipper
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-06-08 12:39:54 -04:00
Eric Callahan 8a674ab5c3 buildcommands: generate swspi pins
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-06-08 12:39:53 -04:00
Eric Callahan 8753d674cc sdcard_spi: add support for software spi
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-06-08 12:39:53 -04:00
Eric Callahan 95a5686fcc build: add software spi support to KConfig and Makefile
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-06-08 12:39:53 -04:00
Eric Callahan 9cb66f93b2 spi_software: add source from Klipper
This contains a port of Klipper's spi_software implementation
for use with CanBoot's sdcard.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-06-08 12:39:52 -04:00
Eric Callahan 536f8b7c3b buildcommands: generate sdcard cs pin code
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-06-08 12:39:52 -04:00
Eric Callahan 2cf2852bfa makefile: add sdcard source
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-06-08 12:39:52 -04:00
Eric Callahan 0ff774a2ce sdcard: initial implementation
Add support for firmware uploads from an SD Card via SPI.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-06-08 12:39:51 -04:00
Eric Callahan 4ca74c7984 command: support disabling command processing
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-06-08 12:39:51 -04:00
Eric Callahan b9d3da8c3e flashcmd: add set_in_transfer and set_complete methods
This allows local flashing to update transfer state.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-06-08 12:39:51 -04:00
Eric Callahan b19650f65b kconfig; Add SD Card menu
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-06-08 12:39:50 -04:00
Eric Callahan f3711f4d5b stm32: allow 16 bit SPI length requests
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-06-08 12:39:50 -04:00
Eric Callahan 3de31f02c3 stm32: add spi_set_rate() method
Proper SPI initialization occurs at a rate of 100-400 kHz.  This should
be changed after init

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-06-08 12:39:50 -04:00
Eric Callahan 3b9f5f6d80 stm32: add spi implementation from klipper
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-06-08 12:39:49 -04:00
Eric Callahan 82c8cc327a lib: add fatfs dependency
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-06-08 12:39:49 -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