baremetal: build userland programs using userland_and_baremetal instead of symlinks

Otherwise I'll go crazy with symlink action.
This commit is contained in:
Ciro Santilli 六四事件 法轮功
2019-05-23 00:00:01 +00:00
parent c8c4f89854
commit fbfc4905ec
29 changed files with 200 additions and 177 deletions

View File

@@ -1206,35 +1206,6 @@ The terminal prints:
hello
....
Now let's run link:baremetal/arch/aarch64/add.S[]:
....
./run --arch aarch64 --baremetal baremetal/arch/aarch64/add.S
....
This time, the terminal does not print anything, which indicates success.
If you look into the source, you will see that we just have an assertion there.
You can see a sample assertion fail in link:baremetal/interactive/assert_fail.c[]:
....
./run --arch aarch64 --baremetal baremetal/interactive/assert_fail.c
....
and the terminal contains:
....
lkmc_test_fail
error: simulation error detected by parsing logs
....
and the exit status of our script is 1:
....
echo $?
....
To modify a baremetal program, simply edit the file, e.g.
....
@@ -1252,17 +1223,44 @@ and rebuild:
`./build-baremetal` uses crosstool-NG, and so it must be preceded by link:build-crosstool-ng[], which `./build qemu-baremetal` also calls.
Alternatively, for the sake of tab completion, we also accept relative paths inside `baremetal/`, for example the following also work:
Now let's run link:baremetal/arch/aarch64/add.S[]:
....
./run --arch aarch64 --baremetal baremetal/c/hello.c
./run --arch aarch64 --baremetal baremetal/arch/aarch64/add.S
....
Absolute paths however are used as is and must point to the actual executable:
This time, the terminal does not print anything, which indicates success: if you look into the source, you will see that we just have an assertion there.
You can see a sample assertion fail in link:baremetal/interactive/assert_fail.c[]:
....
./run --arch aarch64 --baremetal "$(./getvar --arch aarch64 baremetal_build_dir)/hello.elf"
./run --arch aarch64 --baremetal userland/c/assert_fail.c
....
and the terminal contains:
....
lkmc_test_fail
error: simulation error detected by parsing logs
....
and the exit status of our script is 1:
....
echo $?
....
As suggested by the above example, several of the <<userland-content,userland examples>> can also be run in baremetal! This is largely due to the <<about-the-baremetal-setup,awesomeness of Newlib>>.
The examples that work include most <<c,C examples>> that don't rely on complicated syscalls such as threads, and almost all the <<userland-assembly>> examples.
The exact list of userland programs that work in baremetal is specified in <<path-properties>> with the `baremetal` property.
You can run all the baremetal examples in one go and check that all assertions passed with:
....
./test-baremetal --arch aarch64
....
To use gem5 instead of QEMU do: