Commit graph

3736 commits

Author SHA1 Message Date
bunnie
3a02dc125c add rram debug commands & duart-debug mode for the HAL in std 2025-10-26 22:22:46 +08:00
bunnie
0003921eb1 disable preemption during video capture
the camirq is a perfectly good source of preemption,
and xous will run other threads when the handler is finished.

having both natural timer preemption and camera preemption running
at the sime time seems unnecessary and hurts performance.
2025-10-26 13:37:31 +08:00
bunnie
d2254e2ce4
add HAL to keystore dependencies 2025-10-26 13:37:04 +08:00
bunnie
2a2863c11a
put keystore in charge of enabling preemption
this is done after critical setup is done. it doesn't guarantee
that it has an infinite time slice, but it makes the startup sequence
more deterministic.
2025-10-26 13:35:57 +08:00
bunnie
21c9089de2 make pre-emption controllable 2025-10-26 13:35:35 +08:00
bunnie
6dd2a1f554
update dependencies for keystore 2025-10-26 02:00:19 +08:00
bunnie
ba91aa5b58
Add audit code for the keystore
the snippet `attack_keystore()` is left in place along with hints
on how to attack the keystore. Nominally, the attack should fail,
but there are some critical pre-assumptions that can be violated.

I am interested in knowing how robust those assumptions are, so,
documentation and sample code is provided to would-be attackers.

Do me a solid and if you do find a vulnerability, open an issue
ASAP and let me know. Full well aware that some vulns may well
be unpatchable; it is what it is. Hardware is hard, but maybe
we can work together to make it better.
2025-10-26 01:57:06 +08:00
bunnie
f68cc0ba83 reorder some bao-video operation for a cleaner init sequence 2025-10-25 22:55:23 +08:00
bunnie
37ff052b34 chunk data to the USB subsystem
the chunks match the size of the application buffer, eliminating
the possibility of an overrun (of the buffer at least)

there is a possibility still i think of overrunning USB itself
but i think the CPU can't produce data fast enough to actually
do that.
2025-10-25 22:23:36 +08:00
bunnie
8a3e9ea3f5 fix crlf issue in logging crate 2025-10-25 21:36:46 +08:00
bunnie
63b848df28 fix timing interval to match the CPU clock frequency 2025-10-25 21:36:21 +08:00
bunnie
5fb7743d3b add preemption timer to the kernel
we can use the TIMER0 mechanism now that this is available in NTO!
2025-10-24 21:10:19 +08:00
bunnie
8f208cac4c
refactor debug-print in bao1x-hal
on dabao targets the duart is unavailable, so, it's convenient to
have a uart-based debug option in the HAL. this patch creates a
flag that can allow either target.
2025-10-19 01:19:30 +08:00
bunnie
dbb0a75118 bump versions
have to absorb a version change due to xous-semver change

might as well also update the utra/svd generator dependencies
since that's been held off for a long time now.
2025-10-06 13:23:18 +08:00
bunnie
6d4f8004d3 fix breakage associated with changes to xous-semver 2025-10-06 13:17:21 +08:00
bunnie
140f1ae538 add dabao support to usb-bao1x
the minimal set of envisioned services for the dabao would
include a USB handler. Seems like too useful a thing to not
have it enabled.
2025-10-05 17:17:31 +08:00
bunnie
4069b623c4 add note about where to get dabao console from in bao-console 2025-10-05 17:17:07 +08:00
bunnie
e00606538c add SE0 release to userspace usb driver 2025-10-04 16:21:34 +08:00
bunnie
8e4d1d047f remove debug prints from usb userspace
these conflict with the kernel debug prints.
2025-10-01 23:34:53 +08:00
bunnie
d3c55b218f turn on the power supply for the camera 2025-10-01 23:34:35 +08:00
bunnie
b86664d279 move camera clock pin setup into the camera driver in Xous.
previously this was setup in the loader, which is a bit of an
abstraction bodge.
2025-10-01 15:00:40 +08:00
bunnie
d265ce3398 note deprecated pin config 2025-10-01 02:56:40 +08:00
bunnie
889262d20c remove font mapping from bao-video; fonts are now in our space by default 2025-09-25 16:12:47 +08:00
bunnie
0fe5fcdc35 this autogenerated file should not be in the tree 2025-09-24 01:09:19 +08:00
bunnie
ff6ff8841a fix missing api in precursor target from previous PR
also fixup some warnings from the new rustc.
2025-09-21 23:33:37 +08:00
bunnie
0b1f2796f7 for hwsim target make xous-log output to the duart
this removes the kernel log but you have the verilator sim trace
to debug things
2025-09-20 22:12:19 +08:00
bunnie
179e178e96 fix up formatting that changed due to the flag day 2025-09-18 21:31:54 +08:00
bunnie
1255bf12d9 FLAG DAY: fix all names to harmonize around 'bao1x'
The code base had evolved through several code names, interim
names, company names and chip names that alternatively did or did
not exist.

Baochip is the definitive name of the company, and the Baochip1x
(full part number BAO1X2S4F-WA) is the definitivey part number of
the SoC. For convenience, the part number is shortened to 'bao1x'
in most feature flags and variable references.

This commit fixes all of the odd names and removes some unmaintained
early targets.
2025-09-18 21:25:51 +08:00
bunnie
edf5206846 test code for shutdown/keep-on
at the moment not working, will resume debug once new rev of board
is back.
2025-09-18 20:19:48 +08:00
bunnie
e697b2da77 add bio pin setup handler for xous env 2025-09-14 02:14:41 +08:00
bunnie
b0d2a18122 add some debug info for spurious irqs 2025-09-13 16:18:15 +08:00
bunnie
9b515a042f add serial port library functions and handlers
this creates hooks for applications to listen to the serial port,
as well as to send and receive data. some improvements to code
ordering for readability are bundled in this as well.

very lightly tested, most of the code comes from other more tested
code in the Precursor stack.

the TRNG test stuff is not put into this stack because I think
it belongs in the baremetal environment, as it's only ever
run for characterization. We don't need to bog down the production
stack with test code.
2025-09-13 15:37:08 +08:00
bunnie
890c311102 make the logger serial path more robust to failures
the logger should not fail under any circumstances, so
any errors in the USB stack should be ignored.
2025-09-13 15:36:36 +08:00
bunnie
7f5a288090 add some commands for testing the serial console & port setup 2025-09-13 15:36:16 +08:00
bunnie
5dae83d404 improve panic screen formatting 2025-09-13 15:35:34 +08:00
bunnie
c47334704a PoC USB serial on top of the HID modes.
this now works with windows, after much testing and patching.
2025-09-13 01:12:12 +08:00
bunnie
b99da45c38 fixup dependencies to point to local fork versions
the local forks are needed to layer in high speed support,
debug, and a couple of other minor improvements.
2025-09-12 02:51:19 +08:00
bunnie
1b9c0c7143 gate off duart mapping when not debugging deep in the usb stack 2025-09-12 02:50:45 +08:00
bunnie
d20a1e4ed9 gate of unused functions without mass-storage 2025-09-12 02:50:24 +08:00
bunnie
e79f907bb7 add basic usb-serial support
some test code to echo characters back, needs to be improved
fix some reset edge cases, needs more work as stack still
does not enumerate on second plugin
2025-09-12 02:49:21 +08:00
bunnie
08aa40e557 add ctap protocol testing routines 2025-09-09 23:11:30 +08:00
bunnie
0df2cb73f7 fixup bao-video deps 2025-09-09 22:24:55 +08:00
bunnie
5ff4b6c317 turn off debug-print by default in usb 2025-09-09 22:20:02 +08:00
bunnie
1cd6a3c4d0 clean up warning 2025-09-09 18:41:25 +08:00
bunnie
16b3c43e31 get OUT packets working; in particular, HID/U2F seems good to go 2025-09-09 17:53:47 +08:00
bunnie
51adf0e76c clean up interrupt handler & remove page allocation from handler
handler works in an interrupt context, so it can't allocate
a page to return data. this cleans up that problem, and also
removes some redundant brute-forced checks that were copypasta
from previous merging of several routines.
2025-09-09 17:52:12 +08:00
bunnie
5978de6a22 cleanup warning 2025-09-09 17:51:48 +08:00
bunnie
9931daf131 fix broken links from rename 2025-09-08 17:21:49 +08:00
bunnie
6cf4757323 rename usb-cramium to usb-bao1x 2025-09-08 17:21:32 +08:00
bunnie
75a9373fea fix AES dependencies so that the correct acceleration is enabled
This relies on a trick I was not aware of previously, which is
that transitive dependencies absorb the additive set of features
enabled within a crate.

see

https://doc.rust-lang.org/cargo/reference/features.html#feature-unification

for the full description. but basically by referring to the feature
required in "aes" despite not being used in the crate but pulled
in by aes-gcm-siv, i can ensure that the transitive dependency
is in fact used.

I think this was always there but previously I just didn't understand
it correctly or didn't use it right when I tried to deploy it, but
this time I think I got it right.
2025-09-07 11:50:12 +08:00