Commit graph

336 commits

Author SHA1 Message Date
bunnie
37ceefef21 add usb mass storage command handlers
disk enumerates now, and initiates r/w transactions but
the reference driver does not match the implementation in that
the USB stack can't access all of RAM, so we have to add
an intermediate stage that splits the command requests into
smaller chunks
2024-10-19 00:14:12 +08:00
bunnie
dabd87aa3a add usb mass storage command handling 2024-10-19 00:13:52 +08:00
bunnie
ed9759f524 remove a debug statement 2024-10-18 17:18:06 +08:00
bunnie
90d7f45f0a adjust locations of memory for USB loader
and document the rationale
2024-10-18 17:17:29 +08:00
bunnie
452ba4adff cleanup area for statics used by the loader 2024-10-18 17:16:21 +08:00
bunnie
6c655e9358 re-enable interrupts immediately in the handler
we need to catch an interrupt that gets issued while we
are still handling the pending interrupt.
2024-10-18 17:15:24 +08:00
bunnie
a6e7459cdd re-organize the USB subsystem into modules 2024-10-18 14:45:15 +08:00
bunnie
e4f5c32ff3 update link locations to make space in loader for USB stack
this is in preparation for loader-based updates

may have to increase space even more when we pull in e.g.
firmware signing and verification primitives.
2024-10-18 04:17:36 +08:00
bunnie
d8cd9ba5c5 add hook to USB testing, and also move the kernel to make space for loader USB 2024-10-18 04:16:31 +08:00
bunnie
3a4ae8f09f add usb to cramium platform 2024-10-18 04:16:08 +08:00
bunnie
8b14494a15 fix some bugs in gpio twiddle code 2024-10-18 04:15:47 +08:00
bunnie
af6f4766ff translated reference USB stack into Rust
implements mass storage; needs debugging
2024-10-18 04:13:57 +08:00
bunnie
4c810ec447 add various debugging assembly routines for the loader 2024-10-16 03:05:54 +08:00
bunnie
778af25414 add handler for pmic open failure; add test case for self-powerdown 2024-10-12 00:46:47 +08:00
bunnie
1f148a6136 update readme 2024-10-10 02:10:10 +08:00
bunnie
e806421141 add camera test to loader
this loops an image from the camera to the oled display in real time.
it will also dump the Y (luminance) data to to a serial port for
offline development & testing of the QR code algorithm.
2024-10-10 02:05:40 +08:00
bunnie
70de9c707d cleanup bootlogo routine 2024-10-10 02:05:18 +08:00
bunnie
4e6c2706c9 employ the axp2101 driver to setup the voltages 2024-10-07 22:53:10 +08:00
bunnie
b87c9f7672 add I2C tests & code for setting the LDO initial value 2024-10-06 02:45:18 +08:00
bunnie
d7af82261e did *not* mean to commit the font-out hack
this is just to make cycle times faster during debug only
2024-10-04 22:53:00 +08:00
bunnie
9867a3e488 cleanup loader path to use dynamically derived perclk 2024-10-04 22:52:25 +08:00
bunnie
9527dcfbaf move sh1107 to platform-independent lib 2024-10-04 13:07:59 +08:00
bunnie
6fedae8e73 implement logo drawing for oled 2024-10-04 13:07:34 +08:00
bunnie
b572db3f3f update boot logo to a 128x128 suitable black/white test image 2024-10-04 13:07:00 +08:00
bunnie
18c4413ae9 update udma_global api in bootloader swap 2024-10-04 13:06:28 +08:00
bunnie
c44f117331 fixes to udma SPIM for tx-only mode
- fix tx_await() condition to consider both control and tx channels
- make tx_async more efficient for the common case that the buffer
fits in a single transaction by appending the CS de-assert as part
of the initial command stream
- make trait for the udma global clock setting

The high bit in this exploration is that there seems to be no
way to actually confirm when a UDMA transaction has fully completed
on the hardware interface. All the completion signals tell you
when the software-side UDMA resources are freed up. However, in this
case, the hardware-side resources may still be transmitting/receiving
data.

This is a problem for the case of a '4-wire SPI' display where you
need to set an extra line to control command/data mode addressing.

In this case, the current work-around is to read back the state of
the chip select pin as a GPIO to determine when the hardware has
finished.

I suspect that if we can figure out how to use UDMA in a full duplex
mode that we could do something more essentially linked to the
hardware, but this would also require having a dummy Rx buffer allocated
that is the same depth as the hardware Tx buffer if all you cared about
is the hardware conclusion of a Tx.
2024-10-04 12:53:55 +08:00
bunnie
1eb1a1a671 migrate loader board parameters to board files 2024-10-02 01:44:57 +08:00
bunnie
2e086f4152 consolidate spi pin setup 2024-10-02 00:23:48 +08:00
bunnie
0733b65ead firmware updater strategy and thoughts jotted into a file 2024-10-01 23:19:14 +08:00
bunnie
cddd971aa9 remap to the setup_pin() trait
this is an intermediate step on the way to moving these all into
a common area for board definitions
2024-10-01 23:18:31 +08:00
bunnie
482b815f44 convert to using the new setup_pin trait 2024-10-01 23:17:36 +08:00
bunnie
a66cd1c077 add modules from previous commit 2024-10-01 23:16:57 +08:00
bunnie
59b15541f3 add stubs for lifecycle management and update checking in loader
this is just a reminder to me on how i was planning to implement
this after going through a big side-quest to change other things.
2024-10-01 23:15:54 +08:00
bunnie
19741d3615 add new flash IDs to swap routine as well 2024-10-01 14:40:36 +08:00
bunnie
cb466c24a3 recognize more flash chip types
1. System works with 1.8V VDD I/O now, needs a new chip ID for
flash

2. Add direct c-translated version of init_clock_asic() for reference
testing.
2024-10-01 14:39:40 +08:00
bunnie
043dfd84ae update formatting to latest nightly rules 2024-09-24 01:49:45 +08:00
bunnie
4884ee51d9 reserve the top-most word of RAM as a "gutter" for filtered DMA
it's much easier to gutter a blocked AXI transaction, than to
squash it. So we reserve a region of memory as a gutter for blocked
transactions.
2024-08-02 17:26:24 +08:00
bunnie
8015b16cb8 clock tests 2024-07-19 17:16:02 +08:00
bunnie
9c227d2a93 beginning of clock tests 2024-07-13 22:45:58 +08:00
bunnie
30eb2f145f fix a bug where the last seeded value was not being used.
Realized that the last round of mixed values wasn't actually being
used because we nuke the `seed` value at the top of the loop.

We effectively had a round of ChaCha8 that we were doing but then
throwing away.

This construction should capture all the benefit of the computation
without wasting computation.
2024-06-22 21:18:59 +08:00
bunnie
d75624cfe4 reduce fclk on target, reoragnize feature flags into groups
Not all chips can hit rated speed, so for bringup we're defaulting
to the slower setting.
2024-06-19 21:33:14 +08:00
bunnie
8838fa6162 add loader test mode for entropy output 2024-06-18 00:08:57 +08:00
bunnie
c6a0f7f629 apply more autoformat. Why did that not trigger on save? 2024-06-16 02:34:46 +08:00
bunnie
8414f08aae autoformat the logo file 2024-06-16 02:10:27 +08:00
bunnie
d40e92b52d add code to dump the TRNG output via the DUART
gotta move on to other things, can't fully debug the USB
serial thing now. :-/
2024-06-16 02:07:33 +08:00
bunnie
28ab6ae311 add a quick-on boot logo in the loader
the swap load can take a little while, so a graphic at power-on
makes the UI feel more smooth
2024-06-16 01:53:45 +08:00
bunnie
975b44f894 improve visibility of setup_port so it can be re-used 2024-06-16 01:53:00 +08:00
bunnie
84fe4c96ff fix seeding algorithm
- use proper seeding of entire state
- chacha8 does not evolve internal state when extracting the seed,
so we have to run the cipher some to force mixing of the seed
state.
2024-06-15 00:37:38 +08:00
bunnie
eceea1db0b re-introduce the boot delay 2024-06-14 16:08:45 +08:00
bunnie
f91cab4f5d harden swap key generation
trng entropy rate is low, so get a lot of it before using anything
out of the pool.
2024-06-14 16:08:15 +08:00