summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2018-08-22 00:52:21 -0700
committerKeith Packard <keithp@keithp.com>2018-10-02 13:00:32 -0700
commit3c48b0fd504ae97dfaca91d2064b5822ca6e1344 (patch)
tree502c557cf92f0bad3c979c9cec62e409a365dce3
parentac8a9bc2ef301f1f18772af7d871c257a56ae70c (diff)
altoslib: Reduce debug printf spamming during flashing operation
Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--altoslib/AltosHexfile.java10
-rw-r--r--altoslib/AltosRomconfig.java20
-rw-r--r--altoslib/AltosSelfFlash.java4
3 files changed, 4 insertions, 30 deletions
diff --git a/altoslib/AltosHexfile.java b/altoslib/AltosHexfile.java
index 67cc3eee..609d1bcb 100644
--- a/altoslib/AltosHexfile.java
+++ b/altoslib/AltosHexfile.java
@@ -354,11 +354,6 @@ public class AltosHexfile {
int product_len = get_u8(a);
- System.out.printf("Product is at %x length %d\n", a, product_len);
-
- for (int i = 0; i < product_len; i++)
- System.out.printf(" %2d: %02x\n", i, get_u8(a+i));
-
if (product_len <= 0)
return null;
@@ -367,12 +362,11 @@ public class AltosHexfile {
for (int i = 0; i < product_len - 2; i += 2) {
int c = get_u16(a + 2 + i);
- System.out.printf("character %x\n", c);
-
product += Character.toString((char) c);
}
- System.out.printf("product %s\n", product);
+ if (AltosLink.debug)
+ System.out.printf("product %s\n", product);
return product;
}
diff --git a/altoslib/AltosRomconfig.java b/altoslib/AltosRomconfig.java
index bfa1c6f9..ccd01274 100644
--- a/altoslib/AltosRomconfig.java
+++ b/altoslib/AltosRomconfig.java
@@ -32,15 +32,11 @@ public class AltosRomconfig {
static private long find_address(AltosHexfile hexfile, String name, int len) throws AltosNoSymbol {
AltosHexsym symbol = hexfile.lookup_symbol(name);
if (symbol == null) {
- System.out.printf("no symbol %s\n", name);
throw new AltosNoSymbol(name);
}
if (hexfile.address <= symbol.address && symbol.address + len <= hexfile.max_address) {
- System.out.printf("%s: %x\n", name, symbol.address);
return symbol.address;
}
- System.out.printf("invalid symbol addr %x len %d range is %x - %x\n",
- symbol.address, len, hexfile.address, hexfile.max_address);
throw new AltosNoSymbol(name);
}
@@ -123,17 +119,13 @@ public class AltosRomconfig {
public AltosRomconfig(AltosHexfile hexfile) {
try {
- System.out.printf("Attempting symbols\n");
version = get_int(hexfile, ao_romconfig_version, 2);
- System.out.printf("version %d\n", version);
check = get_int(hexfile, ao_romconfig_check, 2);
- System.out.printf("check %d\n", check);
if (check == (~version & 0xffff)) {
switch (version) {
case 2:
case 1:
serial_number = get_int(hexfile, ao_serial_number, 2);
- System.out.printf("serial %d\n", serial_number);
try {
radio_calibration = get_int(hexfile, ao_radio_cal, 4);
} catch (AltosNoSymbol missing) {
@@ -143,18 +135,8 @@ public class AltosRomconfig {
break;
}
}
- System.out.printf("attempting usbid\n");
usb_id = hexfile.find_usb_id();
- if (usb_id == null)
- System.out.printf("No usb id\n");
- else
- System.out.printf("usb id: %04x:%04x\n",
- usb_id.vid, usb_id.pid);
usb_product = hexfile.find_usb_product();
- if (usb_product == null)
- System.out.printf("No usb product\n");
- else
- System.out.printf("usb product: %s\n", usb_product);
} catch (AltosNoSymbol missing) {
valid = false;
@@ -197,7 +179,6 @@ public class AltosRomconfig {
if (addr < base)
base = addr;
- System.out.printf("symbol %s at %x base %x\n", name, addr, base);
} catch (AltosNoSymbol ns) {
if (name_required(name))
throw (ns);
@@ -214,7 +195,6 @@ public class AltosRomconfig {
long addr = find_address(hexfile, name, len) + len;
if (addr > bounds)
bounds = addr;
- System.out.printf("symbol %s at %x bounds %x\n", name, addr, bounds);
} catch (AltosNoSymbol ns) {
if (name_required(name))
throw (ns);
diff --git a/altoslib/AltosSelfFlash.java b/altoslib/AltosSelfFlash.java
index 20839ce4..0250cce7 100644
--- a/altoslib/AltosSelfFlash.java
+++ b/altoslib/AltosSelfFlash.java
@@ -45,7 +45,6 @@ public class AltosSelfFlash extends AltosProgrammer {
int b;
byte[] data = new byte[len];
- System.out.printf("read_memory %x %d\n", addr, len);
for (int offset = 0; offset < len; offset += 0x100) {
link.printf("R %x\n", addr + offset);
byte[] reply = link.get_binary_reply(5000, 0x100);
@@ -161,7 +160,8 @@ public class AltosSelfFlash extends AltosProgrammer {
long base = AltosRomconfig.fetch_base(image);
long bounds = AltosRomconfig.fetch_bounds(image);
- System.out.printf("rom base %x bounds %x\n", base, bounds);
+ if (link.debug)
+ System.out.printf("rom base %x bounds %x\n", base, bounds);
return read_hexfile(base, (int) (bounds - base));
} catch (AltosNoSymbol ns) {
return null;