Skip to contentSkip to conversation

Improve user feedback in case of FPGA bitstream load failure

PATCH Superseded [email protected] 4 participants 8 messages Jun 17, 2025 – Jun 19, 2025

Subsystems (2)

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Improve user feedback in case of FPGA bitstream load failure

From: Pieter Van Trappen <[email protected]>

In fpga.c, change debug() calls to puts() for important user feedback. In zynqpl.c, change 'up to' to 'above' which corrects this confusing or wrong statement.

---
 cmd/fpga.c            | 20 ++++++++++----------
 drivers/fpga/zynqpl.c |  2 +-
 2 files changed, 11 insertions(+), 11 deletions(-)
cmd/fpga.c +10 -10
index 9dc7b63db5d..2c2a63524de 100644
@@ -43,7 +43,7 @@ static int do_fpga_check_params(long *dev, long *fpga_data, size_t *data_size,
 	debug("%s %d, %d\n", __func__, argc, cmdtp->maxargs);
 
 	if (argc != cmdtp->maxargs) {
-		debug("fpga: incorrect parameters passed\n");
+		puts("fpga: incorrect parameters passed\n");
 		return CMD_RET_USAGE;
 	}
 
@@ -51,14 +51,14 @@ static int do_fpga_check_params(long *dev, long *fpga_data, size_t *data_size,
 
 	local_fpga_data = simple_strtol(argv[1], NULL, 16);
 	if (!local_fpga_data) {
-		debug("fpga: zero fpga_data address\n");
+		puts("fpga: zero fpga_data address\n");
 		return CMD_RET_USAGE;
 	}
 	*fpga_data = local_fpga_data;
 
 	local_data_size = hextoul(argv[2], NULL);
 	if (!local_data_size) {
-		debug("fpga: zero size\n");
+		puts("fpga: zero size\n");
 		return CMD_RET_USAGE;
 	}
 	*data_size = local_data_size;
@@ -78,7 +78,7 @@ static int do_fpga_loads(struct cmd_tbl *cmdtp, int flag, int argc,
 	memset(&fpga_sec_info, 0, sizeof(fpga_sec_info));
 
 	if (argc < 5) {
-		debug("fpga: incorrect parameters passed\n");
+		puts("fpga: incorrect parameters passed\n");
 		return CMD_RET_USAGE;
 	}
 
@@ -100,13 +100,13 @@ static int do_fpga_loads(struct cmd_tbl *cmdtp, int flag, int argc,
 
 	if (fpga_sec_info.authflag >= FPGA_NO_ENC_OR_NO_AUTH &&
 	    fpga_sec_info.encflag >= FPGA_NO_ENC_OR_NO_AUTH) {
-		debug("fpga: Use <fpga load> for NonSecure bitstream\n");
+		puts("fpga: Use <fpga load> for NonSecure bitstream\n");
 		return CMD_RET_USAGE;
 	}
 
 	if (fpga_sec_info.encflag == FPGA_ENC_USR_KEY &&
 	    !fpga_sec_info.userkey_addr) {
-		debug("fpga: User key not provided\n");
+		puts("fpga: User key not provided\n");
 		return CMD_RET_USAGE;
 	}
 
@@ -248,12 +248,12 @@ static int do_fpga_loadmk(struct cmd_tbl *cmdtp, int flag, int argc,
 	debug("fpga: argc %x, dev %lx, datastr %s\n", argc, dev, datastr);
 
 	if (dev == FPGA_INVALID_DEVICE) {
-		debug("fpga: Invalid fpga device\n");
+		puts("fpga: Invalid fpga device\n");
 		return CMD_RET_USAGE;
 	}
 
 	if (argc == 0 && !datastr) {
-		debug("fpga: No datastr passed\n");
+		puts("fpga: No datastr passed\n");
 		return CMD_RET_USAGE;
 	}
 
@@ -390,7 +390,7 @@ static int do_fpga_wrapper(struct cmd_tbl *cmdtp, int flag, int argc,
 	fpga_cmd = find_cmd_tbl(argv[1], fpga_commands,
 				ARRAY_SIZE(fpga_commands));
 	if (!fpga_cmd) {
-		debug("fpga: non existing command\n");
+		puts("fpga: non existing command\n");
 		return CMD_RET_USAGE;
 	}
 
@@ -398,7 +398,7 @@ static int do_fpga_wrapper(struct cmd_tbl *cmdtp, int flag, int argc,
 	argv += 2;
 
 	if (argc > fpga_cmd->maxargs) {
-		debug("fpga: more parameters passed\n");
+		puts("fpga: more parameters passed\n");
 		return CMD_RET_USAGE;
 	}
 
drivers/fpga/zynqpl.c +1 -1
index 3e86d854a01..7495ac2a69a 100644
@@ -360,7 +360,7 @@ static int zynq_validate_bitstream(xilinx_desc *desc, const void *buf,
 	}
 
 	if ((u32)buf < SZ_1M) {
-		printf("%s: Bitstream has to be placed up to 1MB (%x)\n",
+		printf("%s: Bitstream has to be placed above 1MB (%x)\n",
 		       __func__, (u32)buf);
 		return FPGA_FAIL;
 	}

base-commit: 62d24441e0a29c828fda6fbda3b10710ce714094

Signature · 1 line
2.48.1
maintainer
#1 lore raw
Quoted 17 lines · On 6/17/25 11:23, [email protected] wrote:

From: Pieter Van Trappen <[email protected]>

In fpga.c, change debug() calls to puts() for important user feedback. In zynqpl.c, change 'up to' to 'above' which corrects this confusing or wrong statement.

---
  cmd/fpga.c            | 20 ++++++++++----------
  drivers/fpga/zynqpl.c |  2 +-
  2 files changed, 11 insertions(+), 11 deletions(-)
cmd/fpga.c +0 -0
index 9dc7b63db5d..2c2a63524de 100644

cmd/fpga.c static int do_fpga_check_params(long *dev, long *fpga_data, size_t *data_size, · line 46

Quoted 5 lines
cmd/fpga.c +1 -1
@@ -43,7 +43,7 @@ static int do_fpga_check_params(long *dev, long *fpga_data, size_t *data_size,
  	debug("%s %d, %d\n", __func__, argc, cmdtp->maxargs);
 
  	if (argc != cmdtp->maxargs) {
-		debug("fpga: incorrect parameters passed\n");
+		puts("fpga: incorrect parameters passed\n");

I think all of these should be moved to log_err that you should be able to control verbosity.

Tom: I think this is where you want to go right?

Thanks,
Michal

#2 lore raw
Quoted 28 lines · Michal Simek
Quoted 17 lines · On 6/17/25 11:23, [email protected] wrote:

From: Pieter Van Trappen <[email protected]>

In fpga.c, change debug() calls to puts() for important user feedback. In zynqpl.c, change 'up to' to 'above' which corrects this confusing or wrong statement.

---
  cmd/fpga.c            | 20 ++++++++++----------
  drivers/fpga/zynqpl.c |  2 +-
  2 files changed, 11 insertions(+), 11 deletions(-)
cmd/fpga.c +0 -0
index 9dc7b63db5d..2c2a63524de 100644

cmd/fpga.c static int do_fpga_check_params(long *dev, long *fpga_data, size_t *data_size, · line 45

Quoted 4 lines
cmd/fpga.c +1 -1
@@ -43,7 +43,7 @@ static int do_fpga_check_params(long *dev, long *fpga_data, size_t *data_size,
  	debug("%s %d, %d\n", __func__, argc, cmdtp->maxargs);
  	if (argc != cmdtp->maxargs) {
-		debug("fpga: incorrect parameters passed\n");
+		puts("fpga: incorrect parameters passed\n");

I think all of these should be moved to log_err that you should be able to control verbosity.

Quoted 1 line

Tom: I think this is where you want to go right?

Sounds right, thanks.

Signature · 1 line
Tom
#3 lore raw
Quoted 29 lines · Tom Rini
Quoted 28 lines · Michal Simek
Quoted 17 lines · On 6/17/25 11:23, [email protected] wrote:

From: Pieter Van Trappen <[email protected]>

In fpga.c, change debug() calls to puts() for important user feedback. In zynqpl.c, change 'up to' to 'above' which corrects this confusing or wrong statement.

---
   cmd/fpga.c            | 20 ++++++++++----------
   drivers/fpga/zynqpl.c |  2 +-
   2 files changed, 11 insertions(+), 11 deletions(-)
cmd/fpga.c +0 -0
index 9dc7b63db5d..2c2a63524de 100644

cmd/fpga.c static int do_fpga_check_params(long *dev, long *fpga_data, size_t *data_size, · line 45

Quoted 4 lines
cmd/fpga.c +1 -1
@@ -43,7 +43,7 @@ static int do_fpga_check_params(long *dev, long *fpga_data, size_t *data_size,
   	debug("%s %d, %d\n", __func__, argc, cmdtp->maxargs);
   	if (argc != cmdtp->maxargs) {
-		debug("fpga: incorrect parameters passed\n");
+		puts("fpga: incorrect parameters passed\n");

I think all of these should be moved to log_err that you should be able to control verbosity.

Quoted 4 lines
Quoted 1 line

Tom: I think this is where you want to go right?

Sounds right, thanks.

Right I will amend accordingly in a v2.

I'm trying to compile now that it's more than some tweaks and I notice many (fixable) errors in the drivers/fpga files such as missing time.h includes, spotted by gcc 14.2 (x86_64). I'm on the next branch.

Is this due to my gcc being too recent or is something else going on? I don't mind patching these in case that's welcomed; let me know.

Thanks, Pieter

#4 lore raw
Quoted 35 lines · Pieter Van Trappen
Quoted 29 lines · Tom Rini
Quoted 28 lines · Michal Simek
Quoted 17 lines · On 6/17/25 11:23, [email protected] wrote:

From: Pieter Van Trappen <[email protected]>

In fpga.c, change debug() calls to puts() for important user feedback. In zynqpl.c, change 'up to' to 'above' which corrects this confusing or wrong statement.

---
   cmd/fpga.c            | 20 ++++++++++----------
   drivers/fpga/zynqpl.c |  2 +-
   2 files changed, 11 insertions(+), 11 deletions(-)
cmd/fpga.c +0 -0
index 9dc7b63db5d..2c2a63524de 100644

cmd/fpga.c static int do_fpga_check_params(long *dev, long *fpga_data, size_t *data_size, · line 45

Quoted 4 lines
cmd/fpga.c +1 -1
@@ -43,7 +43,7 @@ static int do_fpga_check_params(long *dev, long *fpga_data, size_t *data_size,
   	debug("%s %d, %d\n", __func__, argc, cmdtp->maxargs);
   	if (argc != cmdtp->maxargs) {
-		debug("fpga: incorrect parameters passed\n");
+		puts("fpga: incorrect parameters passed\n");

I think all of these should be moved to log_err that you should be able to control verbosity.

Quoted 4 lines
Quoted 1 line

Tom: I think this is where you want to go right?

Sounds right, thanks.

Quoted 8 lines

Right I will amend accordingly in a v2.

I'm trying to compile now that it's more than some tweaks and I notice many (fixable) errors in the drivers/fpga files such as missing time.h includes, spotted by gcc 14.2 (x86_64). I'm on the next branch.

Is this due to my gcc being too recent or is something else going on? I don't mind patching these in case that's welcomed; let me know.

Just further changes on the next branch which your changes are exposing I guess, separate patches for them would be much appreciated, thanks!

Signature · 1 line
Tom
#5 lore raw
Quoted 24 lines · Tom Rini
Quoted 23 lines · Pieter Van Trappen
Quoted 11 lines · Tom Rini
Quoted 10 lines · Michal Simek

Review

Quoted 3 lines · On 6/17/25 11:23, [email protected] wrote:

From: Pieter Van Trappen <[email protected]>

(quoted diff) +1 -1
-		debug("fpga: incorrect parameters passed\n");
+		puts("fpga: incorrect parameters passed\n");

I think all of these should be moved to log_err that you should be able to control verbosity.

Quoted 4 lines
Quoted 1 line

Tom: I think this is where you want to go right?

Sounds right, thanks.

Right I will amend accordingly in a v2.

I'm trying to compile now that it's more than some tweaks and I notice many (fixable) errors in the drivers/fpga files such as missing time.h includes, spotted by gcc 14.2 (x86_64). I'm on the next branch.

Quoted 6 lines
Quoted 2 lines

Is this due to my gcc being too recent or is something else going on? I don't mind patching these in case that's welcomed; let me know.

Just further changes on the next branch which your changes are exposing I guess, separate patches for them would be much appreciated, thanks!

Thanks but that's not the case; I switched to the latest next HEAD which is your commit ce2a7fcb and I get the same error, see below (one of many). Maybe due to my config in which I enabled all FPGA-related configs? Is is there a allyesconfig pipeline somewhere? Sorry I'm new to u-boot development and I don't think patchwork is running pipelines. I'm further investigating, I'm probably doing something wrong although the gcc errors are correct AFAIK.

drivers/fpga/spartan2.c: In function ‘spartan2_sp_load’:
drivers/fpga/spartan2.c:145:22: error: implicit declaration of function ‘get_timer’ [-Wimplicit-function-declaration]
145 | ts = get_timer (0); /* get current
time */

      |                      ^~~~~~~~~
#6 lore raw
Quoted 32 lines · Pieter Van Trappen
Quoted 24 lines · Tom Rini
Quoted 23 lines · Pieter Van Trappen
Quoted 11 lines · Tom Rini
Quoted 10 lines · Michal Simek

Review

Quoted 3 lines · On 6/17/25 11:23, [email protected] wrote:

From: Pieter Van Trappen <[email protected]>

(quoted diff) +1 -1
-		debug("fpga: incorrect parameters passed\n");
+		puts("fpga: incorrect parameters passed\n");

I think all of these should be moved to log_err that you should be able to control verbosity.

Quoted 4 lines
Quoted 1 line

Tom: I think this is where you want to go right?

Sounds right, thanks.

Right I will amend accordingly in a v2.

I'm trying to compile now that it's more than some tweaks and I notice many (fixable) errors in the drivers/fpga files such as missing time.h includes, spotted by gcc 14.2 (x86_64). I'm on the next branch.

Quoted 6 lines
Quoted 2 lines

Is this due to my gcc being too recent or is something else going on? I don't mind patching these in case that's welcomed; let me know.

Just further changes on the next branch which your changes are exposing I guess, separate patches for them would be much appreciated, thanks!

Quoted 7 lines

Thanks but that's not the case; I switched to the latest next HEAD which is your commit ce2a7fcb and I get the same error, see below (one of many). Maybe due to my config in which I enabled all FPGA-related configs? Is is there a allyesconfig pipeline somewhere? Sorry I'm new to u-boot development and I don't think patchwork is running pipelines. I'm further investigating, I'm probably doing something wrong although the gcc errors are correct AFAIK.

Yes, it's related to changing the configs and no we don't have an allyesconfig option in the pipeline. It's still somewhere on the TODO list as there's a lot of issues to sort out there.

Signature · 1 line
Tom
#7 lore raw
Quoted 41 lines · Tom Rini
Quoted 32 lines · Pieter Van Trappen
Quoted 24 lines · Tom Rini
Quoted 23 lines · Pieter Van Trappen
Quoted 11 lines · Tom Rini
Quoted 10 lines · Michal Simek

Review

Quoted 3 lines · On 6/17/25 11:23, [email protected] wrote:

From: Pieter Van Trappen <[email protected]>

(quoted diff) +1 -1
-		debug("fpga: incorrect parameters passed\n");
+		puts("fpga: incorrect parameters passed\n");

I think all of these should be moved to log_err that you should be able to control verbosity.

Quoted 4 lines
Quoted 1 line

Tom: I think this is where you want to go right?

Sounds right, thanks.

Right I will amend accordingly in a v2.

I'm trying to compile now that it's more than some tweaks and I notice many (fixable) errors in the drivers/fpga files such as missing time.h includes, spotted by gcc 14.2 (x86_64). I'm on the next branch.

Quoted 6 lines
Quoted 2 lines

Is this due to my gcc being too recent or is something else going on? I don't mind patching these in case that's welcomed; let me know.

Just further changes on the next branch which your changes are exposing I guess, separate patches for them would be much appreciated, thanks!

Quoted 7 lines

Thanks but that's not the case; I switched to the latest next HEAD which is your commit ce2a7fcb and I get the same error, see below (one of many). Maybe due to my config in which I enabled all FPGA-related configs? Is is there a allyesconfig pipeline somewhere? Sorry I'm new to u-boot development and I don't think patchwork is running pipelines. I'm further investigating, I'm probably doing something wrong although the gcc errors are correct AFAIK.

Quoted 3 lines

Yes, it's related to changing the configs and no we don't have an allyesconfig option in the pipeline. It's still somewhere on the TODO list as there's a lot of issues to sort out there.

OK I understand now; just wanted to make sure I'm not doing work that doesn't serve any purpose. I happily contribute by activating all FPGA-related configs and fix these compilers errors which seems rather straight-forward.

That'll take more time than initially anticipated; I'm hoping to submit patches next week.

Cheers, Pieter