the loader seems to be working now.

This commit is contained in:
bunnie 2020-09-26 00:03:46 +08:00
parent 4760422162
commit 5deeebae3b
5 changed files with 14 additions and 10 deletions

View file

@ -49,6 +49,7 @@ The following files need manual adjustment:
* emulation/csr.csv should map to the csr.csv of the final SoC * emulation/csr.csv should map to the csr.csv of the final SoC
* examples/graphics-server/src/backend/betrusted.rs needs a correct address for the "control" data structure (based on csr.csv) * examples/graphics-server/src/backend/betrusted.rs needs a correct address for the "control" data structure (based on csr.csv)
* kernel/src/debug.rs:7 needs a correct UART base, based on csr.csv * kernel/src/debug.rs:7 needs a correct UART base, based on csr.csv
* loader/src/debug.rs:31 needs a correct UART base, basedon csr.csv
Create the loader.bin from the .elf. `objcopy` adds several hundred megabytes of zero at the end of `loader.bin` so just Create the loader.bin from the .elf. `objcopy` adds several hundred megabytes of zero at the end of `loader.bin` so just
take the first 64kiB, which is the exact size allocated for it anyways in hardware. The final loadable image is created by take the first 64kiB, which is the exact size allocated for it anyways in hardware. The final loadable image is created by

View file

@ -18,7 +18,7 @@ riscv = "0.5.6"
debug-print = [] debug-print = []
print-panics = [] print-panics = []
report-memory = ["stats_alloc"] report-memory = ["stats_alloc"]
default = ["print-panics"] default = ["print-panics", "debug-print"]
[target.'cfg(any(windows, unix))'.dependencies] [target.'cfg(any(windows, unix))'.dependencies]
lazy_static = "1.4" lazy_static = "1.4"

View file

@ -14,6 +14,7 @@ rand = "0.7.3"
[features] [features]
debug-print = [] debug-print = []
earlyprintk = [] earlyprintk = []
default = ["debug-print"]
[profile.release] [profile.release]
codegen-units = 1 # 1 better optimizations codegen-units = 1 # 1 better optimizations

View file

@ -28,7 +28,7 @@ impl Write for Uart {
pub mod debug_print_hardware { pub mod debug_print_hardware {
use crate::debug::*; use crate::debug::*;
pub const SUPERVISOR_UART: Uart = Uart { pub const SUPERVISOR_UART: Uart = Uart {
base: 0xF000_1000 as *mut u32, base: 0xF000_4000 as *mut u32,
}; };
#[macro_export] #[macro_export]

View file

@ -16,20 +16,20 @@ fi
# This is handled in part by betrusted-scripts, with provision-xous.sh # This is handled in part by betrusted-scripts, with provision-xous.sh
# stage1 and kernel are merged into xous.img by this script. # stage1 and kernel are merged into xous.img by this script.
cargo build --target riscv32imac-unknown-none-elf cargo build --release --target riscv32imac-unknown-none-elf
cd kernel && cargo build -p kernel --target riscv32imac-unknown-none-elf cd kernel && cargo build -p kernel --release --target riscv32imac-unknown-none-elf
cd .. cd ..
cd loader && cargo build -p loader --target riscv32imac-unknown-none-elf cd loader && cargo build -p loader --release --target riscv32imac-unknown-none-elf
cd .. cd ..
cargo run -p tools --bin create-image -- \ cargo run --release -p tools --bin create-image -- \
--csv emulation/csr.csv \ --csv emulation/csr.csv \
--kernel kernel/target/riscv32imac-unknown-none-elf/debug/kernel \ --kernel kernel/target/riscv32imac-unknown-none-elf/release/kernel \
--init target/riscv32imac-unknown-none-elf/debug/shell \ --init target/riscv32imac-unknown-none-elf/release/shell \
target/args.bin target/args.bin
riscv64-unknown-elf-objcopy loader/target/riscv32imac-unknown-none-elf/release/loader -O binary loader_raw.bin riscv64-unknown-elf-objcopy loader/target/riscv32imac-unknown-none-elf/release/loader -O binary loader.bin
dd if=loader_raw.bin of=loader.bin bs=1024 count=64 dd if=/dev/null of=loader.bin bs=1 count=1 seek=65536
cat loader.bin target/args.bin > xous.img cat loader.bin target/args.bin > xous.img
if [ $# -gt 0 ] if [ $# -gt 0 ]
@ -38,9 +38,11 @@ then
then then
scp xous.img $1:code/betrusted-scripts/ scp xous.img $1:code/betrusted-scripts/
scp ../betrusted-soc/build/gateware/encrypted.bin $1:code/betrusted-scripts/ scp ../betrusted-soc/build/gateware/encrypted.bin $1:code/betrusted-scripts/
scp ../emulation/csr.csv $1:code/betrusted-scripts/soc-csr.csv
else else
scp -i $2 xous.img $1:code/betrusted-scripts/ scp -i $2 xous.img $1:code/betrusted-scripts/
scp -i $2 ../betrusted-soc/build/gateware/encrypted.bin $1:code/betrusted-scripts/ scp -i $2 ../betrusted-soc/build/gateware/encrypted.bin $1:code/betrusted-scripts/
scp -i $2 emulation/csr.csv $1:code/betrusted-scripts/soc-csr.csv
fi fi
else else
echo "Copy to target with $0 <user@host> <ssh-id>" echo "Copy to target with $0 <user@host> <ssh-id>"