mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-10-29 17:54:14 +08:00
test/stp: build the simulator against the firmware headers
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.
This commit is contained in:
1 parent
aff6ac0923
commit
e19271fc44
8 files changed
+17
-106
No files matched your search
+2
-2
@@ -29,7 +29,7 @@ uint8_t err_status;
|
||||
uint8_t atoi_results_u8;
|
||||
|
||||
static int verbose;
|
||||
void print_string(char *s) { if (verbose) fputs(s, stdout); }
|
||||
void print_string(const char *s) { if (verbose) fputs(s, stdout); }
|
||||
void print_byte(uint8_t b) { if (verbose) printf("%02x", b); }
|
||||
void print_short(uint16_t v) { if (verbose) printf("%04x", v); }
|
||||
void print_long(uint32_t v) { if (verbose) printf("%08x", v); }
|
||||
@@ -37,7 +37,7 @@ void write_char(char c) { if (verbose) putchar(c); }
|
||||
void itoa(uint8_t v) { if (verbose) printf("%u", v); }
|
||||
void print_reg(uint16_t reg) { (void)reg; }
|
||||
|
||||
uint8_t cmd_compare(uint8_t start, uint8_t *cmd)
|
||||
uint8_t cmd_compare(uint8_t start, const uint8_t *cmd)
|
||||
{
|
||||
if (start >= cmd_words_len)
|
||||
return 0;
|
||||
|
||||
Reference in new issue
Block a user