Skip to content

Commit

Permalink
riscv64-generic: update scripts to use Phoenix SBI
Browse files Browse the repository at this point in the history
JIRA: RTOS-844
  • Loading branch information
lukileczo committed Jul 10, 2024
1 parent 6732ff3 commit 2ad3c31
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 24 deletions.
10 changes: 7 additions & 3 deletions _projects/riscv64-generic-qemu/build.project
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Shell script for building riscv64-generic-qemu project
#
# Copyright 2022 Phoenix Systems
# Author: Lukasz Kosinski
# Copyright 2022, 2024 Phoenix Systems
# Author: Lukasz Kosinski, Lukasz Leczkowski
#

[ "${BASH_SOURCE[0]}" -ef "$0" ] && echo "You should source this script, not execute it!" && exit 1

export PLO_DEVICES="ram-storage uart-16550"

b_image_project () {
b_log "Adding PLO to Phoenix SBI"
make -C plo/riscv-sbi all PAYLOAD_PATH="$PREFIX_BOOT/plo.img" PAYLOAD_ADDR=0x80200000
cp "${PREFIX_PROG}sbi-${TARGET_SUBFAMILY}.elf" "$PREFIX_BOOT/"

b_log "The images have been built for the ${TARGET} platform"
}
11 changes: 6 additions & 5 deletions _projects/riscv64-generic-spike/build.project
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Shell script for building riscv64-generic-spike project
#
# Copyright 2022 Phoenix Systems
# Author: Lukasz Kosinski
# Copyright 2022, 2024 Phoenix Systems
# Author: Lukasz Kosinski, Lukasz Leczkowski
#

[ "${BASH_SOURCE[0]}" -ef "$0" ] && echo "You should source this script, not execute it!" && exit 1
Expand All @@ -25,8 +25,9 @@ USER_SCRIPT=(


b_image_project () {
(cd "$PREFIX_PROJECT/riscv/opensbi/" && make O="$OSBI_BUILD_DIR" CROSS_COMPILE="$CROSS" PLATFORM=generic FW_PAYLOAD_PATH="$PREFIX_BOOT/phoenix.disk")
cp "$OSBI_BUILD_DIR/platform/generic/firmware/fw_payload.elf" "$PREFIX_BOOT/phoenix.osbi"
b_log "Adding PLO to Phoenix SBI"
make -C plo/riscv-sbi all PAYLOAD_PATH="$PREFIX_BOOT/phoenix.disk" PAYLOAD_ADDR=0x80200000
cp "${PREFIX_PROG}sbi-${TARGET_SUBFAMILY}.elf" "$PREFIX_BOOT/"

b_log "The images have been built for the ${TARGET} platform"
}
14 changes: 3 additions & 11 deletions _targets/build.project.riscv64-generic
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Shell script for building riscv64-generic project
#
# Copyright 2018, 2019, 2020 Phoenix Systems
# Author: Kaja Swat, Aleksander Kaminski, Pawel Pisarczyk, Lukasz Kosinski
# Copyright 2018-2020, 2024 Phoenix Systems
# Author: Kaja Swat, Aleksander Kaminski, Pawel Pisarczyk, Lukasz Kosinski, Lukasz Leczkowski
#
[ "${BASH_SOURCE[0]}" -ef "$0" ] && echo "You should source this script, not execute it!" && exit 1

Expand Down Expand Up @@ -82,14 +82,6 @@ b_build_target() {
make -C plo all

${CROSS}objcopy -O binary "${PREFIX_PROG_STRIPPED}plo-${TARGET_FAMILY}-${TARGET_SUBFAMILY}.elf" "$PREFIX_BOOT/plo.img"

# Add plo to boot loader
b_log "Adding PLO to boot loader"

OSBI_BUILD_DIR="$PREFIX_BUILD/opensbi"

(cd "$PREFIX_PROJECT/riscv/opensbi/" && make O="$OSBI_BUILD_DIR" CROSS_COMPILE="$CROSS" PLATFORM=generic FW_PAYLOAD_PATH="$PREFIX_BOOT/plo.img")
cp "$OSBI_BUILD_DIR/platform/generic/firmware/fw_payload.elf" "$PREFIX_BOOT/phoenix.osbi"
}


Expand Down
8 changes: 4 additions & 4 deletions scripts/riscv64-generic-qemu.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Shell script for running Phoenix-RTOS on QEMU (riscv64-generic-qemu)
#
# Copyright 2021 Phoenix Systems
# Author: Lukasz Kosinski
# Copyright 2021, 2024 Phoenix Systems
# Author: Lukasz Kosinski, Lukasz Leczkowski
#

REGEX="version ([0-9]+)\.([0-9]+)"
Expand All @@ -24,7 +24,7 @@ fi
exec qemu-system-riscv64 \
-smp 1 \
-machine virt \
"$OPTIMG" "$(dirname "${BASH_SOURCE[0]}")/../_boot/riscv64-generic-qemu/phoenix.osbi" \
"$OPTIMG" "$(dirname "${BASH_SOURCE[0]}")/../_boot/riscv64-generic-qemu/sbi-generic.elf" \
-serial stdio \
-drive file="$(dirname "${BASH_SOURCE[0]}")/../_boot/riscv64-generic-qemu/rootfs.disk",format=raw,cache=unsafe,if=none,id=vblk0 \
-device virtio-blk-device,drive=vblk0 \
Expand Down
2 changes: 1 addition & 1 deletion scripts/riscv64-generic-spike.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
# Author: Lukasz Leczkowski
#

exec spike -m0x80000000:0x10000000 --real-time-clint "$(dirname "${BASH_SOURCE[0]}")/../_boot/riscv64-generic-spike/phoenix.osbi"
exec spike -m0x80000000:0x10000000 --real-time-clint "$(dirname "${BASH_SOURCE[0]}")/../_boot/riscv64-generic-spike/sbi-generic.elf"

0 comments on commit 2ad3c31

Please sign in to comment.