mirror of
https://github.com/antonblanchard/microwatt.git
synced 2026-04-25 12:01:42 +00:00
mw_debug: Add CFLAGS and fix warnings
CFLAGS was defined but not used anywhere. This adds them to the compile line, and fixes the warnings (and errors!) that result. Signed-off-by: Joel Stanley <joel@jms.id.au>
This commit is contained in:
@@ -3,7 +3,7 @@ CFLAGS = -O2 -g -Wall -std=c99
|
|||||||
all: mw_debug
|
all: mw_debug
|
||||||
|
|
||||||
mw_debug: mw_debug.c
|
mw_debug: mw_debug.c
|
||||||
$(CC) -o $@ $^ -lurjtag
|
$(CC) -o $@ $^ $(CFLAGS) -lurjtag
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f mw_debug
|
rm -f mw_debug
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
#define _POSIX_C_SOURCE 200809L
|
||||||
|
#define _GNU_SOURCE
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -15,6 +18,7 @@
|
|||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <urjtag/urjtag.h>
|
#include <urjtag/urjtag.h>
|
||||||
|
#include <inttypes.h>
|
||||||
|
|
||||||
#define DBG_WB_ADDR 0x00
|
#define DBG_WB_ADDR 0x00
|
||||||
#define DBG_WB_DATA 0x01
|
#define DBG_WB_DATA 0x01
|
||||||
@@ -104,6 +108,7 @@ static int sim_init(const char *target)
|
|||||||
|
|
||||||
static int sim_reset(void)
|
static int sim_reset(void)
|
||||||
{
|
{
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void add_bits(uint8_t **p, int *b, uint64_t d, int c)
|
static void add_bits(uint8_t **p, int *b, uint64_t d, int c)
|
||||||
@@ -152,7 +157,7 @@ static int sim_command(uint8_t op, uint8_t addr, uint64_t *data)
|
|||||||
{
|
{
|
||||||
uint8_t buf[16], *p;
|
uint8_t buf[16], *p;
|
||||||
uint64_t d = data ? *data : 0;
|
uint64_t d = data ? *data : 0;
|
||||||
int r, s, b = 0;
|
int r, b = 0;
|
||||||
|
|
||||||
memset(buf, 0, 16);
|
memset(buf, 0, 16);
|
||||||
p = buf+1;
|
p = buf+1;
|
||||||
@@ -280,6 +285,7 @@ static int jtag_init(const char *target)
|
|||||||
|
|
||||||
static int jtag_reset(void)
|
static int jtag_reset(void)
|
||||||
{
|
{
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int jtag_command(uint8_t op, uint8_t addr, uint64_t *data)
|
static int jtag_command(uint8_t op, uint8_t addr, uint64_t *data)
|
||||||
@@ -382,8 +388,8 @@ static void core_status(void)
|
|||||||
else if (stat & DBG_CORE_STAT_TERM)
|
else if (stat & DBG_CORE_STAT_TERM)
|
||||||
statstr = "odd state (TERM but no STOP)";
|
statstr = "odd state (TERM but no STOP)";
|
||||||
printf("Core: %s%s\n", statstr, statstr2);
|
printf("Core: %s%s\n", statstr, statstr2);
|
||||||
printf(" NIA: %016llx\n", (unsigned long long)nia);
|
printf(" NIA: %016" PRIx64 "\n", nia);
|
||||||
printf(" MSR: %016llx\n", msr);
|
printf(" MSR: %016" PRIx64 "\n", msr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void core_stop(void)
|
static void core_stop(void)
|
||||||
@@ -438,12 +444,12 @@ static void gpr_read(uint64_t reg, uint64_t count)
|
|||||||
data = 0xdeadbeef;
|
data = 0xdeadbeef;
|
||||||
check(dmi_read(DBG_CORE_GSPR_DATA, &data), "reading GPR data");
|
check(dmi_read(DBG_CORE_GSPR_DATA, &data), "reading GPR data");
|
||||||
if (reg <= 31)
|
if (reg <= 31)
|
||||||
printf("r%d", reg);
|
printf("r%"PRId64, reg);
|
||||||
else if ((reg - 32) < sizeof(fast_spr_names) / sizeof(fast_spr_names[0]))
|
else if ((reg - 32) < sizeof(fast_spr_names) / sizeof(fast_spr_names[0]))
|
||||||
printf("%s", fast_spr_names[reg - 32]);
|
printf("%s", fast_spr_names[reg - 32]);
|
||||||
else
|
else
|
||||||
printf("gspr%d", reg);
|
printf("gspr%"PRId64, reg);
|
||||||
printf(":\t%016llx\n", data);
|
printf(":\t%016"PRIx64"\n", data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user