commit ed69dc4590a6c76129baa645c449c229a4d69fa8
parent 00ecdccfda58bd7550cc1e7ebea349bba657c4fe
Author: Roberto Vargas <roberto.vargas@arm.com>
Date: Thu, 25 Apr 2019 11:11:23 +0100
[rom] Give more descriptive error messages
Change-Id: Ie2c4cd3acf4768a3d4958ed7da01b91c7ae49e86
Diffstat:
2 files changed, 27 insertions(+), 13 deletions(-)
diff --git a/target/hosted/rom.c b/target/hosted/rom.c
@@ -50,16 +50,21 @@ imach(void)
static void
namespace(void)
{
- if (bind("#t0", "/dev/uart") < 0)
+ if (bind("#t0", "/dev/uart") < 0) {
+ kerror("/dev/uart");
goto error;
- if (bind("#t0", "/dev/cons") < 0)
+ }
+ if (bind("#t0", "/dev/cons") < 0) {
+ kerror("/dev/cons");
goto error;
- if (mount("#R", "/arfs", "/blobs/example.a") < 0)
+ }
+ if (mount("#R", "/arfs", "/blobs/example.a") < 0) {
+ kerror("mount /arfs");
goto error;
+ }
return;
error:
- kerror("namespace");
panic("namespace");
}
diff --git a/target/native/rom.c b/target/native/rom.c
@@ -99,20 +99,30 @@ extern void conslink(Attr *attr);
static void
namespace(void)
{
- if (open("#s0/raw", O_READ) != 0)
+ if (open("#s0/raw", O_READ) != 0) {
+ kerror("#s0/raw read");
goto error;
- if (open("#s0/raw", O_WRITE) != 1)
+ }
+ if (open("#s0/raw", O_WRITE) != 1) {
+ kerror("#s0/raw write");
goto error;
- if (open("#s0/raw", O_WRITE) != 2)
+ }
+ if (open("#s0/raw", O_WRITE) != 2) {
+ kerror("#s0/raw write");
goto error;
-
- if (bind("#s0", "/dev/cons") < 0)
+ }
+ if (bind("#s0", "/dev/cons") < 0) {
+ kerror("bind:/dev/cons");
goto error;
-
- if (bind("#t0", "/dev/uart0") < 0)
+ }
+ if (bind("#t0", "/dev/uart0") < 0) {
+ kerror("bind:/dev/uart0");
goto error;
- if (bind("#t1", "/dev/uart3") < 0)
+ }
+ if (bind("#t1", "/dev/uart3") < 0) {
+ kerror("bind:/dev/uart3");
goto error;
+ }
/*
* TODO: This should be in devc.c. The way the rcode file is parsed should be
@@ -124,7 +134,6 @@ namespace(void)
return;
error:
- kerror("namespace");
panic("namespace");
}