Commit graph

288 commits

Author SHA1 Message Date
bunnie
387b5d22e5 another fix for issue #75: llio resume failure
Found the following KP on resume. This time it looks like it's
failing in a syscall, during a send_message call. There's no
more visibility into what causes this, so this commit tries to clean
up some loose ends in the resume path that could send messages before
the system is ready. Namely, the console mux call got condensed into
an abridged version that doesn't send log messages (you couldn't see
them anyways...), and the I2C engine now pauses suspend until
the current transaction at hand completes. I suspect it's quite
likely that it's the I2C engine that's causing the issues...

LLIO -> PID 14
Jumping to loader...
PROGRAM HALT: CPU Exception on PID 14: Store page fault of 0x00000000 at 0x0003a02e
Current thread 2:
Thread 2:
PC:0003a02e   SP:7ffff170   RA:00036290
GP:00000000   TP:60000000
T0:00000000   T1:000000f0   T2:00000030
T3:00000080   T4:000000f4   T5:ffffffff   T6:0000008f
S0:7ffff1d0   S1:7ffff228   S2:00000007   S3:00000007
S4:00000001   S5:00000004   S6:00037996   S7:00010e34
S8:00011548   S9:000101bc  S10:7fffff4c  S11:0003c000
A0:0000000e   A1:00000000   A2:00000004   A3:00000000
A4:00000000   A5:00000000   A6:00000000   A7:00000000

0003a028 <_xous_syscall>:
   3a028:	00000073		ecall
   3a02c:	4282                	lw	t0,0(sp)
   3a02e:	00a2a023          	sw	a0,0(t0)
   3a032:	00b2a223          	sw	a1,4(t0)
   3a036:	00c2a423          	sw	a2,8(t0)
   3a03a:	00d2a623          	sw	a3,12(t0)
   3a03e:	00e2a823          	sw	a4,16(t0)
   3a042:	00f2aa23          	sw	a5,20(t0)
   3a046:	0102ac23          	sw	a6,24(t0)
   3a04a:	0112ae23          	sw	a7,28(t0)
   3a04e:	8082                	ret

0003623c <_ZN4xous7syscall12send_message17h44786a68889a5f1dE>:
pub fn send_message(connection: CID, message: Message) -> core::result::Result<Result, Error> {
   3623c:			7175                   addi			       sp,sp,-144
   3623e:			c706                   sw			       ra,140(sp)
   36240:			c522                   sw			       s0,136(sp)
   36242:			c326                   sw			       s1,132(sp)
   36244:			84aa                   mv			       s1,a0
   36246:			4549                   li			       a0,18
    crate::arch::syscall(call)
   36248:	4214			lw	a3,0(a2)
   3624a:	4258                	lw	a4,4(a2)
   3624c:	04a10023          	sb	a0,64(sp)
   36250:	c2ae                	sw	a1,68(sp)
   36252:	c4b6                	sw	a3,72(sp)
   36254:	c6ba                	sw	a4,76(sp)
   36256:	4608                	lw	a0,8(a2)
   36258:	464c                	lw	a1,12(a2)
   3625a:	4a14                	lw	a3,16(a2)
   3625c:	4a50                	lw	a2,20(a2)
   3625e:	c8aa                	sw	a0,80(sp)
   36260:	caae                	sw	a1,84(sp)
   36262:	ccb6                	sw	a3,88(sp)
   36264:	ceb2                	sw	a2,92(sp)
    let mut ret = crate::Result::Ok;
   36266:   d082			sw	zero,96(sp)
    let args = call.as_args();
   36268:    0828			addi	a0,sp,24
   3626a:    008c                	addi	a1,sp,64
   3626c:    00000097          		auipc	ra,0x0
   36270:    8da080e7          		jalr	-1830(ra) # 35b46 <_ZN4xous7syscall7SysCall7as_args17h7e6c318e8a926fa8E>
            args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], &mut ret,
   36274:   4562                       lw	a0,24(sp)
   36276:   45f2                       lw	a1,28(sp)
   36278:   5602                       lw	a2,32(sp)
   3627a:   5692                       lw	a3,36(sp)
   3627c:   5722                       lw	a4,40(sp)
   3627e:   57b2                       lw	a5,44(sp)
   36280:   5842                       lw	a6,48(sp)
   36282:   58d2                       lw	a7,52(sp)
   36284:   1080                       addi	s0,sp,96
        _xous_syscall(
   36286:	c022			sw	s0,0(sp)
   36288:	00004097          	auipc	ra,0x4
   3628c:	da0080e7          	jalr	-608(ra) # 3a028 <_xous_syscall>
        crate::Result::Error(e) => Err(e),
   36290:			5586			lw	a1,96(sp)
   36292:			5516                	lw	a0,100(sp)
   36294:			4605                	li	a2,1
   36296:			00c59563          	bne	a1,a2,362a0 <_ZN4xous7syscall12send_message17h44786a68889a5f1dE+0x64>
        Err(e) => Err(e),
   3629a:      c0c8			sw	a0,4(s1)
2021-08-24 01:39:48 +08:00
bunnie
80cae0d446 intermediate progress on issue #74
still not fixed, but things are leaned up.
2021-08-23 05:12:21 +08:00
bunnie
abd8eadfd8 modify the console behavior to better capture panics on resume
switches to kernel console on suspend, keeps it in kernel
console on resume for a few hundred ms before switching back
to our original setting
2021-08-22 14:28:06 +08:00
bunnie
799bb6050e add jtag commands, reboot after burn 2021-08-11 06:15:04 +08:00
bunnie
35e7cfe89e jtag server now reporting ID 2021-08-10 22:46:00 +08:00
bunnie
bdd70f9502 stash to figure out build issue 2021-08-10 22:41:22 +08:00
bunnie
7921b0216f try to improve system stability in debug modes 2021-08-04 22:40:53 +08:00
bunnie
8b83fb7c65 remove heapless, go to libstd for all collections!!!!
*fistpump*
2021-08-04 01:25:32 +08:00
Sean Cross
b86e0a65cd services: recognize xous as a hardware OS
Support `xous` as a valid OS. This allows us to build the entire kernel
under this target.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-08-02 18:11:48 +08:00
bunnie
91fe69ca27 add some real-hardware tests for spinor writes
definitely still bugs.

need to sleep on it.
2021-07-18 02:36:31 +08:00
bunnie
a4f8346c34 reflect the latest fixes to the secure boot process
also patch up some issues with sha512 reset and loose
ends on docs and updates
2021-07-13 00:46:31 +08:00
bunnie
84a2e9f768 fix status bar so that it redraws out of suspend/resume
the bootloader modifies the screen, so all elements must
be redrawn regardless of the pervious state change!
2021-07-11 18:47:19 +08:00
bunnie
6825e2e7e8 reset the i2c machine every new transaction 2021-06-25 03:41:42 +08:00
bunnie
75dca6bd4c checkin for a rollback to sanity check some things 2021-06-25 02:09:42 +08:00
bunnie
afa55055ea add serial console mux setting 2021-06-24 13:52:44 +08:00
bunnie
aa967a5a17 quiet up hosted mode build warnings 2021-06-18 22:37:08 +08:00
bunnie
eee9f4e765 refactor xous-names to permit only a fixed number of connections
this prevents less trusted processes from connecting to servers
after the kernel initializations are done.

this works so long as we don't have disconnects from the kernel
servers. In order to support disconnects we will also need a
way to re-enumerate the SID to guarantee that we don't have a re-use
problem. But for now, the kernel is not designed with any practical
disconnect mechanism; there is no code that calls the Quit mechanism
on any server.
2021-06-15 17:41:14 +08:00
bunnie
0db9ad9e6f add status bar extension to inform of security states
- inverted text indicates a trusted message. policy is enforced in the GAM.
- we don't have a way to lock the USB port yet; but at least now it's communicated.
2021-06-13 04:40:50 +08:00
bunnie
fadc9c29ab Merge remote-tracking branch 'origin/master' into bunnie-dev 2021-06-02 03:59:25 +08:00
bunnie
b9f3182bb9 mods for hosted mode to work again 2021-06-02 03:45:15 +08:00
bunnie
25e6bced00 add power-on utilization reporting
there is now an extra field in the status bar that gives
the %'age of time that the clocks are running.
2021-06-02 01:08:31 +08:00
bunnie
ee2e38be05 add commands to help manage wfi/power debugging 2021-06-01 17:02:30 +08:00
bunnie
52c32cc4d1 auto-powerdown of sha block when not in use 2021-05-30 00:12:18 +08:00
bunnie
30aa794f30 add reference counting on connections between servers
the connection number is re-used for all objects created
within a process space, so you can't `Drop` the connection
immediately when an object goes out of scope. You have to
make sure all instance of the object go out of scope. This
patch adds reference counting to all the objects so that
the `Drop` function works as intended.
2021-05-21 16:24:30 +08:00
Sean Cross
eb7895d601 xous: add a return code to TerminateProcess
As part of this refactor, make `terminate_process()` a divergent call.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-05-20 11:01:00 +08:00
bunnie
08a86749fe fix hosted mode bugs 2021-05-09 01:13:16 +08:00
bunnie
adc7f8e98d cleanup the i2c API
condense async/sync methods into a single one and decide which
is which based upon the presence of an Option<callback>
2021-05-06 14:03:06 +08:00
bunnie
b50aa60591 clean up some visibilities and warnings, get rid of the old, bad API 2021-05-06 05:13:23 +08:00
bunnie
bc82dbd157 transition i2c api on codec, finally found the damn race condition 2021-05-06 05:05:17 +08:00
bunnie
75bb4805b1 clean up RTC server to use the new I2C API 2021-05-06 04:16:31 +08:00
bunnie
b596c40dd6 refactor I2C to have work queue, cleaner (but untested) APIs 2021-05-06 03:40:04 +08:00
bunnie
bb5bc1d212 refactor i2c to break out the i2c machine to a separate server
the concurrency issues on I2C are getting hairy, and it was probably a
dubious decision from the start to merge I2C into the LLIO block; but
originally this was motivated by the idea of keeping all the
"miscellaneous slow stuff" in one process to keep the memory footprint
small and make code a bit more readable.

Keeping I2C in the same process space as the LLIO but splitting it
into its own thread and server splits the difference, by giving us
more options to deal with the concurrency, without inflating the size
of the kernel binary and allocating a lot of extra static data.
2021-05-06 00:45:14 +08:00
bunnie
f8979d6341 intermediate progress on audio. doesn't compile. 2021-05-04 02:22:35 +08:00
bunnie
a4ca725c2a add a reset to an i2c core 2021-05-03 21:24:37 +08:00
bunnie
01e2c7edca migrate to an interrupt-handler only I2C handler
the amount of time it takes to send messages to initiate each
packet is too slow, and causing timeouts. By handling the I2C
directly in an interrupt handler, we accelerate the bus, at
the expense of no visibility via log/trace messages.
2021-05-03 18:53:17 +08:00
bunnie
d65e91f792 refactor i2c to be in the implementation block 2021-05-03 18:14:58 +08:00
bunnie
0e2d57c9fb retrofit the kernel and loader to handle resume
and now the even harder debuggening begins...zomg o_O
2021-04-30 01:55:38 +08:00
bunnie
a55735fb1f add llio to suspend/resume set 2021-04-29 23:15:47 +08:00
bunnie
6e1e74ed84 a minimal but successful touch-and-go suspend/resume cycle 2021-04-29 16:37:43 +08:00
bunnie
cad9c15849 intermediate save of suspend resume
building an awful rube-goldberg contraption of a "clean-suspend"
record.
2021-04-28 19:28:04 +08:00
bunnie
00e3cd55fd fix generic error message 2021-04-27 00:46:24 +08:00
bunnie
f86f295fa5 add some version commands 2021-04-26 01:11:45 +08:00
bunnie
061284ec5f debugging BOOST mode glitch issue
Here's an arcane bug for you:

When powering down, the Spartan 7 3.3V I/O drivers will
output a roughly 800us wide glitch as 3.3V falls below around
1.7V, if the 0.95V core voltage comes down first (which it does
because we have an active discharge on 0.95V, but not on 3.3V).

In this case, it's just wide and high enough to cause the
BOOST mode line to engage, which takes the BOOST output
and ties it to VBUS, which is just enough for the system to
think you're powering it back on again. Which is not what
you want when powering down.

The ultimate fix was to put a heftier pull-down on the BOOST
line so that it can't trip the BOOST output into the VBUS.
Another option could be more active discharge FETs, but that
would require a full board spin and we are already at certification,
so we'll stick with the stronger pull-down on BOOST. It seems to
be a robust fix in the worst corner cases we can find.

The downside is that when powering an external USB device,
you are burning an extra 30mW of power overcoming the pull-down,
but typically, any external USB devices plugged into Precursor
will burn far in excess of that, so the delta should be negligible.
2021-04-23 15:33:14 +08:00
bunnie
f97b61a788 add the killbounce command 2021-04-23 01:49:03 +08:00
bunnie
52a9116edb add various sleep/ship/kill/coldboot commands 2021-04-22 18:08:19 +08:00
bunnie
8dc5bf434b hosted mode vibration debug message 2021-04-16 19:30:56 +08:00
bunnie
809f0445e1 add vibe command 2021-04-16 19:27:48 +08:00
bunnie
93400df67c an initial cut at fcc test commands 2021-04-15 04:10:47 +08:00
bunnie
84853c696a drop message should be non-blocking 2021-04-09 18:53:41 +08:00
bunnie
2916eb3775 relocate the destroy callback call to after the server exits 2021-04-09 18:51:43 +08:00
bunnie
aed2325f68 fix some minor bugs in hosted mode
memory is not page-aligned so `if !cfg()`-out the alignment
checks in hosted mode
2021-04-09 17:31:36 +08:00
bunnie
8b93dd0c63 RTC server now basically working
There is an issue with the rtc commandline time checking
with respect to unhooking its callback, maybe related to
the new disconnect/destroy server code
2021-04-09 05:24:29 +08:00
bunnie
a9de4782c5 crashing on load when logger is in callback 2021-04-08 23:07:02 +08:00
bunnie
0fa3d3c969 begin debugging of the RTC 2021-04-08 04:38:01 +08:00
bunnie
45c90659e5 rtc first draft 2021-04-08 02:30:57 +08:00
bunnie
0f9eea10d9 flesh out callback handling of events in LLIO 2021-04-07 18:29:50 +08:00
bunnie
d5aef77bdc clean up warnings, as much as they make sense to clean up 2021-04-07 00:48:48 +08:00
bunnie
ca349ec1b0 clean up minor bugs and other issues 2021-04-06 22:38:11 +08:00
bunnie
b9162fda3d gettin' there! major modules now mostly working under v0.8 2021-04-06 19:32:35 +08:00
bunnie
9ba2fb134c refactor most major modules, but Xous now crashes 2021-04-05 23:50:00 +08:00
bunnie
dc2519c5ef trying out new API names 2021-04-01 03:47:10 +08:00
bunnie
470b5c6440 finalize API refactor for xous-names 2021-03-30 02:13:23 +08:00
bunnie
f35d478cf0 attempt to refactor xous_names 2021-03-29 04:35:11 +08:00
bunnie
e889765caf refactor the Ticktimer API. 2021-03-28 18:14:41 +08:00
Sean Cross
fdce58d06e ipc: convert project to use xous-ipc
This rewrites the entire project so that most runnable projects now use
`xous-ipc` instead of `xous::String` where possible.

This also removes `rkyv` from the list of dependencies in `xous-rs`.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-26 20:22:33 +08:00
bunnie
8763cf3133 stash before merge 2021-03-24 22:48:23 +08:00
bunnie
9541523d76 move GPIO mapping earlier in LLIO so we can capture the boot prompt 2021-03-23 23:10:26 +08:00
bunnie
2d5c1dd6db leverage min_const_generics and cleanup
the spoils of a hard fought battle to refactor to rkyv 0.4.1
2021-03-18 04:00:38 +08:00
bunnie
ea8b208a15 finalize rkyv 0.4.1 refactor 2021-03-18 03:54:48 +08:00
bunnie
8fbd900a4c Merge branch 'hardware-no-cb' into rkyv-refactor
Bring the two branches up to date, while also laying the groundwork
for XousServerName to be used as a native index type in xous-names
so we aren't burdening xous::String with a hasher
2021-03-17 16:06:06 +08:00
bunnie
edb099d3f2 fix hosted mode with dummy i2c emulation calls 2021-03-16 19:28:01 +08:00
bunnie
d74b3189e6 it builds, at least. 2021-03-16 16:37:38 +08:00
bunnie
8b8cad067c add the i2c file proper 2021-03-16 15:52:30 +08:00
bunnie
eff3e7d7bf incremental i2c changes 2021-03-16 15:52:13 +08:00
bunnie
f9439b48d6 checking in a refactor that we're going to abort 2021-03-16 12:27:29 +08:00
bunnie
d68e3e8cf4 an attempt to refactor to rkyv 0.4.1
unfortunately, it looks like deserialize requires an alloc??
2021-03-16 02:02:53 +08:00
bunnie
ab1b839900 checkpoint before figuring out how to deal with the String rkyv version issue... 2021-03-16 00:11:23 +08:00
bunnie
be38661a1e half-baked i2c stuff, but about to tear a bunch of it out 2021-03-15 14:58:48 +08:00
bunnie
54cf95aec1 turn off more debugging for demo 2021-03-11 04:43:58 +08:00
bunnie
16d8438a0d turn off some debugging 2021-03-11 04:12:14 +08:00
bunnie
0dbfa6a668 clean up warnings 2021-03-11 04:09:47 +08:00
bunnie
4baaec61d2 add sensors command to read ADC values 2021-03-11 02:57:58 +08:00
bunnie
835bee2c75 lay in foundations to support the sleep function 2021-03-11 01:45:54 +08:00
bunnie
07b3dd9afa add PID printout to every service as it starts 2021-02-15 19:16:21 +08:00
bunnie
6bbb3f9644 add note about where things got left off 2021-02-10 20:59:14 +08:00
bunnie
9ad83d4873 a bunch for run-of-the-mill system functions in llio implemented 2021-01-28 04:03:30 +08:00
bunnie
7d3ef78f2a about halfway through the API implementation 2021-01-28 02:56:00 +08:00
bunnie
8ed37a0dcb add API framework for LLIO 2021-01-27 13:33:03 +08:00