Commit 45019e27 authored by Alessandro Rubini's avatar Alessandro Rubini

Merge branch 'build-cleanup'

parents b8ee6bf6 87ed5e5b
......@@ -16,4 +16,3 @@
.config.old
include/config
include/generated
.depend
......@@ -58,13 +58,13 @@ config W1
# The other ones can be set by non-developers
config ETHERBONE
config IP
depends on WR_NODE
boolean "Compile Etherbone support in wrpc-sw"
boolean "Compile minimal IP support in wrpc-sw"
help
This allows to run LM32 code that is aware of Etherbone.
You need to run a gateware file that includes Etherbone support.
If in doubt, say No.
This allows to run LM32 code that is aware of IP. The feature is
needed to run Etherbone in your gateware, because Etherbone
is UDP-based and thus the CPU needs to run DHCP.
config CMD_CONFIG
depends on WR_NODE
......
......@@ -61,7 +61,7 @@ LDFLAGS_PLATFORM = -mmultiply-enabled -mbarrel-shift-enabled \
# packet-filter rules depend on configuration; default is rules-plain
pfilter-y := rules-plain.bin
pfilter-$(CONFIG_ETHERBONE) := rules-ebone.bin
pfilter-$(CONFIG_IP) := rules-ebone.bin
pfilter-$(CONFIG_NIC_PFILTER) := rules-e+nic.bin
export pfilter-y
......@@ -112,7 +112,7 @@ all: tools $(OUTPUT).ram $(OUTPUT).vhd $(OUTPUT).mif
# we need to remove "ptpdump" support for ppsi if RAM size is small and
# we include etherbone
ifneq ($(CONFIG_RAMSIZE),131072)
ifdef CONFIG_ETHERBONE
ifdef CONFIG_IP
PPSI_USER_CFLAGS = -DCONFIG_NO_PTPDUMP
endif
endif
......@@ -160,7 +160,7 @@ $(AUTOCONF): silentoldconfig
clean:
rm -f $(OBJS) $(OUTPUT).elf $(OUTPUT).bin $(OUTPUT).ram \
$(LDS) rules-*.bin .depend
$(LDS) rules-*.bin
$(MAKE) -C $(PPSI) clean
$(MAKE) -C sdb-lib clean
$(MAKE) -C tools clean
......@@ -168,7 +168,7 @@ clean:
%.o: %.c
${CC} $(CFLAGS) $(PTPD_CFLAGS) $(INCLUDE_DIR) $(LIB_DIR) -c $*.c -o $@
tools:
tools: .config
$(MAKE) -C tools
# if needed, check out the submodules (first time only), so users
......@@ -181,22 +181,20 @@ gitmodules:
# following targets from Makefile.kconfig
silentoldconfig:
@mkdir -p include/config
$(MAKE) -f Makefile.kconfig $@
$(MAKE) quiet=quiet_ -f Makefile.kconfig $@
scripts_basic config:
$(MAKE) -f Makefile.kconfig $@
$(MAKE) quiet=quiet_ -f Makefile.kconfig $@
%config:
$(MAKE) -f Makefile.kconfig $@
$(MAKE) quiet=quiet_ -f Makefile.kconfig $@
defconfig:
$(MAKE) -f Makefile.kconfig spec_defconfig
$(MAKE) quiet=quiet_ -f Makefile.kconfig spec_defconfig
.config: silentoldconfig
# Trivial depend rule. We can't $(obj-y:.o=.c) because some objects come from
# assembly source. In glob avoid the toold directory, and ppsi/pp-printf
.depend: $(wildcard *.c [^pt]/*.c)
$(CC) $(CFLAGS) -DSDBFS_BIG_ENDIAN -MM $^ > $@
-include .depend
# This forces more compilations than needed, but it's useful
# (we depend on .config and not on include/generated/autoconf.h
# because the latter is touched by silentoldconfig at each build)
$(obj-y): .config $(wildcard include/*.h)
......@@ -4,24 +4,28 @@
# CONFIG_WR_SWITCH is not set
CONFIG_WR_NODE=y
CONFIG_PRINT_BUFSIZE=128
CONFIG_PRINTF_XINT=y
# CONFIG_PRINTF_XINT is not set
CONFIG_RAMSIZE=131072
# CONFIG_WR_NODE_PCS16 is not set
CONFIG_STACKSIZE=2048
CONFIG_PPSI=y
CONFIG_UART=y
CONFIG_W1=y
# CONFIG_ETHERBONE is not set
# CONFIG_IP is not set
# CONFIG_CMD_CONFIG is not set
#
# wrpc-sw is tainted if you change the following options
#
CONFIG_DEVELOPER=y
# CONFIG_CHECK_RESET is not set
# CONFIG_PRINTF_FULL is not set
CONFIG_CMD_LL=y
CONFIG_CHECK_RESET=y
CONFIG_SPLL_FIFO_LOG=y
CONFIG_PRINTF_FULL=y
# CONFIG_PRINTF_MINI is not set
# CONFIG_PRINTF_NONE is not set
# CONFIG_PTP_NOPOSIX is not set
# CONFIG_DETERMINISTIC_BINARY is not set
# CONFIG_UART_SW is not set
# CONFIG_SDB_STORAGE is not set
CONFIG_LEGACY_EEPROM=y
CONFIG_DETERMINISTIC_BINARY=y
CONFIG_UART_SW=y
CONFIG_SDB_STORAGE=y
# CONFIG_LEGACY_EEPROM is not set
CONFIG_VLAN_ARRAY_SIZE=1
#
# Automatically generated make config: don't edit
#
# CONFIG_WR_SWITCH is not set
CONFIG_WR_NODE=y
CONFIG_PRINT_BUFSIZE=128
CONFIG_PRINTF_XINT=y
CONFIG_STACKSIZE=2048
CONFIG_PPSI=y
CONFIG_UART=y
CONFIG_W1=y
CONFIG_ETHERBONE=y
# CONFIG_CMD_CONFIG is not set
#
# wrpc-sw is tainted if you change the following options
#
# CONFIG_DEVELOPER is not set
CONFIG_LEGACY_EEPROM=y
......@@ -11,7 +11,7 @@ CONFIG_STACKSIZE=10240
CONFIG_PPSI=y
CONFIG_UART=y
CONFIG_W1=y
CONFIG_ETHERBONE=y
CONFIG_IP=y
CONFIG_CMD_CONFIG=y
#
......
#
# Automatically generated make config: don't edit
#
# CONFIG_WR_SWITCH is not set
CONFIG_WR_NODE=y
CONFIG_PRINT_BUFSIZE=128
CONFIG_PRINTF_XINT=y
CONFIG_STACKSIZE=2048
CONFIG_PPSI=y
CONFIG_UART=y
CONFIG_W1=y
# CONFIG_ETHERBONE is not set
CONFIG_CMD_CONFIG=y
#
# wrpc-sw is tainted if you change the following options
#
CONFIG_DEVELOPER=y
# CONFIG_CHECK_RESET is not set
# CONFIG_PRINTF_FULL is not set
# CONFIG_PRINTF_MINI is not set
# CONFIG_PRINTF_NONE is not set
# CONFIG_PTP_NOPOSIX is not set
# CONFIG_DETERMINISTIC_BINARY is not set
CONFIG_UART_SW=y
# CONFIG_SDB_STORAGE is not set
CONFIG_LEGACY_EEPROM=y
......@@ -9,7 +9,7 @@ CONFIG_STACKSIZE=2048
CONFIG_PPSI=y
CONFIG_UART=y
CONFIG_W1=y
# CONFIG_ETHERBONE is not set
# CONFIG_IP is not set
# CONFIG_CMD_CONFIG is not set
#
......
......@@ -9,7 +9,7 @@ CONFIG_STACKSIZE=2048
CONFIG_PPSI=y
CONFIG_UART=y
CONFIG_W1=y
CONFIG_ETHERBONE=y
CONFIG_IP=y
CONFIG_NIC_PFILTER=y
# CONFIG_CMD_CONFIG is not set
......
......@@ -833,7 +833,7 @@ initialization script
@item @code{sdb} @tab prints devices connected to the Wishbone bus inside @sc{wrpc}
@item @code{ip get}
@item @code{ip set <ip>} @tab reports or sets the IPv4 address of the @sc{wrpc} (only available if @t{CONFIG_ETHERBONE} is set at build time
@item @code{ip set <ip>} @tab reports or sets the IPv4 address of the @sc{wrpc} (only available if @t{CONFIG_IP} is set at build time
@item @code{w1w <offset> <byte> [<byte> ...]}
@item @code{w1r <offset> <len>} @tab If @t{CONFIG_W1} is set and a OneWire @sc{eeprom} exists, write and read data. For writing, @t{byte} values are decimal
......
......@@ -52,5 +52,10 @@ int board_update(void);
#define BOARD_MAX_CHAN_AUX 2
#define BOARD_MAX_PTRACKERS 1
#ifdef CONFIG_IP
#define HAS_IP 1
#else
#define HAS_IP 0
#endif
#endif /* __BOARD_WRC_H */
......@@ -11,6 +11,8 @@ typedef signed short int16_t;
typedef signed int int32_t;
typedef signed long long int64_t;
typedef unsigned long intptr_t;
#define UINT32_MAX 4294967295U
#endif
......@@ -188,8 +188,9 @@ int minipc_server_action(struct minipc_ch *ch, int timeoutms)
if (!(strcmp(p_in->name, flist->pd->name)))
break;
if (!flist) {
int i = EOPNOTSUPP;
p_out->type = MINIPC_ARG_ENCODE(MINIPC_ATYPE_ERROR, int);
*(int *)(&p_out->val) = EOPNOTSUPP;
memcpy(&p_out->val, &i, sizeof(i));
goto send_reply;
}
pd = flist->pd;
......@@ -198,7 +199,7 @@ int minipc_server_action(struct minipc_ch *ch, int timeoutms)
i = pd->f(pd, p_in->args, p_out->val);
if (i < 0) {
p_out->type = MINIPC_ARG_ENCODE(MINIPC_ATYPE_ERROR, int);
*(int *)(&p_out->val) = errno;
memcpy(&p_out->val, &errno, sizeof(errno));
} else {
/* Use retval, but fix the length for strings */
if (MINIPC_GET_ATYPE(pd->retval) == MINIPC_ATYPE_STRING) {
......
......@@ -2,4 +2,4 @@ obj-y += lib/util.o lib/atoi.o
obj-y += lib/usleep.o
obj-$(CONFIG_WR_NODE) += lib/net.o
obj-$(CONFIG_ETHERBONE) += lib/arp.o lib/icmp.o lib/ipv4.o lib/bootp.o
obj-$(CONFIG_WR_NODE) += lib/arp.o lib/icmp.o lib/ipv4.o lib/bootp.o
......@@ -90,9 +90,6 @@ void wrc_mon_gui(void)
int aux_stat;
uint64_t sec;
uint32_t nsec;
#ifdef CONFIG_ETHERBONE
uint8_t ip[4];
#endif
struct wr_servo_state *s =
&((struct wr_data *)ppi->ext_data)->servo_state;
int64_t crtt;
......@@ -155,14 +152,17 @@ void wrc_mon_gui(void)
cprintf(C_GREEN, "Calibrated ");
else
cprintf(C_RED, "Uncalibrated ");
#ifdef CONFIG_ETHERBONE
cprintf(C_WHITE, "\nIPv4: ");
getIP(ip);
if (needIP)
cprintf(C_RED, "BOOTP running");
else
cprintf(C_GREEN, "%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
#endif
if (HAS_IP) {
uint8_t ip[4];
cprintf(C_WHITE, "\nIPv4: ");
getIP(ip);
if (needIP)
cprintf(C_RED, "BOOTP running");
else
cprintf(C_GREEN, "%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
}
if (wrc_mon_status() == 0)
return;
......
......@@ -156,14 +156,12 @@ static int conf_string(struct menu *menu)
static int conf_sym(struct menu *menu)
{
struct symbol *sym = menu->sym;
int type;
tristate oldval, newval;
while (1) {
printf("%*s%s ", indent - 1, "", _(menu->prompt->text));
if (sym->name)
printf("(%s) ", sym->name);
type = sym_get_type(sym);
putchar('[');
oldval = sym_get_tristate_value(sym);
switch (oldval) {
......@@ -228,11 +226,9 @@ static int conf_choice(struct menu *menu)
{
struct symbol *sym, *def_sym;
struct menu *child;
int type;
bool is_new;
sym = menu->sym;
type = sym_get_type(sym);
is_new = !sym_has_value(sym);
if (sym_is_changable(sym)) {
conf_sym(menu);
......
......@@ -406,7 +406,6 @@ int conf_write(const char *name)
int type, l;
const char *str;
time_t now;
int use_timestamp = 1;
char *env;
dirname[0] = 0;
......@@ -447,8 +446,6 @@ int conf_write(const char *name)
sym_calc_value(sym);
time(&now);
env = getenv("KCONFIG_NOTIMESTAMP");
if (env && *env)
use_timestamp = 0;
fprintf(out, _("#\n"
"# Automatically generated make config: don't edit\n"
......
......@@ -16,7 +16,7 @@ obj-$(CONFIG_WR_NODE) += \
shell/cmd_help.o \
shell/cmd_refresh.o
obj-$(CONFIG_ETHERBONE) += shell/cmd_ip.o
obj-$(CONFIG_IP) += shell/cmd_ip.o
obj-$(CONFIG_PPSI) += shell/cmd_verbose.o
obj-$(CONFIG_CMD_CONFIG) += shell/cmd_config.o
obj-$(CONFIG_CMD_SLEEP) += shell/cmd_sleep.o
......
......@@ -90,10 +90,10 @@ static void wrc_initialize(void)
calib_t24p(WRC_MODE_MASTER, &cal_phase_transition);
spll_very_init();
#ifdef CONFIG_ETHERBONE
ipv4_init();
arp_init();
#endif
if (HAS_IP) {
ipv4_init();
arp_init();
}
}
#define LINK_WENT_UP 1
......@@ -199,18 +199,16 @@ int main(void)
}
switch (l_status) {
#ifdef CONFIG_ETHERBONE
case LINK_WENT_UP:
needIP = 1;
break;
#endif
case LINK_UP:
update_rx_queues();
#ifdef CONFIG_ETHERBONE
ipv4_poll();
arp_poll();
#endif
if (HAS_IP) {
ipv4_poll();
arp_poll();
}
break;
case LINK_WENT_DOWN:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment