running `cargo +nightly fmt -p app-loader` gives you one result.
running `cargo +nightly fmt --check` gives you another result.
manually opening and saving the files causes a result to agree
with the check.
I noticed that I actually hadn't changed anything in the xous-rs
directory, so I got rid of the patch. I also removed a few files
that weren't being used. Furthermore, I noticed that a couple of
random files were different from upstream so I changed them back.
I also modified the README slightly.
I was facing a bunch of issues with the build system and
dependencies. I fixed it by using the Cargo.lock from upstream/main. I
also modified app-loader since as_slice_mut is now unsafe.
Instead of getting the slice by creating a large Vec, I now use
MapMemory to create this region directly. There is some sort of bug
with Vec that doesn't allow creation of large Vec's, and this change
makes it possible to load much larger apps (including `vault',
although there are still issues like menus to sort out).
I have added another progressbar when the list of apps is being
loaded (I find that this makes stuff more clear).
I also discovered that if I use gam to "switch" to app-loader from
itself this works at bringing the menu back up
`app-loader' can now successfully download apps from the app server
and run them! I have also improved the UI by adding a progressbar
when an app is loading so that you know when it is done and also
replacing some panics with notifications that way the whole machine
doesn't shut down if the server has some problems.
The remaining UI work is to make sure that the menu pops back up when
you for example set the server.
I also need to add locales, a README, etc.
This creates:
1) An `xtask' command that allows someone to compile individual apps
without compiling the entire image (note that this is required because
xtask generates files that contain gam context names, and if you just
do a regular `cargo build' building the app will fail)
2) A python file app_server.py that acts as a server to give the
app-loader a list of the apps and actually send it the
3) A basic UX that allows app-loader to set the server, get the list
of apps, and load apps.
Currently, this mostly works, except that there is some random
`ShareViolation' when the app-loader loads the app.
I have made `app-loader' more object oriented (to fit in with the
style of the other xous apps), and I am moving some of my personal
projects to another branch of my repo
`EXPECTED_APP_CONTEXTS' was added to the list of authorized
switchers. I don't think this is ideal, but I think it would be
difficult to come up with a better solution that doesn't make
`app-loader' "special" in some way.
This allows `app-loader' to register new names (which are then used by
the loaded apps to claim tokens). At the moment this is restricted to
apps that are pre-registered, i.e. included in the image.
It turns out that in ELF files there *is* a difference between
file size and mem size. Mem size is the size of the chunk of memory,
but file size is the size of what we copy into there from the
file. Most of the time they are the same, which is why previously
`spawn' only considered mem size, but this caused issues.
In particular, in the xous implementation of the rust standard
library, there whenever something is allocated it has to first check
an AtomicI32 LOCKED to see if it is 0 or 1, and set it to 1 when it is
allocating so that only one thing is allocating at a time. However,
the mem size for the section containing LOCKED is larger than the file
size, meaning that `spawn' copied more of the file that it should
have. This lead to junk being put into LOCKED, which caused the new
process to assume that something else was perpetually allocating.
Now, `spawn' puts 0's in the space between the end of the file size
and the end of the memsize, which makes everything work as expected.
The only problem remaining is that when an app registers for GAM, GAM
checks whether the app is allowed to register, which is based on what
apps were included in the image. Obviously, this does not work when
you are trying to load apps that are not already in the image
I forgot to revert to the previous versions of the other status
files (turns out I only need to do it for one). I also changed to
using the hello binary in debug.
When the user selects App Loader from the app menu, a new menu shows
up that displays the currently loaded apps (in the future this will
contain options to add/remove apps as well). This is a much more sane
approach than whatever I was doing before because it requires minimal
changes to the rest of the source tree (I had to change xtask so that
it would replace -'s with _'s in constant names so that I could name
my app app-loader).