mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-17 10:49:47 +00:00
Use mip for arm and riscv targets
This commit is contained in:
1 parent
52ab963845
commit
a71262437d
4 files changed
+27
-10
No files matched your search
@@ -100,11 +100,13 @@ valgrind: valgrind_unit_test
|
||||
infer:
|
||||
infer run -- cc test/unit_test.c -c -W -Wall -Werror -Isrc -I. -O2 -DMG_ENABLE_MBEDTLS=1 -DMG_ENABLE_LINES -I/usr/local/Cellar/mbedtls/2.23.0/include -DMG_ENABLE_IPV6=1 -g -o /dev/null
|
||||
|
||||
arm: DEFS += -DMG_ENABLE_FILE=0 -DMG_ENABLE_MIP=1 -DMG_ARCH=MG_ARCH_NEWLIB
|
||||
arm: mongoose.h $(SRCS)
|
||||
$(DOCKER) mdashnet/armgcc arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb $(SRCS) test/mongoose_custom.c -Itest -DMG_ARCH=MG_ARCH_NEWLIB $(OPTS) $(WARN) $(INCS) $(DEFS) -o unit_test -nostartfiles --specs nosys.specs -e 0
|
||||
$(DOCKER) mdashnet/armgcc arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb $(SRCS) $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) -o unit_test -nostartfiles --specs nosys.specs -e 0
|
||||
|
||||
riscv: DEFS += -DMG_ENABLE_FILE=0 -DMG_ENABLE_MIP=1 -DMG_ARCH=MG_ARCH_NEWLIB
|
||||
riscv: mongoose.h $(SRCS)
|
||||
$(DOCKER) mdashnet/riscv riscv-none-elf-gcc -march=rv32imc -mabi=ilp32 $(SRCS) test/mongoose_custom.c -Itest -DMG_ARCH=MG_ARCH_NEWLIB $(OPTS) $(WARN) $(INCS) $(DEFS) -o unit_test
|
||||
$(DOCKER) mdashnet/riscv riscv-none-elf-gcc -march=rv32imc -mabi=ilp32 $(SRCS) $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) -o unit_test
|
||||
|
||||
#vc98: VCFLAGS += -DMG_ENABLE_IPV6=1
|
||||
vc98: Makefile mongoose.h $(SRCS)
|
||||
|
||||
@@ -316,8 +316,9 @@ static struct ip *tx_ip(struct mip_if *ifp, uint8_t proto, uint32_t ip_src,
|
||||
return ip;
|
||||
}
|
||||
|
||||
void tx_udp(struct mip_if *ifp, uint32_t ip_src, uint16_t sport,
|
||||
uint32_t ip_dst, uint16_t dport, const void *buf, size_t len) {
|
||||
static void tx_udp(struct mip_if *ifp, uint32_t ip_src, uint16_t sport,
|
||||
uint32_t ip_dst, uint16_t dport, const void *buf,
|
||||
size_t len) {
|
||||
struct ip *ip = tx_ip(ifp, 17, ip_src, ip_dst, len + sizeof(struct udp));
|
||||
struct udp *udp = (struct udp *) (ip + 1);
|
||||
udp->sport = sport;
|
||||
@@ -438,7 +439,8 @@ static void rx_dhcp(struct mip_if *ifp, struct pkt *pkt) {
|
||||
}
|
||||
}
|
||||
|
||||
struct mg_connection *getpeer(struct mg_mgr *mgr, struct pkt *pkt, bool lsn) {
|
||||
static struct mg_connection *getpeer(struct mg_mgr *mgr, struct pkt *pkt,
|
||||
bool lsn) {
|
||||
struct mg_connection *c = NULL;
|
||||
for (c = mgr->conns; c != NULL; c = c->next) {
|
||||
if (c->is_udp && pkt->udp && c->loc.port == pkt->udp->dport) break;
|
||||
@@ -721,6 +723,12 @@ void mip_init(struct mg_mgr *mgr, struct mip_ipcfg *ipcfg,
|
||||
mgr->extraconnsize = sizeof(struct tcpstate);
|
||||
}
|
||||
|
||||
int mg_mkpipe(struct mg_mgr *m, mg_event_handler_t fn, void *d, bool udp) {
|
||||
(void) m, (void) fn, (void) d, (void) udp;
|
||||
MG_ERROR(("Not implemented"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
void mg_connect_resolved(struct mg_connection *c) {
|
||||
struct mip_if *ifp = (struct mip_if *) c->mgr->priv;
|
||||
if (ifp->eport < MIP_ETHEMERAL_PORT) ifp->eport = MIP_ETHEMERAL_PORT;
|
||||
|
||||
+11
-3
@@ -6096,8 +6096,9 @@ static struct ip *tx_ip(struct mip_if *ifp, uint8_t proto, uint32_t ip_src,
|
||||
return ip;
|
||||
}
|
||||
|
||||
void tx_udp(struct mip_if *ifp, uint32_t ip_src, uint16_t sport,
|
||||
uint32_t ip_dst, uint16_t dport, const void *buf, size_t len) {
|
||||
static void tx_udp(struct mip_if *ifp, uint32_t ip_src, uint16_t sport,
|
||||
uint32_t ip_dst, uint16_t dport, const void *buf,
|
||||
size_t len) {
|
||||
struct ip *ip = tx_ip(ifp, 17, ip_src, ip_dst, len + sizeof(struct udp));
|
||||
struct udp *udp = (struct udp *) (ip + 1);
|
||||
udp->sport = sport;
|
||||
@@ -6218,7 +6219,8 @@ static void rx_dhcp(struct mip_if *ifp, struct pkt *pkt) {
|
||||
}
|
||||
}
|
||||
|
||||
struct mg_connection *getpeer(struct mg_mgr *mgr, struct pkt *pkt, bool lsn) {
|
||||
static struct mg_connection *getpeer(struct mg_mgr *mgr, struct pkt *pkt,
|
||||
bool lsn) {
|
||||
struct mg_connection *c = NULL;
|
||||
for (c = mgr->conns; c != NULL; c = c->next) {
|
||||
if (c->is_udp && pkt->udp && c->loc.port == pkt->udp->dport) break;
|
||||
@@ -6501,6 +6503,12 @@ void mip_init(struct mg_mgr *mgr, struct mip_ipcfg *ipcfg,
|
||||
mgr->extraconnsize = sizeof(struct tcpstate);
|
||||
}
|
||||
|
||||
int mg_mkpipe(struct mg_mgr *m, mg_event_handler_t fn, void *d, bool udp) {
|
||||
(void) m, (void) fn, (void) d, (void) udp;
|
||||
MG_ERROR(("Not implemented"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
void mg_connect_resolved(struct mg_connection *c) {
|
||||
struct mip_if *ifp = (struct mip_if *) c->mgr->priv;
|
||||
if (ifp->eport < MIP_ETHEMERAL_PORT) ifp->eport = MIP_ETHEMERAL_PORT;
|
||||
|
||||
+1
-2
@@ -9,7 +9,7 @@ static int s_num_tests = 0;
|
||||
s_num_tests++; \
|
||||
if (!(expr)) { \
|
||||
printf("FAILURE %s:%d: %s\n", __FILE__, __LINE__, #expr); \
|
||||
exit(EXIT_FAILURE); \
|
||||
abort(); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
@@ -2248,7 +2248,6 @@ static void test_rewrites(void) {
|
||||
ASSERT(fetch(&mgr, buf, url, "GET /foo HTTP/1.0\n\n") == 301);
|
||||
ASSERT(fetch(&mgr, buf, url, "GET /foo/ HTTP/1.0\n\n") == 200);
|
||||
// printf("-->[%s]\n", buf);
|
||||
// exit(0);
|
||||
mg_mgr_free(&mgr);
|
||||
ASSERT(mgr.conns == NULL);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user