mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-10-29 17:54:14 +08:00
test/stp/shim held hand-written copies of the headers the STP code includes, and they had drifted: the uIP buffer was 600 bytes instead of 1556, struct machine had three fields, port_ingress_filter_get() returned a plain uint8_t. The simulator now compiles rtl837x_stp.c and rtl837x_stp_cli.c the way test/ compiles firmware sources, with the real headers and sdcc_shim.h forced in, and with the same warnings, including -Wno-pointer-sign for the string literals passed to cmd_compare(). It stays on -std=c11: in gnu11 mode glibc defines LITTLE_ENDIAN, which uip-conf.h names as the byte order, and HTONS() stops swapping. Its own print_string() and cmd_compare() take the firmware's argument types.
29 lines
811 B
Makefile
29 lines
811 B
Makefile
CC ?= cc
|
|
SRCROOT = ../..
|
|
CFLAGS = -std=c11 -g -O1 -Wall -Wextra -Werror -Wno-unused-parameter -Wno-unknown-pragmas \
|
|
-Wno-pointer-sign \
|
|
-DRTLP_HOST_TEST \
|
|
-fsanitize=address,undefined -fno-omit-frame-pointer \
|
|
-include ../sdcc_shim.h -I../stub -I$(SRCROOT) -I$(SRCROOT)/httpd -I$(SRCROOT)/uip
|
|
ifeq ($(findstring clang,$(shell $(CC) --version 2>/dev/null)),)
|
|
CFLAGS += -Wno-builtin-declaration-mismatch
|
|
endif
|
|
LDFLAGS = -fsanitize=address,undefined
|
|
|
|
SRCS = stp_sim.c $(SRCROOT)/rtl837x_stp.c $(SRCROOT)/rtl837x_stp_cli.c
|
|
|
|
all: build/stp_sim
|
|
./build/stp_sim
|
|
|
|
verbose: build/stp_sim
|
|
./build/stp_sim -v
|
|
|
|
build/stp_sim: $(SRCS) $(SRCROOT)/rtl837x_stp.h
|
|
mkdir -p build
|
|
$(CC) $(CFLAGS) $(SRCS) -o $@ $(LDFLAGS)
|
|
|
|
clean:
|
|
rm -rf build
|
|
|
|
.PHONY: all verbose clean
|