aboutsummaryrefslogtreecommitdiff
path: root/fesvr/htif.cc
diff options
context:
space:
mode:
authorAndrew Waterman <andrew@sifive.com>2022-10-17 13:51:59 -0700
committerAndrew Waterman <andrew@sifive.com>2022-10-17 13:51:59 -0700
commit68aeeb5500521ff52c216862f9a653b64191f3ad (patch)
tree407230ff48f79f177a792451598d9b2b6e3d34a0 /fesvr/htif.cc
parent191634d2854dfed448fc323195f9b65c305e2d77 (diff)
parent03be4ae6c7b8e9865083b61427ff9724c7706fcf (diff)
downloadspike-68aeeb5500521ff52c216862f9a653b64191f3ad.zip
spike-68aeeb5500521ff52c216862f9a653b64191f3ad.tar.gz
spike-68aeeb5500521ff52c216862f9a653b64191f3ad.tar.bz2
Merge branch 'master' into plic_uart_v1plic_uart_v1
Diffstat (limited to 'fesvr/htif.cc')
-rw-r--r--fesvr/htif.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/fesvr/htif.cc b/fesvr/htif.cc
index ead309c..29eb7d8 100644
--- a/fesvr/htif.cc
+++ b/fesvr/htif.cc
@@ -82,8 +82,14 @@ htif_t::~htif_t()
void htif_t::start()
{
- if (!targs.empty() && targs[0] != "none")
+ if (!targs.empty() && targs[0] != "none") {
+ try {
load_program();
+ } catch (const incompat_xlen & err) {
+ fprintf(stderr, "Error: cannot execute %d-bit program on RV%d hart\n", err.actual_xlen, err.expected_xlen);
+ exit(1);
+ }
+ }
reset();
}
@@ -129,7 +135,7 @@ std::map<std::string, uint64_t> htif_t::load_payload(const std::string& payload,
} preload_aware_memif(this);
try {
- return load_elf(path.c_str(), &preload_aware_memif, entry);
+ return load_elf(path.c_str(), &preload_aware_memif, entry, expected_xlen);
} catch (mem_trap_t& t) {
bad_address("loading payload " + payload, t.get_tval());
abort();