Commit graph

1074 commits

Author SHA1 Message Date
bunnie
0d1105fb25 fix index selection in menus 2025-11-12 16:26:35 +08:00
bunnie
564374dfd3 cleanup menu implementation warnings and shallow bugs 2025-11-12 15:28:11 +08:00
bunnie
93547fa2cd add ephemeral api 2025-11-12 15:27:55 +08:00
bunnie
c168c7d720 update ui to use builder pattern 2025-11-12 15:26:17 +08:00
bunnie
785293a440 add menu widget implementation 2025-11-12 13:15:07 +08:00
bunnie
54f476edd3 fixup hosted mode emulation for baosec 2025-11-08 04:20:30 +08:00
bunnie
99769d4622 cleanup the keystore api 2025-11-08 03:52:03 +08:00
bunnie
50962a6ba6 cleanup warning in latest rust
pointers to font tables are conjured out of thin air and
the standards have changed on how to do this.
2025-11-07 00:36:57 +08:00
bunnie
d91c2e7671 fix API to reflect that the 0-state is the most permissive state 2025-11-06 14:10:00 +08:00
bunnie
12d0728582 shorten the generic identifier
make it long enough that it's unlikely to have two identical
ones randomly connected to the same machine

but short enough that it's likely/conceivable to have a collision
2025-11-06 14:08:48 +08:00
bunnie
2d7ee0c614 ensure security bits are set according to -A1 stepping
in some modes these don't get side-effected elsewhere so make
sure they are set correctly upon entering the next stage
2025-11-06 14:08:05 +08:00
bunnie
aaf1cbd2f9 add base routines for deriving & controlling serial numbers 2025-11-04 13:13:52 +08:00
bunnie
0b92da5bab add better locking on core USB object
there is a lock that happens in serial console interactions with
local echo where the instant feedback of a character entered causes
the USB object to be locked when the interrupt handler enters to
receive a character that was just sent.

The fix to this is to add the ability to disable interrupts before
entering a critical section (such as enqueuing data for a write)
and then re-enabling after tha section is done.
2025-11-03 08:00:31 +08:00
bunnie
9d3da626f2 handle case where driver is called too early, before everything is setup 2025-11-02 10:37:04 +08:00
bunnie
d901c61846 modify boot sequence to generate keys for a dabao environment
also update the audit to check the respective flags
2025-11-01 23:56:47 +08:00
bunnie
26078dcc7d add keystore to dabao configuration
After some contemplation, we should include the keystore in the
core service set featured by the dabao-xous configuration.

The pros are: any compatibility/sharing of resources
that require access to RRAM, one-way counters, UUIDs, etc.
will either require a wholly separate implementation that is
"insecure" or it could just reuse the baosec work. Furthermore,
as cryptographic accelerators are laid into the keystore,
the APIs become available to the dabao environment

The cons are: more space is used in a space-constrained
dabao environment (roughly 140k "deadweight" at the start, but
as cryptographic APIs get layered in this can grow substantially);
the key slots are "used up" in part by the scheme, which leaves
less key slots available for user-defined purposes.

This is mitigated by the fact that there are a couple thousand
key slots, and so even though we use a couple hundred of them
it's still not the whole range.

Also, the baosec/dabao feature flag can be used to feature-out
cryptographic APIs/accelerators that are too obscure or not
useful for the dabao environment, to "lighten up" the
firmware load.
2025-11-01 22:59:07 +08:00
bunnie
ea43e9248a cleanup dangling debug code 2025-10-31 09:01:02 +08:00
bunnie
0c522ce914
refactor identify_flash_reset_qpi() to be all-in-one command
identify_flash_reset_qpi's behavior has been revised to
include setting all relevant parameters so that the device
that is identified behaves identically to the model device
(e.g. Macronix), to the extent that it is possible. This
includes setting the QE bit.

The routine to check QE has been renamed to `flash_ensure_eq()`
to reflect that it is safe to call multiple times: it checks
if the bit is already set, and if so, doesn't do anything.
Thus it can be routinely called without worry of wearing
out the device.
2025-10-30 14:56:04 +08:00
bunnie
94e1f6044a add spim flash autodetect routine and partial support for xtx devices
xtx devices still not fully working, but at least able to switch
in and out of spim modes in the face of uncertainty over which
device type is present.
2025-10-30 04:13:37 +08:00
bunnie
a14c093da8 enable pullup on SE0 for dabao 2025-10-29 03:42:49 +08:00
bunnie
c827a0ed12
add swap key slot 2025-10-28 18:50:09 +08:00
bunnie
82a47602c2 improve std interface for bio
- imem accessors are static-mapped slices
- AtomicCsr is used so that the bio structure is Sync allowing
it to be shared across threads
2025-10-28 18:01:17 +08:00
bunnie
52198821b0 cleanup typos 2025-10-28 18:00:38 +08:00
bunnie
c159ddd214
cleanup std interface for acram ranges
need to register memory windows to the rram object so that
writes can succeed in a virtual memory environment
2025-10-28 17:58:51 +08:00
bunnie
d10274b9ec
fixup pio->bio typos
also fixup a return-type bug in the std implementation for
bio pin settings

much more bio abstractions will be needed, but for now,
this branch is just focused on the keystore.
2025-10-28 17:57:33 +08:00
bunnie
6e41294854
only clear ACLs that need clearing
also clean up some comments/docs and increase visibility
of the security constant for RRAM so that it can be applied
early in boot
2025-10-28 03:36:12 +08:00
bunnie
290a662bc3
add pubkey block to the data sets, fix nuisance key range
just learned of another ECO incoming that will tie the key
and data areas together in terms of access control from
the IFR region, so the nuisance key range has to have
its access control redefined to steer clear of the data
slots allocated that have write-protects on them.

pubkey block is added to the data ranges

also a oneway counter to keep track of pubkey validation
failures in boot0 is added
2025-10-28 03:33:15 +08:00
bunnie
e6bef77b5f
change boot1 default behavior
The motivation for this is to make the tester configuration
exactly identical to that used in production. Right now a
"cheater" step is used to set the board type to dabao and
enable boot waiting because in the test environment there
isn't a physical switch anyone can press to invoke that
behavior.

So, in order to get the test environment to work just like
production, the behavior goes from insta-die if no valid
image is found on the next stage, to "wait for new image".
This is slightly less secure of a default, but only slightly
so. Basically the previous scheme required someone to be
physically present to press the "give me a new image" button,
this one causes the system to automatically accept a new image.
I suppose the main downside is this does allow the possibility
of say, a fully remote, automated exploit to be delivered
if an adversary can damage the loader image such that it
doesn't pass signature check and then it will automatically
go into a mode looking for a new image, at which point
an arbitrary image could be potentially loaded (although
because the image would need to be signed, and there is
a trap that destroys secrets if a developer image is
presented, it wouldn't instantly lead to secret disclosure,
but it would be a denial of service).

The flip side is that with the paranoid default, developers
are "confused" by the silent failure of a brand new chip that
has no code loaded in it (because it goes catatonic until
the developer knows to press the load button).

The loader image is protected from writes after boot, so
in theory there isn't a direct path to "spoil" the loader
image and trigger this path, so it's not like we're just
hanging in the wind. It just means that there isn't a
full human-presence requirement as a defense in depth against
a potential denial of service if an adversary could find
a way to spoil the loader image.

If the DoS path is a concern, one option is to configure
the system such that the developer key is revoked. This
would disallow that from being recognized as a valid
image, and would also prevent the DoS from happening,
as it would require the adversary to present a valid,
signed image which presumably they can't as long as
the signing keys are kept safe.
2025-10-27 18:22:00 +08:00
bunnie
70a0b62014
rram handler for std environment
rram handler for `std` requires the following additional features
over baremetal:

- mapped pages list, because a process has to "own" a page of RRAM
before writing to it. It's anticipated that the rram writer hardware is
"owned" by the keystore, so all write-access will be mediated by a
service in that PID

- irq-context handling of writes. this prevents writes from being
detached from their staging data, or other concurrent writes
from conflicting.
2025-10-26 22:18:23 +08:00
bunnie
fc3da61307 add duart debug support for std environment 2025-10-26 22:17:37 +08:00
bunnie
775726af23 standardize BAUD_RATE location
also slow down pre-emption timer a bit, on a slower system
like ours 100Hz is less overhead
2025-10-26 19:30:49 +08:00
bunnie
4e522873f0 add preemptionstate opcode to the hal api 2025-10-26 13:38:28 +08:00
bunnie
1c435909a2
fix the sense of the access permission bits
I had read the docs as saying 1 is denied access, but in fact,
1 is allowed access, at least empirically.
2025-10-26 01:55:27 +08:00
bunnie
bce08a1d27 clarify comments on coreuser protection 2025-10-26 01:46:57 +08:00
bunnie
0a1813b28c fix off by one in assert statement 2025-10-25 21:37:19 +08:00
bunnie
d11d2f8cd5 modify default voltages; normalize the setting location 2025-10-25 01:37:21 +08:00
bunnie
c92af3c25a fix up pin mappings for v2 board release 2025-10-25 01:30:58 +08:00
bunnie
d44f489a83 map out PID 0's access in going to secure mode 2025-10-24 21:16:00 +08:00
bunnie
04d46b9549 update location of system timer interval definition 2025-10-24 21:12:00 +08:00
bunnie
caf6fc3a61
Implement erase_secrets() on entry into developer mode 2025-10-21 23:46:06 +08:00
bunnie
391af0313f
fix typo 2025-10-21 19:15:22 +08:00
bunnie
917154ae74
fixup coreuser settings
the more i test things the less confidence i have.

this fixes up a missing table entry in the table definition,
and then also adds a bypass routine - this is not actually
a hidden vulnerability, it's an explicit vulnerability until
the protect() routine is called. But it looks like we may have
to exploit it in order to transform our userstate in
the bootloader to one that has write-access to keys in order
to erase them in case of a developer boot.
2025-10-21 19:12:30 +08:00
bunnie
be038e56aa
cleanup comments
figured out why the data region acl wouldn't write - had
to be in boot0 declared mode
2025-10-21 19:11:52 +08:00
bunnie
e3140609e4
designate the eraseable keys
only some keys are marked as writeable to harden against
potential oracle attacks, i.e., if we made all keys
erasable and an oracle attack was found, then the entire
key region can be exposed by the oracle attack.

Instead, some key material always persists, but a sufficiently
large amount of seed material is erased such that the key is not
recoverable by guessing the key.
2025-10-21 19:08:35 +08:00
bunnie
3e4b0b6571
Add bao2 signing keys 2025-10-21 02:39:11 +08:00
bunnie
2559ddd02d
stash state on some issues in ACL setup
the key setup seems to work correctly
but the data ACL setting doesn't "stick". The region
could be write-protected by some other element in the
CP/IFR config, need to dig a lot more. For now we need
to move on and crank out something to stick on the alpha
dabao boards...
2025-10-21 02:19:40 +08:00
bunnie
2095acfe13
slot manager debug.
add read/write specs as well to the slot definitions.

Not terribly happy with how this all worked out. The subtle
differences between Data and Keys is really irritating.
it's the sort of thing you would say "let's make a trait"
for it but then the two behave just differently enough
that I worry I can't make a trait generic enough to encompass
all the weird stuff that exists in the hardware.

The existing implementation definitely looks like trait
territory, but it currently hides the subtleties around
key/data chaining and secure crypto engine handling of
the two regions as distinct entities. so long as we don't
plan to use those things, traits are a good idea, but
i don't feel like I can reject using the crypto engine
features out of hand this early on just to make the
APIs nice and square.
2025-10-20 23:32:29 +08:00
bunnie
5c60de32ce
debug the slot manager and rram APIs 2025-10-20 23:31:01 +08:00
bunnie
0943b67972
implementation of the ACL APIs and coreuser functionality
'coreuser' is a slightly confusing term from the hardware
system because it's overloaded to mean some conceptually
related items that aren't implementation-wise essentially linked.

coreuser defines both some access protections on the main
array of the RRAM, and also some access protections on key
and data slots.

this patch includes some code that sets up the coreuser
functionality to a very simple scheme where just one PID
is trusted and the rest are not trusted. More complicated
schemes could be introduced with varying levels of trust
and dependencies but I like the analytical simplicity of
two states, so let's start there and complicate only when
absolutely necessary.
2025-10-20 02:15:20 +08:00
bunnie
a64337679f
Add API for defining key/data slots, and initial ranges for the same
Data and key slots are hardware access-controlled areas that
can store sensitive data. Slot definitions come with a "spec"
field that defines what the access controls *should* be,
so that we can check them later.

In practice no user code should be manipulating these, but
there is an initial stage where a totally blank device needs
to be provisioned, hence the focus on correct specification
and checking of state, rather than convenient runtime manipulation
and update of the same.
2025-10-20 02:07: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
fe4ef1bc39
refactor rram API
- add range checking to control access to main array or secure
array. This is purely a software enforced check, but it is in
theory backed by hardware gating that is a back stop in case
an adversary can gain arbitrary code access
- rework the rram primitive to return an error type
- add a `std` implementation stub. It is still missing an IRQ
context handler which ensures that all RRAM writes are atomic,
e.g. you can't take an interrupt in the middle of an RRAM
write because it would screw up the buffer staging.
2025-10-19 01:09:58 +08:00
bunnie
951f088625
add coreuser templates
coreuser is the signal that sets the security level of the system
2025-10-19 01:09:15 +08:00
bunnie
39ceef55f3
Add protected-rram module
this lays the foundation for access control, data slots,
key slots, etc.
2025-10-19 01:07:44 +08:00
bunnie
b59bff2223 cleanup/redefine keyslot regions 2025-10-19 01:06:54 +08:00
bunnie
a40bb7c244 other half of the adjustment 2025-10-18 01:16:16 +08:00
bunnie
3b4e035a4f
revise auth_data handling for key header block
auth_data actually changes with each signing operation (ostensibly
to prevent replay of signatures coming from tokens) so it has
to be presented as data parallel to the signature, instead of
as a static filed baked into the key header.

This commit revises the header record to reflect this organizatio
of data and also revises the signature check to be in-line
with the protocol.
2025-10-06 23:31:02 +08:00
bunnie
7d6630b7ec fix one way counter offset calculations 2025-10-06 23:24:42 +08:00
bunnie
03ea3c9d0c changes to the apis to accommodate the public key record format 2025-10-06 15:20:34 +08:00
bunnie
a1a5ff1592 add public key templates
Beta/developer keys are fully filled out.

Placeholders for production signing keys are also provided.
2025-10-06 15:19:19 +08:00
bunnie
3c68eea714
Merge branch 'main' into signing 2025-10-06 13:45:29 +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
69d81042b9 upgrade signature check to handle domain separation data
this is needed to handle the fido2/webauthn style signatures
2025-10-06 03:49:11 +08:00
bunnie
95f192ca38 add dabao target 2025-10-05 17:15:05 +08:00
bunnie
01a78e4474 fixup app region start and add freq/voltage configs for board targets
this is the agnostic version of all of the board targets, which
allows the boot1 to lookup based on the current configuration
which configurations to apply.

I think I've talked myself into giving away $0.20 of parts with
every dabao board so that everyone can run at full frequency.
Originally I thought I'd limit to the minimal configuration with
low frequency operation but since this is the main developer
platform all the benchmarks and first impressions will come
through this board. Crippling it with a slower clock frequency
by omitting the supplementary digital regulator seems
short-sighted, even if it means up slightly subsidizing things
with this extra cost.
2025-10-05 17:12:40 +08:00
bunnie
c6fb0565ff add frequency/voltage exports from api into the hal
also cleanup some small debug messages
2025-10-05 17:12:04 +08:00
bunnie
2f5af89547 make the swap header length explicitly controlled
previously it was just "4096" in the image writer
2025-10-04 18:52:30 +08:00
bunnie
c86844a39a make signatureinflash structure data
this cleans up one unsafe step where we have to assume an
alignment of the data at the cost of the structure being copied
to stack. I think this is a fine trade-off.
2025-10-04 18:51:34 +08:00
bunnie
b91d54c5cf add SPIM optional target for signature checking
this allows us to check the signature on stuff in off-chip swap
memory through the SPI interface.
2025-10-04 18:50:49 +08:00
bunnie
7f9b783027 mirror board constants from API; make SPIM channel a const
this implements the API/HAL split on the HAL side, and also
reveals SPIM channel as a constant that can be just read out
so that spim accessors that need to build from raw parts
can do it without having to re-allocate IOs.
2025-10-04 00:53:22 +08:00
bunnie
869da85ef7 add swap descriptors as structures; add offsets for boards
In the API layer, the boards aren't setup with convenience flags.
they are all laid out and the caller needs to know which board
it's trying to resolve. This is because the API layer is agnostic
to board and assumes the tool working with it knows what board
it's working with already.

The HAL layer tries to hide the board-specific stuff, and so
API defines are re-imported there in a board-transparent fashion.

Also add swap descriptors to the API crate, so that the image
generation tools can refer to the exact same structures as
are used inside the code, simplifying image creation maintenance.
2025-10-04 00:51:25 +08:00
bunnie
07e7197517 upgrade the sigcheck boot routine to pass kernel arguments
all other boot modes would get an a0 with the address that the
kernel is "supposed" to be located. this is neither security
sensitive or problematic.
2025-10-01 23:36:14 +08:00
bunnie
ec9aed29dd fix kernel offset so signature doesn't shift the image
the image needs to be page-aligned so it can do direct-map
to memory.
2025-10-01 23:35:24 +08:00
bunnie
e77d412bad extract the peripheral reset line 2025-10-01 14:29:04 +08:00
bunnie
346d7cd4d4 indicate the space for the marquee line on the boot logo 2025-10-01 14:28:45 +08:00
bunnie
03744c2dca ops are no-std stafe 2025-10-01 14:28:13 +08:00
bunnie
2eaaa99f6e fix kernel config conflict
no signature checking is necessary in the kernel so don't
introduce the dependencies
2025-10-01 02:57:55 +08:00
bunnie
cdb60eed0f update the static table definition 2025-09-30 21:52:45 +08:00
bunnie
dec6c1944b add overflow handler to big reads (to fake big disks) 2025-09-30 17:28:42 +08:00
bunnie
cade3980cc fix double-offset error in oneway counter readback 2025-09-30 00:37:57 +08:00
bunnie
15562abf00 add functional code slice
this puts a domain separator in every signature block
a domain separator meaning, even though the same private key
maybe be used to sign multiple blocks, because a functional code
is embedded in the block that is tied to the block's function, you
can't take a pre-signed block and shove it into another block's slot
and expect it to work.
2025-09-29 22:17:56 +08:00
bunnie
e7135d9e80 narrow down functional codes allowed for signature validation 2025-09-29 22:17:09 +08:00
bunnie
f8e124f6f9 limit writeable area to the active data area
the top of memory is reserved for various security structures

the security structures do have some hardware protection

but life is better when we also help programmers avoid triggering
the protections by accident and then just being confused.
2025-09-29 18:41:29 +08:00
bunnie
0d8cf34b18 add docs to sigcheck routine and fetch public keys from the specified source
this fixes the issue where we're asking an untrusted image to
tell us what keys to check it with :P ~~~
2025-09-29 16:22:16 +08:00
bunnie
ba817cc1a9 add uf2 identifier for baochip-1x
just pulled it out of a uuid generator, checked it has no
collisions. At some point, maybe some official repo will allow
us to be "real" but ain't nobody got time for those politics
today.
2025-09-29 16:20:43 +08:00
bunnie
150e46d9c0 restructure the HAL's security primitives
- combohash constants are moved to API: these need to be in a
dependency-free library so that we can refer to these values in
any context without creating circular dependencies

- sigcheck code is now put into the HAL layer, instead of in the
individual bootloaders. This is because the sigcheck code is re-usable
between boot0/boot1.

- sram timing trimming data has been entered from the XLS file
and put into an array for easy access

- more board initialization functions have been adedd, and cleaned
up to adhere to the rule that pin allocations don't change the state
of the pins, allowing pin allocation calls to be idemptoent (e.g.
you can call it several times without negative effects - the reason
being that the pin setups also return the pin maps, which can then
be passed to the functions of interest to manipulate the pin states)
2025-09-29 13:42:23 +08:00
bunnie
c6445c9a9b add an API for accessing one-way counter values
A macro is added, a bit like this one:

```
encode_oneway! {
    #[offset = 80]
    pub enum BootWaitCoding {
        Disable,
        Enable,
    }
}
```

Which encodes possible one-way counter states along with their
offset in the one-way counter array.

The states in the enum correspond to the evolution of the counter,
modulo the number of elements in the enume.

The macro also creates a getter for the states, and an incrementer
to try and make this whole process less error-prone.
2025-09-29 13:40:14 +08:00
bunnie
f8967ebaec fix offsets in one way counter implementation 2025-09-26 22:57:27 +08:00
bunnie
094207fe40 add signatures API
this allows us to generate signatures using the same API
that we use to check 'em.
2025-09-26 22:56:19 +08:00
bunnie
9434bb5383 style_macro is how fonts are added to bao1x
By adding a resolver to a given glyph set, the glyph set is
automatically pulled into the image.

Glyph set is now co-located in the bao-video process, instead
of the loader.

The orignial argument for putting the font data in the loader
is that it's a large, static blob; by putting it in the loader,
updates can be more compact, and fonts don't need to be schlepped
over every time you have an application update.

This came with consequences. It made verifying the loader more
complicated (because its memory space is split between the graphics
manager and root keys). It also means we have to fix the partition
size for the loader at "fairly large" for fonts, even if we don't
need all of them in all of the configs.

With baochip, we have swap memory! Off-chip memory is cheap and
only the fonts actually used by the host get mapped into main memory.
This means we don't have as much of a trade-off in terms of
cost for fonts if we put them in off-chip swap storage. Also,
the updates are split between swap and main memory, and the roadmap
includes an item for swap to be individually loadable programs
so that if the video server doesn't need an update, it won't be
pulled into the update set.
2025-09-25 16:08:36 +08:00
bunnie
7724e38ca1 cleand up fontmap 2025-09-25 16:08:27 +08:00
bunnie
2d5039568c genearted artifacts corresponding to template update 2025-09-25 16:08:06 +08:00
bunnie
f30ab0d98e remove fonts from loader for bao1x: update codegen template 2025-09-25 16:07:31 +08:00
bunnie
26fefa7e5b add modules and bitflags to bitbybit migration todo 2025-09-24 01:03:43 +08:00
bunnie
cd182e9efc remove Drop on no-std
this saves a whole bunch of glue code that never gets called
in no-std
2025-09-24 01:03:09 +08:00
bunnie
d02df71bf1 beginnings of ACRAM support 2025-09-24 01:02:53 +08:00
bunnie
497bb74624 add combohash support 2025-09-24 01:02:39 +08:00
bunnie
a3a7bf9f3a add a format for passing static initialized data to baremetal
a small, 256-byte record is added to the top of baremetal records
that is a "poke table" that incorporates what values to put where
for baremetal targets, as well as a zeroization region.

This is generally more efficient because most values are set to
zero, and the only things that generally have a non-zero value
are 'static' variables, which are used extremely sparingly.
2025-09-21 21:50:48 +08:00
bunnie
5151553028 fix dabao target for lib1x-hal
this is the "effective" traget for simulation: no external
peripherals expected.
2025-09-20 22:16:16 +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
04088d15d9 update TRNG tuning parameters to match NTO tape-out
performance is much better, ~7.9834 bits entropy/byte on the
raw RO now.
2025-09-18 20:18:07 +08:00
bunnie
a65917707b propagate name change to legacy lib 2025-09-14 02:15:04 +08:00
bunnie
e87501f14d move debug lib in bdma so we can gate it on/off more easily 2025-09-14 02:10:10 +08:00
bunnie
0391a6aef5 fix naming for bio api 2025-09-14 02:09:40 +08:00
bunnie
a4d9fc9dc7 add bio bit setting and also add input bit mapping to board file 2025-09-14 02:07:42 +08:00
bunnie
514b27eb18 add pio bit setting to api 2025-09-14 02:07:14 +08:00
bunnie
f094c22eaa add some notes moving toward trng characterization on new chip 2025-09-13 23:29:27 +08:00
bunnie
a077e9c617 fix IRQ mapping on board description 2025-09-13 16:17:47 +08:00
bunnie
e4d230f42e fix plug/unplug not ready error 2025-09-13 15:35:57 +08:00
bunnie
ff499f7c09 bookmark some usb-device debug config 2025-09-13 01:11:41 +08:00
bunnie
bd50819fa0 fix EP0 receive issue in usb-device
usb-device has a limitation for this hardware in that it can't
initiate an ep0-receive. It has a hook for flipping ep0 from
IN to OUT (as a modal thing) but for our stack you need to
explicitly setup EP0 to receive - an exact amount of data based
on what's expected - exactly at the point of the setup packet
arriving saying an OUT transaction is pending.

The hack to work-around this is to simply intercept those setup
packets in the handle_event_inner() interrupt handler and initiate
the receive. In fact, the data is completely ignored (in our
application it's setting a baud rate which is fictional in our
system). However, clients such as windows will time out and
refuse to communicate if the OUT packet is not ACK'd, even if
it is ignored.
2025-09-13 01:09:11 +08:00
bunnie
82c5b7e970 add per-ep app pointers
this fixes the read/write looping issue
2025-09-12 15:45:10 +08:00
bunnie
faaa1ad4b9 significant code cleanup on the usb driver
- endpoint allocator now handles more edge cases. likely there
are still more weird cases to be considered, but it at least
handles the CDC-ACM case of a lone interrupt endpoint that
can't be mix-and-matched with other devices

- initiate OUT to kick off reads

- remove dead code

- handle bulk and interrupt cases for both read and write

- clean up reset edge cases - still more work to do there,
the stack does not recover on second plugin

- better debug output
2025-09-12 02:46:57 +08:00
bunnie
9609a6d66e point to forked version of usb-device, increase control buffer size
larger control buffer is needed for composite descriptor to
fully write and send
2025-09-12 02:46:16 +08:00
bunnie
659296f672 add support for USB serial in baremetal targets 2025-09-11 00:54:02 +08:00
bunnie
c2df76b59b remove floating point print to reduce code size 2025-09-11 00:53:48 +08:00
bunnie
55f1c805a0 fix EP number to 4 (8 PEI) 2025-09-09 23:57:50 +08:00
bunnie
200f71eba8 settle on the safe config for the USB driver
set to 4 endpoints because that's what we know we have for sure
2025-09-09 22:23:01 +08:00
bunnie
50e3899028 make it so that double-debug alloc doesn't cause insta-failure 2025-09-09 22:22:41 +08:00
bunnie
06ad86a0fc fix ifram allocs for usb so usb+camera can run simultaneously 2025-09-09 22:22:16 +08:00
bunnie
19620d800f some tweaks to accommodate a possibly larger ep_num 2025-09-09 18:40:52 +08:00
bunnie
bcd8120ea3 tighten up the USB memory usage 2025-09-09 18:17:51 +08:00
bunnie
e0ad3e1831 match up EP requests to pending data
previously we had no way to correlate an incoming packet
to an actual read from the USB stack because we didn't store
the EP that originated the request

This fixes that issue and also passes on the pending EP requests
correctly to the rest of the stack
2025-09-09 17:50:45 +08:00
bunnie
8739eb6bf7 cleanup test code 2025-09-08 10:29:42 +08:00
bunnie
00db7d108d upgrade link to high speed 2025-09-08 09:52:20 +08:00
bunnie
1c4ed2944c fix mirror/flip of camera 2025-08-20 03:06:45 +08:00
bunnie
11fb1452c9 cleanup the initialization code some more
move the full mem initailization above the memory load/store
pipe cleaner, and have the memory load/store actually do a load
and not just stores.
2025-08-20 01:49:48 +08:00
bunnie
ffc226b9a8
Merge branch 'main' into nto-bringup 2025-08-19 19:51:16 +08:00
bunnie
53c4485387 more warnings 2025-08-19 19:46:23 +08:00
bunnie
ecbac27e76 fix rustc-1.89 warnings 2025-08-19 19:45:29 +08:00
bunnie
49484bb93d add power management pins to board description 2025-08-19 19:01:26 +08:00
bunnie
bdd8b727a7 add get dcdc routine to axp2101 api 2025-08-19 19:01:03 +08:00
bunnie
cd58323541 fix uart divider commit
needs to disable uart before the new values can take
2025-08-14 14:10:26 +08:00
bunnie
b4ffcfe11a add stack dump as a macro in the lib for cramium-hal
I have a feeling this won't be the last time I want to use a
utility like this during bringup...
2025-08-14 03:28:48 +08:00
bunnie
891489f789 cleanup stack tracing code 2025-08-14 03:28:27 +08:00
Sam Chin
d02970c264 now with read 2025-08-13 18:53:33 +08:00
Sam Chin
7af77a1d10 can now set multiple clocks on multiple fifos 2025-08-13 15:34:39 +08:00
Sam Chin
f9cbf14d19 now the pins can toggle without impacting capsense since I removed reset 2025-08-13 14:52:50 +08:00
Sam Chin
a6643a3314 moving square wave generator over - it does not play nice with other things right now 2025-08-12 21:19:29 +08:00
Sam Chin
ba997be92f working modular gpio with all bio cores 2025-08-12 20:35:02 +08:00
Sam Chin
a5e95c9c6d pin up works for core 0 via lib 2025-08-12 19:39:56 +08:00
Sam Chin
db7690210a pin up in library 2025-08-12 17:06:42 +08:00
bunnie
cb1f82ecc8 add changes to work around BIO code issue
there is either a code bug or a compiler issue that is causing
something on stack to be smashed that is causing trouble for
the code base as a whole. Or it could be improperly initialized
statics? unclear. this needs to be worked through.

however, a series of changes were made that make the code
work. The biggest tell is that the code generally works perfectly
when optimizations are off, but when optimizations are on some
shenanigans have to happen to convince the compiler to not split
constant values across the entire arc of the function. More
diagnostics to follow.
2025-08-11 15:00:09 +08:00
bunnie
c9f1e29907 commit a "magic state" that seems to be able to get BIO core 3
unwedged
2025-08-10 22:32:13 +08:00
bunnie
1a9b4e48ef leave bread crumb about the upgrade to HS usb 2025-08-10 16:08:44 +08:00
bunnie
7dd0ffaadd update board definition to NTO/baosec production pinouts 2025-08-10 01:50:26 +08:00
bunnie
38bd899c9f prep table for changing h/v flip 2025-08-10 01:50:02 +08:00
bunnie
b2ec951774 add SOF_SYNC feature to camera driver - new in NTO 2025-08-10 01:49:18 +08:00
bunnie
a22cf7f58c add more debug feedback in tests 2025-08-08 03:37:43 +08:00
bunnie
ca105f4be8 cleanup some more cache_flush refs 2025-08-05 23:02:54 +08:00
bunnie
4fbae4969b add baremetal RRAM API
this works in baremetal environment. Needs to be modified/augmented
for xous...
2025-08-05 23:00:28 +08:00
bunnie
da623ccd01 harmonize cache_flush in hal and also add rram module 2025-08-05 23:00:09 +08:00
bunnie
77d7094d3b reduce the pddb size for the vexii-test target 2025-07-21 19:03:24 +08:00
bunnie
51c5fc75be add artybio target, remove debug prints that don't map to the target 2025-06-15 01:03:01 +08:00
Sam Chin
04bf756b8e theoretically clean version which has been tested with and without the feature 2025-06-11 15:05:59 +08:00
Sam Chin
0412a401d8 no more deadcode 2025-06-10 21:51:55 +08:00
Sam Chin
2659fc0894 wip'
'
2025-06-10 21:51:55 +08:00
bunnie
1abf043005 check NACK status in i2c_await routine; update bare metal API
NACK bit is now checked after running the transaction, and if
it is set an appropriate error code is returned.

The trait implementation for i2c baremetal calls is also
updated in this commit
2025-06-07 22:54:52 +08:00
bunnie
09644f435a add CSR bank for I2C error signals 2025-06-07 22:54:10 +08:00
bunnie
34ae2011b2 sidequest - add some accessors to axp2101 object 2025-06-07 22:47:16 +08:00
bunnie
73a1714772 Modify I2C API to accommodate Nack responses specifically 2025-06-07 22:46:14 +08:00
bunnie
2c99b32e5a add an API opcode for messaging the cramium_hal_service
in the Xous context, because the IRQ banks are owned by a global
object, not every server can simply refer to the IRQ bits by just
dereferencing a pointer. Instead, it needs to send a message to
the cram_hal_service with an API number which then catches this
and does the dereference on behalf of the caller.
2025-06-07 02:46:42 +08:00
bunnie
c48c97ebdd add the hal-side implementation
this call works either on bare iron or in a xous context
2025-06-07 02:45:59 +08:00
bunnie
c24bb3a450 add irq_status_bits() trait and enum for selecting Irq bank
multiple IRQs related to the UDMA will eventually get mapped into
the global IRQ handler for UDMA. Create an enum type that will
help us differentiate this and add a trait that returns the raw bits
for a given IRQ type.

Probably a fancier wrapper should be made to interptet the IRQ
bits but unfortunately there isn't a uniform pattern to the IRQ
mappings, it's pretty much whatever fit into the IRQ space based
on the underlying function. At the moment not even sure if this
is the right register to be chasing, so we'll use this for probing
that aspect and then get fancy later, maybe.
2025-06-07 02:42:25 +08:00
bunnie
cfe9b3c845 modify base API for GlobalConfig to auto-infer the API address
the switch based on target is now absorbed into the new() function.
This paves the way for us to add more CSR ranges into the global
configuration object, i.e. IRQ csrs for I2C.
2025-06-07 01:52:25 +08:00
bunnie
6e0f6e23a1 fix warning from latest rust version 2025-05-25 14:07:58 +08:00
bunnie
0b07c58336 compactify the slider layout
this saves some empty vertical space allowing for more info
on the screen while sliders happen
2025-05-23 12:56:32 +08:00
bunnie
f8bbf97724 clean up draw list handling
our implementantation of Buffer can't (currently) dynamically grow
the size of the object to serialize things that are bigger than
a page, so we have to enforce Vec-like objects to have a serialized
size of less than the page limit.

This is a bit of a moving target because it depends on implementation
specific details. A conservative bodge was put in to try and
work around this problem for now.
2025-05-23 12:34:55 +08:00
bunnie
4c1933414c fix off-by-one error in clip rect definition 2025-05-23 10:54:55 +08:00
bunnie
0f7ad13c08 only set dirty bits for precursor-like targets
This was introducing a mysterious "line" artifact on text rendering
in new systems.

Probably need to do some real on-device testing of this change
because the automated tests won't catch a dirty bit error on
the LCD.
2025-05-23 10:52:55 +08:00
bunnie
29017766f4 handle no domain separator case in keystore 2025-05-21 18:02:43 +08:00
bunnie
70975fbff3 cleanup dependencies 2025-05-21 10:20:59 +08:00
bunnie
fa3ab1dea1 cleanup dependencies a bit
cramium-soc i think should be deprecated everywhere because
it is redundant with the board targets: anywhere you see a board
target that includes the crossbar soc it should also transitively
pull in the cramium-soc dependency equivalents.

we'll chase this out more later, but for now we're just trying
to get the PDDB to compile
2025-05-20 14:35:42 +08:00
bunnie
7947949589 add constant to precursor board file
this helps with cross-target builds...
2025-05-18 09:24:33 +08:00
bunnie
dff4dded64 remove yield_slice() in std target
This is a bad idea because yield_slice() causes the active
process to hand off to a new one (without an IRQ). However,
the idea of most flash operations is we really want them
atomic - we can't have something else decide to go and muck
with flash while say, we are waiting for a page erase to
complete. So, implement spin locking to block the CPU
during phases where the hardware operation is non-interruptable.
2025-05-18 04:25:37 +08:00
bunnie
3872ae2a1c fix comment typo 2025-05-16 19:03:56 +08:00
bunnie
450c9153f2 fix usage comments on ifram allocation for flash 2025-05-16 19:03:28 +08:00
bunnie
e2379821e6 republish xous-rs to fix cargo test 2025-05-11 15:36:17 +08:00
bunnie
8a4959056b bump version for xous crate update - commit so we can publish crates 2025-05-11 14:45:24 +08:00
bunnie
ad3e4616dd incorporate xous-rs to hal migration into keystore-api 2025-05-11 12:40:56 +08:00
bunnie
f27c78c918 add BOOKEND constants to the hal layer; add MMAP_VIRT range
BOOKEND test sentinels are moved out of xous-rs, and into the
board definitions allowing us more flexibility on configuration
board-specific test configs (before it was a xous-wide constant,
which seems a bad idea because it makes migrating test infra
hard as the manufacturing infra updates)

MMAP_VIRT as a range is also added is this commit
2025-05-11 12:34:48 +08:00
bunnie
d4f2951af5 add a HAL layer for Precursor
this allows us move board-specific parameters out of xous-rs
and into a board library that is consistent with the new board
libraries, reducing special case code for Precursor
2025-05-11 12:32:45 +08:00
bunnie
645846e32e move pddb, spinor params into the board section of the HAL for hosted
this makes code a little cleaner when porting to new targets
2025-05-08 15:59:31 +08:00
bunnie
a399702403 add proposed values for TG28 fusing & testing
include some readback testing and make addresses pub so they
don't throw warnings when not referenced in the crate
2025-05-06 19:06:44 +08:00
bunnie
3faad803d3 add catch-all operand for keystore 2025-05-06 01:47:30 +08:00
bunnie
868a1f280b move SPINOR params into board definition
this makes a lot more sense that defining it at the chip level
2025-05-05 01:47:50 +08:00
bunnie
05720032cf flesh out keystore api 2025-05-05 01:47:17 +08:00
bunnie
87140a2024 cleanup the api a bit more
realized it was dumb to have separate file paths for the
orthogonal implementations
2025-05-04 19:12:51 +08:00
bunnie
c8db01c563 re-org rootkeys-api into common and generation-specific libraries 2025-05-04 19:05:58 +08:00
bunnie
f3fa5f6c68 migrate rootkeys API to a neutral third party crate
this will allow for bridging APIs between generations
2025-05-04 18:30:39 +08:00
bunnie
d985491c7f add block erase routines 2025-05-04 03:32:52 +08:00
bunnie
7ee15b874d cleanup on the gc2145 driver 2025-05-01 16:40:46 +08:00
bunnie
6fdf868b44 make camera pins generic 2025-05-01 04:09:36 +08:00
bunnie
6d1a362735 add gc2145 to cargo file 2025-05-01 04:09:17 +08:00
bunnie
0ca3caf917 add gc2145 module 2025-05-01 04:09:00 +08:00
bunnie
d7aafc6c50 put yuv mode into the ov2640 driver directly 2025-05-01 04:08:37 +08:00
bunnie
2523b0afee gc2145 talking and up
exposure and noise levels need to be fixed, and need
to find a way to rotate/flip the screen? i think.
2025-05-01 04:07:24 +08:00
bunnie
eb7a861def Merge branch 'pddb-feat-down' of github.com:betrusted-io/xous-core into pddb-feat-down 2025-04-29 22:31:40 +08:00
bunnie
18de29f7a7 improve compatibility of api signatures 2025-04-29 22:27:59 +08:00
bunnie
bad5259f43 base64 should be an optional dependency in std
otherwise the loader breaks
2025-04-29 03:32:59 +08:00
bunnie
a5fec5a1d1 fix formatting 2025-04-29 03:19:49 +08:00
bunnie
cb35696200 Merge branch 'main' of github.com:betrusted-io/xous-core into cram-dev 2025-04-29 03:18:57 +08:00
bunnie
26464d4266 fix vertical scrollbar drawing offet bug 2025-04-29 03:10:41 +08:00
bunnie
ae5ff3addd add strings for bip39 entry in small screen mode 2025-04-29 03:02:09 +08:00
bunnie
14740d0cc1 add a numeric-priority mode to the OSK
if the pre-populated field looks numeric, prioritize numbers
over letters for the OSK.
2025-04-29 03:01:29 +08:00
bunnie
0e5410eb36 add more convenience apis 2025-04-29 03:01:10 +08:00
bunnie
9512defd2d add base64 dep for showing bip39 seeds 2025-04-29 03:00:44 +08:00
bunnie
9b5510985f initial take at bip39 entry 2025-04-29 03:00:30 +08:00
bunnie
da7efec6a6 add clone operation for gfx 2025-04-28 19:02:27 +08:00
bunnie
e55630fd57 allow for centering of list items
and make OSK entries centered

this makes the list a little nicer to navigate
2025-04-28 19:01:59 +08:00
bunnie
8be197a2b5 initial slider implementation 2025-04-28 19:01:31 +08:00
bunnie
3b0543a5f0 add supporting changes for textentry 2025-04-28 18:19:36 +08:00
bunnie
e690da3f77 add textentry implementation
includes a simple on-screen keyboard element
2025-04-28 18:18:57 +08:00
bunnie
87b4b18210 cleanup an api change in gfx visibility 2025-04-28 15:18:54 +08:00
bunnie
500df9714e an initial take at a checkbox implementation 2025-04-28 15:18:38 +08:00
bunnie
0d3563412e add more APIs to scrolling list widget
these facilitate checkbox implementation
2025-04-28 15:18:10 +08:00
bunnie
c90c449d32 make pane height adjustable
this allows for top/bottom text on modals...
2025-04-28 03:18:07 +08:00
bunnie
1ac5a55d25 cleanup height calculations 2025-04-28 03:17:50 +08:00
bunnie
a40279ef1e remove errant clear 2025-04-28 03:17:27 +08:00
bunnie
10044579aa initial take at radiobuttons 2025-04-28 02:27:41 +08:00
bunnie
39b0fb9e12 remove lifetime from builder pattern
this causes integration issues with the enum_dispatch macro
2025-04-28 02:27:16 +08:00
bunnie
c657d4db54 fix typo 2025-04-28 02:03:23 +08:00
bunnie
ac19def8df add scrollbars 2025-04-28 02:01:24 +08:00
bunnie
e56acbd243 first take at a 2-d scrolling widget 2025-04-28 01:18:25 +08:00
bunnie
bb6820419f sanity check AXP2101 e-fuse settings 2025-04-27 15:12:07 +08:00
bunnie
e22997874d add DCDC5 configuration 2025-04-21 02:42:40 +08:00
bunnie
1484453100 add scroll widget stub 2025-04-21 00:38:25 +08:00
bunnie
31dcab40aa add a test target with limited scope
this is for SoC testing with i.e. no peripherals or simulated
peripherals in a simulated environment
2025-04-20 07:48:29 -07:00
bunnie
2f467d6f23 Merge remote-tracking branch 'origin/cram-dev' into cram-dev 2025-04-20 04:06:41 -07:00
bunnie
1bad10fb21 work-arounds for DMA on BIO
- writes need at least a "pipe cleaner" to set the pipe in the correct
state
- may also need a "double-write" to commit the data - this is to be
explored with a smaller test case
- DMA write only works over all corners at 700MHz when
  FCLK=ACLK (i.e. FCLK is at half rate)
2025-04-20 03:28:40 -07:00
bunnie
7bd545e95c minimize character output during tests
this significantly improves runtime in GLS mode
2025-04-20 03:28:40 -07:00
bunnie
66ec140cf3 limit spi debug output 2025-04-20 03:28:40 -07:00
bunnie
b390a824d4 fix slew and drive rating for SPI interface
this is necessary to meet 50MHz timing on NTO
2025-04-20 03:28:40 -07:00
bunnie
72763dc3c7 modify fast dma test for clocking option 2025-04-20 03:28:40 -07:00
bunnie
019f342c98 update bio tests for clkmode option 2025-04-20 03:28:40 -07:00
bunnie
5e7a687c8b found the offending Debug deriver that was causing fp library bloat
this one derive was causing the bootloader to be about 20% bigger.
2025-03-05 22:42:56 +08:00
bunnie
f394ccab42
Merge branch 'main' into cram-dev 2025-03-05 20:56:36 +08:00
bunnie
c49c41699b cleanup warning 2025-03-05 20:54:03 +08:00
bunnie
57a4f24a02 restrict ObjectList to std targets only 2025-03-04 19:11:23 +08:00
bunnie
63a9a2b0a0 implement notification models for small screens 2025-03-04 19:06:41 +08:00
bunnie
1e9e02435b add missing model boilerplate
a lot of routines were left blank in the initial port to get
through the core graphics primitives porting. This commit
fills in those missing bits in a fashion that optimizes the
modals for drawing on small displays.
2025-03-04 19:05:41 +08:00
bunnie
3c5975715d kind of hack to make font rendering work on oled displays
so, there is a fundamental abstraction mismatch in the blitstr
library. In Precursor, I created a rule that you can't draw text
on black backgrounds without some special permissions in highly
trusted contexts.

For baosec, this restriction is removed because the whole OS
can run inside a single chip (i.e. we have eliminated most
easy RAM modification attacks, requires probing/glitching; but
as a trade-off, we don't have as much RAM so we can't afford the
extra abstractions).

The compromise is for OLED-type platforms where inverse drawing
is very common to save power, all text ops are assumed to be XOR
operations (so you're always flipping pixels instead of drawing
at a defined color).
2025-03-04 19:02:45 +08:00
bunnie
15f41a5f5b object list API elements 2025-03-04 19:01:47 +08:00
bunnie
5d4d009e64 add object list draw routine
this can accelerate drawing of complicated objects, such as
QR codes, that are composed of many rectangles.

there are some warts...in theory, this should be able to seralize
arbitrary-sized lists, but there must be some bug somewhere
that is preventing it from happening. For now, the list length
is clipped to the capacity of a page of memory.
2025-03-04 19:00:33 +08:00
bunnie
8602af4d18 add modals adapter code
initial take just lifted directly from the gam version;
layout details needs adapting for small screen still
2025-03-04 02:07:17 +08:00
bunnie
c67cb7666c fixup feature dependencies 2025-03-04 01:26:03 +08:00
bunnie
06d8760209 add routine to set pwm mode on axp2101 2025-03-04 01:24:41 +08:00
bunnie
da5c215477 fix type defaults for trait
part of the i16->isize transition
2025-03-03 02:12:57 +08:00
bunnie
433d632926 add a clear, modals & text bounds api calls
the text bounds api call is needed in v2 because there is no gam
to mediate this call

clear allows for a fast clear operation that may have hardware
dependent consequences

acquire/release of modals mode is added to the graphics server
as well to implement a feature previously handled by the gam
2025-03-03 02:11:23 +08:00
bunnie
b1ce74faa0 add handler for unspecified clipping areas in v2 targets 2025-03-03 02:10:50 +08:00
bunnie
2957cce789 add some v2 graphics api adapters and opcodes 2025-03-03 02:10:24 +08:00
bunnie
02bc28be4a
Merge branch 'main' into cram-dev 2025-02-28 17:44:58 +08:00
bunnie
e84daa0179 fixup more emulation issues 2025-02-28 17:42:30 +08:00
bunnie
b6ed2c7398 fix cursor overlay in sh1107 display mode 2025-02-28 17:30:17 +08:00
bunnie
db4d21c54c fix emulation bugs 2025-02-28 17:29:43 +08:00
bunnie
67e501328d mirror code structure from hosted mode 2025-02-28 16:33:31 +08:00
bunnie
317bc6a9fd related to previous commit 2025-02-28 16:33:14 +08:00
bunnie
e0ef852d06 fix routine so we're passing by reference, not by copy
this is just an "old code" problem, written before I fully understood
these subtleties
2025-02-28 16:32:32 +08:00
bunnie
8f48572b9c restrict font choices in baosec target
we have a smaller font map, so don't resolve glyphs to fonts
that we don't have.
2025-02-28 16:32:03 +08:00
bunnie
48009c710a regenerate logo according to new framebuffer layout 2025-02-27 21:35:10 +08:00
bunnie
b29d885000 fix various driver bugs & harmonize wih precursor color "standard" 2025-02-27 21:33:31 +08:00
bunnie
3d0d727094 fix bits vs bytes 2025-02-27 21:33:10 +08:00
bunnie
f3fccf9135 fix unnecessary mutability in trait 2025-02-27 03:12:41 +08:00
bunnie
9abc920bb2 refactor sh1107 driver so pixels in fb line up with bits in u32 2025-02-27 03:12:15 +08:00
bunnie
6e26db411a
Merge branch 'main' into cram-dev 2025-02-26 14:57:55 +08:00
bunnie
f5473868b1 fix return calls to use scalar5 instead of scalar2 2025-02-26 14:37:20 +08:00
bunnie
4096b35fef refactor shared implementation to use reply and receive next api 2025-02-26 14:36:50 +08:00
bunnie
2a97d9a827 fix location of font offsets 2025-02-24 02:28:34 +08:00
bunnie
ffceea0389 fix blit_screen routine 2025-02-24 00:57:53 +08:00
bunnie
a9c9d8d67b commit generated logo 2025-02-24 00:57:03 +08:00
bunnie
d281332b16 fixup conversion to simplify the image blit operation 2025-02-24 00:56:33 +08:00
bunnie
55cbe7a962 add module ref to handlers 2025-02-23 18:06:45 +08:00
bunnie
d50d228984 move baseline graphics handlers to a shared library 2025-02-23 18:06:25 +08:00
bunnie
e1a606f0bb add routines to create a clone of the display itself
this is an unsafe bit of code that is necessary because the
panic handler needs to run in its own thread with a hardware
handle to the frame buffer. this allows panics in the main
graphics thread to not cause the panic handler to fail.
2025-02-23 16:54:04 +08:00
bunnie
b7ef119a04 split pin numbers from pin setting
this allows us to probe pins/clone them without having to re-allocate
them.
2025-02-23 16:53:28 +08:00
bunnie
0d5a4e8e91
Merge branch 'main' into cram-dev 2025-02-23 12:15:37 +08:00
bunnie
9f890d3dbd add camera irq opcode to main graphics handler opcode list 2025-02-23 12:04:17 +08:00
bunnie
f37df2b1cb add hardware primitives missing for graphics layer compatibility 2025-02-23 12:02:37 +08:00
bunnie
35fe7ed73f add bitmaps for logos 2025-02-23 11:56:57 +08:00
bunnie
7e57af5841 add documentation target for library
this helps cargo doc to run
2025-02-22 01:07:12 +08:00
bunnie
56123fea8d fix doc warnings 2025-02-22 01:07:01 +08:00
bunnie
b8b1bfed03 fix doc warnings 2025-02-22 01:06:46 +08:00
bunnie
cc8a0a57a7 fixup apis to use traits 2025-02-21 23:42:01 +08:00
bunnie
8acb9e7521 add platform implementations of the frame buffer trait 2025-02-21 23:41:44 +08:00
bunnie
b352ecb667 remove platform-specific operation and replace with a trait 2025-02-21 23:41:19 +08:00
bunnie
d9d48262ac expand FrameBuffer trait to interop with precursor details 2025-02-21 23:09:45 +08:00
bunnie
efb627bf4f remove slice size specifier from blitstr2
this makes the api portable
2025-02-21 17:46:28 +08:00
bunnie
0770d5437f bring chat lib up to date with new ux-api layer 2025-02-21 17:46:11 +08:00
bunnie
27e4b77792 cleanup compile warning in cramium-api 2025-02-21 17:45:27 +08:00
bunnie
19f3221417 final changes to make ux-api platform-independent 2025-02-21 17:44:54 +08:00
bunnie
30c5876ad4 add missing apis/derives to minigfx to make it precursor-compatible 2025-02-21 17:43:50 +08:00
bunnie
07563c44db add precursor as a platform to ux-api 2025-02-21 17:43:23 +08:00
bunnie
5e258916da migrate graphics library API to a platform-neutral service crate
this kicks off an enormous set of refactoring changes...
2025-02-21 17:42:39 +08:00
bunnie
2ad0a58a56 remove redundant constants 2025-02-20 20:48:00 +08:00
bunnie
385e4198f2 accommodate movement of the opcode api 2025-02-20 20:39:28 +08:00
bunnie
fc8e7060a3 migrate opcodes out to an agnostic platform crate 2025-02-20 20:39:04 +08:00
bunnie
558c61ada7
Merge branch 'main' into cram-dev 2025-02-20 15:10:47 +08:00
bunnie
affe4e6c54 move APIs out of cramium-hal
So the organization of the code is now the following tiers:

libs/cramium-api: contains hardware-abstracted API code to the hardware
layers (traits, some constants, enums, etc.). For example, "here is
an IO trait that lets you configure and set GPIO pins", which could
then be implemented in hardware or emulation. The APIs aren't entirely
generic across all SoCs because they are tweaked to accommodate
quirks of the cramium SoC.

libs/cramium-hal: contains board-specific driver codes that do not
require persistent services to be started. Possibly misnamed because
it also includes not just cramium-chip items, but also e.g. peripherals
to the cramium SoC, such as the PMIC and camera.

services/cramium-hal-service: contains the `main` process that manages
shared resources, such as UDMA, IO pins, IFRAM. These drivers cannot
be delegated to a `lib` crate because there can be only one instance
of these resources, and instead we have to dynamically allocate
access to these through IPC messaging.

services/cramium-emu: hosted mode emulation of things in
cramium-hal-service.

services/bao-video: contains a `main` process that integrates
the camera and OLED driver. This means that all graphic drawing
primitives also interface with this crate. These are condensed
into a single process space to speed up execution, and kept
separate from cramium-hal-services because we want the video
services to not be blocked by, for example, a thread that is
handling I2C things.
2025-02-20 13:54:46 +08:00
bunnie
2235f7a3f1 clean up ux-api to be no-std clean
ux-api can't do rkyv derives and rely on std items in a
no-std environment. This is necessary because some of the
base layer APIs (frame buffers, points, etc.) are relied
upon in a no-std loader environment to render diagnostics
to the screen. Thus ux-api needs to have a baseline of
primitives available without a std flag.
2025-02-20 13:32:52 +08:00