Commit graph

393 commits

Author SHA1 Message Date
bunnie
e07ab36984 fixup IRQ handling
- disable IRQs on departure
- put EV enable outside of the HAL function
this is necessary because we need all HAL calls to be finished
before an interrupt happens to avoid locking problems
2024-12-22 00:30:27 +08:00
bunnie
b66b60497b make the app uart configurable
so processes other than swap can use it
2024-12-22 00:29:50 +08:00
bunnie
c8e4392a95 pass a handle to udma_global to i2c init 2024-12-06 03:33:39 +08:00
bunnie
189611f3c4 add updates, verilator-only, and simulation-only feature gates
- updates enables or disables updates in the loader
- verilator-only will turn off routines that access hardware not
present in verilator (e.g. leads to a bus lockup)
- simulation-only turns of features that take a long amount of time
and aren't necessary in simulation, such as bulk clearing of
all RAM - in simulation, we can configure the simulator to do this
for us prior to boot; but in HW, of course, RAM is just random,
or worse, has the previous session's secrets in it.
2024-11-30 02:27:35 +08:00
bunnie
1710fb7ee2 cleanup the cramium hw implementation feature flags
this re-oragnizes the feature matrix of the loader to
reflect the chip/board division of feature flags better.
2024-11-30 02:26:56 +08:00
bunnie
43988bde05 cleanup warning on a debug routine
this is not used under certain combinations of e.g. printing
and swap
2024-11-30 02:25:58 +08:00
bunnie
b85b9d2dc2 improve assert message 2024-11-30 02:25:40 +08:00
bunnie
a527b3a300 gate RAM clearing behind not(simulation-only) feature flag
RAM clearing takes a lot of time in simulation and is not necessary,
hence the feature gate option.
2024-11-30 02:22:47 +08:00
bunnie
861b7ae3ff compromise on oscillator setting
I felt uncomfortable leaving the oscillator setting entirely
outside the PLL routine, so as a compromise I defer the oscillator
switch-over until after the initial PLL settings are loaded.

This makes both the simulation model and the actual hardware
happy. I think probably what the simulation model *should* have
done is consider the "powerdown" pin when checking the validity
of the signals going into the PLL model - but this is impossible
to modify/check because the PLL is provided as an encrypted blob :(
2024-11-28 15:32:19 +08:00
bunnie
6e8bff749c eliminate invalid PLL transition
this transition was in the reference C code, but in verilog simulation
it turns out it activates the PLL in an invalid mode which can lead
to glitching. Removing this makes both the simulation happy and
presumably the PLL happier as well.
2024-11-28 15:07:43 +08:00
bunnie
ec3d8b5042 handle swap image burning 2024-11-22 00:55:29 +08:00
bunnie
a7619e55a8 add progress bar to burn 2024-11-21 22:03:06 +08:00
bunnie
b944c51474 a simple update with verified image now working 2024-11-21 18:23:55 +08:00
bunnie
89fb9b4df6 add reference to the presign module 2024-11-21 02:22:39 +08:00
bunnie
30cb5f84f7 make more space in the cramium loader
need code space to handle image verification.

getting kind of heavy, but I think we're almost done.
2024-11-21 02:22:08 +08:00
bunnie
2437712b7b add some basic image integrity checking code
this doesn't protect against malicious tampering (because
the public key is the developer key) but it will at least
catch correctness errors in USB upload and filesystem
behavior.
2024-11-21 02:20:40 +08:00
bunnie
3bf8598509 make slice cursor peekable 2024-11-21 02:19:45 +08:00
bunnie
fb0efbce3b add helper type for pre-hash digests 2024-11-21 02:19:21 +08:00
bunnie
ed085f2c83 UX improvements for loader update interface 2024-11-20 21:41:41 +08:00
bunnie
9c1186022f quiet debug 2024-11-20 21:41:23 +08:00
bunnie
8b571561f8 cleanup warning 2024-11-20 21:41:08 +08:00
bunnie
60dcd906ed include slice_cursor in mod list 2024-11-20 21:40:50 +08:00
bunnie
3b567fb3e2 modularize SliceCursor 2024-11-20 21:40:25 +08:00
bunnie
b68abf1d2b change volume label 2024-11-20 20:43:39 +08:00
bunnie
6d3a58ccea cleanup warnings 2024-11-20 20:41:10 +08:00
bunnie
9a839e3fe6 add keypress handling and no_std Cursor implementation 2024-11-20 20:40:48 +08:00
bunnie
d9709997fb add template disk image
this is a pre-initialized, FAT12 image that is compatible with
Windows (which is the harder of the OSes to please)
2024-11-20 20:40:05 +08:00
bunnie
e181c0d460 use global allocator for simple-fatfs
also initialize the disk image with some default data
2024-11-20 20:39:27 +08:00
bunnie
8cc80741ac cleanup warning 2024-11-20 20:39:06 +08:00
bunnie
6c79441ee1 add boot option to loader 2024-11-20 01:45:56 +08:00
bunnie
bb594a5c40 try to improve the pmic detection code
we can now recover from an I2C timeout and get the PMIC data
out, but mysteriously, when we leave the routine, the CPU hangs.

I think fundamentally the I2C instability is due to something
very wonky inside the chip itself, so the recovery only papers
over an issue that is only fixed with a reboot...
2024-11-20 01:44:58 +08:00
bunnie
f14cf1948c gfx is now used as part of the update routine 2024-11-20 01:44:28 +08:00
bunnie
391fb84f00 update api to inclued perclk_freq 2024-11-20 01:43:25 +08:00
bunnie
626d997868 move pl230 test to an easier place for checking 2024-11-18 18:37:33 +08:00
bunnie
aba5d25e36 cleanup warnings when boardbringup is not selected 2024-11-05 19:41:12 +08:00
bunnie
0463629a0a cleanup warnings when board-bringup target is not selected 2024-11-05 19:40:28 +08:00
bunnie
dc20c84785 refer to new modules 2024-11-05 01:45:13 +08:00
bunnie
08f7252791 integrate new qr finding code 2024-11-05 01:44:53 +08:00
bunnie
16c9b2c7e2 insert refactored qr code
code alignment and finding now works *great*. Near real-time
performance!
2024-11-05 01:44:12 +08:00
bunnie
f6d6db566a add homography searching routines 2024-11-05 01:43:59 +08:00
bunnie
6c4cd3bc67 add qr option 2024-10-27 23:28:08 +08:00
bunnie
8625dae0db add more swap sram support and change resolution api name 2024-10-27 23:27:26 +08:00
bunnie
4f85deaecb change api name for resolutions to dimensions 2024-10-27 23:26:45 +08:00
bunnie
bceb08afb8 recognize 8MiB swap chip 2024-10-27 23:24:42 +08:00
bunnie
38ad0363ce fix capacity units 2024-10-26 18:45:36 +08:00
bunnie
1a90df9d53 add descriptor chaining for large bulk transfers 2024-10-26 03:06:37 +08:00
bunnie
2a92932850 cleanup some debug 2024-10-26 03:06:10 +08:00
bunnie
f9e99a4ff3 add assembly stub for cramium boot
this fixes a stability issue observed at boot
2024-10-24 01:29:04 +08:00
bunnie
e7f706e9cd revert statics clearing routine
this turns out to be a bad idea because it corrupts systems
that have suspend/resume.
2024-10-21 03:28:58 +08:00
bunnie
9647202366 cleanup testing code for QR code
now it will overlay crosshairs on finder patterns and do affine
correction when the finders are found.
2024-10-21 01:18:12 +08:00