[ipxe-devel] #define SWD_BEST_OFF 1 - breaks my build

Joshua C. joshuacov at googlemail.com
Mon Apr 23 23:06:22 UTC 2012


As the title says "#define SWD_BEST_OFF    1" breaks my build of
bin/10ec8168.rom. In the file nrv2b.c best_pos is defined as

#if defined(SWD_BEST_OFF)
	unsigned int best_pos[ SWD_BEST_OFF ];
#endif

Because of  SWD_BEST_OFF==1 the following code breaks the build (line
632 in nrv2b.c):

#if defined(SWD_BEST_OFF)
 	if (s->best_pos[2] == 0)
 		s->best_pos[2] = key + 1;
 #endif


I patch this as follows so that I can build my rom:

---
 util/nrv2b.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/util/nrv2b.c b/util/nrv2b.c
index cbb94c0..b7f9be1 100644
--- a/util/nrv2b.c
+++ b/util/nrv2b.c
@@ -629,7 +629,7 @@ static int swd_search2(struct ucl_swd *s)
 			s->b[s->bp], s->b[s->bp+1], s->b[key], s->b[key+1]);
 #endif
 	assert(memcmp(&s->b[s->bp],&s->b[key],2) == 0);
-#if defined(SWD_BEST_OFF)
+#if defined(SWD_BEST_OFF) && (SWD_BEST_OFF >= 2)
 	if (s->best_pos[2] == 0)
 		s->best_pos[2] = key + 1;
 #endif
-- 
1.7.10
-- 

However looking through the code in nrv2b.c I didn't see SWD_BEST_OFF
being changed anywhere. So the following actually never gets executed:

line     code

 593 #if defined(SWD_BEST_OFF)
 594                         if (i < SWD_BEST_OFF)

 685 #if defined(SWD_BEST_OFF)
 689                         for (i = 2; i < SWD_BEST_OFF; i++)

Can someone look at this?

-- joshua



More information about the ipxe-devel mailing list