Commit Graph

133 Commits

Author SHA1 Message Date
Sean Cross
c8872c1088 sw: don't clear OUT buffer during usb_recv
If there is data already in the OUT buffer, don't throw it away.

This was necessary when using `epfifo` due to the way it shared OUT and
SETUP packets.  However, it is causing reliability issues with eptri.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-11-29 09:47:52 +08:00
Sean Cross
065c0fa8b7 sw: add information to determine why it didn't update
This will be useful if it needs troubleshooting in the future.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-11-28 18:10:23 +08:00
Sean Cross
9f86fc5c96 main: initialize spi to ensure it's active
Initialize the SPI flash prior to checking for the bootloader.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-11-28 17:50:16 +08:00
Sean Cross
5718d41608 sw: accept alternate SPI ID for PVT
Signed-off-by: Sean Cross <sean@xobs.io>
2019-11-28 16:43:48 +08:00
Sean Cross
acdccf5f98 booster: change magic number for booster
Since the USB and flash communication layers are different, change the
magic number for booster.  This will prevent previous versions of foboot
from trying to launch our updater with the wrong version.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-11-28 16:36:45 +08:00
Sean Cross
5b5b98c6d4 sw: eptri: add a note about reset condition length
It isn't followed yet, but the note is there so I know where to look.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-11-28 16:36:01 +08:00
Sean Cross
0b49f2f493 sw: don't init/deinit spi at first
This was necessary due to a misunderstanding on how to use picorvspi,
but we don't even use that module anymore.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-11-28 16:35:20 +08:00
Sean Cross
0156e211eb foboot: don't re-enter updater when spi id doesn't match
Consult the spi_id prior to jumping to the updater.  This will
ensure that if the wrong image is flashed, it won't get
re-executed during a reboot.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-11-27 14:00:05 +08:00
Sean Cross
aa00485f43 sw: include hardware version in product description
This addresses #21.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-11-25 09:34:00 +08:00
Sean Cross
cba427a7fb spi: switch from SPI mode 1 to mode 0
We got CPHA wrong before.  Set the pin before the clock.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-11-22 19:03:05 +08:00
Sean Cross
dcb75f1e7e usb: fix interface descriptors
Windows wouldn't enumerate the device because the descriptor was buggy.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-11-22 12:18:38 +08:00
Sean Cross
95efe4681e dfu: set manifest-wait-reset timeout to 10ms
This removes the one-second delay after we're done flashing.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-11-22 11:44:08 +08:00
Sean Cross
cc8e9d5af8 sw: eptri: remove rgb led calls
These are an abstraction violation, and emit warnings.  They shouldn't
be needed anymore, now that debugging is finished.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-11-22 11:42:00 +08:00
Sean Cross
a6c888ba50 sw: spi: remove unused gpio functions
Now that we hardcode gpio output, remove the abstracted functions.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-11-22 11:41:36 +08:00
Sean Cross
d4b1a64dca sw: get usb working with eptri
This commit is the final commit necessary to get foboot working with the
new eptri api.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-11-22 11:37:27 +08:00
Sean Cross
1ee442d407 dfu: parameterize all timeouts
This makes it easier to try out different timeouts for various DFU
operations.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-11-22 11:31:46 +08:00
Sean Cross
1ed2e4ce5e dfu: use 4 kb erase blocks
There is no benefit to using larger erase block sizes, so stick to using
the smallest available size.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-11-22 11:31:19 +08:00
Sean Cross
c6c3ae8c47 spi: speed up bit banging and special case everything
This patch significantly improves SPI throughput by avoiding
many duplicated writes.  For example, we now only adjust the MISO
direction once during every byte rather than for every bit.

This improves the time it takes to upload a 128 kilobyte file from 29
seconds to 6 seconds.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-11-22 11:28:53 +08:00
Sean Cross
1f91f81f8e eptri: work-in-progress to get eptri working
Signed-off-by: Sean Cross <sean@xobs.io>
2019-11-22 08:03:35 +08:00
Sean Cross
58f99aebf2 eptri: wip commit
This commit includes the spibone support we're using to debug eptri.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-11-01 17:07:27 +08:00
Sean Cross
298aefed9f sw: don't ack the fifo reads
This is no longer required.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-09-25 14:09:33 +08:00
Sean Cross
3ee8482e35 sw: working commit
This commit represents a working build.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-09-20 20:16:26 +08:00
Sean Cross
6de5089821 sw: add cdc endpoint
Signed-off-by: Sean Cross <sean@xobs.io>
2019-09-12 10:23:40 +08:00
Sean Cross
eb8fc91527 sw: more usb support for multiple endpoints
Signed-off-by: Sean Cross <sean@xobs.io>
2019-09-12 10:23:15 +08:00
Sean Cross
868195254a sw: eptri: add uart test
Signed-off-by: Sean Cross <sean@xobs.io>
2019-09-12 10:21:04 +08:00
Sean Cross
c2bbd5c58f sw: main: init usb earlier
Signed-off-by: Sean Cross <sean@xobs.io>
2019-09-11 13:32:10 +08:00
Sean Cross
950a98ba8c sw: usb-dev: add address and eptri support
Signed-off-by: Sean Cross <sean@xobs.io>
2019-09-11 13:31:54 +08:00
Sean Cross
3ea66a7689 src: epfifo: add address support
Signed-off-by: Sean Cross <sean@xobs.io>
2019-09-11 13:30:32 +08:00
Sean Cross
a9a75fb02f sw: use latest csr.h file
Signed-off-by: Sean Cross <sean@xobs.io>
2019-09-11 13:29:27 +08:00
Sean Cross
cf8273d8c1 sw: usb: add set_address support
Signed-off-by: Sean Cross <sean@xobs.io>
2019-09-11 13:29:03 +08:00
Sean Cross
e4c43b74d9 sw: add initial eptri support
Signed-off-by: Sean Cross <sean@xobs.io>
2019-09-11 13:28:43 +08:00
Sean Cross
1664f3533c sw: apply nerve pinch to bootloader update
Use the same FBM nerve pinch to prevent entering the updater.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-07-26 10:31:57 +08:00
Sean Cross
3e2febb464 sw: initial addition of bootloader updater
Add the ability to boot from a bootloader if the right hook is found.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-07-24 20:58:45 +08:00
Sean Cross
49a7197f7c sw: generated: add latest csr.h file
Signed-off-by: Sean Cross <sean@xobs.io>
2019-07-21 13:01:37 +08:00
Sean Cross
a363e25b76 sw: time: rename SYSTEM_CLOCK_FREQUENCY to CONFIG_CLOCK_FREQUENCY
This changed in litex.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-07-21 12:29:20 +08:00
Sean Cross
10454fa0be sbled: fix mapping of r,g,b and add bit-bang mode
Fix the mapping of red, green, and blue.  Now the LEDDPWRR, LEDDPWRG,
and LEDDPWRB map to their correct values.

Additionally, a bit-banged mode for the LED has been added to enable
fine-grained control in a simpler manner.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-07-08 10:13:09 +08:00
Sean Cross
5468cb914a sw: spi: remove lots of dual/quad/qpi code
This is an effort to fix boards that go into RO mode on their own.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-07-05 15:23:04 +08:00
Tom Keddie
9be328ead9 sw : fix warning in dfu.h and usb-dev.c 2019-06-30 18:28:05 -07:00
Sean Cross
b41f4930cf csr: include generated macro for bitstream sync
The ICE40 bitstream sync byte is now available as a macro in csr.h.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-06-19 14:06:32 -07:00
Sean Cross
5fe9a814ea sw: support riscv64 on raspberry pi
The name of the compiler has changed on raspberry pi, so support the
previous name as well as the new one.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-06-19 08:20:43 -07:00
Sean Cross
4d40bb5f18 sw: update csr.h to release version
Signed-off-by: Sean Cross <sean@xobs.io>
2019-06-18 19:45:04 -07:00
Sean Cross
8354617950 Merge branch 'master' of github.com:im-tomu/foboot 2019-06-17 15:33:49 -07:00
Sean Cross
4057294332 sw: clean up underflows observed during updates
On some platforms, something overflows and puts the system in a state
where it cannot update.  By checking for underflow on various counters,
we can now update properly on these systems.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-06-17 14:48:08 -07:00
Tom Keddie
341db19f70 Move bitstream sync constants to CONFIG entries 2019-06-13 20:20:24 -07:00
Tom Keddie
c19d3d439c Add explicit include of csr.h 2019-06-05 13:21:41 -07:00
Tom Keddie
56e7fc09d9 Remove warnings 2019-06-05 13:18:57 -07:00
Tom Keddie
2770730c1a Merge branch 'master' into tomk_201090605_imagesize_override 2019-06-05 13:14:08 -07:00
Tom Keddie
268069e126 Add optional override of user flash image in dfu code 2019-06-05 13:08:05 -07:00
Sean Cross
8807edee24 usb-desc: use PID assigned to Fomu
Signed-off-by: Sean Cross <sean@xobs.io>
2019-05-22 11:21:45 +08:00
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