mirror of
https://github.com/cesanta/mongoose.git
synced 2026-12-04 21:58:22 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
010fd33858 |
No files matched your search
+68
-32
@@ -6134,8 +6134,7 @@ size_t mg_jwt_verify_es256(struct mg_str jwt, const struct mg_jwt_opts *opts,
|
|||||||
void mg_l2_init(struct mg_tcpip_if *ifp);
|
void mg_l2_init(struct mg_tcpip_if *ifp);
|
||||||
bool mg_l2_poll(struct mg_tcpip_if *ifp, bool expired_1000ms);
|
bool mg_l2_poll(struct mg_tcpip_if *ifp, bool expired_1000ms);
|
||||||
uint8_t *mg_l2_header(struct mg_tcpip_if *ifp, enum mg_l2proto proto,
|
uint8_t *mg_l2_header(struct mg_tcpip_if *ifp, enum mg_l2proto proto,
|
||||||
uint8_t *src, uint8_t *dst, uint8_t *frame,
|
uint8_t *src, uint8_t *dst, uint8_t *frame);
|
||||||
uint8_t dscp);
|
|
||||||
size_t mg_l2_trailer(struct mg_tcpip_if *ifp, size_t len, uint8_t *cur);
|
size_t mg_l2_trailer(struct mg_tcpip_if *ifp, size_t len, uint8_t *cur);
|
||||||
bool mg_l2_rx(struct mg_tcpip_if *ifp, enum mg_l2proto *proto,
|
bool mg_l2_rx(struct mg_tcpip_if *ifp, enum mg_l2proto *proto,
|
||||||
struct mg_str *pay, struct mg_str *raw);
|
struct mg_str *pay, struct mg_str *raw);
|
||||||
@@ -6154,7 +6153,7 @@ size_t mg_l2_driver_output(struct mg_tcpip_if *ifp, size_t len);
|
|||||||
// clang-format off
|
// clang-format off
|
||||||
extern void mg_l2_eth_init(struct mg_tcpip_if *);
|
extern void mg_l2_eth_init(struct mg_tcpip_if *);
|
||||||
extern bool mg_l2_eth_poll(struct mg_tcpip_if *, bool);
|
extern bool mg_l2_eth_poll(struct mg_tcpip_if *, bool);
|
||||||
extern uint8_t *mg_l2_eth_header(struct mg_tcpip_if *, enum mg_l2proto, struct mg_l2addr *, struct mg_l2addr *, uint8_t *, uint8_t);
|
extern uint8_t *mg_l2_eth_header(struct mg_tcpip_if *, enum mg_l2proto, struct mg_l2addr *, struct mg_l2addr *, uint8_t *);
|
||||||
extern size_t mg_l2_eth_trailer(struct mg_tcpip_if *, size_t, uint8_t *);
|
extern size_t mg_l2_eth_trailer(struct mg_tcpip_if *, size_t, uint8_t *);
|
||||||
extern bool mg_l2_eth_rx(struct mg_tcpip_if *, enum mg_l2proto *, struct mg_str *, struct mg_str *);
|
extern bool mg_l2_eth_rx(struct mg_tcpip_if *, enum mg_l2proto *, struct mg_str *, struct mg_str *);
|
||||||
extern struct mg_l2addr *mg_l2_eth_getaddr(struct mg_tcpip_if *, uint8_t *);
|
extern struct mg_l2addr *mg_l2_eth_getaddr(struct mg_tcpip_if *, uint8_t *);
|
||||||
@@ -6167,7 +6166,7 @@ extern uint8_t mg_l2_eth_ip6put(struct mg_l2addr *, uint8_t *);
|
|||||||
|
|
||||||
extern void mg_l2_ppp_init(struct mg_tcpip_if *);
|
extern void mg_l2_ppp_init(struct mg_tcpip_if *);
|
||||||
extern bool mg_l2_ppp_poll(struct mg_tcpip_if *, bool);
|
extern bool mg_l2_ppp_poll(struct mg_tcpip_if *, bool);
|
||||||
extern uint8_t *mg_l2_ppp_header(struct mg_tcpip_if *, enum mg_l2proto, struct mg_l2addr *, struct mg_l2addr *, uint8_t *, uint8_t);
|
extern uint8_t *mg_l2_ppp_header(struct mg_tcpip_if *, enum mg_l2proto, struct mg_l2addr *, struct mg_l2addr *, uint8_t *);
|
||||||
extern size_t mg_l2_ppp_trailer(struct mg_tcpip_if *, size_t, uint8_t *);
|
extern size_t mg_l2_ppp_trailer(struct mg_tcpip_if *, size_t, uint8_t *);
|
||||||
extern bool mg_l2_ppp_rx(struct mg_tcpip_if *, enum mg_l2proto *, struct mg_str *, struct mg_str *);
|
extern bool mg_l2_ppp_rx(struct mg_tcpip_if *, enum mg_l2proto *, struct mg_str *, struct mg_str *);
|
||||||
extern struct mg_l2addr *mg_l2_ppp_getaddr(struct mg_tcpip_if *, uint8_t *);
|
extern struct mg_l2addr *mg_l2_ppp_getaddr(struct mg_tcpip_if *, uint8_t *);
|
||||||
@@ -6179,13 +6178,13 @@ extern uint8_t mg_l2_ppp_ip6put(struct mg_l2addr *, uint8_t *);
|
|||||||
#endif
|
#endif
|
||||||
extern void mg_l2_pppoe_init(struct mg_tcpip_if *);
|
extern void mg_l2_pppoe_init(struct mg_tcpip_if *);
|
||||||
extern bool mg_l2_pppoe_poll(struct mg_tcpip_if *, bool);
|
extern bool mg_l2_pppoe_poll(struct mg_tcpip_if *, bool);
|
||||||
extern uint8_t *mg_l2_pppoe_header(struct mg_tcpip_if *, enum mg_l2proto, struct mg_l2addr *, struct mg_l2addr *, uint8_t *, uint8_t);
|
extern uint8_t *mg_l2_pppoe_header(struct mg_tcpip_if *, enum mg_l2proto, struct mg_l2addr *, struct mg_l2addr *, uint8_t *);
|
||||||
extern size_t mg_l2_pppoe_trailer(struct mg_tcpip_if *, size_t, uint8_t *);
|
extern size_t mg_l2_pppoe_trailer(struct mg_tcpip_if *, size_t, uint8_t *);
|
||||||
extern bool mg_l2_pppoe_rx(struct mg_tcpip_if *, enum mg_l2proto *, struct mg_str *, struct mg_str *);
|
extern bool mg_l2_pppoe_rx(struct mg_tcpip_if *, enum mg_l2proto *, struct mg_str *, struct mg_str *);
|
||||||
|
|
||||||
typedef void (*l2_init_fn)(struct mg_tcpip_if *);
|
typedef void (*l2_init_fn)(struct mg_tcpip_if *);
|
||||||
typedef bool (*l2_poll_fn)(struct mg_tcpip_if *, bool);
|
typedef bool (*l2_poll_fn)(struct mg_tcpip_if *, bool);
|
||||||
typedef uint8_t *((*l2_header_fn)(struct mg_tcpip_if *, enum mg_l2proto, struct mg_l2addr *, struct mg_l2addr *, uint8_t *, uint8_t));
|
typedef uint8_t *((*l2_header_fn)(struct mg_tcpip_if *, enum mg_l2proto, struct mg_l2addr *, struct mg_l2addr *, uint8_t *));
|
||||||
typedef size_t (*l2_trailer_fn)(struct mg_tcpip_if *, size_t, uint8_t *);
|
typedef size_t (*l2_trailer_fn)(struct mg_tcpip_if *, size_t, uint8_t *);
|
||||||
typedef bool (*l2_rx_fn)(struct mg_tcpip_if *, enum mg_l2proto *, struct mg_str *, struct mg_str *);
|
typedef bool (*l2_rx_fn)(struct mg_tcpip_if *, enum mg_l2proto *, struct mg_str *, struct mg_str *);
|
||||||
typedef struct mg_l2addr (*(*l2_getaddr_fn)(struct mg_tcpip_if *, uint8_t *));
|
typedef struct mg_l2addr (*(*l2_getaddr_fn)(struct mg_tcpip_if *, uint8_t *));
|
||||||
@@ -6228,10 +6227,9 @@ bool mg_l2_poll(struct mg_tcpip_if *ifp, bool expired_1000ms) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint8_t *mg_l2_header(struct mg_tcpip_if *ifp, enum mg_l2proto proto,
|
uint8_t *mg_l2_header(struct mg_tcpip_if *ifp, enum mg_l2proto proto,
|
||||||
uint8_t *src, uint8_t *dst, uint8_t *frame,
|
uint8_t *src, uint8_t *dst, uint8_t *frame) {
|
||||||
uint8_t dscp) {
|
|
||||||
return l2_header[ifp->l2type](ifp, proto, (struct mg_l2addr *) src,
|
return l2_header[ifp->l2type](ifp, proto, (struct mg_l2addr *) src,
|
||||||
(struct mg_l2addr *) dst, frame, dscp);
|
(struct mg_l2addr *) dst, frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t mg_l2_trailer(struct mg_tcpip_if *ifp, size_t len, uint8_t *frame) {
|
size_t mg_l2_trailer(struct mg_tcpip_if *ifp, size_t len, uint8_t *frame) {
|
||||||
@@ -6345,7 +6343,7 @@ bool mg_l2_eth_poll(struct mg_tcpip_if *ifp, bool expired_1000ms) {
|
|||||||
|
|
||||||
uint8_t *mg_l2_eth_header(struct mg_tcpip_if *ifp, enum mg_l2proto proto,
|
uint8_t *mg_l2_eth_header(struct mg_tcpip_if *ifp, enum mg_l2proto proto,
|
||||||
struct mg_l2addr *src, struct mg_l2addr *dst,
|
struct mg_l2addr *src, struct mg_l2addr *dst,
|
||||||
uint8_t *frame, uint8_t dscp) {
|
uint8_t *frame) {
|
||||||
struct eth_data *d = &ifp->l2data.eth;
|
struct eth_data *d = &ifp->l2data.eth;
|
||||||
struct eth *eth = (struct eth *) frame;
|
struct eth *eth = (struct eth *) frame;
|
||||||
uint8_t *hlp;
|
uint8_t *hlp;
|
||||||
@@ -6357,8 +6355,7 @@ uint8_t *mg_l2_eth_header(struct mg_tcpip_if *ifp, enum mg_l2proto proto,
|
|||||||
} else { // Add 802.1Q tag
|
} else { // Add 802.1Q tag
|
||||||
struct qtag *qtag = (struct qtag *) ð->type;
|
struct qtag *qtag = (struct qtag *) ð->type;
|
||||||
qtag->tpid = mg_htons(0x8100);
|
qtag->tpid = mg_htons(0x8100);
|
||||||
qtag->tci = mg_htons((uint16_t) ((d->vlan_id & 0x1fff) | // VID + DEI
|
qtag->tci = mg_htons(d->vlan_id); // PCP = default (best-effort)
|
||||||
(dscp >> 3) << 13)); // RFC-9435 5.1.1
|
|
||||||
hlp += sizeof(*qtag);
|
hlp += sizeof(*qtag);
|
||||||
MG_STORE_BE16(qtag + 1, eth_types[(unsigned int) proto]);
|
MG_STORE_BE16(qtag + 1, eth_types[(unsigned int) proto]);
|
||||||
}
|
}
|
||||||
@@ -6637,24 +6634,22 @@ static uint8_t *l2_ppp_header(enum mg_l2proto proto, uint8_t *p) {
|
|||||||
|
|
||||||
uint8_t *mg_l2_ppp_header(struct mg_tcpip_if *ifp, enum mg_l2proto proto,
|
uint8_t *mg_l2_ppp_header(struct mg_tcpip_if *ifp, enum mg_l2proto proto,
|
||||||
struct mg_l2addr *src, struct mg_l2addr *dst,
|
struct mg_l2addr *src, struct mg_l2addr *dst,
|
||||||
uint8_t *frame, uint8_t dscp) {
|
uint8_t *frame) {
|
||||||
(void) ifp;
|
(void) ifp;
|
||||||
(void) src;
|
(void) src;
|
||||||
(void) dst;
|
(void) dst;
|
||||||
(void) dscp;
|
|
||||||
return l2_ppp_header(proto, hdlc_header(frame));
|
return l2_ppp_header(proto, hdlc_header(frame));
|
||||||
}
|
}
|
||||||
|
|
||||||
extern uint8_t *mg_l2_eth_header(struct mg_tcpip_if *ifp, enum mg_l2proto proto,
|
extern uint8_t *mg_l2_eth_header(struct mg_tcpip_if *ifp, enum mg_l2proto proto,
|
||||||
struct mg_l2addr *src, struct mg_l2addr *dst,
|
struct mg_l2addr *src, struct mg_l2addr *dst,
|
||||||
uint8_t *frame, uint8_t dscp);
|
uint8_t *frame);
|
||||||
|
|
||||||
static uint8_t *pppoe_header(struct mg_tcpip_if *ifp, enum mg_l2proto proto,
|
static uint8_t *pppoe_header(struct mg_tcpip_if *ifp, enum mg_l2proto proto,
|
||||||
uint8_t code, uint16_t id, struct mg_l2addr *src,
|
uint8_t code, uint16_t id, struct mg_l2addr *src,
|
||||||
struct mg_l2addr *dst, uint8_t *frame,
|
struct mg_l2addr *dst, uint8_t *frame) {
|
||||||
uint8_t dscp) {
|
|
||||||
struct pppoe *pppoe =
|
struct pppoe *pppoe =
|
||||||
(struct pppoe *) mg_l2_eth_header(ifp, proto, src, dst, frame, dscp);
|
(struct pppoe *) mg_l2_eth_header(ifp, proto, src, dst, frame);
|
||||||
pppoe->vertype = 0x11;
|
pppoe->vertype = 0x11;
|
||||||
pppoe->code = code;
|
pppoe->code = code;
|
||||||
pppoe->id = id;
|
pppoe->id = id;
|
||||||
@@ -6663,10 +6658,10 @@ static uint8_t *pppoe_header(struct mg_tcpip_if *ifp, enum mg_l2proto proto,
|
|||||||
|
|
||||||
uint8_t *mg_l2_pppoe_header(struct mg_tcpip_if *ifp, enum mg_l2proto proto,
|
uint8_t *mg_l2_pppoe_header(struct mg_tcpip_if *ifp, enum mg_l2proto proto,
|
||||||
struct mg_l2addr *src, struct mg_l2addr *dst,
|
struct mg_l2addr *src, struct mg_l2addr *dst,
|
||||||
uint8_t *frame, uint8_t dscp) {
|
uint8_t *frame) {
|
||||||
(void) dst;
|
(void) dst;
|
||||||
return l2_ppp_header(proto, pppoe_header(ifp, MG_TCPIP_L2PROTO_PPPoE_SESS, 0,
|
return l2_ppp_header(proto, pppoe_header(ifp, MG_TCPIP_L2PROTO_PPPoE_SESS, 0,
|
||||||
s_id, src, dst, frame, dscp));
|
s_id, src, dst, frame));
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t mg_l2_ppp_trailer(struct mg_tcpip_if *ifp, size_t len, uint8_t *cur) {
|
size_t mg_l2_ppp_trailer(struct mg_tcpip_if *ifp, size_t len, uint8_t *cur) {
|
||||||
@@ -6702,8 +6697,7 @@ static uint8_t *ppp_tx_frame_header(struct mg_tcpip_if *ifp, uint16_t proto) {
|
|||||||
return ppp_header(proto, hdlc_header(l2p));
|
return ppp_header(proto, hdlc_header(l2p));
|
||||||
return ppp_header(proto, pppoe_header(ifp, MG_TCPIP_L2PROTO_PPPoE_SESS, 0,
|
return ppp_header(proto, pppoe_header(ifp, MG_TCPIP_L2PROTO_PPPoE_SESS, 0,
|
||||||
s_id, (struct mg_l2addr *) ifp->mac,
|
s_id, (struct mg_l2addr *) ifp->mac,
|
||||||
(struct mg_l2addr *) ifp->gwmac, l2p,
|
(struct mg_l2addr *) ifp->gwmac, l2p));
|
||||||
0));
|
|
||||||
}
|
}
|
||||||
static size_t ppp_tx_frame_trailer(struct mg_tcpip_if *ifp, size_t len,
|
static size_t ppp_tx_frame_trailer(struct mg_tcpip_if *ifp, size_t len,
|
||||||
uint8_t *cur) {
|
uint8_t *cur) {
|
||||||
@@ -7018,7 +7012,7 @@ static size_t pppoe_tx_frame(struct mg_tcpip_if *ifp, uint8_t code, uint16_t id,
|
|||||||
struct mg_l2addr *dst) {
|
struct mg_l2addr *dst) {
|
||||||
uint8_t *l2p = (uint8_t *) ifp->tx.buf;
|
uint8_t *l2p = (uint8_t *) ifp->tx.buf;
|
||||||
uint8_t *p = pppoe_header(ifp, MG_TCPIP_L2PROTO_PPPoE_DISC, code, id,
|
uint8_t *p = pppoe_header(ifp, MG_TCPIP_L2PROTO_PPPoE_DISC, code, id,
|
||||||
(struct mg_l2addr *) ifp->mac, dst, l2p, 0);
|
(struct mg_l2addr *) ifp->mac, dst, l2p);
|
||||||
memmove(p, data, datasz);
|
memmove(p, data, datasz);
|
||||||
return mg_l2_driver_output(ifp, pppoe_trailer(ifp, datasz, p + datasz));
|
return mg_l2_driver_output(ifp, pppoe_trailer(ifp, datasz, p + datasz));
|
||||||
}
|
}
|
||||||
@@ -9380,7 +9374,7 @@ struct pkt {
|
|||||||
// L2 API
|
// L2 API
|
||||||
void mg_l2_init(struct mg_tcpip_if *ifp);
|
void mg_l2_init(struct mg_tcpip_if *ifp);
|
||||||
uint8_t *mg_l2_header(struct mg_tcpip_if *ifp, enum mg_l2proto proto,
|
uint8_t *mg_l2_header(struct mg_tcpip_if *ifp, enum mg_l2proto proto,
|
||||||
uint8_t *src, uint8_t *dst, uint8_t *frame, uint8_t dscp);
|
uint8_t *src, uint8_t *dst, uint8_t *frame);
|
||||||
size_t mg_l2_trailer(struct mg_tcpip_if *ifp, size_t len, uint8_t *cur);
|
size_t mg_l2_trailer(struct mg_tcpip_if *ifp, size_t len, uint8_t *cur);
|
||||||
bool mg_l2_rx(struct mg_tcpip_if *ifp, enum mg_l2proto *proto,
|
bool mg_l2_rx(struct mg_tcpip_if *ifp, enum mg_l2proto *proto,
|
||||||
struct mg_str *pay, struct mg_str *raw);
|
struct mg_str *pay, struct mg_str *raw);
|
||||||
@@ -9560,7 +9554,7 @@ void mg_tcpip_arp_request(struct mg_tcpip_if *ifp, uint32_t ip, uint8_t *mac) {
|
|||||||
uint8_t *l2p = (uint8_t *) ifp->tx.buf;
|
uint8_t *l2p = (uint8_t *) ifp->tx.buf;
|
||||||
struct arp *arp = (struct arp *) mg_l2_header(
|
struct arp *arp = (struct arp *) mg_l2_header(
|
||||||
ifp, MG_TCPIP_L2PROTO_ARP, ifp->mac,
|
ifp, MG_TCPIP_L2PROTO_ARP, ifp->mac,
|
||||||
mg_l2_mapip(ifp->l2type, MG_TCPIP_L2ADDR_BCAST, NULL), l2p, 0);
|
mg_l2_mapip(ifp->l2type, MG_TCPIP_L2ADDR_BCAST, NULL), l2p);
|
||||||
memset(arp, 0, sizeof(*arp));
|
memset(arp, 0, sizeof(*arp));
|
||||||
arp->fmt = mg_htons(1), arp->pro = mg_htons(0x800), arp->hlen = 6,
|
arp->fmt = mg_htons(1), arp->pro = mg_htons(0x800), arp->hlen = 6,
|
||||||
arp->plen = 4;
|
arp->plen = 4;
|
||||||
@@ -9607,7 +9601,7 @@ static struct ip *tx_ip(struct mg_tcpip_if *ifp, uint8_t *l2_dst, uint8_t proto,
|
|||||||
// ifp->tx.buf is 8-bit aligned, keep other headers as pointers, see pkt
|
// ifp->tx.buf is 8-bit aligned, keep other headers as pointers, see pkt
|
||||||
uint8_t *l2p = (uint8_t *) ifp->tx.buf;
|
uint8_t *l2p = (uint8_t *) ifp->tx.buf;
|
||||||
struct ip *ip = (struct ip *) mg_l2_header(ifp, MG_TCPIP_L2PROTO_IPV4,
|
struct ip *ip = (struct ip *) mg_l2_header(ifp, MG_TCPIP_L2PROTO_IPV4,
|
||||||
ifp->mac, l2_dst, l2p, dscp);
|
ifp->mac, l2_dst, l2p);
|
||||||
memset(ip, 0, sizeof(*ip));
|
memset(ip, 0, sizeof(*ip));
|
||||||
ip->ver = 0x45; // Version 4, header length 5 words
|
ip->ver = 0x45; // Version 4, header length 5 words
|
||||||
ip->tos = (uint8_t) (dscp << 2);
|
ip->tos = (uint8_t) (dscp << 2);
|
||||||
@@ -9783,9 +9777,8 @@ static void rx_arp(struct mg_tcpip_if *ifp, struct pkt *pkt) {
|
|||||||
// ARP request. Make a response, then send
|
// ARP request. Make a response, then send
|
||||||
// MG_VERBOSE(("ARP req from %M", mg_print_ip4, &pkt->arp->spa));
|
// MG_VERBOSE(("ARP req from %M", mg_print_ip4, &pkt->arp->spa));
|
||||||
uint8_t *l2p = (uint8_t *) ifp->tx.buf;
|
uint8_t *l2p = (uint8_t *) ifp->tx.buf;
|
||||||
struct arp *arp =
|
struct arp *arp = (struct arp *) mg_l2_header(
|
||||||
(struct arp *) mg_l2_header(ifp, MG_TCPIP_L2PROTO_ARP, ifp->mac,
|
ifp, MG_TCPIP_L2PROTO_ARP, ifp->mac, mg_l2_getaddr(ifp, pkt->l2), l2p);
|
||||||
mg_l2_getaddr(ifp, pkt->l2), l2p, 0);
|
|
||||||
*arp = *pkt->arp;
|
*arp = *pkt->arp;
|
||||||
arp->op = mg_htons(2);
|
arp->op = mg_htons(2);
|
||||||
memcpy(arp->tha, pkt->arp->sha, sizeof(pkt->arp->tha));
|
memcpy(arp->tha, pkt->arp->sha, sizeof(pkt->arp->tha));
|
||||||
@@ -9983,7 +9976,7 @@ static struct ip6 *tx_ip6(struct mg_tcpip_if *ifp, uint8_t *l2_dst,
|
|||||||
// ifp->tx.buf is 8-bit aligned, keep other headers as pointers, see pkt
|
// ifp->tx.buf is 8-bit aligned, keep other headers as pointers, see pkt
|
||||||
uint8_t *l2p = (uint8_t *) ifp->tx.buf;
|
uint8_t *l2p = (uint8_t *) ifp->tx.buf;
|
||||||
struct ip6 *ip6 = (struct ip6 *) mg_l2_header(ifp, MG_TCPIP_L2PROTO_IPV6,
|
struct ip6 *ip6 = (struct ip6 *) mg_l2_header(ifp, MG_TCPIP_L2PROTO_IPV6,
|
||||||
ifp->mac, l2_dst, l2p, dscp);
|
ifp->mac, l2_dst, l2p);
|
||||||
memset(ip6, 0, sizeof(*ip6));
|
memset(ip6, 0, sizeof(*ip6));
|
||||||
ip6->ver = (uint8_t) (0x60 | (dscp >> 2)); // Version 6, traffic class
|
ip6->ver = (uint8_t) (0x60 | (dscp >> 2)); // Version 6, traffic class
|
||||||
ip6->label[0] = (uint8_t) (dscp << 6);
|
ip6->label[0] = (uint8_t) (dscp << 6);
|
||||||
@@ -12742,7 +12735,11 @@ struct mg_flexspi_nor_driver_interface {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MG_OTA <= MG_OTA_RT1064
|
#if MG_OTA <= MG_OTA_RT1064
|
||||||
|
#if MG_OTA == MG_OTA_RT1064
|
||||||
|
#define MG_FLEXSPI_BASE 0x402A4000
|
||||||
|
#else
|
||||||
#define MG_FLEXSPI_BASE 0x402A8000
|
#define MG_FLEXSPI_BASE 0x402A8000
|
||||||
|
#endif
|
||||||
#define flexspi_nor \
|
#define flexspi_nor \
|
||||||
(*((struct mg_flexspi_nor_driver_interface **) (*(uint32_t *) 0x0020001c + \
|
(*((struct mg_flexspi_nor_driver_interface **) (*(uint32_t *) 0x0020001c + \
|
||||||
16)))
|
16)))
|
||||||
@@ -12907,9 +12904,45 @@ MG_IRAM static bool mg_imxrt_erase(void *addr) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
MG_IRAM static void flash_sync(void *addr, size_t len) {
|
||||||
|
// Include any sectors erased while programming their first page
|
||||||
|
size_t ss = s_mg_flash_imxrt.secsz, es = ss;
|
||||||
|
#if MG_IMXRT_PARAM_SECTOR_COUNT > 0
|
||||||
|
ss = flash_sector_size(addr);
|
||||||
|
es = flash_sector_size((void *) ((uintptr_t) addr + len - 1));
|
||||||
|
#endif
|
||||||
|
uintptr_t start = MG_ROUND_DOWN((uintptr_t) addr, ss);
|
||||||
|
uintptr_t end = MG_ROUND_UP((uintptr_t) addr + len, es);
|
||||||
|
|
||||||
|
MG_DSB();
|
||||||
|
// Reset the FlexSPI AHB read buffers and IP FIFOs, even with CPU caches off
|
||||||
|
while ((MG_REG(MG_FLEXSPI_BASE + 0xe0) & 3U) != 3U) (void) 0; // STS0
|
||||||
|
MG_REG(MG_FLEXSPI_BASE) |= MG_BIT(0); // MCR0 SWRESET
|
||||||
|
while (MG_REG(MG_FLEXSPI_BASE) & MG_BIT(0)) (void) 0;
|
||||||
|
|
||||||
|
#if MG_OTA == MG_OTA_RT1180
|
||||||
|
uintptr_t cache = 0x44400000; // XCACHE_PC (CM33)
|
||||||
|
if (MG_REG(cache) & MG_BIT(0)) { // CCR ENCACHE
|
||||||
|
// CLCR: invalidate by physical address. Cache lines are 16 bytes
|
||||||
|
MG_SET_BITS(MG_REG(cache + 4), 3U << 24, MG_BIT(24) | MG_BIT(26));
|
||||||
|
for (; start < end; start += 16) {
|
||||||
|
MG_REG(cache + 8) = (uint32_t) start | MG_BIT(0); // CSAR: address | LGO
|
||||||
|
while (MG_REG(cache + 8) & MG_BIT(0)) (void) 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
if (MG_REG(0xe000ed14) & MG_BIT(16)) { // CM7 SCB CCR: D-cache enabled
|
||||||
|
for (; start < end; start += 32) {
|
||||||
|
MG_REG(0xe000ef5c) = (uint32_t) start; // DCIMVAC
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
MG_DSB();
|
||||||
|
}
|
||||||
|
|
||||||
MG_IRAM static bool mg_imxrt_write(void *addr, const void *buf, size_t len) {
|
MG_IRAM static bool mg_imxrt_write(void *addr, const void *buf, size_t len) {
|
||||||
struct mg_flexspi_nor_config config, *config_ptr = &config;
|
struct mg_flexspi_nor_config config, *config_ptr = &config;
|
||||||
bool ok = false;
|
bool ok = false, sync = false;
|
||||||
// Interrupts must be disabled before calls to ROM API in RT1020 and 1060
|
// Interrupts must be disabled before calls to ROM API in RT1020 and 1060
|
||||||
MG_ARM_DISABLE_IRQ();
|
MG_ARM_DISABLE_IRQ();
|
||||||
if (flexspi_nor_get_config(&config_ptr) != 0) goto fwxit;
|
if (flexspi_nor_get_config(&config_ptr) != 0) goto fwxit;
|
||||||
@@ -12930,6 +12963,7 @@ MG_IRAM static bool mg_imxrt_write(void *addr, const void *buf, size_t len) {
|
|||||||
ok = true;
|
ok = true;
|
||||||
|
|
||||||
while (ok && src < end) {
|
while (ok && src < end) {
|
||||||
|
sync = true; // Erase/program may modify flash even on failure
|
||||||
if (flash_page_start(dst) && flash_erase(config_ptr, dst) == false) {
|
if (flash_page_start(dst) && flash_erase(config_ptr, dst) == false) {
|
||||||
ok = false;
|
ok = false;
|
||||||
break;
|
break;
|
||||||
@@ -12971,6 +13005,7 @@ MG_IRAM static bool mg_imxrt_write(void *addr, const void *buf, size_t len) {
|
|||||||
}
|
}
|
||||||
MG_DEBUG(("Flash write %lu bytes @ %p: %s.", len, dst, ok ? "ok" : "fail"));
|
MG_DEBUG(("Flash write %lu bytes @ %p: %s.", len, dst, ok ? "ok" : "fail"));
|
||||||
fwxit:
|
fwxit:
|
||||||
|
if (sync) flash_sync(addr, len);
|
||||||
if (!s_flash_irq_disabled) MG_ARM_ENABLE_IRQ();
|
if (!s_flash_irq_disabled) MG_ARM_ENABLE_IRQ();
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
@@ -18517,6 +18552,7 @@ static void mg_tls_derive_secret(const char *label, uint8_t *key, size_t keysz,
|
|||||||
size_t labelsz = strlen(label);
|
size_t labelsz = strlen(label);
|
||||||
uint8_t secret[32];
|
uint8_t secret[32];
|
||||||
uint8_t packed[256] = {0, (uint8_t) hashsz, (uint8_t) labelsz};
|
uint8_t packed[256] = {0, (uint8_t) hashsz, (uint8_t) labelsz};
|
||||||
|
// TODO: assert lengths of label, key, data and hash
|
||||||
if (labelsz > 0) memmove(packed + 3, label, labelsz);
|
if (labelsz > 0) memmove(packed + 3, label, labelsz);
|
||||||
packed[3 + labelsz] = (uint8_t) datasz;
|
packed[3 + labelsz] = (uint8_t) datasz;
|
||||||
if (datasz > 0) memmove(packed + labelsz + 4, data, datasz);
|
if (datasz > 0) memmove(packed + labelsz + 4, data, datasz);
|
||||||
@@ -31090,7 +31126,7 @@ static size_t mg_cyw_tx(unsigned int ifc, void *data, size_t len) {
|
|||||||
uint16_t txlen = (uint16_t) (len + sizeof(*hdr));
|
uint16_t txlen = (uint16_t) (len + sizeof(*hdr));
|
||||||
memset(txdata, 0, sizeof(*hdr));
|
memset(txdata, 0, sizeof(*hdr));
|
||||||
memcpy((uint8_t *) txdata + sizeof(*hdr), data, len);
|
memcpy((uint8_t *) txdata + sizeof(*hdr), data, len);
|
||||||
// TODO(): hdr->bdc.priority = dscp >> 3; // RFC-9435 5.1.1
|
// TODO(): hdr->bdc.priority = map IP to TOS if supporting QoS/ToS
|
||||||
hdr->bdc.flags = 2 << 4; // BDC version 2
|
hdr->bdc.flags = 2 << 4; // BDC version 2
|
||||||
hdr->bdc.flags2 = (uint8_t) ifc; // 0 -> STA, 1 -> AP
|
hdr->bdc.flags2 = (uint8_t) ifc; // 0 -> STA, 1 -> AP
|
||||||
// hdr->bdc.data_offset = 0; // actually zeroed above
|
// hdr->bdc.data_offset = 0; // actually zeroed above
|
||||||
|
|||||||
+1
-1
@@ -225,7 +225,7 @@ static size_t mg_cyw_tx(unsigned int ifc, void *data, size_t len) {
|
|||||||
uint16_t txlen = (uint16_t) (len + sizeof(*hdr));
|
uint16_t txlen = (uint16_t) (len + sizeof(*hdr));
|
||||||
memset(txdata, 0, sizeof(*hdr));
|
memset(txdata, 0, sizeof(*hdr));
|
||||||
memcpy((uint8_t *) txdata + sizeof(*hdr), data, len);
|
memcpy((uint8_t *) txdata + sizeof(*hdr), data, len);
|
||||||
// TODO(): hdr->bdc.priority = dscp >> 3; // RFC-9435 5.1.1
|
// TODO(): hdr->bdc.priority = map IP to TOS if supporting QoS/ToS
|
||||||
hdr->bdc.flags = 2 << 4; // BDC version 2
|
hdr->bdc.flags = 2 << 4; // BDC version 2
|
||||||
hdr->bdc.flags2 = (uint8_t) ifc; // 0 -> STA, 1 -> AP
|
hdr->bdc.flags2 = (uint8_t) ifc; // 0 -> STA, 1 -> AP
|
||||||
// hdr->bdc.data_offset = 0; // actually zeroed above
|
// hdr->bdc.data_offset = 0; // actually zeroed above
|
||||||
|
|||||||
@@ -8,8 +8,7 @@
|
|||||||
void mg_l2_init(struct mg_tcpip_if *ifp);
|
void mg_l2_init(struct mg_tcpip_if *ifp);
|
||||||
bool mg_l2_poll(struct mg_tcpip_if *ifp, bool expired_1000ms);
|
bool mg_l2_poll(struct mg_tcpip_if *ifp, bool expired_1000ms);
|
||||||
uint8_t *mg_l2_header(struct mg_tcpip_if *ifp, enum mg_l2proto proto,
|
uint8_t *mg_l2_header(struct mg_tcpip_if *ifp, enum mg_l2proto proto,
|
||||||
uint8_t *src, uint8_t *dst, uint8_t *frame,
|
uint8_t *src, uint8_t *dst, uint8_t *frame);
|
||||||
uint8_t dscp);
|
|
||||||
size_t mg_l2_trailer(struct mg_tcpip_if *ifp, size_t len, uint8_t *cur);
|
size_t mg_l2_trailer(struct mg_tcpip_if *ifp, size_t len, uint8_t *cur);
|
||||||
bool mg_l2_rx(struct mg_tcpip_if *ifp, enum mg_l2proto *proto,
|
bool mg_l2_rx(struct mg_tcpip_if *ifp, enum mg_l2proto *proto,
|
||||||
struct mg_str *pay, struct mg_str *raw);
|
struct mg_str *pay, struct mg_str *raw);
|
||||||
@@ -28,7 +27,7 @@ size_t mg_l2_driver_output(struct mg_tcpip_if *ifp, size_t len);
|
|||||||
// clang-format off
|
// clang-format off
|
||||||
extern void mg_l2_eth_init(struct mg_tcpip_if *);
|
extern void mg_l2_eth_init(struct mg_tcpip_if *);
|
||||||
extern bool mg_l2_eth_poll(struct mg_tcpip_if *, bool);
|
extern bool mg_l2_eth_poll(struct mg_tcpip_if *, bool);
|
||||||
extern uint8_t *mg_l2_eth_header(struct mg_tcpip_if *, enum mg_l2proto, struct mg_l2addr *, struct mg_l2addr *, uint8_t *, uint8_t);
|
extern uint8_t *mg_l2_eth_header(struct mg_tcpip_if *, enum mg_l2proto, struct mg_l2addr *, struct mg_l2addr *, uint8_t *);
|
||||||
extern size_t mg_l2_eth_trailer(struct mg_tcpip_if *, size_t, uint8_t *);
|
extern size_t mg_l2_eth_trailer(struct mg_tcpip_if *, size_t, uint8_t *);
|
||||||
extern bool mg_l2_eth_rx(struct mg_tcpip_if *, enum mg_l2proto *, struct mg_str *, struct mg_str *);
|
extern bool mg_l2_eth_rx(struct mg_tcpip_if *, enum mg_l2proto *, struct mg_str *, struct mg_str *);
|
||||||
extern struct mg_l2addr *mg_l2_eth_getaddr(struct mg_tcpip_if *, uint8_t *);
|
extern struct mg_l2addr *mg_l2_eth_getaddr(struct mg_tcpip_if *, uint8_t *);
|
||||||
@@ -41,7 +40,7 @@ extern uint8_t mg_l2_eth_ip6put(struct mg_l2addr *, uint8_t *);
|
|||||||
|
|
||||||
extern void mg_l2_ppp_init(struct mg_tcpip_if *);
|
extern void mg_l2_ppp_init(struct mg_tcpip_if *);
|
||||||
extern bool mg_l2_ppp_poll(struct mg_tcpip_if *, bool);
|
extern bool mg_l2_ppp_poll(struct mg_tcpip_if *, bool);
|
||||||
extern uint8_t *mg_l2_ppp_header(struct mg_tcpip_if *, enum mg_l2proto, struct mg_l2addr *, struct mg_l2addr *, uint8_t *, uint8_t);
|
extern uint8_t *mg_l2_ppp_header(struct mg_tcpip_if *, enum mg_l2proto, struct mg_l2addr *, struct mg_l2addr *, uint8_t *);
|
||||||
extern size_t mg_l2_ppp_trailer(struct mg_tcpip_if *, size_t, uint8_t *);
|
extern size_t mg_l2_ppp_trailer(struct mg_tcpip_if *, size_t, uint8_t *);
|
||||||
extern bool mg_l2_ppp_rx(struct mg_tcpip_if *, enum mg_l2proto *, struct mg_str *, struct mg_str *);
|
extern bool mg_l2_ppp_rx(struct mg_tcpip_if *, enum mg_l2proto *, struct mg_str *, struct mg_str *);
|
||||||
extern struct mg_l2addr *mg_l2_ppp_getaddr(struct mg_tcpip_if *, uint8_t *);
|
extern struct mg_l2addr *mg_l2_ppp_getaddr(struct mg_tcpip_if *, uint8_t *);
|
||||||
@@ -53,13 +52,13 @@ extern uint8_t mg_l2_ppp_ip6put(struct mg_l2addr *, uint8_t *);
|
|||||||
#endif
|
#endif
|
||||||
extern void mg_l2_pppoe_init(struct mg_tcpip_if *);
|
extern void mg_l2_pppoe_init(struct mg_tcpip_if *);
|
||||||
extern bool mg_l2_pppoe_poll(struct mg_tcpip_if *, bool);
|
extern bool mg_l2_pppoe_poll(struct mg_tcpip_if *, bool);
|
||||||
extern uint8_t *mg_l2_pppoe_header(struct mg_tcpip_if *, enum mg_l2proto, struct mg_l2addr *, struct mg_l2addr *, uint8_t *, uint8_t);
|
extern uint8_t *mg_l2_pppoe_header(struct mg_tcpip_if *, enum mg_l2proto, struct mg_l2addr *, struct mg_l2addr *, uint8_t *);
|
||||||
extern size_t mg_l2_pppoe_trailer(struct mg_tcpip_if *, size_t, uint8_t *);
|
extern size_t mg_l2_pppoe_trailer(struct mg_tcpip_if *, size_t, uint8_t *);
|
||||||
extern bool mg_l2_pppoe_rx(struct mg_tcpip_if *, enum mg_l2proto *, struct mg_str *, struct mg_str *);
|
extern bool mg_l2_pppoe_rx(struct mg_tcpip_if *, enum mg_l2proto *, struct mg_str *, struct mg_str *);
|
||||||
|
|
||||||
typedef void (*l2_init_fn)(struct mg_tcpip_if *);
|
typedef void (*l2_init_fn)(struct mg_tcpip_if *);
|
||||||
typedef bool (*l2_poll_fn)(struct mg_tcpip_if *, bool);
|
typedef bool (*l2_poll_fn)(struct mg_tcpip_if *, bool);
|
||||||
typedef uint8_t *((*l2_header_fn)(struct mg_tcpip_if *, enum mg_l2proto, struct mg_l2addr *, struct mg_l2addr *, uint8_t *, uint8_t));
|
typedef uint8_t *((*l2_header_fn)(struct mg_tcpip_if *, enum mg_l2proto, struct mg_l2addr *, struct mg_l2addr *, uint8_t *));
|
||||||
typedef size_t (*l2_trailer_fn)(struct mg_tcpip_if *, size_t, uint8_t *);
|
typedef size_t (*l2_trailer_fn)(struct mg_tcpip_if *, size_t, uint8_t *);
|
||||||
typedef bool (*l2_rx_fn)(struct mg_tcpip_if *, enum mg_l2proto *, struct mg_str *, struct mg_str *);
|
typedef bool (*l2_rx_fn)(struct mg_tcpip_if *, enum mg_l2proto *, struct mg_str *, struct mg_str *);
|
||||||
typedef struct mg_l2addr (*(*l2_getaddr_fn)(struct mg_tcpip_if *, uint8_t *));
|
typedef struct mg_l2addr (*(*l2_getaddr_fn)(struct mg_tcpip_if *, uint8_t *));
|
||||||
@@ -102,10 +101,9 @@ bool mg_l2_poll(struct mg_tcpip_if *ifp, bool expired_1000ms) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint8_t *mg_l2_header(struct mg_tcpip_if *ifp, enum mg_l2proto proto,
|
uint8_t *mg_l2_header(struct mg_tcpip_if *ifp, enum mg_l2proto proto,
|
||||||
uint8_t *src, uint8_t *dst, uint8_t *frame,
|
uint8_t *src, uint8_t *dst, uint8_t *frame) {
|
||||||
uint8_t dscp) {
|
|
||||||
return l2_header[ifp->l2type](ifp, proto, (struct mg_l2addr *) src,
|
return l2_header[ifp->l2type](ifp, proto, (struct mg_l2addr *) src,
|
||||||
(struct mg_l2addr *) dst, frame, dscp);
|
(struct mg_l2addr *) dst, frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t mg_l2_trailer(struct mg_tcpip_if *ifp, size_t len, uint8_t *frame) {
|
size_t mg_l2_trailer(struct mg_tcpip_if *ifp, size_t len, uint8_t *frame) {
|
||||||
|
|||||||
+2
-3
@@ -63,7 +63,7 @@ bool mg_l2_eth_poll(struct mg_tcpip_if *ifp, bool expired_1000ms) {
|
|||||||
|
|
||||||
uint8_t *mg_l2_eth_header(struct mg_tcpip_if *ifp, enum mg_l2proto proto,
|
uint8_t *mg_l2_eth_header(struct mg_tcpip_if *ifp, enum mg_l2proto proto,
|
||||||
struct mg_l2addr *src, struct mg_l2addr *dst,
|
struct mg_l2addr *src, struct mg_l2addr *dst,
|
||||||
uint8_t *frame, uint8_t dscp) {
|
uint8_t *frame) {
|
||||||
struct eth_data *d = &ifp->l2data.eth;
|
struct eth_data *d = &ifp->l2data.eth;
|
||||||
struct eth *eth = (struct eth *) frame;
|
struct eth *eth = (struct eth *) frame;
|
||||||
uint8_t *hlp;
|
uint8_t *hlp;
|
||||||
@@ -75,8 +75,7 @@ uint8_t *mg_l2_eth_header(struct mg_tcpip_if *ifp, enum mg_l2proto proto,
|
|||||||
} else { // Add 802.1Q tag
|
} else { // Add 802.1Q tag
|
||||||
struct qtag *qtag = (struct qtag *) ð->type;
|
struct qtag *qtag = (struct qtag *) ð->type;
|
||||||
qtag->tpid = mg_htons(0x8100);
|
qtag->tpid = mg_htons(0x8100);
|
||||||
qtag->tci = mg_htons((uint16_t) ((d->vlan_id & 0x1fff) | // VID + DEI
|
qtag->tci = mg_htons(d->vlan_id); // PCP = default (best-effort)
|
||||||
(dscp >> 3) << 13)); // RFC-9435 5.1.1
|
|
||||||
hlp += sizeof(*qtag);
|
hlp += sizeof(*qtag);
|
||||||
MG_STORE_BE16(qtag + 1, eth_types[(unsigned int) proto]);
|
MG_STORE_BE16(qtag + 1, eth_types[(unsigned int) proto]);
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-11
@@ -139,24 +139,22 @@ static uint8_t *l2_ppp_header(enum mg_l2proto proto, uint8_t *p) {
|
|||||||
|
|
||||||
uint8_t *mg_l2_ppp_header(struct mg_tcpip_if *ifp, enum mg_l2proto proto,
|
uint8_t *mg_l2_ppp_header(struct mg_tcpip_if *ifp, enum mg_l2proto proto,
|
||||||
struct mg_l2addr *src, struct mg_l2addr *dst,
|
struct mg_l2addr *src, struct mg_l2addr *dst,
|
||||||
uint8_t *frame, uint8_t dscp) {
|
uint8_t *frame) {
|
||||||
(void) ifp;
|
(void) ifp;
|
||||||
(void) src;
|
(void) src;
|
||||||
(void) dst;
|
(void) dst;
|
||||||
(void) dscp;
|
|
||||||
return l2_ppp_header(proto, hdlc_header(frame));
|
return l2_ppp_header(proto, hdlc_header(frame));
|
||||||
}
|
}
|
||||||
|
|
||||||
extern uint8_t *mg_l2_eth_header(struct mg_tcpip_if *ifp, enum mg_l2proto proto,
|
extern uint8_t *mg_l2_eth_header(struct mg_tcpip_if *ifp, enum mg_l2proto proto,
|
||||||
struct mg_l2addr *src, struct mg_l2addr *dst,
|
struct mg_l2addr *src, struct mg_l2addr *dst,
|
||||||
uint8_t *frame, uint8_t dscp);
|
uint8_t *frame);
|
||||||
|
|
||||||
static uint8_t *pppoe_header(struct mg_tcpip_if *ifp, enum mg_l2proto proto,
|
static uint8_t *pppoe_header(struct mg_tcpip_if *ifp, enum mg_l2proto proto,
|
||||||
uint8_t code, uint16_t id, struct mg_l2addr *src,
|
uint8_t code, uint16_t id, struct mg_l2addr *src,
|
||||||
struct mg_l2addr *dst, uint8_t *frame,
|
struct mg_l2addr *dst, uint8_t *frame) {
|
||||||
uint8_t dscp) {
|
|
||||||
struct pppoe *pppoe =
|
struct pppoe *pppoe =
|
||||||
(struct pppoe *) mg_l2_eth_header(ifp, proto, src, dst, frame, dscp);
|
(struct pppoe *) mg_l2_eth_header(ifp, proto, src, dst, frame);
|
||||||
pppoe->vertype = 0x11;
|
pppoe->vertype = 0x11;
|
||||||
pppoe->code = code;
|
pppoe->code = code;
|
||||||
pppoe->id = id;
|
pppoe->id = id;
|
||||||
@@ -165,10 +163,10 @@ static uint8_t *pppoe_header(struct mg_tcpip_if *ifp, enum mg_l2proto proto,
|
|||||||
|
|
||||||
uint8_t *mg_l2_pppoe_header(struct mg_tcpip_if *ifp, enum mg_l2proto proto,
|
uint8_t *mg_l2_pppoe_header(struct mg_tcpip_if *ifp, enum mg_l2proto proto,
|
||||||
struct mg_l2addr *src, struct mg_l2addr *dst,
|
struct mg_l2addr *src, struct mg_l2addr *dst,
|
||||||
uint8_t *frame, uint8_t dscp) {
|
uint8_t *frame) {
|
||||||
(void) dst;
|
(void) dst;
|
||||||
return l2_ppp_header(proto, pppoe_header(ifp, MG_TCPIP_L2PROTO_PPPoE_SESS, 0,
|
return l2_ppp_header(proto, pppoe_header(ifp, MG_TCPIP_L2PROTO_PPPoE_SESS, 0,
|
||||||
s_id, src, dst, frame, dscp));
|
s_id, src, dst, frame));
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t mg_l2_ppp_trailer(struct mg_tcpip_if *ifp, size_t len, uint8_t *cur) {
|
size_t mg_l2_ppp_trailer(struct mg_tcpip_if *ifp, size_t len, uint8_t *cur) {
|
||||||
@@ -204,8 +202,7 @@ static uint8_t *ppp_tx_frame_header(struct mg_tcpip_if *ifp, uint16_t proto) {
|
|||||||
return ppp_header(proto, hdlc_header(l2p));
|
return ppp_header(proto, hdlc_header(l2p));
|
||||||
return ppp_header(proto, pppoe_header(ifp, MG_TCPIP_L2PROTO_PPPoE_SESS, 0,
|
return ppp_header(proto, pppoe_header(ifp, MG_TCPIP_L2PROTO_PPPoE_SESS, 0,
|
||||||
s_id, (struct mg_l2addr *) ifp->mac,
|
s_id, (struct mg_l2addr *) ifp->mac,
|
||||||
(struct mg_l2addr *) ifp->gwmac, l2p,
|
(struct mg_l2addr *) ifp->gwmac, l2p));
|
||||||
0));
|
|
||||||
}
|
}
|
||||||
static size_t ppp_tx_frame_trailer(struct mg_tcpip_if *ifp, size_t len,
|
static size_t ppp_tx_frame_trailer(struct mg_tcpip_if *ifp, size_t len,
|
||||||
uint8_t *cur) {
|
uint8_t *cur) {
|
||||||
@@ -520,7 +517,7 @@ static size_t pppoe_tx_frame(struct mg_tcpip_if *ifp, uint8_t code, uint16_t id,
|
|||||||
struct mg_l2addr *dst) {
|
struct mg_l2addr *dst) {
|
||||||
uint8_t *l2p = (uint8_t *) ifp->tx.buf;
|
uint8_t *l2p = (uint8_t *) ifp->tx.buf;
|
||||||
uint8_t *p = pppoe_header(ifp, MG_TCPIP_L2PROTO_PPPoE_DISC, code, id,
|
uint8_t *p = pppoe_header(ifp, MG_TCPIP_L2PROTO_PPPoE_DISC, code, id,
|
||||||
(struct mg_l2addr *) ifp->mac, dst, l2p, 0);
|
(struct mg_l2addr *) ifp->mac, dst, l2p);
|
||||||
memmove(p, data, datasz);
|
memmove(p, data, datasz);
|
||||||
return mg_l2_driver_output(ifp, pppoe_trailer(ifp, datasz, p + datasz));
|
return mg_l2_driver_output(ifp, pppoe_trailer(ifp, datasz, p + datasz));
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-7
@@ -227,7 +227,7 @@ struct pkt {
|
|||||||
// L2 API
|
// L2 API
|
||||||
void mg_l2_init(struct mg_tcpip_if *ifp);
|
void mg_l2_init(struct mg_tcpip_if *ifp);
|
||||||
uint8_t *mg_l2_header(struct mg_tcpip_if *ifp, enum mg_l2proto proto,
|
uint8_t *mg_l2_header(struct mg_tcpip_if *ifp, enum mg_l2proto proto,
|
||||||
uint8_t *src, uint8_t *dst, uint8_t *frame, uint8_t dscp);
|
uint8_t *src, uint8_t *dst, uint8_t *frame);
|
||||||
size_t mg_l2_trailer(struct mg_tcpip_if *ifp, size_t len, uint8_t *cur);
|
size_t mg_l2_trailer(struct mg_tcpip_if *ifp, size_t len, uint8_t *cur);
|
||||||
bool mg_l2_rx(struct mg_tcpip_if *ifp, enum mg_l2proto *proto,
|
bool mg_l2_rx(struct mg_tcpip_if *ifp, enum mg_l2proto *proto,
|
||||||
struct mg_str *pay, struct mg_str *raw);
|
struct mg_str *pay, struct mg_str *raw);
|
||||||
@@ -407,7 +407,7 @@ void mg_tcpip_arp_request(struct mg_tcpip_if *ifp, uint32_t ip, uint8_t *mac) {
|
|||||||
uint8_t *l2p = (uint8_t *) ifp->tx.buf;
|
uint8_t *l2p = (uint8_t *) ifp->tx.buf;
|
||||||
struct arp *arp = (struct arp *) mg_l2_header(
|
struct arp *arp = (struct arp *) mg_l2_header(
|
||||||
ifp, MG_TCPIP_L2PROTO_ARP, ifp->mac,
|
ifp, MG_TCPIP_L2PROTO_ARP, ifp->mac,
|
||||||
mg_l2_mapip(ifp->l2type, MG_TCPIP_L2ADDR_BCAST, NULL), l2p, 0);
|
mg_l2_mapip(ifp->l2type, MG_TCPIP_L2ADDR_BCAST, NULL), l2p);
|
||||||
memset(arp, 0, sizeof(*arp));
|
memset(arp, 0, sizeof(*arp));
|
||||||
arp->fmt = mg_htons(1), arp->pro = mg_htons(0x800), arp->hlen = 6,
|
arp->fmt = mg_htons(1), arp->pro = mg_htons(0x800), arp->hlen = 6,
|
||||||
arp->plen = 4;
|
arp->plen = 4;
|
||||||
@@ -454,7 +454,7 @@ static struct ip *tx_ip(struct mg_tcpip_if *ifp, uint8_t *l2_dst, uint8_t proto,
|
|||||||
// ifp->tx.buf is 8-bit aligned, keep other headers as pointers, see pkt
|
// ifp->tx.buf is 8-bit aligned, keep other headers as pointers, see pkt
|
||||||
uint8_t *l2p = (uint8_t *) ifp->tx.buf;
|
uint8_t *l2p = (uint8_t *) ifp->tx.buf;
|
||||||
struct ip *ip = (struct ip *) mg_l2_header(ifp, MG_TCPIP_L2PROTO_IPV4,
|
struct ip *ip = (struct ip *) mg_l2_header(ifp, MG_TCPIP_L2PROTO_IPV4,
|
||||||
ifp->mac, l2_dst, l2p, dscp);
|
ifp->mac, l2_dst, l2p);
|
||||||
memset(ip, 0, sizeof(*ip));
|
memset(ip, 0, sizeof(*ip));
|
||||||
ip->ver = 0x45; // Version 4, header length 5 words
|
ip->ver = 0x45; // Version 4, header length 5 words
|
||||||
ip->tos = (uint8_t) (dscp << 2);
|
ip->tos = (uint8_t) (dscp << 2);
|
||||||
@@ -630,9 +630,8 @@ static void rx_arp(struct mg_tcpip_if *ifp, struct pkt *pkt) {
|
|||||||
// ARP request. Make a response, then send
|
// ARP request. Make a response, then send
|
||||||
// MG_VERBOSE(("ARP req from %M", mg_print_ip4, &pkt->arp->spa));
|
// MG_VERBOSE(("ARP req from %M", mg_print_ip4, &pkt->arp->spa));
|
||||||
uint8_t *l2p = (uint8_t *) ifp->tx.buf;
|
uint8_t *l2p = (uint8_t *) ifp->tx.buf;
|
||||||
struct arp *arp =
|
struct arp *arp = (struct arp *) mg_l2_header(
|
||||||
(struct arp *) mg_l2_header(ifp, MG_TCPIP_L2PROTO_ARP, ifp->mac,
|
ifp, MG_TCPIP_L2PROTO_ARP, ifp->mac, mg_l2_getaddr(ifp, pkt->l2), l2p);
|
||||||
mg_l2_getaddr(ifp, pkt->l2), l2p, 0);
|
|
||||||
*arp = *pkt->arp;
|
*arp = *pkt->arp;
|
||||||
arp->op = mg_htons(2);
|
arp->op = mg_htons(2);
|
||||||
memcpy(arp->tha, pkt->arp->sha, sizeof(pkt->arp->tha));
|
memcpy(arp->tha, pkt->arp->sha, sizeof(pkt->arp->tha));
|
||||||
@@ -830,7 +829,7 @@ static struct ip6 *tx_ip6(struct mg_tcpip_if *ifp, uint8_t *l2_dst,
|
|||||||
// ifp->tx.buf is 8-bit aligned, keep other headers as pointers, see pkt
|
// ifp->tx.buf is 8-bit aligned, keep other headers as pointers, see pkt
|
||||||
uint8_t *l2p = (uint8_t *) ifp->tx.buf;
|
uint8_t *l2p = (uint8_t *) ifp->tx.buf;
|
||||||
struct ip6 *ip6 = (struct ip6 *) mg_l2_header(ifp, MG_TCPIP_L2PROTO_IPV6,
|
struct ip6 *ip6 = (struct ip6 *) mg_l2_header(ifp, MG_TCPIP_L2PROTO_IPV6,
|
||||||
ifp->mac, l2_dst, l2p, dscp);
|
ifp->mac, l2_dst, l2p);
|
||||||
memset(ip6, 0, sizeof(*ip6));
|
memset(ip6, 0, sizeof(*ip6));
|
||||||
ip6->ver = (uint8_t) (0x60 | (dscp >> 2)); // Version 6, traffic class
|
ip6->ver = (uint8_t) (0x60 | (dscp >> 2)); // Version 6, traffic class
|
||||||
ip6->label[0] = (uint8_t) (dscp << 6);
|
ip6->label[0] = (uint8_t) (dscp << 6);
|
||||||
|
|||||||
+43
-1
@@ -411,7 +411,11 @@ struct mg_flexspi_nor_driver_interface {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MG_OTA <= MG_OTA_RT1064
|
#if MG_OTA <= MG_OTA_RT1064
|
||||||
|
#if MG_OTA == MG_OTA_RT1064
|
||||||
|
#define MG_FLEXSPI_BASE 0x402A4000
|
||||||
|
#else
|
||||||
#define MG_FLEXSPI_BASE 0x402A8000
|
#define MG_FLEXSPI_BASE 0x402A8000
|
||||||
|
#endif
|
||||||
#define flexspi_nor \
|
#define flexspi_nor \
|
||||||
(*((struct mg_flexspi_nor_driver_interface **) (*(uint32_t *) 0x0020001c + \
|
(*((struct mg_flexspi_nor_driver_interface **) (*(uint32_t *) 0x0020001c + \
|
||||||
16)))
|
16)))
|
||||||
@@ -576,9 +580,45 @@ MG_IRAM static bool mg_imxrt_erase(void *addr) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
MG_IRAM static void flash_sync(void *addr, size_t len) {
|
||||||
|
// Include any sectors erased while programming their first page
|
||||||
|
size_t ss = s_mg_flash_imxrt.secsz, es = ss;
|
||||||
|
#if MG_IMXRT_PARAM_SECTOR_COUNT > 0
|
||||||
|
ss = flash_sector_size(addr);
|
||||||
|
es = flash_sector_size((void *) ((uintptr_t) addr + len - 1));
|
||||||
|
#endif
|
||||||
|
uintptr_t start = MG_ROUND_DOWN((uintptr_t) addr, ss);
|
||||||
|
uintptr_t end = MG_ROUND_UP((uintptr_t) addr + len, es);
|
||||||
|
|
||||||
|
MG_DSB();
|
||||||
|
// Reset the FlexSPI AHB read buffers and IP FIFOs, even with CPU caches off
|
||||||
|
while ((MG_REG(MG_FLEXSPI_BASE + 0xe0) & 3U) != 3U) (void) 0; // STS0
|
||||||
|
MG_REG(MG_FLEXSPI_BASE) |= MG_BIT(0); // MCR0 SWRESET
|
||||||
|
while (MG_REG(MG_FLEXSPI_BASE) & MG_BIT(0)) (void) 0;
|
||||||
|
|
||||||
|
#if MG_OTA == MG_OTA_RT1180
|
||||||
|
uintptr_t cache = 0x44400000; // XCACHE_PC (CM33)
|
||||||
|
if (MG_REG(cache) & MG_BIT(0)) { // CCR ENCACHE
|
||||||
|
// CLCR: invalidate by physical address. Cache lines are 16 bytes
|
||||||
|
MG_SET_BITS(MG_REG(cache + 4), 3U << 24, MG_BIT(24) | MG_BIT(26));
|
||||||
|
for (; start < end; start += 16) {
|
||||||
|
MG_REG(cache + 8) = (uint32_t) start | MG_BIT(0); // CSAR: address | LGO
|
||||||
|
while (MG_REG(cache + 8) & MG_BIT(0)) (void) 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
if (MG_REG(0xe000ed14) & MG_BIT(16)) { // CM7 SCB CCR: D-cache enabled
|
||||||
|
for (; start < end; start += 32) {
|
||||||
|
MG_REG(0xe000ef5c) = (uint32_t) start; // DCIMVAC
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
MG_DSB();
|
||||||
|
}
|
||||||
|
|
||||||
MG_IRAM static bool mg_imxrt_write(void *addr, const void *buf, size_t len) {
|
MG_IRAM static bool mg_imxrt_write(void *addr, const void *buf, size_t len) {
|
||||||
struct mg_flexspi_nor_config config, *config_ptr = &config;
|
struct mg_flexspi_nor_config config, *config_ptr = &config;
|
||||||
bool ok = false;
|
bool ok = false, sync = false;
|
||||||
// Interrupts must be disabled before calls to ROM API in RT1020 and 1060
|
// Interrupts must be disabled before calls to ROM API in RT1020 and 1060
|
||||||
MG_ARM_DISABLE_IRQ();
|
MG_ARM_DISABLE_IRQ();
|
||||||
if (flexspi_nor_get_config(&config_ptr) != 0) goto fwxit;
|
if (flexspi_nor_get_config(&config_ptr) != 0) goto fwxit;
|
||||||
@@ -599,6 +639,7 @@ MG_IRAM static bool mg_imxrt_write(void *addr, const void *buf, size_t len) {
|
|||||||
ok = true;
|
ok = true;
|
||||||
|
|
||||||
while (ok && src < end) {
|
while (ok && src < end) {
|
||||||
|
sync = true; // Erase/program may modify flash even on failure
|
||||||
if (flash_page_start(dst) && flash_erase(config_ptr, dst) == false) {
|
if (flash_page_start(dst) && flash_erase(config_ptr, dst) == false) {
|
||||||
ok = false;
|
ok = false;
|
||||||
break;
|
break;
|
||||||
@@ -640,6 +681,7 @@ MG_IRAM static bool mg_imxrt_write(void *addr, const void *buf, size_t len) {
|
|||||||
}
|
}
|
||||||
MG_DEBUG(("Flash write %lu bytes @ %p: %s.", len, dst, ok ? "ok" : "fail"));
|
MG_DEBUG(("Flash write %lu bytes @ %p: %s.", len, dst, ok ? "ok" : "fail"));
|
||||||
fwxit:
|
fwxit:
|
||||||
|
if (sync) flash_sync(addr, len);
|
||||||
if (!s_flash_irq_disabled) MG_ARM_ENABLE_IRQ();
|
if (!s_flash_irq_disabled) MG_ARM_ENABLE_IRQ();
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -317,6 +317,7 @@ static void mg_tls_derive_secret(const char *label, uint8_t *key, size_t keysz,
|
|||||||
size_t labelsz = strlen(label);
|
size_t labelsz = strlen(label);
|
||||||
uint8_t secret[32];
|
uint8_t secret[32];
|
||||||
uint8_t packed[256] = {0, (uint8_t) hashsz, (uint8_t) labelsz};
|
uint8_t packed[256] = {0, (uint8_t) hashsz, (uint8_t) labelsz};
|
||||||
|
// TODO: assert lengths of label, key, data and hash
|
||||||
if (labelsz > 0) memmove(packed + 3, label, labelsz);
|
if (labelsz > 0) memmove(packed + 3, label, labelsz);
|
||||||
packed[3 + labelsz] = (uint8_t) datasz;
|
packed[3 + labelsz] = (uint8_t) datasz;
|
||||||
if (datasz > 0) memmove(packed + labelsz + 4, data, datasz);
|
if (datasz > 0) memmove(packed + labelsz + 4, data, datasz);
|
||||||
|
|||||||
@@ -1,18 +1,21 @@
|
|||||||
# Environment setup: https://mongoose.ws/documentation/tutorials/tools/
|
# Environment setup: https://mongoose.ws/documentation/tutorials/tools/
|
||||||
|
|
||||||
|
MGDIR = ../../../..
|
||||||
|
|
||||||
CFLAGS = -W -Wall -Wextra -Werror -Wundef -Wshadow -Wdouble-promotion
|
CFLAGS = -W -Wall -Wextra -Werror -Wundef -Wshadow -Wdouble-promotion
|
||||||
CFLAGS += -Wformat-truncation -fno-common -Wno-conversion -Wno-sign-conversion
|
CFLAGS += -Wformat-truncation -fno-common -Wno-conversion -Wno-sign-conversion
|
||||||
CFLAGS += -g3 -Os -ffunction-sections -fdata-sections
|
CFLAGS += -g3 -Os -ffunction-sections -fdata-sections
|
||||||
CFLAGS += -Wno-cast-function-type -Wno-old-style-declaration
|
CFLAGS += -Wno-cast-function-type -Wno-old-style-declaration
|
||||||
CFLAGS += -Wno-unused-parameter -Wno-unused-function
|
CFLAGS += -Wno-unused-parameter -Wno-unused-function
|
||||||
CFLAGS += -I. -Imongoose -Icmsis_core/CMSIS/Core/Include/
|
CFLAGS += -I. -I$(MGDIR) -Ilittlefs -Icmsis_core/CMSIS/Core/Include/
|
||||||
CFLAGS += -Icmsis_rt1186/devices/MIMXRT1186/ -Icmsis_rt1186/devices/MIMXRT1186/periph/ -Icmsis_rt1186/devices/MIMXRT1186/drivers/
|
CFLAGS += -Icmsis_rt1186/devices/MIMXRT1186/ -Icmsis_rt1186/devices/MIMXRT1186/periph/ -Icmsis_rt1186/devices/MIMXRT1186/drivers/
|
||||||
CFLAGS += -DCPU_MIMXRT1186CVJ8C_cm33 -DCPU_MIMXRT1186CVJ8C -DMIMXRT1186_cm33_SERIES
|
CFLAGS += -DCPU_MIMXRT1186CVJ8C_cm33 -DCPU_MIMXRT1186CVJ8C -DMIMXRT1186_cm33_SERIES
|
||||||
CFLAGS += -DXIP_EXTERNAL_FLASH=1 -DXIP_BOOT_HEADER_ENABLE=1
|
CFLAGS += -DXIP_EXTERNAL_FLASH=1 -DXIP_BOOT_HEADER_ENABLE=1
|
||||||
CFLAGS += -mcpu=cortex-m33 -mthumb -mfpu=fpv5-sp-d16 -mfloat-abi=hard $(CFLAGS_EXTRA)
|
CFLAGS += -mcpu=cortex-m33 -mthumb -mfpu=fpv5-sp-d16 -mfloat-abi=hard $(CFLAGS_EXTRA)
|
||||||
LDFLAGS ?= -Tlink.ld -nostdlib -nostartfiles --specs=nano.specs -lc -lgcc -Wl,--gc-sections
|
LDFLAGS ?= -Tlink.ld -nostdlib -nostartfiles --specs=nano.specs -lc -lgcc -Wl,--gc-sections
|
||||||
|
|
||||||
SOURCES = main.c hal.c flash_image.c mongoose/mongoose.c
|
SOURCES = main.c hal.c flash_image.c $(MGDIR)/mongoose.c
|
||||||
|
SOURCES += littlefs/lfs.c littlefs/lfs_util.c
|
||||||
SOURCES += cmsis_rt1186/devices/MIMXRT1186/gcc/startup_MIMXRT1186_cm33.S
|
SOURCES += cmsis_rt1186/devices/MIMXRT1186/gcc/startup_MIMXRT1186_cm33.S
|
||||||
SOURCES += cmsis_rt1186/devices/MIMXRT1186/drivers/fsl_clock.c
|
SOURCES += cmsis_rt1186/devices/MIMXRT1186/drivers/fsl_clock.c
|
||||||
SOURCES += cmsis_rt1186/devices/MIMXRT1186/drivers/fsl_pmu.c
|
SOURCES += cmsis_rt1186/devices/MIMXRT1186/drivers/fsl_pmu.c
|
||||||
@@ -23,17 +26,16 @@ SOURCES += cmsis_rt1186/devices/MIMXRT1186/drivers/fsl_trdc.c
|
|||||||
|
|
||||||
CFLAGS += -D__ATOLLIC__ -D__STARTUP_CLEAR_BSS -DMG_HAL_DISABLE_RANDOM -DMG_HAL_ENABLE_PHY_STRAP
|
CFLAGS += -D__ATOLLIC__ -D__STARTUP_CLEAR_BSS -DMG_HAL_DISABLE_RANDOM -DMG_HAL_ENABLE_PHY_STRAP
|
||||||
|
|
||||||
all build: firmware.bin
|
# Disabled for littlefs/lfs.c
|
||||||
|
CFLAGS += -Wno-shadow
|
||||||
|
|
||||||
mongoose/mongoose.c mongoose/mongoose.h:
|
all build: firmware.bin
|
||||||
mkdir -p mongoose
|
|
||||||
cp ../../../../mongoose.[ch] mongoose/
|
|
||||||
|
|
||||||
firmware.bin: firmware.elf
|
firmware.bin: firmware.elf
|
||||||
arm-none-eabi-objcopy -O binary $< $@
|
arm-none-eabi-objcopy -O binary $< $@
|
||||||
arm-none-eabi-size --format=berkeley $<
|
arm-none-eabi-size --format=berkeley $<
|
||||||
|
|
||||||
firmware.elf: cmsis_core cmsis_rt1186 $(SOURCES) $(wildcard *.h) link.ld Makefile
|
firmware.elf: cmsis_core cmsis_rt1186 littlefs sys/dirent.h $(SOURCES) $(MGDIR)/mongoose.h $(wildcard *.h) link.ld Makefile
|
||||||
arm-none-eabi-gcc $(SOURCES) $(CFLAGS) $(LDFLAGS) -o $@
|
arm-none-eabi-gcc $(SOURCES) $(CFLAGS) $(LDFLAGS) -o $@
|
||||||
|
|
||||||
cmsis_core:
|
cmsis_core:
|
||||||
@@ -44,9 +46,13 @@ cmsis_rt1186:
|
|||||||
unzip -q NXP.MIMXRT1186_DFP.26.06.00.pack -d $@
|
unzip -q NXP.MIMXRT1186_DFP.26.06.00.pack -d $@
|
||||||
rm NXP.MIMXRT1186_DFP.26.06.00.pack
|
rm NXP.MIMXRT1186_DFP.26.06.00.pack
|
||||||
|
|
||||||
|
littlefs/lfs.c littlefs/lfs_util.c: littlefs
|
||||||
|
littlefs:
|
||||||
|
git clone -q -c advice.detachedHead=false --depth 1 -b v2.11.3 https://github.com/littlefs-project/littlefs $@
|
||||||
|
|
||||||
# Show all symbols sorted by size
|
# Show all symbols sorted by size
|
||||||
show_symbols_sorted_by_size: firmware.bin
|
show_symbols_sorted_by_size: firmware.bin
|
||||||
arm-none-eabi-readelf -sW firmware.elf | sed 1,3d | sed 's,^.*: ,,' | tr -s ' ' | cut -d ' ' -f 2,7 | sort -nk1 | grep -v '^0 '
|
arm-none-eabi-readelf -sW firmware.elf | sed 1,3d | sed 's,^.*: ,,' | tr -s ' ' | cut -d ' ' -f 2,7 | sort -nk1 | grep -v '^0 '
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf firmware.* cmsis_* mongoose/mongoose.*
|
rm -rf firmware.* cmsis_* mongoose/mongoose.* littlefs
|
||||||
@@ -74,6 +74,14 @@ static void http_ev_handler(struct mg_connection *c, int ev, void *ev_data) {
|
|||||||
struct mg_http_message *hm = (struct mg_http_message *) ev_data;
|
struct mg_http_message *hm = (struct mg_http_message *) ev_data;
|
||||||
if (mg_match(hm->uri, mg_str("/api/tick"), NULL)) {
|
if (mg_match(hm->uri, mg_str("/api/tick"), NULL)) {
|
||||||
mg_http_reply(c, 200, "", "{%m:%llu}\n", MG_ESC("tick"), hal_get_tick());
|
mg_http_reply(c, 200, "", "{%m:%llu}\n", MG_ESC("tick"), hal_get_tick());
|
||||||
|
} else if (mg_match(hm->uri, mg_str("/files/#"), NULL)) {
|
||||||
|
struct mg_http_serve_opts opts = {
|
||||||
|
.root_dir = "/files/=/fs/",
|
||||||
|
.enable_delete = true,
|
||||||
|
.enable_upload = true,
|
||||||
|
.enable_dir_listing = true,
|
||||||
|
};
|
||||||
|
mg_http_serve_dir(c, hm, &opts);
|
||||||
} else if (mg_match(hm->uri, mg_str("/api/crash"), NULL)) {
|
} else if (mg_match(hm->uri, mg_str("/api/crash"), NULL)) {
|
||||||
__asm volatile("udf #0"); // Trigger HardFault
|
__asm volatile("udf #0"); // Trigger HardFault
|
||||||
} else {
|
} else {
|
||||||
@@ -108,6 +116,18 @@ int main(void) {
|
|||||||
MG_INFO(("RAM used: %zu, free: %zu", hal_ram_used(), hal_ram_free()));
|
MG_INFO(("RAM used: %zu, free: %zu", hal_ram_used(), hal_ram_free()));
|
||||||
MG_INFO(("Crash record: %M", mg_print_crash_record));
|
MG_INFO(("Crash record: %M", mg_print_crash_record));
|
||||||
|
|
||||||
|
// Create directory for Web file manager. Will be mapped to /files/ URL
|
||||||
|
if (!mg_lfs_init(MG_LFS_SIZE)) {
|
||||||
|
MG_ERROR(("LittleFS initialisation failed"));
|
||||||
|
} else {
|
||||||
|
mkdir("/fs", 0755);
|
||||||
|
MG_INFO(("File manager operations:"));
|
||||||
|
MG_INFO(("Upload: curl IP/files/NAME --data-binary @FILE"));
|
||||||
|
MG_INFO(("Delete: curl IP/files/NAME -X DELETE"));
|
||||||
|
MG_INFO(("Show: curl IP/files/NAME"));
|
||||||
|
MG_INFO(("List: curl IP/files/"));
|
||||||
|
}
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
mg_mgr_poll(&mgr, 0);
|
mg_mgr_poll(&mgr, 0);
|
||||||
blink_task();
|
blink_task();
|
||||||
|
|||||||
@@ -3,6 +3,12 @@
|
|||||||
#define MG_ENABLE_TCPIP 1
|
#define MG_ENABLE_TCPIP 1
|
||||||
#define MG_ENABLE_DRIVER_NETC 1
|
#define MG_ENABLE_DRIVER_NETC 1
|
||||||
#define MG_OTA MG_OTA_RT1180
|
#define MG_OTA MG_OTA_RT1180
|
||||||
|
|
||||||
|
#define MG_ENABLE_LFS 1
|
||||||
|
#define MG_LFS_SIZE (128 * 1024) // Multiple of the 4 KiB flash sector size
|
||||||
|
#define MG_LFS_BUF_SIZE 256 // Match the RT1180 flash write alignment
|
||||||
|
// LittleFS shares the OTA staging area; files may be lost after an update.
|
||||||
|
|
||||||
// Keep the Mongoose PHY address aligned with NETC switch link binding
|
// Keep the Mongoose PHY address aligned with NETC switch link binding
|
||||||
#include "board_config.h"
|
#include "board_config.h"
|
||||||
#define MG_TCPIP_PHY_ADDR BOARD_ETH_PHY_ADDR
|
#define MG_TCPIP_PHY_ADDR BOARD_ETH_PHY_ADDR
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
// LittleFS provides directory types in mongoose.h instead of newlib's stub.
|
||||||
@@ -1,30 +1,32 @@
|
|||||||
# Environment setup: https://mongoose.ws/documentation/tutorials/tools/
|
# Environment setup: https://mongoose.ws/documentation/tutorials/tools/
|
||||||
|
|
||||||
|
MGDIR = ../../../..
|
||||||
|
|
||||||
CFLAGS = -W -Wall -Wextra -Werror -Wundef -Wshadow -Wdouble-promotion
|
CFLAGS = -W -Wall -Wextra -Werror -Wundef -Wshadow -Wdouble-promotion
|
||||||
CFLAGS += -Wformat-truncation -fno-common -Wno-conversion -Wno-sign-conversion
|
CFLAGS += -Wformat-truncation -fno-common -Wno-conversion -Wno-sign-conversion
|
||||||
CFLAGS += -g3 -Os -ffunction-sections -fdata-sections
|
CFLAGS += -g3 -Os -ffunction-sections -fdata-sections
|
||||||
CFLAGS += -Wno-cast-function-type
|
CFLAGS += -Wno-cast-function-type
|
||||||
CFLAGS += -I. -Imongoose -Icmsis_core/CMSIS/Core/Include/ -DCPU_MIMXRT1062DVL6B
|
CFLAGS += -I. -I$(MGDIR) -Ilittlefs -Icmsis_core/CMSIS/Core/Include/ -DCPU_MIMXRT1062DVL6B
|
||||||
CFLAGS += -Icmsis_rt1060/devices/MIMXRT1062/ -Icmsis_rt1060/devices/MIMXRT1062/periph/ -Icmsis_rt1060/devices/MIMXRT1062/drivers/
|
CFLAGS += -Icmsis_rt1060/devices/MIMXRT1062/ -Icmsis_rt1060/devices/MIMXRT1062/periph/ -Icmsis_rt1060/devices/MIMXRT1062/drivers/
|
||||||
CFLAGS += -mcpu=cortex-m7 -mthumb -mfloat-abi=hard -mfpu=fpv5-sp-d16 $(CFLAGS_EXTRA)
|
CFLAGS += -mcpu=cortex-m7 -mthumb -mfloat-abi=hard -mfpu=fpv5-sp-d16 $(CFLAGS_EXTRA)
|
||||||
LDFLAGS ?= -Tlink.ld -nostdlib -nostartfiles --specs nano.specs -lc -lgcc -Wl,--gc-sections
|
LDFLAGS ?= -Tlink.ld -nostdlib -nostartfiles --specs nano.specs -lc -lgcc -Wl,--gc-sections
|
||||||
|
|
||||||
SOURCES = main.c hal.c flash_image.c mongoose/mongoose.c
|
SOURCES = main.c hal.c flash_image.c $(MGDIR)/mongoose.c
|
||||||
|
SOURCES += littlefs/lfs.c littlefs/lfs_util.c
|
||||||
SOURCES += cmsis_rt1060/devices/MIMXRT1062/gcc/startup_MIMXRT1062.S
|
SOURCES += cmsis_rt1060/devices/MIMXRT1062/gcc/startup_MIMXRT1062.S
|
||||||
|
|
||||||
CFLAGS += -D__ATOLLIC__ -D__STARTUP_CLEAR_BSS # Make startup code work as expected
|
CFLAGS += -D__ATOLLIC__ -D__STARTUP_CLEAR_BSS # Make startup code work as expected
|
||||||
|
|
||||||
all build: firmware.bin
|
# Disabled for littlefs/lfs.c
|
||||||
|
CFLAGS += -Wno-shadow
|
||||||
|
|
||||||
mongoose/mongoose.c mongoose/mongoose.h:
|
all build: firmware.bin
|
||||||
mkdir -p mongoose/
|
|
||||||
cp ../../../../mongoose.[ch] mongoose/
|
|
||||||
|
|
||||||
firmware.bin: firmware.elf
|
firmware.bin: firmware.elf
|
||||||
arm-none-eabi-objcopy -O binary $< $@
|
arm-none-eabi-objcopy -O binary $< $@
|
||||||
arm-none-eabi-size --format=berkeley $<
|
arm-none-eabi-size --format=berkeley $<
|
||||||
|
|
||||||
firmware.elf: cmsis_core cmsis_rt1060 $(SOURCES) $(wildcard *.h) link.ld Makefile
|
firmware.elf: cmsis_core cmsis_rt1060 littlefs sys/dirent.h $(SOURCES) $(MGDIR)/mongoose.h $(wildcard *.h) link.ld Makefile
|
||||||
arm-none-eabi-gcc $(SOURCES) $(CFLAGS) $(LDFLAGS) -o $@
|
arm-none-eabi-gcc $(SOURCES) $(CFLAGS) $(LDFLAGS) -o $@
|
||||||
|
|
||||||
cmsis_core:
|
cmsis_core:
|
||||||
@@ -35,9 +37,13 @@ cmsis_rt1060:
|
|||||||
unzip -q NXP.MIMXRT1062_DFP.26.06.00.pack -d $@
|
unzip -q NXP.MIMXRT1062_DFP.26.06.00.pack -d $@
|
||||||
rm NXP.MIMXRT1062_DFP.26.06.00.pack
|
rm NXP.MIMXRT1062_DFP.26.06.00.pack
|
||||||
|
|
||||||
|
littlefs/lfs.c littlefs/lfs_util.c: littlefs
|
||||||
|
littlefs:
|
||||||
|
git clone -q -c advice.detachedHead=false --depth 1 -b v2.11.3 https://github.com/littlefs-project/littlefs $@
|
||||||
|
|
||||||
# Show all symbols sorted by size
|
# Show all symbols sorted by size
|
||||||
show_symbols_sorted_by_size: firmware.bin
|
show_symbols_sorted_by_size: firmware.bin
|
||||||
arm-none-eabi-readelf -sW firmware.elf | sed 1,3d | sed 's,^.*: ,,' | tr -s ' ' | cut -d ' ' -f 2,7 | sort -nk1 | grep -v '^0 '
|
arm-none-eabi-readelf -sW firmware.elf | sed 1,3d | sed 's,^.*: ,,' | tr -s ' ' | cut -d ' ' -f 2,7 | sort -nk1 | grep -v '^0 '
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf firmware.* cmsis_* mongoose/mongoose.*
|
rm -rf firmware.* cmsis_* mongoose/mongoose.* littlefs
|
||||||
@@ -70,6 +70,14 @@ static void http_ev_handler(struct mg_connection *c, int ev, void *ev_data) {
|
|||||||
struct mg_http_message *hm = (struct mg_http_message *) ev_data;
|
struct mg_http_message *hm = (struct mg_http_message *) ev_data;
|
||||||
if (mg_match(hm->uri, mg_str("/api/tick"), NULL)) {
|
if (mg_match(hm->uri, mg_str("/api/tick"), NULL)) {
|
||||||
mg_http_reply(c, 200, "", "{%m:%llu}\n", MG_ESC("tick"), hal_get_tick());
|
mg_http_reply(c, 200, "", "{%m:%llu}\n", MG_ESC("tick"), hal_get_tick());
|
||||||
|
} else if (mg_match(hm->uri, mg_str("/files/#"), NULL)) {
|
||||||
|
struct mg_http_serve_opts opts = {
|
||||||
|
.root_dir = "/files/=/fs/",
|
||||||
|
.enable_delete = true,
|
||||||
|
.enable_upload = true,
|
||||||
|
.enable_dir_listing = true,
|
||||||
|
};
|
||||||
|
mg_http_serve_dir(c, hm, &opts);
|
||||||
} else if (mg_match(hm->uri, mg_str("/api/crash"), NULL)) {
|
} else if (mg_match(hm->uri, mg_str("/api/crash"), NULL)) {
|
||||||
__asm volatile("udf #0"); // Trigger HardFault
|
__asm volatile("udf #0"); // Trigger HardFault
|
||||||
} else {
|
} else {
|
||||||
@@ -102,6 +110,18 @@ int main(void) {
|
|||||||
MG_INFO(("RAM used: %zu, free: %zu", hal_ram_used(), hal_ram_free()));
|
MG_INFO(("RAM used: %zu, free: %zu", hal_ram_used(), hal_ram_free()));
|
||||||
MG_INFO(("Crash record: %M", mg_print_crash_record));
|
MG_INFO(("Crash record: %M", mg_print_crash_record));
|
||||||
|
|
||||||
|
// Create directory for Web file manager. Will be mapped to /files/ URL
|
||||||
|
if (!mg_lfs_init(MG_LFS_SIZE)) {
|
||||||
|
MG_ERROR(("LittleFS initialisation failed"));
|
||||||
|
} else {
|
||||||
|
mkdir("/fs", 0755);
|
||||||
|
MG_INFO(("File manager operations:"));
|
||||||
|
MG_INFO(("Upload: curl IP/files/NAME --data-binary @FILE"));
|
||||||
|
MG_INFO(("Delete: curl IP/files/NAME -X DELETE"));
|
||||||
|
MG_INFO(("Show: curl IP/files/NAME"));
|
||||||
|
MG_INFO(("List: curl IP/files/"));
|
||||||
|
}
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
mg_mgr_poll(&mgr, 0);
|
mg_mgr_poll(&mgr, 0);
|
||||||
blink_task();
|
blink_task();
|
||||||
|
|||||||
@@ -5,6 +5,11 @@
|
|||||||
#define MG_TLS MG_TLS_BUILTIN
|
#define MG_TLS MG_TLS_BUILTIN
|
||||||
#define MG_OTA MG_OTA_RT1060
|
#define MG_OTA MG_OTA_RT1060
|
||||||
|
|
||||||
|
#define MG_ENABLE_LFS 1
|
||||||
|
#define MG_LFS_SIZE (128 * 1024) // Multiple of the 4 KiB flash sector size
|
||||||
|
#define MG_LFS_BUF_SIZE 256 // Match the RT1060 flash write alignment
|
||||||
|
// LittleFS shares the OTA staging area; files may be lost after an update
|
||||||
|
|
||||||
#define MG_ENABLE_TCPIP 1
|
#define MG_ENABLE_TCPIP 1
|
||||||
#define MG_ENABLE_DRIVER_IMXRT10 1
|
#define MG_ENABLE_DRIVER_IMXRT10 1
|
||||||
#define MG_IO_SIZE 256
|
#define MG_IO_SIZE 256
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
// LittleFS provides directory types in mongoose.h instead of newlib's stub.
|
||||||
@@ -1,16 +1,19 @@
|
|||||||
# Environment setup: https://mongoose.ws/documentation/tutorials/tools/
|
# Environment setup: https://mongoose.ws/documentation/tutorials/tools/
|
||||||
|
|
||||||
|
MGDIR = ../../../..
|
||||||
|
|
||||||
CFLAGS = -W -Wall -Wextra -Werror -Wundef -Wshadow -Wdouble-promotion
|
CFLAGS = -W -Wall -Wextra -Werror -Wundef -Wshadow -Wdouble-promotion
|
||||||
CFLAGS += -Wformat-truncation -fno-common -Wno-conversion -Wno-sign-conversion
|
CFLAGS += -Wformat-truncation -fno-common -Wno-conversion -Wno-sign-conversion
|
||||||
CFLAGS += -g3 -Os -ffunction-sections -fdata-sections
|
CFLAGS += -g3 -Os -ffunction-sections -fdata-sections
|
||||||
CFLAGS += -Wno-cast-function-type
|
CFLAGS += -Wno-cast-function-type
|
||||||
CFLAGS += -I. -Imongoose -Icmsis_core/CMSIS/Core/Include/ -DCPU_MIMXRT1176DVMAA_cm7
|
CFLAGS += -I. -I$(MGDIR) -Ilittlefs -Icmsis_core/CMSIS/Core/Include/ -DCPU_MIMXRT1176DVMAA_cm7
|
||||||
CFLAGS += -Icmsis_rt1170/devices/MIMXRT1176/ -Icmsis_rt1170/devices/MIMXRT1176/periph/ -Icmsis_rt1170/devices/MIMXRT1176/drivers/
|
CFLAGS += -Icmsis_rt1170/devices/MIMXRT1176/ -Icmsis_rt1170/devices/MIMXRT1176/periph/ -Icmsis_rt1170/devices/MIMXRT1176/drivers/
|
||||||
CFLAGS += -mcpu=cortex-m7 -mthumb -mfloat-abi=hard -mfpu=fpv5-d16 $(CFLAGS_EXTRA)
|
CFLAGS += -mcpu=cortex-m7 -mthumb -mfloat-abi=hard -mfpu=fpv5-d16 $(CFLAGS_EXTRA)
|
||||||
CFLAGS += -Wno-unused-parameter # NXP support files
|
CFLAGS += -Wno-unused-parameter # NXP support files
|
||||||
LDFLAGS ?= -Tlink.ld -nostdlib -nostartfiles --specs nano.specs -lc -lgcc -Wl,--gc-sections
|
LDFLAGS ?= -Tlink.ld -nostdlib -nostartfiles --specs nano.specs -lc -lgcc -Wl,--gc-sections
|
||||||
|
|
||||||
SOURCES = main.c hal.c flash_image.c mongoose/mongoose.c
|
SOURCES = main.c hal.c flash_image.c $(MGDIR)/mongoose.c
|
||||||
|
SOURCES += littlefs/lfs.c littlefs/lfs_util.c
|
||||||
SOURCES += cmsis_rt1170/devices/MIMXRT1176/gcc/startup_MIMXRT1176_cm7.S
|
SOURCES += cmsis_rt1170/devices/MIMXRT1176/gcc/startup_MIMXRT1176_cm7.S
|
||||||
SOURCES += cmsis_rt1170/devices/MIMXRT1176/drivers/fsl_clock.c
|
SOURCES += cmsis_rt1170/devices/MIMXRT1176/drivers/fsl_clock.c
|
||||||
SOURCES += cmsis_rt1170/devices/MIMXRT1176/drivers/fsl_anatop_ai.c
|
SOURCES += cmsis_rt1170/devices/MIMXRT1176/drivers/fsl_anatop_ai.c
|
||||||
@@ -20,17 +23,16 @@ SOURCES += cmsis_rt1170/devices/MIMXRT1176/drivers/fsl_common_arm.c
|
|||||||
|
|
||||||
CFLAGS += -D__ATOLLIC__ -D__STARTUP_CLEAR_BSS # Make startup code work as expected
|
CFLAGS += -D__ATOLLIC__ -D__STARTUP_CLEAR_BSS # Make startup code work as expected
|
||||||
|
|
||||||
all build: firmware.bin
|
# Disabled for littlefs/lfs.c
|
||||||
|
CFLAGS += -Wno-shadow
|
||||||
|
|
||||||
mongoose/mongoose.c mongoose/mongoose.h:
|
all build: firmware.bin
|
||||||
mkdir -p mongoose
|
|
||||||
cp ../../../../mongoose.[ch] mongoose/
|
|
||||||
|
|
||||||
firmware.bin: firmware.elf
|
firmware.bin: firmware.elf
|
||||||
arm-none-eabi-objcopy -O binary $< $@
|
arm-none-eabi-objcopy -O binary $< $@
|
||||||
arm-none-eabi-size --format=berkeley $<
|
arm-none-eabi-size --format=berkeley $<
|
||||||
|
|
||||||
firmware.elf: cmsis_core cmsis_rt1170 $(SOURCES) $(wildcard *.h) link.ld Makefile
|
firmware.elf: cmsis_core cmsis_rt1170 littlefs sys/dirent.h $(SOURCES) $(MGDIR)/mongoose.h $(wildcard *.h) link.ld Makefile
|
||||||
arm-none-eabi-gcc $(SOURCES) $(CFLAGS) $(LDFLAGS) -o $@
|
arm-none-eabi-gcc $(SOURCES) $(CFLAGS) $(LDFLAGS) -o $@
|
||||||
|
|
||||||
cmsis_core:
|
cmsis_core:
|
||||||
@@ -41,9 +43,13 @@ cmsis_rt1170:
|
|||||||
unzip -q NXP.MIMXRT1176_DFP.26.06.00.pack -d $@
|
unzip -q NXP.MIMXRT1176_DFP.26.06.00.pack -d $@
|
||||||
rm NXP.MIMXRT1176_DFP.26.06.00.pack
|
rm NXP.MIMXRT1176_DFP.26.06.00.pack
|
||||||
|
|
||||||
|
littlefs/lfs.c littlefs/lfs_util.c: littlefs
|
||||||
|
littlefs:
|
||||||
|
git clone -q -c advice.detachedHead=false --depth 1 -b v2.11.3 https://github.com/littlefs-project/littlefs $@
|
||||||
|
|
||||||
# Show all symbols sorted by size
|
# Show all symbols sorted by size
|
||||||
show_symbols_sorted_by_size: firmware.bin
|
show_symbols_sorted_by_size: firmware.bin
|
||||||
arm-none-eabi-readelf -sW firmware.elf | sed 1,3d | sed 's,^.*: ,,' | tr -s ' ' | cut -d ' ' -f 2,7 | sort -nk1 | grep -v '^0 '
|
arm-none-eabi-readelf -sW firmware.elf | sed 1,3d | sed 's,^.*: ,,' | tr -s ' ' | cut -d ' ' -f 2,7 | sort -nk1 | grep -v '^0 '
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf firmware.* cmsis_* mongoose/mongoose.*
|
rm -rf firmware.* cmsis_* mongoose/mongoose.* littlefs
|
||||||
@@ -74,6 +74,14 @@ static void http_ev_handler(struct mg_connection *c, int ev, void *ev_data) {
|
|||||||
struct mg_http_message *hm = (struct mg_http_message *) ev_data;
|
struct mg_http_message *hm = (struct mg_http_message *) ev_data;
|
||||||
if (mg_match(hm->uri, mg_str("/api/tick"), NULL)) {
|
if (mg_match(hm->uri, mg_str("/api/tick"), NULL)) {
|
||||||
mg_http_reply(c, 200, "", "{%m:%llu}\n", MG_ESC("tick"), hal_get_tick());
|
mg_http_reply(c, 200, "", "{%m:%llu}\n", MG_ESC("tick"), hal_get_tick());
|
||||||
|
} else if (mg_match(hm->uri, mg_str("/files/#"), NULL)) {
|
||||||
|
struct mg_http_serve_opts opts = {
|
||||||
|
.root_dir = "/files/=/fs/",
|
||||||
|
.enable_delete = true,
|
||||||
|
.enable_upload = true,
|
||||||
|
.enable_dir_listing = true,
|
||||||
|
};
|
||||||
|
mg_http_serve_dir(c, hm, &opts);
|
||||||
} else if (mg_match(hm->uri, mg_str("/api/crash"), NULL)) {
|
} else if (mg_match(hm->uri, mg_str("/api/crash"), NULL)) {
|
||||||
__asm volatile("udf #0"); // Trigger HardFault
|
__asm volatile("udf #0"); // Trigger HardFault
|
||||||
} else {
|
} else {
|
||||||
@@ -108,6 +116,18 @@ int main(void) {
|
|||||||
MG_INFO(("RAM used: %zu, free: %zu", hal_ram_used(), hal_ram_free()));
|
MG_INFO(("RAM used: %zu, free: %zu", hal_ram_used(), hal_ram_free()));
|
||||||
MG_INFO(("Crash record: %M", mg_print_crash_record));
|
MG_INFO(("Crash record: %M", mg_print_crash_record));
|
||||||
|
|
||||||
|
// Create directory for Web file manager. Will be mapped to /files/ URL
|
||||||
|
if (!mg_lfs_init(MG_LFS_SIZE)) {
|
||||||
|
MG_ERROR(("LittleFS initialisation failed"));
|
||||||
|
} else {
|
||||||
|
mkdir("/fs", 0755);
|
||||||
|
MG_INFO(("File manager operations:"));
|
||||||
|
MG_INFO(("Upload: curl IP/files/NAME --data-binary @FILE"));
|
||||||
|
MG_INFO(("Delete: curl IP/files/NAME -X DELETE"));
|
||||||
|
MG_INFO(("Show: curl IP/files/NAME"));
|
||||||
|
MG_INFO(("List: curl IP/files/"));
|
||||||
|
}
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
mg_mgr_poll(&mgr, 0);
|
mg_mgr_poll(&mgr, 0);
|
||||||
blink_task();
|
blink_task();
|
||||||
|
|||||||
@@ -9,6 +9,12 @@
|
|||||||
#define MG_IO_SIZE 256
|
#define MG_IO_SIZE 256
|
||||||
#define MG_ENABLE_CUSTOM_MILLIS 1
|
#define MG_ENABLE_CUSTOM_MILLIS 1
|
||||||
#define MG_OTA MG_OTA_RT1170
|
#define MG_OTA MG_OTA_RT1170
|
||||||
|
|
||||||
|
#define MG_ENABLE_LFS 1
|
||||||
|
#define MG_LFS_SIZE (128 * 1024) // Multiple of the 4 KiB flash sector size
|
||||||
|
#define MG_LFS_BUF_SIZE 256 // Match the RT1170 flash write alignment
|
||||||
|
// LittleFS shares the OTA staging area; files may be lost after an update
|
||||||
|
|
||||||
// #define MG_ENABLE_TCPIP_PRINT_DEBUG_STATS 1
|
// #define MG_ENABLE_TCPIP_PRINT_DEBUG_STATS 1
|
||||||
#define MG_TCPIP_PHY_ADDR 3
|
#define MG_TCPIP_PHY_ADDR 3
|
||||||
#define MG_DRIVER_MDC_CR 24
|
#define MG_DRIVER_MDC_CR 24
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
// LittleFS provides directory types in mongoose.h instead of newlib's stub.
|
||||||
Reference in new issue
Block a user