A-yup. :)

On Fri, 2009-06-19 at 18:13 -0700, Rick Altherr wrote:
> Rather than casting to int, should the printf's be using the PRI*  
> macros for uint32_t?
> --
> Rick Altherr
> [email protected]
> 
> "He said he hadn't had a byte in three days. I had a short, so I split  
> it with him."
>   -- Unsigned
> 
> 
> 
> On Jun 19, 2009, at 4:16 PM, [email protected] wrote:
> 
> > Author: duane
> > Date: 2009-06-20 01:15:58 +0200 (Sat, 20 Jun 2009)
> > New Revision: 2293
> >
> > Modified:
> >   trunk/src/jtag/arm-jtag-ew.c
> >   trunk/src/jtag/core.c
> >   trunk/src/jtag/ft2232.c
> >   trunk/src/jtag/jlink.c
> >   trunk/src/jtag/presto.c
> >   trunk/src/jtag/tcl.c
> > Log:
> > printf() warning fixes due to uint32_t change-over
> >
> > Modified: trunk/src/jtag/arm-jtag-ew.c
> > ===================================================================
> > --- trunk/src/jtag/arm-jtag-ew.c    2009-06-19 22:39:35 UTC (rev 2292)
> > +++ trunk/src/jtag/arm-jtag-ew.c    2009-06-19 23:15:58 UTC (rev 2293)
> > @@ -472,14 +472,14 @@
> >     if (result == 0)
> >     {
> >             unsigned int u_tg = buf_get_u32(usb_in_buffer, 0, 16);
> > -           LOG_INFO("U_tg = %d mV, U_aux = %d mV, U_tgpwr = %d mV, I_tgpwr 
> > =  
> > %d mA, D1 = %d, Target power %s %s\n", \
> > -                   buf_get_u32(usb_in_buffer + 0, 0, 16), \
> > -                   buf_get_u32(usb_in_buffer + 2, 0, 16), \
> > -                   buf_get_u32(usb_in_buffer + 4, 0, 16), \
> > -                   buf_get_u32(usb_in_buffer + 6, 0, 16), \
> > -                   usb_in_buffer[9], \
> > -                   usb_in_buffer[11] ? "OVERCURRENT" : "OK", \
> > -                   usb_in_buffer[10] ? "enabled" : "disabled");
> > +           LOG_INFO("U_tg = %d mV, U_aux = %d mV, U_tgpwr = %d mV, I_tgpwr 
> > =  
> > %d mA, D1 = %d, Target power %s %s\n",
> > +                    (int)(buf_get_u32(usb_in_buffer + 0, 0, 16)),
> > +                    (int)(buf_get_u32(usb_in_buffer + 2, 0, 16)),
> > +                    (int)(buf_get_u32(usb_in_buffer + 4, 0, 16)),
> > +                    (int)(buf_get_u32(usb_in_buffer + 6, 0, 16)),
> > +                    usb_in_buffer[9],
> > +                    usb_in_buffer[11] ? "OVERCURRENT" : "OK",
> > +                    usb_in_buffer[10] ? "enabled" : "disabled");
> >
> >             if (u_tg < 1500)
> >             {
> >
> > Modified: trunk/src/jtag/core.c
> > ===================================================================
> > --- trunk/src/jtag/core.c   2009-06-19 22:39:35 UTC (rev 2292)
> > +++ trunk/src/jtag/core.c   2009-06-19 23:15:58 UTC (rev 2293)
> > @@ -862,10 +862,13 @@
> >             const char *name, uint32_t idcode)
> > {
> >     log_printf_lf(level, __FILE__, __LINE__, __FUNCTION__,
> > -                   "JTAG tap: %s %16.16s: 0x%08x "
> > -                   "(mfg: 0x%3.3x, part: 0x%4.4x, ver: 0x%1.1x)",
> > -           name, msg, idcode,
> > -           EXTRACT_MFG(idcode), EXTRACT_PART(idcode), EXTRACT_VER(idcode) 
> > );
> > +                             "JTAG tap: %s %16.16s: 0x%08x "
> > +                             "(mfg: 0x%3.3x, part: 0x%4.4x, ver: 0x%1.1x)",
> > +                             name, msg,
> > +                             (unsigned int)idcode,
> > +                             (unsigned int)EXTRACT_MFG(idcode),
> > +                             (unsigned int)EXTRACT_PART(idcode),
> > +                             (unsigned int)EXTRACT_VER(idcode) );
> > }
> >
> > static bool jtag_idcode_is_final(uint32_t idcode)
> > @@ -889,7 +892,7 @@
> >             if (!triggered && jtag_idcode_is_final(idcode))
> >                     continue;
> >             LOG_WARNING("Unexpected idcode after end of chain: %d 0x%08x",
> > -                           count, idcode);
> > +                                   count, (unsigned int)idcode);
> >             triggered = true;
> >     }
> > }
> > @@ -1100,7 +1103,7 @@
> >     LOG_DEBUG("Created Tap: %s @ abs position %d, "
> >                     "irlen %d, capture: 0x%x mask: 0x%x", tap->dotted_name,
> >                             tap->abs_chain_position, tap->ir_length,
> > -                           tap->ir_capture_value, tap->ir_capture_mask);
> > +                     (unsigned int)(tap->ir_capture_value), (unsigned 
> > int)(tap- 
> > >ir_capture_mask));
> >     jtag_tap_add(tap);
> > }
> >
> >
> > Modified: trunk/src/jtag/ft2232.c
> > ===================================================================
> > --- trunk/src/jtag/ft2232.c 2009-06-19 22:39:35 UTC (rev 2292)
> > +++ trunk/src/jtag/ft2232.c 2009-06-19 23:15:58 UTC (rev 2293)
> > @@ -411,7 +411,9 @@
> >
> >     if (*bytes_read < size)
> >     {
> > -           LOG_ERROR("couldn't read the requested number of bytes from  
> > FT2232 device (%i < %i)", *bytes_read, size);
> > +           LOG_ERROR("couldn't read the requested number of bytes from  
> > FT2232 device (%i < %i)",
> > +                     (unsigned int)(*bytes_read),
> > +                     (unsigned int)size);
> >             return ERROR_JTAG_DEVICE_ERROR;
> >     }
> >
> > @@ -963,7 +965,8 @@
> >             LOG_ERROR("couldn't write MPSSE commands to FT2232");
> >             exit(-1);
> >     }
> > -   LOG_DEBUG("ft2232_buffer_size: %i, bytes_written: %i",  
> > ft2232_buffer_size, bytes_written);
> > +   LOG_DEBUG("ft2232_buffer_size: %i, bytes_written: %i",
> > +             ft2232_buffer_size, (int)bytes_written);
> >     ft2232_buffer_size = 0;
> >
> >     /* add command for complete bytes */
> > @@ -1016,7 +1019,9 @@
> >                     LOG_ERROR("couldn't write MPSSE commands to FT2232");
> >                     exit(-1);
> >             }
> > -           LOG_DEBUG("ft2232_buffer_size: %i, bytes_written: %i",  
> > ft2232_buffer_size, bytes_written);
> > +           LOG_DEBUG("ft2232_buffer_size: %i, bytes_written: %i",
> > +                     ft2232_buffer_size,
> > +                     (int)bytes_written);
> >             ft2232_buffer_size = 0;
> >
> >             if (type != SCAN_OUT)
> > @@ -1026,7 +1031,9 @@
> >                             LOG_ERROR("couldn't read from FT2232");
> >                             exit(-1);
> >                     }
> > -                   LOG_DEBUG("thisrun_read: %i, bytes_read: %i", 
> > thisrun_read,  
> > bytes_read);
> > +                   LOG_DEBUG("thisrun_read: %i, bytes_read: %i",
> > +                             thisrun_read,
> > +                             (int)bytes_read);
> >                     receive_pointer += bytes_read;
> >             }
> >     }
> > @@ -1122,7 +1129,9 @@
> >             LOG_ERROR("couldn't write MPSSE commands to FT2232");
> >             exit(-1);
> >     }
> > -   LOG_DEBUG("ft2232_buffer_size: %i, bytes_written: %i",  
> > ft2232_buffer_size, bytes_written);
> > +   LOG_DEBUG("ft2232_buffer_size: %i, bytes_written: %i",
> > +             ft2232_buffer_size,
> > +             (int)bytes_written);
> >     ft2232_buffer_size = 0;
> >
> >     if (type != SCAN_OUT)
> > @@ -1132,7 +1141,9 @@
> >                     LOG_ERROR("couldn't read from FT2232");
> >                     exit(-1);
> >             }
> > -           LOG_DEBUG("thisrun_read: %i, bytes_read: %i", thisrun_read,  
> > bytes_read);
> > +           LOG_DEBUG("thisrun_read: %i, bytes_read: %i",
> > +                     thisrun_read,
> > +                     (int)bytes_read);
> >             receive_pointer += bytes_read;
> >     }
> >
> >
> > Modified: trunk/src/jtag/jlink.c
> > ===================================================================
> > --- trunk/src/jtag/jlink.c  2009-06-19 22:39:35 UTC (rev 2292)
> > +++ trunk/src/jtag/jlink.c  2009-06-19 23:15:58 UTC (rev 2293)
> > @@ -589,7 +589,7 @@
> >     }
> >
> >     jlink_caps = buf_get_u32(usb_in_buffer, 0, 32);
> > -   LOG_INFO("JLink caps 0x%x", jlink_caps);
> > +   LOG_INFO("JLink caps 0x%x", (unsigned)jlink_caps);
> >
> >     if (jlink_caps & (1 << EMU_CAP_GET_HW_VERSION))
> >     {
> > @@ -608,7 +608,7 @@
> >             if (major_revision >= 5)
> >                     jlink_hw_jtag_version = 3;
> >
> > -           LOG_INFO("JLink hw version %i", jlink_hw_version);
> > +           LOG_INFO("JLink hw version %i", (int)jlink_hw_version);
> >     }
> >
> >     if (jlink_caps & (1 << EMU_CAP_GET_MAX_BLOCK_SIZE))
> > @@ -624,7 +624,7 @@
> >             }
> >
> >             jlink_max_size = buf_get_u32(usb_in_buffer, 0, 32);
> > -           LOG_INFO("JLink max mem block %i", jlink_max_size);
> > +           LOG_INFO("JLink max mem block %i", (int)jlink_max_size);
> >     }
> >
> >     return ERROR_OK;
> >
> > Modified: trunk/src/jtag/presto.c
> > ===================================================================
> > --- trunk/src/jtag/presto.c 2009-06-19 22:39:35 UTC (rev 2292)
> > +++ trunk/src/jtag/presto.c 2009-06-19 23:15:58 UTC (rev 2293)
> > @@ -150,7 +150,8 @@
> >
> >     if (ftbytes != size)
> >     {
> > -           LOG_ERROR("couldn't write the requested number of bytes to 
> > PRESTO  
> > (%u < %u)", (uint32_t)ftbytes, size);
> > +           LOG_ERROR("couldn't write the requested number of bytes to 
> > PRESTO  
> > (%u < %u)",
> > +                     (unsigned)ftbytes, (unsigned)size);
> >             return ERROR_JTAG_DEVICE_ERROR;
> >     }
> >
> > @@ -192,7 +193,8 @@
> >     if (ftbytes != size)
> >     {
> >             /* this is just a warning, there might have been timeout when  
> > detecting PRESTO, which is not fatal */
> > -           LOG_WARNING("couldn't read the requested number of bytes from  
> > PRESTO (%u < %u)", (uint32_t)ftbytes, size);
> > +           LOG_WARNING("couldn't read the requested number of bytes from  
> > PRESTO (%u < %u)",
> > +                       (unsigned)ftbytes, (unsigned)size);
> >             return ERROR_JTAG_DEVICE_ERROR;
> >     }
> >
> >
> > Modified: trunk/src/jtag/tcl.c
> > ===================================================================
> > --- trunk/src/jtag/tcl.c    2009-06-19 22:39:35 UTC (rev 2292)
> > +++ trunk/src/jtag/tcl.c    2009-06-19 23:15:58 UTC (rev 2293)
> > @@ -872,16 +872,16 @@
> >                                       tap->abs_chain_position,
> >                                       tap->dotted_name,
> >                                       tap->enabled ? 'Y' : 'n',
> > -                                     tap->idcode,
> > -                                     (tap->expected_ids_cnt > 0 ? 
> > tap->expected_ids[0] : 0),
> > -                                     tap->ir_length,
> > -                                     expected,
> > -                                     expected_mask,
> > -                                     cur_instr);
> > +                                     (unsigned int)(tap->idcode),
> > +                                     (unsigned int)(tap->expected_ids_cnt 
> > > 0 ? tap- 
> > >expected_ids[0] : 0),
> > +                                     (unsigned int)(tap->ir_length),
> > +                                     (unsigned int)(expected),
> > +                                     (unsigned int)(expected_mask),
> > +                                     (unsigned int)(cur_instr));
> >
> >             for (ii = 1; ii < tap->expected_ids_cnt; ii++) {
> >                     command_print(cmd_ctx, "   |                    |       
> >    
> > |            | 0x%08x |      |      |      |         ",
> > -                                             tap->expected_ids[ii]);
> > +                                             (unsigned 
> > int)(tap->expected_ids[ii]));
> >             }
> >
> >             tap = tap->next_tap;
> > @@ -1503,3 +1503,9 @@
> >     return ERROR_OK;
> > }
> >
> > +/*
> > + * Local Variables:
> > + * c-basic-offset: 4
> > + * tab-width: 4
> > + * End:
> > + */
> >
> > _______________________________________________
> > Openocd-svn mailing list
> > [email protected]
> > https://lists.berlios.de/mailman/listinfo/openocd-svn
> 
> _______________________________________________
> Openocd-development mailing list
> [email protected]
> https://lists.berlios.de/mailman/listinfo/openocd-development

_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to