From 4e2185a40825f9516806d0ee1c56b5100b288065 Mon Sep 17 00:00:00 2001 From: Roland Haag Date: Wed, 7 Mar 2012 10:08:01 +1300 Subject: [PATCH] fet: show more chip information (code/RAM ranges). --- drivers/fet.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/fet.c b/drivers/fet.c index 4ccaa6d..7418284 100644 --- a/drivers/fet.c +++ b/drivers/fet.c @@ -561,6 +561,36 @@ static int identify_new(struct fet_device *dev, const char *force_id) dev->code_start = LE_WORD(r->msg29_data, 0); dev->base.max_breakpoints = LE_WORD(r->msg29_data, 0x14); + printc_dbg(" Code start address: 0x%x\n", + LE_WORD(r->msg29_data, 0)); + /* + * The value at 0x02 seems to contain a "virtual code end + * address". So this value seems to be useful only for + * calculating the total ROM size. + * + * For example, as for the msp430f6736 with 128kb ROM, the ROM + * is split into two areas: A "near" ROM, and a "far ROM". + */ + const uint32_t codeSize = + LE_LONG(r->msg29_data, 0x02) + - LE_WORD(r->msg29_data, 0) + + 1; + printc_dbg(" Code size : %lu byte = %lu kb\n", + codeSize, + codeSize / 1024); + + printc_dbg(" RAM start address: 0x%x\n", + LE_WORD(r->msg29_data, 0x0c)); + printc_dbg(" RAM end address: 0x%x\n", + LE_WORD(r->msg29_data, 0x0e)); + const uint16_t ramSize = + LE_WORD(r->msg29_data, 0x0e) + - LE_WORD(r->msg29_data, 0x0c) + + 1; + printc_dbg(" RAM size : %u byte = %u kb\n", + ramSize, + ramSize / 1024); + show_dev_info(r->name, dev); if (xfer(dev, C_IDENT3, r->msg2b_data, r->msg2b_len, 0) < 0)