printf("ST Microelectronics ");
                break;
        default:
-               printf("Unknown Vendor: (0x%08X) ", info->flash_id);
+               printf("Unknown Vendor: (0x%08lX) ", info->flash_id);
                break;
        }
        for (i = 0; i < info->sector_count; ++i) {
                read_flash(ulOffset, &d);
                if (d != 0xffff) {
                        printf
-                           ("Flash not erased at offset 0x%x Please erase to reprogram \n",
+                           ("Flash not erased at offset 0x%lx Please erase to reprogram\n",
                             ulOffset);
                        return FLASH_FAIL;
                }
                read_flash(ulOffset, &d);
                if (d != 0xffff) {
                        printf
-                           ("Flash not erased at offset 0x%x Please erase to reprogram \n",
+                           ("Flash not erased at offset 0x%lx Please erase to reprogram\n",
                             ulOffset);
                        return FLASH_FAIL;
                }
 
                        "Writing one time programmable memory\n"
                        "Make sure your operating voltages and temperature are within spec\n"
                        "   source address:  0x%p\n"
-                       "   OTP destination: %s page 0x%03X - %s page 0x%03X\n"
-                       "   number to write: %ld halfpages\n"
+                       "   OTP destination: %s page 0x%03X - %s page 0x%03lX\n"
+                       "   number to write: %lu halfpages\n"
                        " type \"YES\" (no quotes) to confirm: ",
                        addr,
                        lowup(half), page,
                }
        }
 
-       printf("OTP memory %s: addr 0x%08lx  page 0x%03X  count %ld ... ",
+       printf("OTP memory %s: addr 0x%p  page 0x%03X  count %zu ... ",
                argv[1], addr, page, count);
 
        set_otp_timing(otp_func == bfrom_OtpWrite);
 
                }
                if (i == ARRAY_SIZE(bfin_memory_map)) {
                        printf("%cCPLB exception outside of memory map at 0x%p\n",
-                               (data ? 'D' : 'I'), new_cplb_addr);
+                               (data ? 'D' : 'I'), (void *)new_cplb_addr);
                        bfin_panic(regs);
                } else
                        debug("CPLB addr %p matches map 0x%p - 0x%p\n", new_cplb_addr, bfin_memory_map[i].start, bfin_memory_map[i].end);
 static void decode_address(char *buf, unsigned long address)
 {
        unsigned long sym_addr;
+       void *paddr = (void *)address;
        const char *sym = symbol_lookup(address, &sym_addr);
 
        if (sym) {
-               sprintf(buf, "<0x%p> { %s + 0x%x }", address, sym, address - sym_addr);
+               sprintf(buf, "<0x%p> { %s + 0x%lx }", paddr, sym, address - sym_addr);
                return;
        }
 
        if (!address)
-               sprintf(buf, "<0x%p> /* Maybe null pointer? */", address);
+               sprintf(buf, "<0x%p> /* Maybe null pointer? */", paddr);
        else if (address >= CONFIG_SYS_MONITOR_BASE &&
                 address < CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN)
-               sprintf(buf, "<0x%p> /* somewhere in u-boot */", address);
+               sprintf(buf, "<0x%p> /* somewhere in u-boot */", paddr);
        else
-               sprintf(buf, "<0x%p> /* unknown address */", address);
+               sprintf(buf, "<0x%p> /* unknown address */", paddr);
 }
 
 static char *strhwerrcause(uint16_t hwerrcause)
 void dump(struct pt_regs *fp)
 {
        char buf[150];
-       size_t i;
+       int i;
        uint16_t hwerrcause, excause;
 
        if (!ENABLE_DUMP)
        printf("SEQUENCER STATUS:\n");
        printf(" SEQSTAT: %08lx  IPEND: %04lx  SYSCFG: %04lx\n",
                fp->seqstat, fp->ipend, fp->syscfg);
-       printf("  HWERRCAUSE: 0x%lx: %s\n", hwerrcause, strhwerrcause(hwerrcause));
-       printf("  EXCAUSE   : 0x%lx: %s\n", excause, strexcause(excause));
+       printf("  HWERRCAUSE: 0x%x: %s\n", hwerrcause, strhwerrcause(hwerrcause));
+       printf("  EXCAUSE   : 0x%x: %s\n", excause, strexcause(excause));
        for (i = 6; i <= 15; ++i) {
                if (fp->ipend & (1 << i)) {
                        decode_address(buf, bfin_read32(EVT0 + 4*i));
        printf(" P0 : %08lx    P1 : %08lx    P2 : %08lx    P3 : %08lx\n",
                fp->p0, fp->p1, fp->p2, fp->p3);
        printf(" P4 : %08lx    P5 : %08lx    FP : %08lx    SP : %08lx\n",
-               fp->p4, fp->p5, fp->fp, fp);
+               fp->p4, fp->p5, fp->fp, (unsigned long)fp);
        printf(" LB0: %08lx    LT0: %08lx    LC0: %08lx\n",
                fp->lb0, fp->lt0, fp->lc0);
        printf(" LB1: %08lx    LT1: %08lx    LC1: %08lx\n",
 {
        char buf[150];
        unsigned long tflags;
-       size_t i = 0;
+       int i = 0;
 
        if (!ENABLE_DUMP)
                return;