Commit Graph

84 Commits

Author SHA1 Message Date
Sean Cross
b6f3cc503d sw: main: fix "boot to main bootloader"
This gets the "main bootloader" support working.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-05-20 21:30:21 +08:00
Sean Cross
f88a76c3b0 sw: dfu: use macro for SPI flash offset
Signed-off-by: Sean Cross <sean@xobs.io>
2019-05-20 21:29:58 +08:00
Sean Cross
ae0df08489 sw: usb-desc: update landing URL and product name
Signed-off-by: Sean Cross <sean@xobs.io>
2019-05-20 21:29:29 +08:00
Sean Cross
3ad9853278 sw: usb-desc: mark product name as "static const"
Signed-off-by: Sean Cross <sean@xobs.io>
2019-05-20 21:28:40 +08:00
Sean Cross
4050898b51 sw: use foosn as the manufacturer
Signed-off-by: Sean Cross <sean@xobs.io>
2019-05-20 12:33:07 +08:00
Sean Cross
b708810f00 sw: dfu: fix sentinal search on null first packet
When the first packet is NULL, we weren't searching for the sentinal
properly.  Limit the amount of data we search for.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-05-20 12:29:42 +08:00
Sean Cross
a3f1ee6d44 sw: fix typo in main
Signed-off-by: Sean Cross <sean@xobs.io>
2019-05-20 11:22:18 +08:00
Sean Cross
c5b5397529 initial commit of foboot main
This is an initial commit of a non-recovery version of foboot.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-05-20 10:59:48 +08:00
Sean Cross
c89bb50ebc dfu: reset timeout to a sane value
Somehow it defaults to something that is very unreasonable.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-05-14 19:26:12 +08:00
Sean Cross
8f5de3fb62 sw: usb-epfifo: remove dead code and fix usb behavior
This fixes USB behavior so it's much more reliable.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-05-12 21:48:03 +08:00
Sean Cross
2adac57076 sw: epfifo: use new fifo arrangement
Signed-off-by: Sean Cross <sean@xobs.io>
2019-05-10 23:41:18 +08:00
Sean Cross
e7493017a0 sw: initial commit of boot options
This adds the ability to configure the program that will be loaded.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-05-01 14:08:30 -07:00
Sean Cross
9c7db8a84a sw: usb-desc: fix usb version
It should be 2.1, not 2.10.  This fixes Windows enumeration.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-05-01 08:59:42 -07:00
Sean Cross
5d6a0d0ec7 sw: webusb: fix landing descriptor warning
For some reason, -flto didn't like the "extern const struct" definition.
Hide the variable now and use an accessor function to silence this
warning, which may have caused other issues with stability.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-04-26 09:22:11 +08:00
Sean Cross
b8145bde36 sw: use correct abi
The CPU we're using has no div/mul instructions, so use the rv32i ABI
instead of rv32im.

This saves about 15%.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-04-25 13:29:27 +08:00
Sean Cross
cd6151b009 sw: add -flto to cflags
This reduces codesize by 15% (~1 kB).

Signed-off-by: Sean Cross <sean@xobs.io>
2019-04-25 12:07:13 +08:00
Sean Cross
646388fcb7 sw: dfu: fix calculation for address offset
We were using the wrong offset for address calculation.  Use the block
size, rather than the program size.  This wasn't an issue before, because
the block size and the program size were both 256 bytes.  Now the block
size can be 1024 bytes.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-04-22 15:51:57 +08:00
Sean Cross
b3050ae299 sw: spi: comment out dead code
This code emitted a warning.  It's not used, so leave it commented for now.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-04-22 15:08:49 +08:00
Sean Cross
b8151d46a4 sw: ld: limit bootloader to 4096 bytes
It doesn't need any more, and we can use the rest of RAM to load a
temporary program.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-04-22 14:49:20 +08:00
Sean Cross
6e653b98d6 sw: support loading directly to RAM
If a sentinal is present, allow dfu-util to load a program directly to
RAM.  This saves us the step of writing to flash.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-04-22 14:42:14 +08:00
Sean Cross
85bb787536 sw: support 1024-byte DFU writes
This increases performance of DFU write commands.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-04-22 14:19:09 +08:00
Sean Cross
26a327486f sw: minor shrink of sw code size
Signed-off-by: Sean Cross <sean@xobs.io>
2019-04-22 12:03:01 +08:00
Sean Cross
8faf9dbec5 sw: remove printf
There is no UART in the failsafe bootloader, so remove printf.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-04-22 11:42:44 +08:00
Sean Cross
f36dde5c7e swp: remove swapfile
This got added somehow.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-04-22 11:20:09 +08:00
Sean Cross
c0690187b4 Merge branch 'wishbone-debug' 2019-04-21 21:48:33 +08:00
Sean Cross
eb6fa89452 merge debug
Signed-off-by: Sean Cross <sean@xobs.io>
2019-04-21 21:48:16 +08:00
Sean Cross
91a205fe2c Merge branch 'master' of github.com:im-tomu/foboot into wishbone-debug
Signed-off-by: Sean Cross <sean@xobs.io>
2019-04-18 21:35:20 +08:00
Sean Cross
e7184d9243 no changes
Signed-off-by: Sean Cross <sean@xobs.io>
2019-04-18 21:34:39 +08:00
Sean Cross
bfd1ddc957 sw: update csr definition for bios
Signed-off-by: Sean Cross <sean@xobs.io>
2019-04-11 15:57:36 +08:00
Sean Cross
e5a2b29456 sw: fix line endings
Signed-off-by: Sean Cross <sean@xobs.io>
2019-04-11 15:53:08 +08:00
Sean Cross
9144b767a8 sw: fix line endings
Signed-off-by: Sean Cross <sean@xobs.io>
2019-04-11 11:48:57 +08:00
Sean Cross
482708d6fb sw: spi: remove broken, unused Write command
The Write command was from fomu-flash, and didn't properly erase the
required sectors.  This wasn't an issue, because it is entirely unused.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-04-11 11:47:10 +08:00
Sean Cross
9cb4e4a8ce WIP: riscv boot
Signed-off-by: Sean Cross <sean@xobs.io>
2019-04-11 09:40:28 +08:00
Sean Cross
0bcc45b185 sw: update to use picospi
Use the new picospi instead of bbspi.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-04-10 17:02:02 +08:00
Sean Cross
d89eea3934 usb: refactor state machine to work with xhci devices
Due to some subtle quirks, as well as a poorly-implemented state machine,
foboot was not compatible with many Desktop devices.

This should fix the implementation so that it is more compatible.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-04-08 17:19:54 +08:00
Sean Cross
595be29063 sw: Makefile: use 32-bit riscv compiler on rpi
The rpi image does not have a 64-bit riscv compiler.  Use the
32-bit version of the toolchain if we detect we're on an rpi.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-04-07 04:55:13 +01:00
Sean Cross
4b6ad47705 sw: spi-gpio: remove unused files
These were moved into spi.c to allow them to be inlined.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-04-06 11:04:43 +08:00
Sean Cross
91a23d808c sw: Makefile: fix third_party and package naming
With these changes, litex mode should now work.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-04-06 10:51:08 +08:00
Sean Cross
a9a5f0cc0d sw: minor removal of unused code
Signed-off-by: Sean Cross <sean@xobs.io>
2019-04-06 09:35:50 +08:00
Sean Cross
d6ae51f69b sw: ld: add support for litex build
Signed-off-by: Sean Cross <sean@xobs.io>
2019-04-06 09:35:23 +08:00
Sean Cross
2437e8b5c1 sw: Makefile: support litex build environment
Allow this software package to be built from within the Litex build system.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-04-06 09:34:26 +08:00
Sean Cross
b40a9bad43 rgb: fix typo in macro
Signed-off-by: Sean Cross <sean@xobs.io>
2019-04-05 18:17:11 +08:00
Sean Cross
b5f17acdf6 sw: enable fancy led effects
Support different LED patterns depending on the mode.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-04-05 18:10:05 +08:00
Sean Cross
fd76536351 usb-dev: reboot to image 0
Since this is a failsafe bootloader, reboot to Image 0.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-04-05 17:33:28 +08:00
Sean Cross
eaa0d63ccb usb-epfifo: fix DATA0/DATA1 swaps for Tx
We were sometimes sending DATA0 instead of DATA1.  Fix that.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-04-05 17:33:02 +08:00
Sean Cross
7d091a72b9 main: poll dfu in main loop
Signed-off-by: Sean Cross <sean@xobs.io>
2019-04-05 15:10:19 +08:00
Sean Cross
7bcc8529d6 dfu: initial working commit
This commit actually works, but still has a few issues.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-04-05 15:09:52 +08:00
Sean Cross
ac349ce1a1 spi: support 32- and 64-kB erase blocks
Signed-off-by: Sean Cross <sean@xobs.io>
2019-04-05 15:09:04 +08:00
Sean Cross
cbf4958236 usb-epfifo: remove extra USB_NAK setting
This works around an issue, though it's still not properly working.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-04-05 13:21:09 +08:00
Sean Cross
2b0575889f usb-dev: remove commented-out printf statements
Signed-off-by: Sean Cross <sean@xobs.io>
2019-04-05 13:20:54 +08:00