Skip to content

Commit fdd8ca7

Browse files
committed
fix builds
1 parent 7dad3b5 commit fdd8ca7

File tree

6 files changed

+20
-32
lines changed

6 files changed

+20
-32
lines changed

devices/airlift/common-hal/socketpool/Socket.c

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -50,22 +50,6 @@ static int socketpool_type_to_airlift_type(socketpool_socketpool_sock_t type) {
5050
}
5151
}
5252

53-
// // The SOCKETPOOL_ constants are actually the same as the LWIP constants, but it's
54-
// // possible they might not be, so map them, just in case.
55-
// static socketpool_socketpool_sock_t airlift_type_to_socketpool_type(int type) {
56-
// switch (type) {
57-
// case SOCK_STREAM:
58-
// return SOCKETPOOL_SOCK_STREAM;
59-
// case SOCK_DGRAM:
60-
// return SOCKETPOOL_SOCK_DGRAM;
61-
// case SOCK_RAW:
62-
// return SOCKETPOOL_SOCK_RAW;
63-
// default:
64-
// mp_raise_ValueError_varg(MP_ERROR_TEXT("Invalid %q"), MP_QSTR_type);
65-
// }
66-
// }
67-
68-
6953
static bool _socketpool_socket(socketpool_socketpool_obj_t *self,
7054
socketpool_socketpool_addressfamily_t family, socketpool_socketpool_sock_t type,
7155
int proto,
@@ -279,8 +263,7 @@ int common_hal_socketpool_socket_bind(socketpool_socket_obj_t *self,
279263
mp_raise_RuntimeError_varg(MP_ERROR_TEXT("%q in use"), MP_QSTR_socket);
280264
}
281265
if (self->bound) {
282-
// Same as CPython.
283-
mp_raise_OSError(MP_EINVAL);
266+
return MP_EINVAL;
284267
}
285268

286269
// Validate the host name (which might be a numeric IP string) to an IPv4 address first.
@@ -298,7 +281,7 @@ int common_hal_socketpool_socket_bind(socketpool_socket_obj_t *self,
298281
if (memcmp(ipv4, zero_ipv4, IPV4_LENGTH) != 0 &&
299282
memcmp(ipv4, self_ipv4, IPV4_LENGTH) != 0) {
300283
// Same as CPython.
301-
mp_raise_OSError(99); // EADDRNOTAVAIL (sometimes 125!)
284+
return 99; // EADDRNOTAVAIL (sometimes 125!)
302285
}
303286
self->bound = true;
304287
memcpy(self->hostname, host, hostlen);

ports/raspberrypi/boards/cytron_edu_v2_pico_2w/mpconfigboard.mk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ CIRCUITPY_SDCARDIO = 1
1414
CIRCUITPY__EVE = 1
1515

1616
CIRCUITPY_CYW43 = 1
17-
CIRCUITPY_SSL = 1
17+
CIRCUITPY_SSL_NATIVE = 1
1818
CIRCUITPY_HASHLIB = 1
1919
CIRCUITPY_WEB_WORKFLOW = 1
2020
CIRCUITPY_MDNS = 1
21-
CIRCUITPY_SOCKETPOOL = 1
22-
CIRCUITPY_WIFI = 1
21+
CIRCUITPY_SOCKETPOOL_NATIVE = 1
22+
CIRCUITPY_WIFI_NATIVE = 1
2323

2424
CFLAGS += \
2525
-DCYW43_PIN_WL_DYNAMIC=0 \

ports/raspberrypi/boards/studiolab_picoexpander/mpconfigboard.mk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ EXTERNAL_FLASH_DEVICES = "W25Q32JVxQ"
1212
CIRCUITPY__EVE = 1
1313

1414
CIRCUITPY_CYW43 = 1
15-
CIRCUITPY_SSL = 1
15+
CIRCUITPY_SSLNATIVE = 1
1616
CIRCUITPY_HASHLIB = 1
1717
CIRCUITPY_WEB_WORKFLOW = 1
1818
CIRCUITPY_MDNS = 1
19-
CIRCUITPY_SOCKETPOOL = 1
20-
CIRCUITPY_WIFI = 1
19+
CIRCUITPY_SOCKETPOOL_NATIVE = 1
20+
CIRCUITPY_WIFI_NATIVE = 1
2121

2222
CFLAGS += \
2323
-DCYW43_PIN_WL_DYNAMIC=0 \

ports/raspberrypi/mpconfigport.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,4 @@ CIRCUITPY_SETTABLE_PROCESSOR_FREQUENCY = 1
8888
CIRCUITPY_MESSAGE_COMPRESSION_LEVEL ?= 1
8989

9090
# (ssl is selectively enabled but it's always the mbedtls implementation)
91-
CIRCUITPY_SSL_MBEDTLS = 1
91+
CIRCUITPY_SSL_MBEDTLS = $(CIRCUITPY_SSL_NATIVE)

ports/zephyr-cp/common-hal/socketpool/Socket.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ socketpool_socket_obj_t *common_hal_socketpool_socket_accept(socketpool_socket_o
341341
}
342342
}
343343

344-
size_t common_hal_socketpool_socket_bind(socketpool_socket_obj_t *self,
344+
int common_hal_socketpool_socket_bind(socketpool_socket_obj_t *self,
345345
const char *host, size_t hostlen, uint32_t port) {
346346
// struct sockaddr_storage bind_addr;
347347
const char *broadcast = "<broadcast>";
@@ -381,7 +381,7 @@ size_t common_hal_socketpool_socket_bind(socketpool_socket_obj_t *self,
381381
}
382382

383383
void socketpool_socket_close(socketpool_socket_obj_t *self) {
384-
#if CIRCUITPY_SSL
384+
#if CIRCUITPY_SSL_NATIVE
385385
if (self->ssl_socket) {
386386
ssl_sslsocket_obj_t *ssl_socket = self->ssl_socket;
387387
self->ssl_socket = NULL;

ports/zephyr-cp/cptools/build_circuitpython.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,13 @@
8080
}
8181

8282
# Other flags to set when a module is enabled
83-
EXTRA_FLAGS = {"busio": ["BUSIO_SPI", "BUSIO_I2C"]}
83+
# "CIRCUITPY_" is prepended onto each.
84+
EXTRA_FLAGS = {
85+
"busio": ["BUSIO_SPI", "BUSIO_I2C"],
86+
"socketpool": ["SOCKETPOOL_NATIVE"],
87+
"ssl": ["SSL_NATIVE", "SSL_MBEDTLS"],
88+
"wifi": ["WIFI_NATIVE"],
89+
}
8490

8591
SHARED_MODULE_AND_COMMON_HAL = ["os"]
8692

@@ -291,9 +297,8 @@ async def build_circuitpython():
291297
circuitpython_flags.append(f"-DCIRCUITPY_USB_HOST={1 if usb_host else 0}")
292298
circuitpython_flags.append(f"-DCIRCUITPY_BOARD_ID='\"{board}\"'")
293299
circuitpython_flags.append(f"-DCIRCUITPY_TRANSLATE_OBJECT={1 if lto else 0}")
294-
circuitpython_flags.append("-DINTERNAL_FLASH_FILESYSTEM")
295-
circuitpython_flags.append("-DLONGINT_IMPL_MPZ")
296-
circuitpython_flags.append("-DCIRCUITPY_SSL_MBEDTLS")
300+
circuitpython_flags.append("-DINTERNAL_FLASH_FILESYSTEM=1")
301+
circuitpython_flags.append("-DLONGINT_IMPL_MPZ=1")
297302
circuitpython_flags.append("-DFFCONF_H='\"lib/oofatfs/ffconf.h\"'")
298303
circuitpython_flags.extend(("-I", srcdir))
299304
circuitpython_flags.extend(("-I", builddir))

0 commit comments

Comments
 (0)