extmod: Make extmod.mk self-contained.
This makes it so that all a port needs to do is set the relevant variables and "include extmod.mk" and doesn't need to worry about adding anything to OBJ, CFLAGS, SRC_QSTR, etc. Make all extmod variables (src, flags, etc) private to extmod.mk. Also move common/shared, extmod-related fragments (e.g. wiznet, cyw43, bluetooth) into extmod.mk. Now that SRC_MOD, CFLAGS_MOD, CXXFLAGS_MOD are unused by both extmod.mk (and user-C-modules in a previous commit), remove all uses of them from port makefiles. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This commit is contained in:
parent
87011f6353
commit
d6d8722558
@ -3,17 +3,19 @@
|
||||
ifeq ($(MICROPY_BLUETOOTH_BTSTACK),1)
|
||||
|
||||
GIT_SUBMODULES += lib/btstack
|
||||
|
||||
MICROPY_BLUETOOTH_BTSTACK_USB ?= 0
|
||||
MICROPY_BLUETOOTH_BTSTACK_H4 ?= 1
|
||||
|
||||
BTSTACK_EXTMOD_DIR = extmod/btstack
|
||||
|
||||
EXTMOD_SRC_C += extmod/btstack/modbluetooth_btstack.c
|
||||
SRC_EXTMOD_C += $(BTSTACK_EXTMOD_DIR)/modbluetooth_btstack.c
|
||||
|
||||
INC += -I$(TOP)/$(BTSTACK_EXTMOD_DIR)
|
||||
|
||||
CFLAGS_MOD += -DMICROPY_BLUETOOTH_BTSTACK=1
|
||||
CFLAGS_MOD += -DMICROPY_PY_BLUETOOTH_USE_SYNC_EVENTS=1
|
||||
CFLAGS_MOD += -DMICROPY_PY_BLUETOOTH_ENABLE_PAIRING_BONDING=1
|
||||
CFLAGS_EXTMOD += -DMICROPY_BLUETOOTH_BTSTACK=1
|
||||
CFLAGS_EXTMOD += -DMICROPY_PY_BLUETOOTH_USE_SYNC_EVENTS=1
|
||||
CFLAGS_EXTMOD += -DMICROPY_PY_BLUETOOTH_ENABLE_PAIRING_BONDING=1
|
||||
|
||||
BTSTACK_DIR = $(TOP)/lib/btstack
|
||||
|
||||
@ -28,44 +30,50 @@ INC += -I$(BTSTACK_DIR)/3rd-party/bluedroid/encoder/include
|
||||
INC += -I$(BTSTACK_DIR)/3rd-party/md5
|
||||
INC += -I$(BTSTACK_DIR)/3rd-party/yxml
|
||||
|
||||
SRC_BTSTACK = \
|
||||
SRC_BTSTACK_C = \
|
||||
$(addprefix lib/btstack/src/, $(SRC_FILES)) \
|
||||
$(addprefix lib/btstack/src/ble/, $(filter-out %_tlv.c, $(SRC_BLE_FILES))) \
|
||||
|
||||
ifeq ($(MICROPY_BLUETOOTH_BTSTACK_USB),1)
|
||||
ifeq ($(MICROPY_BLUETOOTH_BTSTACK_H4),1)
|
||||
$(error Cannot specifiy both MICROPY_BLUETOOTH_BTSTACK_USB and MICROPY_BLUETOOTH_BTSTACK_H4)
|
||||
$(error Cannot enable both MICROPY_BLUETOOTH_BTSTACK_USB and MICROPY_BLUETOOTH_BTSTACK_H4)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(MICROPY_BLUETOOTH_BTSTACK_USB),1)
|
||||
ifneq ($(MICROPY_BLUETOOTH_BTSTACK_H4),1)
|
||||
$(error Must enable one of MICROPY_BLUETOOTH_BTSTACK_USB or MICROPY_BLUETOOTH_BTSTACK_H4)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(MICROPY_BLUETOOTH_BTSTACK_USB),1)
|
||||
SRC_BTSTACK += \
|
||||
SRC_BTSTACK_C += \
|
||||
lib/btstack/platform/libusb/hci_transport_h2_libusb.c
|
||||
|
||||
CFLAGS_MOD += -DMICROPY_BLUETOOTH_BTSTACK_USB=1
|
||||
CFLAGS_EXTMOD += -DMICROPY_BLUETOOTH_BTSTACK_USB=1
|
||||
|
||||
CFLAGS += $(shell pkg-config libusb-1.0 --cflags)
|
||||
LDFLAGS += $(shell pkg-config libusb-1.0 --libs)
|
||||
CFLAGS_THIRDPARTY += $(shell pkg-config libusb-1.0 --cflags)
|
||||
LDFLAGS_THIRDPARTY += $(shell pkg-config libusb-1.0 --libs)
|
||||
endif
|
||||
|
||||
ifeq ($(MICROPY_BLUETOOTH_BTSTACK_H4),1)
|
||||
SRC_BTSTACK += \
|
||||
SRC_BTSTACK_C += \
|
||||
lib/btstack/src/hci_transport_h4.c \
|
||||
lib/btstack/chipset/zephyr/btstack_chipset_zephyr.c
|
||||
|
||||
EXTMOD_SRC_C += \
|
||||
SRC_BTSTACK_C += \
|
||||
extmod/btstack/btstack_hci_uart.c \
|
||||
|
||||
CFLAGS_MOD += -DMICROPY_BLUETOOTH_BTSTACK_H4=1
|
||||
CFLAGS_EXTMOD += -DMICROPY_BLUETOOTH_BTSTACK_H4=1
|
||||
endif
|
||||
|
||||
ifeq ($(MICROPY_BLUETOOTH_BTSTACK_ENABLE_CLASSIC),1)
|
||||
include $(BTSTACK_DIR)/src/classic/Makefile.inc
|
||||
SRC_BTSTACK += \
|
||||
SRC_BTSTACK_C += \
|
||||
$(addprefix lib/btstack/src/classic/, $(SRC_CLASSIC_FILES))
|
||||
endif
|
||||
|
||||
LIB_SRC_C += $(SRC_BTSTACK)
|
||||
SRC_THIRDPARTY_C += $(SRC_BTSTACK_C)
|
||||
|
||||
# Suppress some warnings.
|
||||
BTSTACK_WARNING_CFLAGS = -Wno-old-style-definition -Wno-unused-variable -Wno-unused-parameter -Wno-implicit-fallthrough
|
||||
|
208
extmod/extmod.mk
208
extmod/extmod.mk
@ -1,55 +1,66 @@
|
||||
# This makefile fragment adds the source code files for the core extmod modules
|
||||
# and provides rules to build 3rd-party components for extmod modules.
|
||||
|
||||
PY_EXTMOD_O_BASENAME = \
|
||||
extmod/moduasyncio.o \
|
||||
extmod/moductypes.o \
|
||||
extmod/modujson.o \
|
||||
extmod/moduos.o \
|
||||
extmod/modure.o \
|
||||
extmod/moduzlib.o \
|
||||
extmod/moduheapq.o \
|
||||
extmod/modutimeq.o \
|
||||
extmod/moduhashlib.o \
|
||||
extmod/moducryptolib.o \
|
||||
extmod/modubinascii.o \
|
||||
extmod/virtpin.o \
|
||||
extmod/machine_bitstream.o \
|
||||
extmod/machine_mem.o \
|
||||
extmod/machine_pinbase.o \
|
||||
extmod/machine_signal.o \
|
||||
extmod/machine_pulse.o \
|
||||
extmod/machine_pwm.o \
|
||||
extmod/machine_i2c.o \
|
||||
extmod/machine_spi.o \
|
||||
extmod/modbluetooth.o \
|
||||
extmod/modlwip.o \
|
||||
extmod/modussl_axtls.o \
|
||||
extmod/modussl_mbedtls.o \
|
||||
extmod/moduplatform.o\
|
||||
extmod/modurandom.o \
|
||||
extmod/moduselect.o \
|
||||
extmod/moduwebsocket.o \
|
||||
extmod/modwebrepl.o \
|
||||
extmod/modframebuf.o \
|
||||
extmod/vfs.o \
|
||||
extmod/vfs_blockdev.o \
|
||||
extmod/vfs_reader.o \
|
||||
extmod/vfs_posix.o \
|
||||
extmod/vfs_posix_file.o \
|
||||
extmod/vfs_fat.o \
|
||||
extmod/vfs_fat_diskio.o \
|
||||
extmod/vfs_fat_file.o \
|
||||
extmod/vfs_lfs.o \
|
||||
extmod/utime_mphal.o \
|
||||
extmod/uos_dupterm.o \
|
||||
shared/libc/abort_.o \
|
||||
shared/libc/printf.o \
|
||||
SRC_EXTMOD_C += \
|
||||
extmod/machine_bitstream.c \
|
||||
extmod/machine_i2c.c \
|
||||
extmod/machine_mem.c \
|
||||
extmod/machine_pinbase.c \
|
||||
extmod/machine_pulse.c \
|
||||
extmod/machine_pwm.c \
|
||||
extmod/machine_signal.c \
|
||||
extmod/machine_spi.c \
|
||||
extmod/modbluetooth.c \
|
||||
extmod/modbtree.c \
|
||||
extmod/modframebuf.c \
|
||||
extmod/modlwip.c \
|
||||
extmod/modnetwork.c \
|
||||
extmod/modonewire.c \
|
||||
extmod/moduasyncio.c \
|
||||
extmod/modubinascii.c \
|
||||
extmod/moducryptolib.c \
|
||||
extmod/moductypes.c \
|
||||
extmod/moduhashlib.c \
|
||||
extmod/moduheapq.c \
|
||||
extmod/modujson.c \
|
||||
extmod/moduos.c \
|
||||
extmod/moduplatform.c\
|
||||
extmod/modurandom.c \
|
||||
extmod/modure.c \
|
||||
extmod/moduselect.c \
|
||||
extmod/modusocket.c \
|
||||
extmod/modussl_axtls.c \
|
||||
extmod/modussl_mbedtls.c \
|
||||
extmod/modutimeq.c \
|
||||
extmod/moduwebsocket.c \
|
||||
extmod/moduzlib.c \
|
||||
extmod/modwebrepl.c \
|
||||
extmod/network_cyw43.c \
|
||||
extmod/network_ninaw10.c \
|
||||
extmod/network_wiznet5k.c \
|
||||
extmod/uos_dupterm.c \
|
||||
extmod/utime_mphal.c \
|
||||
extmod/vfs.c \
|
||||
extmod/vfs_blockdev.c \
|
||||
extmod/vfs_fat.c \
|
||||
extmod/vfs_fat_diskio.c \
|
||||
extmod/vfs_fat_file.c \
|
||||
extmod/vfs_lfs.c \
|
||||
extmod/vfs_posix.c \
|
||||
extmod/vfs_posix_file.c \
|
||||
extmod/vfs_reader.c \
|
||||
extmod/virtpin.c \
|
||||
shared/libc/abort_.c \
|
||||
shared/libc/printf.c \
|
||||
|
||||
PY_EXTMOD_O = $(addprefix $(BUILD)/, $(PY_EXTMOD_O_BASENAME))
|
||||
SRC_THIRDPARTY_C += \
|
||||
|
||||
PY_O += $(PY_EXTMOD_O)
|
||||
SRC_QSTR += $(PY_EXTMOD_O_BASENAME:.o=.c)
|
||||
PY_O += $(addprefix $(BUILD)/, $(SRC_EXTMOD_C:.c=.o))
|
||||
PY_O += $(addprefix $(BUILD)/, $(SRC_THIRDPARTY_C:.c=.o))
|
||||
SRC_QSTR += $(SRC_EXTMOD_C)
|
||||
|
||||
CFLAGS += $(CFLAGS_EXTMOD) $(CFLAGS_THIRDPARTY)
|
||||
LDFLAGS += $(LDFLAGS_EXTMOD) $(LDFLAGS_THIRDPARTY)
|
||||
|
||||
################################################################################
|
||||
# VFS FAT FS
|
||||
@ -57,11 +68,11 @@ SRC_QSTR += $(PY_EXTMOD_O_BASENAME:.o=.c)
|
||||
OOFATFS_DIR = lib/oofatfs
|
||||
|
||||
# this sets the config file for FatFs
|
||||
CFLAGS_MOD += -DFFCONF_H=\"$(OOFATFS_DIR)/ffconf.h\"
|
||||
CFLAGS_THIRDPARTY += -DFFCONF_H=\"$(OOFATFS_DIR)/ffconf.h\"
|
||||
|
||||
ifeq ($(MICROPY_VFS_FAT),1)
|
||||
CFLAGS_MOD += -DMICROPY_VFS_FAT=1
|
||||
SRC_MOD += $(addprefix $(OOFATFS_DIR)/,\
|
||||
CFLAGS_EXTMOD += -DMICROPY_VFS_FAT=1
|
||||
SRC_THIRDPARTY_C += $(addprefix $(OOFATFS_DIR)/,\
|
||||
ff.c \
|
||||
ffunicode.c \
|
||||
)
|
||||
@ -73,18 +84,18 @@ endif
|
||||
LITTLEFS_DIR = lib/littlefs
|
||||
|
||||
ifeq ($(MICROPY_VFS_LFS1),1)
|
||||
CFLAGS_MOD += -DMICROPY_VFS_LFS1=1
|
||||
CFLAGS_MOD += -DLFS1_NO_MALLOC -DLFS1_NO_DEBUG -DLFS1_NO_WARN -DLFS1_NO_ERROR -DLFS1_NO_ASSERT
|
||||
SRC_MOD += $(addprefix $(LITTLEFS_DIR)/,\
|
||||
CFLAGS_EXTMOD += -DMICROPY_VFS_LFS1=1
|
||||
CFLAGS_THIRDPARTY += -DLFS1_NO_MALLOC -DLFS1_NO_DEBUG -DLFS1_NO_WARN -DLFS1_NO_ERROR -DLFS1_NO_ASSERT
|
||||
SRC_THIRDPARTY_C += $(addprefix $(LITTLEFS_DIR)/,\
|
||||
lfs1.c \
|
||||
lfs1_util.c \
|
||||
)
|
||||
endif
|
||||
|
||||
ifeq ($(MICROPY_VFS_LFS2),1)
|
||||
CFLAGS_MOD += -DMICROPY_VFS_LFS2=1
|
||||
CFLAGS_MOD += -DLFS2_NO_MALLOC -DLFS2_NO_DEBUG -DLFS2_NO_WARN -DLFS2_NO_ERROR -DLFS2_NO_ASSERT
|
||||
SRC_MOD += $(addprefix $(LITTLEFS_DIR)/,\
|
||||
CFLAGS_EXTMOD += -DMICROPY_VFS_LFS2=1
|
||||
CFLAGS_THIRDPARTY += -DLFS2_NO_MALLOC -DLFS2_NO_DEBUG -DLFS2_NO_WARN -DLFS2_NO_ERROR -DLFS2_NO_ASSERT
|
||||
SRC_THIRDPARTY_C += $(addprefix $(LITTLEFS_DIR)/,\
|
||||
lfs2.c \
|
||||
lfs2_util.c \
|
||||
)
|
||||
@ -96,13 +107,13 @@ endif
|
||||
# ussl
|
||||
|
||||
ifeq ($(MICROPY_PY_USSL),1)
|
||||
CFLAGS_MOD += -DMICROPY_PY_USSL=1
|
||||
CFLAGS_EXTMOD += -DMICROPY_PY_USSL=1
|
||||
ifeq ($(MICROPY_SSL_AXTLS),1)
|
||||
CFLAGS_MOD += -DMICROPY_SSL_AXTLS=1 -I$(TOP)/lib/axtls/ssl -I$(TOP)/lib/axtls/crypto -I$(TOP)/extmod/axtls-include
|
||||
AXTLS_DIR = lib/axtls
|
||||
GIT_SUBMODULES += $(AXTLS_DIR)
|
||||
CFLAGS_EXTMOD += -DMICROPY_SSL_AXTLS=1 -I$(TOP)/lib/axtls/ssl -I$(TOP)/lib/axtls/crypto -I$(TOP)/extmod/axtls-include
|
||||
$(BUILD)/$(AXTLS_DIR)/%.o: CFLAGS += -Wno-all -Wno-unused-parameter -Wno-uninitialized -Wno-sign-compare -Wno-old-style-definition -Dmp_stream_errno=errno $(AXTLS_DEFS_EXTRA)
|
||||
SRC_MOD += $(addprefix $(AXTLS_DIR)/,\
|
||||
SRC_THIRDPARTY_C += $(addprefix $(AXTLS_DIR)/,\
|
||||
ssl/asn1.c \
|
||||
ssl/loader.c \
|
||||
ssl/tls1.c \
|
||||
@ -120,8 +131,9 @@ SRC_MOD += $(addprefix $(AXTLS_DIR)/,\
|
||||
else ifeq ($(MICROPY_SSL_MBEDTLS),1)
|
||||
MBEDTLS_DIR = lib/mbedtls
|
||||
GIT_SUBMODULES += $(MBEDTLS_DIR)
|
||||
SRC_MOD += lib/mbedtls_errors/mp_mbedtls_errors.c
|
||||
SRC_MOD += $(addprefix $(MBEDTLS_DIR)/library/,\
|
||||
CFLAGS_EXTMOD += -DMICROPY_SSL_MBEDTLS=1 -I$(TOP)/$(MBEDTLS_DIR)/include
|
||||
SRC_THIRDPARTY_C += lib/mbedtls_errors/mp_mbedtls_errors.c
|
||||
SRC_THIRDPARTY_C += $(addprefix $(MBEDTLS_DIR)/library/,\
|
||||
aes.c \
|
||||
aesni.c \
|
||||
arc4.c \
|
||||
@ -204,10 +216,10 @@ GIT_SUBMODULES += lib/lwip
|
||||
# A port should add an include path where lwipopts.h can be found (eg extmod/lwip-include)
|
||||
LWIP_DIR = lib/lwip/src
|
||||
INC += -I$(TOP)/$(LWIP_DIR)/include
|
||||
CFLAGS_MOD += -DMICROPY_PY_LWIP=1
|
||||
$(BUILD)/$(LWIP_DIR)/core/ipv4/dhcp.o: CFLAGS_MOD += -Wno-address
|
||||
SRC_MOD += shared/netutils/netutils.c
|
||||
SRC_MOD += $(addprefix $(LWIP_DIR)/,\
|
||||
CFLAGS_EXTMOD += -DMICROPY_PY_LWIP=1
|
||||
$(BUILD)/$(LWIP_DIR)/core/ipv4/dhcp.o: CFLAGS += -Wno-address
|
||||
SRC_THIRDPARTY_C += shared/netutils/netutils.c
|
||||
SRC_THIRDPARTY_C += $(addprefix $(LWIP_DIR)/,\
|
||||
apps/mdns/mdns.c \
|
||||
core/def.c \
|
||||
core/dns.c \
|
||||
@ -246,8 +258,8 @@ SRC_MOD += $(addprefix $(LWIP_DIR)/,\
|
||||
netif/ethernet.c \
|
||||
)
|
||||
ifeq ($(MICROPY_PY_LWIP_SLIP),1)
|
||||
CFLAGS_MOD += -DMICROPY_PY_LWIP_SLIP=1
|
||||
SRC_MOD += $(LWIP_DIR)/netif/slipif.c
|
||||
CFLAGS_EXTMOD += -DMICROPY_PY_LWIP_SLIP=1
|
||||
SRC_THIRDPARTY_C += $(LWIP_DIR)/netif/slipif.c
|
||||
endif
|
||||
endif
|
||||
|
||||
@ -258,8 +270,7 @@ ifeq ($(MICROPY_PY_BTREE),1)
|
||||
BTREE_DIR = lib/berkeley-db-1.xx
|
||||
BTREE_DEFS = -D__DBINTERFACE_PRIVATE=1 -Dmpool_error=printf -Dabort=abort_ "-Dvirt_fd_t=void*" $(BTREE_DEFS_EXTRA)
|
||||
INC += -I$(TOP)/$(BTREE_DIR)/PORT/include
|
||||
SRC_MOD += extmod/modbtree.c
|
||||
SRC_MOD += $(addprefix $(BTREE_DIR)/,\
|
||||
SRC_THIRDPARTY_C += $(addprefix $(BTREE_DIR)/,\
|
||||
btree/bt_close.c \
|
||||
btree/bt_conv.c \
|
||||
btree/bt_debug.c \
|
||||
@ -275,10 +286,67 @@ SRC_MOD += $(addprefix $(BTREE_DIR)/,\
|
||||
btree/bt_utils.c \
|
||||
mpool/mpool.c \
|
||||
)
|
||||
CFLAGS_MOD += -DMICROPY_PY_BTREE=1
|
||||
CFLAGS_EXTMOD += -DMICROPY_PY_BTREE=1
|
||||
# we need to suppress certain warnings to get berkeley-db to compile cleanly
|
||||
# and we have separate BTREE_DEFS so the definitions don't interfere with other source code
|
||||
$(BUILD)/$(BTREE_DIR)/%.o: CFLAGS += -Wno-old-style-definition -Wno-sign-compare -Wno-unused-parameter $(BTREE_DEFS)
|
||||
$(BUILD)/extmod/modbtree.o: CFLAGS += $(BTREE_DEFS)
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
# networking
|
||||
|
||||
ifeq ($(MICROPY_PY_NETWORK_CYW43),1)
|
||||
CFLAGS_EXTMOD += -DMICROPY_PY_NETWORK_CYW43=1
|
||||
DRIVERS_SRC_C += drivers/cyw43/cyw43_ctrl.c drivers/cyw43/cyw43_lwip.c
|
||||
LIBS += $(TOP)/drivers/cyw43/libcyw43.a
|
||||
endif
|
||||
|
||||
ifneq ($(MICROPY_PY_NETWORK_WIZNET5K),)
|
||||
ifneq ($(MICROPY_PY_NETWORK_WIZNET5K),0)
|
||||
WIZNET5K_DIR=lib/wiznet5k
|
||||
GIT_SUBMODULES += lib/wiznet5k
|
||||
INC += -I$(TOP)/$(WIZNET5K_DIR) -I$(TOP)/$(WIZNET5K_DIR)/Ethernet
|
||||
CFLAGS += -DMICROPY_PY_NETWORK_WIZNET5K=$(MICROPY_PY_NETWORK_WIZNET5K) -D_WIZCHIP_=$(MICROPY_PY_NETWORK_WIZNET5K)
|
||||
CFLAGS_THIRDPARTY += -DWIZCHIP_PREFIXED_EXPORTS=1
|
||||
ifeq ($(MICROPY_PY_LWIP),1)
|
||||
# When using MACRAW mode (with lwIP), maximum buffer space must be used for the raw socket
|
||||
CFLAGS_THIRDPARTY += -DWIZCHIP_USE_MAX_BUFFER
|
||||
endif
|
||||
SRC_THIRDPARTY_C += $(addprefix $(WIZNET5K_DIR)/,\
|
||||
Ethernet/W$(MICROPY_PY_NETWORK_WIZNET5K)/w$(MICROPY_PY_NETWORK_WIZNET5K).c \
|
||||
Ethernet/wizchip_conf.c \
|
||||
Ethernet/socket.c \
|
||||
Internet/DNS/dns.c \
|
||||
Internet/DHCP/dhcp.c \
|
||||
)
|
||||
endif
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
# bluetooth
|
||||
|
||||
ifeq ($(MICROPY_PY_BLUETOOTH),1)
|
||||
CFLAGS_EXTMOD += -DMICROPY_PY_BLUETOOTH=1
|
||||
|
||||
ifeq ($(MICROPY_BLUETOOTH_NIMBLE),1)
|
||||
ifeq ($(MICROPY_BLUETOOTH_BTSTACK),1)
|
||||
$(error Cannot enable both NimBLE and BTstack at the same time)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(MICROPY_BLUETOOTH_NIMBLE),1)
|
||||
ifneq ($(MICROPY_BLUETOOTH_BTSTACK),1)
|
||||
$(error Must enable one of MICROPY_BLUETOOTH_NIMBLE or MICROPY_BLUETOOTH_BTSTACK)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(MICROPY_BLUETOOTH_NIMBLE),1)
|
||||
include $(TOP)/extmod/nimble/nimble.mk
|
||||
endif
|
||||
|
||||
ifeq ($(MICROPY_BLUETOOTH_BTSTACK),1)
|
||||
include $(TOP)/extmod/btstack/btstack.mk
|
||||
endif
|
||||
|
||||
endif
|
||||
|
@ -33,6 +33,9 @@
|
||||
#include "py/stream.h"
|
||||
#include "py/mperrno.h"
|
||||
#include "py/mphal.h"
|
||||
|
||||
#if MICROPY_PY_NETWORK_WIZNET5K
|
||||
|
||||
#include "shared/netutils/netutils.h"
|
||||
#include "extmod/modnetwork.h"
|
||||
#include "extmod/machine_spi.h"
|
||||
@ -40,8 +43,6 @@
|
||||
#include "modmachine.h"
|
||||
#include "drivers/bus/spi.h"
|
||||
|
||||
#if MICROPY_PY_NETWORK_WIZNET5K
|
||||
|
||||
#include "lib/wiznet5k/Ethernet/wizchip_conf.h"
|
||||
|
||||
// The WIZNET5K module supports two usage modes:
|
||||
|
@ -5,15 +5,15 @@ ifeq ($(MICROPY_BLUETOOTH_NIMBLE),1)
|
||||
EXTMOD_DIR = extmod
|
||||
NIMBLE_EXTMOD_DIR = $(EXTMOD_DIR)/nimble
|
||||
|
||||
EXTMOD_SRC_C += $(NIMBLE_EXTMOD_DIR)/modbluetooth_nimble.c
|
||||
SRC_EXTMOD_C += $(NIMBLE_EXTMOD_DIR)/modbluetooth_nimble.c
|
||||
|
||||
CFLAGS_MOD += -DMICROPY_BLUETOOTH_NIMBLE=1
|
||||
CFLAGS_EXTMOD += -DMICROPY_BLUETOOTH_NIMBLE=1
|
||||
|
||||
# Use NimBLE from the submodule in lib/mynewt-nimble by default,
|
||||
# allowing a port to use their own system version (e.g. ESP32).
|
||||
MICROPY_BLUETOOTH_NIMBLE_BINDINGS_ONLY ?= 0
|
||||
|
||||
CFLAGS_MOD += -DMICROPY_BLUETOOTH_NIMBLE_BINDINGS_ONLY=$(MICROPY_BLUETOOTH_NIMBLE_BINDINGS_ONLY)
|
||||
CFLAGS_EXTMOD += -DMICROPY_BLUETOOTH_NIMBLE_BINDINGS_ONLY=$(MICROPY_BLUETOOTH_NIMBLE_BINDINGS_ONLY)
|
||||
|
||||
ifeq ($(MICROPY_BLUETOOTH_NIMBLE_BINDINGS_ONLY),0)
|
||||
|
||||
@ -24,16 +24,16 @@ GIT_SUBMODULES += lib/mynewt-nimble
|
||||
# case, all NimBLE events are run by the MicroPython scheduler. On Unix, the
|
||||
# scheduler is also responsible for polling the UART, whereas on STM32 the
|
||||
# UART is also polled by the RX IRQ.
|
||||
CFLAGS_MOD += -DMICROPY_PY_BLUETOOTH_USE_SYNC_EVENTS=1
|
||||
CFLAGS_EXTMOD += -DMICROPY_PY_BLUETOOTH_USE_SYNC_EVENTS=1
|
||||
|
||||
# Without the ringbuffer, and with the full implementation, we can also
|
||||
# enable pairing and bonding. This requires both synchronous events and
|
||||
# some customisation of the key store.
|
||||
CFLAGS_MOD += -DMICROPY_PY_BLUETOOTH_ENABLE_PAIRING_BONDING=1
|
||||
CFLAGS_EXTMOD += -DMICROPY_PY_BLUETOOTH_ENABLE_PAIRING_BONDING=1
|
||||
|
||||
NIMBLE_LIB_DIR = lib/mynewt-nimble
|
||||
|
||||
LIB_SRC_C += $(addprefix $(NIMBLE_LIB_DIR)/, \
|
||||
SRC_THIRDPARTY_C += $(addprefix $(NIMBLE_LIB_DIR)/, \
|
||||
$(addprefix ext/tinycrypt/src/, \
|
||||
aes_encrypt.c \
|
||||
cmac_mode.c \
|
||||
@ -98,7 +98,7 @@ LIB_SRC_C += $(addprefix $(NIMBLE_LIB_DIR)/, \
|
||||
)
|
||||
# nimble/host/store/ram/src/ble_store_ram.c \
|
||||
|
||||
EXTMOD_SRC_C += $(addprefix $(NIMBLE_EXTMOD_DIR)/, \
|
||||
SRC_THIRDPARTY_C += $(addprefix $(NIMBLE_EXTMOD_DIR)/, \
|
||||
nimble/nimble_npl_os.c \
|
||||
hal/hal_uart.c \
|
||||
)
|
||||
|
@ -19,7 +19,7 @@ INC += -I$(TOP)
|
||||
# compiler settings
|
||||
CWARN = -Wall -Werror
|
||||
CWARN += -Wextra -Wno-unused-parameter -Wpointer-arith
|
||||
CFLAGS += $(INC) $(CWARN) -std=gnu99 $(CFLAGS_MOD) $(COPT) $(CFLAGS_EXTRA)
|
||||
CFLAGS += $(INC) $(CWARN) -std=gnu99 $(COPT) $(CFLAGS_EXTRA)
|
||||
CFLAGS += -fdata-sections -ffunction-sections -fno-asynchronous-unwind-tables
|
||||
|
||||
# Debugging/Optimization
|
||||
|
@ -23,7 +23,6 @@ CFLAGS_CORTEX_M4 = -mthumb -mtune=cortex-m4 -march=armv7e-m -mabi=aapcs -mcpu=co
|
||||
CFLAGS += -Wall -Wpointer-arith -Werror -std=gnu99 -nostdlib $(CFLAGS_CORTEX_M4) -Os
|
||||
CFLAGS += -g -ffunction-sections -fdata-sections -fno-common -fsigned-char -mno-unaligned-access
|
||||
CFLAGS += -Iboards/$(BOARD)
|
||||
CFLAGS += $(CFLAGS_MOD)
|
||||
|
||||
# Workaround gcc 12.1 bug.
|
||||
CFLAGS += -Wno-array-bounds
|
||||
|
@ -58,11 +58,11 @@ CFLAGS_XTENSA = -fsingle-precision-constant -Wdouble-promotion \
|
||||
-DLWIP_OPEN_SRC
|
||||
|
||||
CFLAGS += $(INC) -Wall -Wpointer-arith -Werror -std=gnu99 -nostdlib -DUART_OS=$(UART_OS) \
|
||||
$(CFLAGS_XTENSA) $(CFLAGS_MOD) $(COPT) $(CFLAGS_EXTRA) -I$(BOARD_DIR)
|
||||
$(CFLAGS_XTENSA) $(COPT) $(CFLAGS_EXTRA) -I$(BOARD_DIR)
|
||||
|
||||
LD_FILES ?= boards/esp8266_2m.ld
|
||||
LDFLAGS += -nostdlib -T $(LD_FILES) -Map=$(@:.elf=.map) --cref
|
||||
LIBS += -L$(ESP_SDK)/lib -lmain -ljson -llwip_open -lpp -lnet80211 -lwpa -lphy -lnet80211 $(LDFLAGS_MOD)
|
||||
LIBS += -L$(ESP_SDK)/lib -lmain -ljson -llwip_open -lpp -lnet80211 -lwpa -lphy -lnet80211
|
||||
|
||||
LIBGCC_FILE_NAME = $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
|
||||
LIBS += -L$(dir $(LIBGCC_FILE_NAME)) -lgcc
|
||||
@ -107,11 +107,6 @@ SRC_C = \
|
||||
posix_helpers.c \
|
||||
hspi.c \
|
||||
$(wildcard $(BOARD_DIR)/*.c) \
|
||||
$(SRC_MOD)
|
||||
|
||||
EXTMOD_SRC_C = $(addprefix extmod/,\
|
||||
modonewire.c \
|
||||
)
|
||||
|
||||
LIB_SRC_C = $(addprefix lib/,\
|
||||
libm/math.c \
|
||||
@ -163,17 +158,15 @@ DRIVERS_SRC_C = $(addprefix drivers/,\
|
||||
SRC_S = \
|
||||
gchelper.s \
|
||||
|
||||
OBJ =
|
||||
OBJ += $(PY_O)
|
||||
OBJ += $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(SRC_S:.s=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(EXTMOD_SRC_C:.c=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(SHARED_SRC_C:.c=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(LIB_SRC_C:.c=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(DRIVERS_SRC_C:.c=.o))
|
||||
|
||||
# List of sources for qstr extraction
|
||||
SRC_QSTR += $(SRC_C) $(EXTMOD_SRC_C) $(SHARED_SRC_C) $(DRIVERS_SRC_C)
|
||||
SRC_QSTR += $(SRC_C) $(SHARED_SRC_C)
|
||||
# Append any auto-generated sources that are needed by sources listed in SRC_QSTR
|
||||
SRC_QSTR_AUTO_DEPS +=
|
||||
|
||||
|
@ -150,10 +150,6 @@ SRC_C += \
|
||||
drivers/bus/softspi.c \
|
||||
drivers/dht/dht.c \
|
||||
eth.c \
|
||||
extmod/modnetwork.c \
|
||||
extmod/modonewire.c \
|
||||
extmod/modusocket.c \
|
||||
extmod/uos_dupterm.c \
|
||||
fatfs_port.c \
|
||||
hal/pwm_backport.c \
|
||||
led.c \
|
||||
@ -257,16 +253,6 @@ SRC_S += shared/runtime/gchelper_m3.s \
|
||||
# QSTR Sources
|
||||
# =============================================================================
|
||||
|
||||
# All settings for Ethernet support are controller by the value of MICROPY_PY_LWIP
|
||||
ifeq ($(MICROPY_PY_LWIP),1)
|
||||
SRC_QSTR += \
|
||||
extmod/modlwip.c \
|
||||
extmod/modnetwork.c \
|
||||
extmod/modusocket.c \
|
||||
extmod/moduwebsocket.c \
|
||||
network_lan.c
|
||||
endif
|
||||
|
||||
# List of sources for qstr extraction
|
||||
SRC_QSTR += \
|
||||
extmod/modonewire.c \
|
||||
@ -386,7 +372,7 @@ CFLAGS += \
|
||||
-DMBEDTLS_CONFIG_FILE='"mbedtls/mbedtls_config.h"'
|
||||
endif
|
||||
|
||||
CFLAGS += $(CFLAGS_MOD) $(CFLAGS_EXTRA)
|
||||
CFLAGS += $(CFLAGS_EXTRA)
|
||||
|
||||
# =============================================================================
|
||||
# Linker Flags
|
||||
@ -433,7 +419,6 @@ OBJ += $(LIBM_O)
|
||||
OBJ += $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(SRC_S:.s=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(SRC_SS:.S=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(SRC_MOD:.c=.o))
|
||||
OBJ += $(GEN_PINS_SRC:.c=.o)
|
||||
|
||||
# Workaround for bug in older gcc, warning on "static usbd_device_t _usbd_dev = { 0 };"
|
||||
|
@ -44,11 +44,6 @@ endif
|
||||
|
||||
# Flags for optional C++ source code
|
||||
CXXFLAGS += $(filter-out -std=c99,$(CFLAGS))
|
||||
CXXFLAGS += $(CXXFLAGS_MOD)
|
||||
|
||||
# Flags for user C modules
|
||||
CFLAGS += $(CFLAGS_MOD)
|
||||
LDFLAGS += $(LDFLAGS_MOD)
|
||||
|
||||
LIBS =
|
||||
|
||||
@ -65,14 +60,10 @@ ifeq ($(CROSS), 1)
|
||||
SRC_C += shared/libc/string0.c
|
||||
endif
|
||||
|
||||
SRC_C += $(SRC_MOD)
|
||||
|
||||
SRC_CXX += $(SRC_MOD_CXX)
|
||||
|
||||
SRC_QSTR += shared/readline/readline.c shared/runtime/pyexec.c
|
||||
SRC_QSTR += $(SRC_MOD) $(SRC_MOD_CXX)
|
||||
|
||||
OBJ += $(PY_CORE_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
|
||||
OBJ += $(PY_CORE_O)
|
||||
OBJ += $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(SRC_CXX:.cpp=.o))
|
||||
|
||||
ifeq ($(CROSS), 1)
|
||||
|
@ -132,9 +132,8 @@ CFLAGS += -ffunction-sections -fdata-sections
|
||||
LDFLAGS += -Wl,--gc-sections
|
||||
endif
|
||||
|
||||
|
||||
CFLAGS += $(CFLAGS_MCU_$(MCU_SERIES))
|
||||
CFLAGS += $(INC) -Wall -Werror -ansi -std=c11 -nostdlib $(COPT) $(NRF_DEFINES) $(CFLAGS_MOD) $(CFLAGS_EXTRA)
|
||||
CFLAGS += $(INC) -Wall -Werror -ansi -std=c11 -nostdlib $(COPT) $(NRF_DEFINES) $(CFLAGS_EXTRA)
|
||||
CFLAGS += -fno-strict-aliasing
|
||||
CFLAGS += -Iboards/$(BOARD)
|
||||
CFLAGS += -DNRF5_HAL_H='<$(MCU_VARIANT)_hal.h>'
|
||||
@ -357,8 +356,8 @@ SRC_C += \
|
||||
LIBGCC_FILE_NAME = $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
|
||||
LIBS += -L $(dir $(LIBGCC_FILE_NAME)) -lgcc
|
||||
|
||||
OBJ += $(PY_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(SRC_MOD:.c=.o))
|
||||
OBJ += $(PY_O)
|
||||
OBJ += $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(SRC_NRFX:.c=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(SRC_NRFX_HAL:.c=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(DRIVERS_SRC_C:.c=.o))
|
||||
@ -515,11 +514,11 @@ flash: deploy
|
||||
|
||||
$(BUILD)/$(OUTPUT_FILENAME).elf: $(OBJ)
|
||||
$(ECHO) "LINK $@"
|
||||
$(Q)$(CC) $(LDFLAGS) -o $@ $(OBJ) $(LDFLAGS_MOD) $(LIBS)
|
||||
$(Q)$(CC) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)
|
||||
$(Q)$(SIZE) $@
|
||||
|
||||
# List of sources for qstr extraction
|
||||
SRC_QSTR += $(SRC_C) $(SRC_LIB) $(DRIVERS_SRC_C) $(SRC_BOARD_MODULES) $(SRC_MOD)
|
||||
SRC_QSTR += $(SRC_C) $(SRC_LIB) $(DRIVERS_SRC_C) $(SRC_BOARD_MODULES)
|
||||
|
||||
# Append any auto-generated sources that are needed by sources listed in
|
||||
# SRC_QSTR
|
||||
|
@ -121,7 +121,7 @@ CFLAGS_MCU_RA4W1 = $(CFLAGS_CORTEX_M) -mtune=cortex-m4 -mcpu=cortex-m4
|
||||
CFLAGS_MCU_RA6M1 = $(CFLAGS_CORTEX_M) -mtune=cortex-m4 -mcpu=cortex-m4
|
||||
CFLAGS_MCU_RA6M2 = $(CFLAGS_CORTEX_M) -mtune=cortex-m4 -mcpu=cortex-m4
|
||||
|
||||
CFLAGS += $(INC) -Wall -Wpointer-arith -Werror -Wdouble-promotion -Wfloat-conversion -std=gnu99 -nostdlib $(CFLAGS_MOD) $(CFLAGS_EXTRA)
|
||||
CFLAGS += $(INC) -Wall -Wpointer-arith -Werror -Wdouble-promotion -Wfloat-conversion -std=gnu99 -nostdlib $(CFLAGS_EXTRA)
|
||||
#CFLAGS += -D$(CMSIS_MCU)
|
||||
CFLAGS += $(CFLAGS_MCU_$(CMSIS_MCU))
|
||||
CFLAGS += $(COPT)
|
||||
@ -161,8 +161,9 @@ endif
|
||||
|
||||
# Flags for optional C++ source code
|
||||
CXXFLAGS += $(filter-out -Wmissing-prototypes -Wold-style-definition -std=gnu99,$(CFLAGS))
|
||||
CXXFLAGS += $(CXXFLAGS_MOD)
|
||||
ifneq ($(SRC_CXX)$(SRC_MOD_CXX),)
|
||||
|
||||
# TODO make this common -- shouldn't be using these "private" vars from py.mk
|
||||
ifneq ($(SRC_CXX)$(SRC_USERMOD_CXX)$(SRC_USERMOD_LIB_CXX),)
|
||||
LIBSTDCPP_FILE_NAME = "$(shell $(CXX) $(CXXFLAGS) -print-file-name=libstdc++.a)"
|
||||
LDFLAGS += -L"$(shell dirname $(LIBSTDCPP_FILE_NAME))"
|
||||
endif
|
||||
@ -279,10 +280,6 @@ ifeq ($(MICROPY_FLOAT_IMPL),double)
|
||||
$(LIBM_O): CFLAGS := $(filter-out -Wdouble-promotion -Wfloat-conversion, $(CFLAGS))
|
||||
endif
|
||||
|
||||
EXTMOD_SRC_C += $(addprefix extmod/,\
|
||||
modonewire.c \
|
||||
)
|
||||
|
||||
DRIVERS_SRC_C += $(addprefix drivers/,\
|
||||
bus/softspi.c \
|
||||
bus/softqspi.c \
|
||||
@ -334,9 +331,6 @@ SRC_C += $(addprefix $(BOARD_DIR)/ra_gen/,\
|
||||
vector_data.c \
|
||||
)
|
||||
|
||||
SRC_CXX += \
|
||||
$(SRC_MOD_CXX)
|
||||
|
||||
SRC_O += \
|
||||
$(STARTUP_FILE) \
|
||||
$(SYSTEM_FILE)
|
||||
@ -408,13 +402,11 @@ OBJ += $(PY_O)
|
||||
OBJ += $(addprefix $(BUILD)/, $(LIB_SRC_C:.c=.o))
|
||||
OBJ += $(LIBM_O)
|
||||
OBJ += $(addprefix $(BUILD)/, $(SHARED_SRC_C:.c=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(EXTMOD_SRC_C:.c=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(DRIVERS_SRC_C:.c=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(HAL_SRC_C:.c=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(SRC_CXX:.cpp=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(SRC_O))
|
||||
OBJ += $(addprefix $(BUILD)/, $(SRC_MOD:.c=.o))
|
||||
OBJ += $(BUILD)/pins_$(BOARD).o
|
||||
|
||||
# This file contains performance critical functions so turn up the optimisation
|
||||
@ -514,7 +506,7 @@ GEN_PINS_AF_PY = $(BUILD)/pins_af.py
|
||||
FILE2H = $(TOP)/tools/file2h.py
|
||||
|
||||
# List of sources for qstr extraction
|
||||
SRC_QSTR += $(SRC_C) $(SRC_CXX) $(SRC_MOD) $(SHARED_SRC_C) $(EXTMOD_SRC_C)
|
||||
SRC_QSTR += $(SRC_C) $(SRC_CXX) $(SHARED_SRC_C)
|
||||
|
||||
# Making OBJ use an order-only depenedency on the generated pins.h file
|
||||
# has the side effect of making the pins.h file before we actually compile
|
||||
|
@ -60,11 +60,10 @@ CFLAGS_MCU_SAMD21 = -mtune=cortex-m0plus -mcpu=cortex-m0plus -msoft-float
|
||||
CFLAGS_MCU_SAMD51 = -mtune=cortex-m4 -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard
|
||||
CFLAGS += $(INC) -Wall -Werror -std=c99 -nostdlib -mthumb $(CFLAGS_MCU_$(MCU_SERIES)) -fsingle-precision-constant -Wdouble-promotion
|
||||
CFLAGS += -DMCU_$(MCU_SERIES) -D__$(CMSIS_MCU)__
|
||||
CFLAGS += $(CFLAGS_MOD) $(CFLAGS_EXTRA)
|
||||
CFLAGS += $(CFLAGS_EXTRA)
|
||||
CFLAGS += -DMPCONFIG_MCU_H='<boards/mpconfig_$(MCU_SERIES_LOWER).h>'
|
||||
|
||||
LDFLAGS += -nostdlib $(addprefix -T,$(LD_FILES)) -Map=$@.map --cref
|
||||
LDFLAGS += $(LDFLAGS_MOD)
|
||||
|
||||
LIBS += $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
|
||||
|
||||
@ -80,7 +79,7 @@ endif
|
||||
|
||||
# Flags for optional C++ source code
|
||||
CXXFLAGS += $(filter-out -std=c99,$(CFLAGS))
|
||||
CXXFLAGS += $(CXXFLAGS_MOD)
|
||||
|
||||
# TODO make this common -- shouldn't be using these "private" vars from py.mk
|
||||
ifneq ($(SRC_CXX)$(SRC_USERMOD_CXX)$(SRC_USERMOD_LIB_CXX),)
|
||||
LIBSTDCPP_FILE_NAME = "$(shell $(CXX) $(CXXFLAGS) -print-file-name=libstdc++.a)"
|
||||
@ -114,10 +113,6 @@ SRC_C += \
|
||||
lib/asf4/$(MCU_SERIES_LOWER)/hal/src/hal_atomic.c \
|
||||
lib/asf4/$(MCU_SERIES_LOWER)/hal/src/hal_flash.c \
|
||||
lib/asf4/$(MCU_SERIES_LOWER)/hpl/nvmctrl/hpl_nvmctrl.c \
|
||||
lib/libm/ef_sqrt.c \
|
||||
lib/libm/fmodf.c \
|
||||
lib/libm/math.c \
|
||||
lib/libm/nearbyintf.c \
|
||||
lib/tinyusb/src/class/cdc/cdc_device.c \
|
||||
lib/tinyusb/src/common/tusb_fifo.c \
|
||||
lib/tinyusb/src/device/usbd.c \
|
||||
@ -125,7 +120,6 @@ SRC_C += \
|
||||
lib/tinyusb/src/portable/microchip/samd/dcd_samd.c \
|
||||
lib/tinyusb/src/tusb.c \
|
||||
drivers/bus/softspi.c \
|
||||
extmod/uos_dupterm.c \
|
||||
shared/runtime/mpirq.c \
|
||||
shared/libc/printf.c \
|
||||
shared/libc/string0.c \
|
||||
@ -138,9 +132,11 @@ SRC_C += \
|
||||
shared/runtime/sys_stdio_mphal.c \
|
||||
shared/timeutils/timeutils.c \
|
||||
|
||||
SRC_C += $(SRC_MOD)
|
||||
|
||||
SRC_CXX += $(SRC_MOD_CXX)
|
||||
LIBM_SRC_C += \
|
||||
lib/libm/ef_sqrt.c \
|
||||
lib/libm/fmodf.c \
|
||||
lib/libm/math.c \
|
||||
lib/libm/nearbyintf.c \
|
||||
|
||||
# List of sources for qstr extraction
|
||||
SRC_QSTR += \
|
||||
@ -159,17 +155,16 @@ SRC_QSTR += \
|
||||
modsamd.c \
|
||||
samd_flash.c \
|
||||
shared/readline/readline.c \
|
||||
extmod/uos_dupterm.c \
|
||||
shared/runtime/mpirq.c \
|
||||
shared/runtime/sys_stdio_mphal.c \
|
||||
|
||||
SRC_QSTR += $(SRC_MOD) $(SRC_CXX)
|
||||
SRC_QSTR += $(SRC_CXX)
|
||||
|
||||
OBJ += $(PY_O)
|
||||
OBJ += $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(SRC_CXX:.cpp=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(SRC_S:.s=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(SRC_MOD:.c=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(LIBM_SRC_C:.c=.o))
|
||||
OBJ += $(GEN_PINS_SRC:.c=.o)
|
||||
|
||||
ifneq ($(FROZEN_MANIFEST),)
|
||||
|
@ -2,7 +2,7 @@ MICROPY_VFS_LFS2 ?= 1
|
||||
|
||||
SRC_S += shared/runtime/gchelper_m3.s
|
||||
|
||||
SRC_MOD += $(addprefix lib/libm/,\
|
||||
LIBM_SRC_C += $(addprefix lib/libm/,\
|
||||
acoshf.c \
|
||||
asinfacosf.c \
|
||||
asinhf.c \
|
||||
|
@ -95,7 +95,7 @@ INC += -I$(USBDEV_DIR)/core/inc -I$(USBDEV_DIR)/class/inc
|
||||
#INC += -I$(USBHOST_DIR)
|
||||
INC += -Ilwip_inc
|
||||
|
||||
CFLAGS += $(INC) -Wall -Wpointer-arith -Werror -Wdouble-promotion -Wfloat-conversion -std=gnu99 -nostdlib $(CFLAGS_MOD) $(CFLAGS_EXTRA)
|
||||
CFLAGS += $(INC) -Wall -Wpointer-arith -Werror -Wdouble-promotion -Wfloat-conversion -std=gnu99 -nostdlib $(CFLAGS_EXTRA)
|
||||
CFLAGS += -D$(CMSIS_MCU) -DUSE_FULL_LL_DRIVER
|
||||
CFLAGS += $(CFLAGS_MCU_$(MCU_SERIES))
|
||||
CFLAGS += $(COPT)
|
||||
@ -156,7 +156,7 @@ endif
|
||||
|
||||
# Flags for optional C++ source code
|
||||
CXXFLAGS += $(filter-out -Wmissing-prototypes -Wold-style-definition -std=gnu99,$(CFLAGS))
|
||||
CXXFLAGS += $(CXXFLAGS_MOD)
|
||||
|
||||
# TODO make this common -- shouldn't be using these "private" vars from py.mk
|
||||
ifneq ($(SRC_CXX)$(SRC_USERMOD_CXX)$(SRC_USERMOD_LIB_CXX),)
|
||||
LIBSTDCPP_FILE_NAME = "$(shell $(CXX) $(CXXFLAGS) -print-file-name=libstdc++.a)"
|
||||
@ -275,12 +275,6 @@ ifeq ($(MICROPY_FLOAT_IMPL),double)
|
||||
$(LIBM_O): CFLAGS := $(filter-out -Wdouble-promotion -Wfloat-conversion, $(CFLAGS))
|
||||
endif
|
||||
|
||||
EXTMOD_SRC_C += $(addprefix extmod/,\
|
||||
modonewire.c \
|
||||
modnetwork.c \
|
||||
modusocket.c \
|
||||
)
|
||||
|
||||
DRIVERS_SRC_C += $(addprefix drivers/,\
|
||||
bus/softspi.c \
|
||||
bus/softqspi.c \
|
||||
@ -358,11 +352,9 @@ SRC_C += \
|
||||
servo.c \
|
||||
dac.c \
|
||||
adc.c \
|
||||
sdio.c \
|
||||
$(wildcard $(BOARD_DIR)/*.c)
|
||||
|
||||
SRC_CXX += \
|
||||
$(SRC_MOD_CXX)
|
||||
|
||||
SRC_O += \
|
||||
$(STARTUP_FILE) \
|
||||
$(SYSTEM_FILE)
|
||||
@ -482,70 +474,26 @@ USBDEV_SRC_C += $(addprefix $(USBDEV_DIR)/,\
|
||||
class/src/usbd_msc_scsi.c \
|
||||
)
|
||||
|
||||
ifeq ($(MICROPY_PY_BLUETOOTH),1)
|
||||
CFLAGS_MOD += -DMICROPY_PY_BLUETOOTH=1
|
||||
CFLAGS_MOD += -DMICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE=1
|
||||
endif
|
||||
|
||||
ifeq ($(MICROPY_PY_NETWORK_CYW43),1)
|
||||
CFLAGS_MOD += -DMICROPY_PY_NETWORK_CYW43=1
|
||||
SRC_C += sdio.c
|
||||
EXTMOD_SRC_C += extmod/network_cyw43.c
|
||||
DRIVERS_SRC_C += drivers/cyw43/cyw43_ctrl.c drivers/cyw43/cyw43_lwip.c
|
||||
LIBS += $(TOP)/drivers/cyw43/libcyw43.a
|
||||
endif
|
||||
|
||||
ifneq ($(MICROPY_PY_NETWORK_WIZNET5K),0)
|
||||
WIZNET5K_DIR=lib/wiznet5k
|
||||
GIT_SUBMODULES += lib/wiznet5k
|
||||
INC += -I$(TOP)/$(WIZNET5K_DIR) -I$(TOP)/$(WIZNET5K_DIR)/Ethernet
|
||||
CFLAGS_MOD += -DMICROPY_PY_NETWORK_WIZNET5K=$(MICROPY_PY_NETWORK_WIZNET5K) -D_WIZCHIP_=$(MICROPY_PY_NETWORK_WIZNET5K)
|
||||
CFLAGS_MOD += -DWIZCHIP_PREFIXED_EXPORTS=1
|
||||
ifeq ($(MICROPY_PY_LWIP),1)
|
||||
# When using MACRAW mode (with lwIP), maximum buffer space must be used for the raw socket
|
||||
CFLAGS_MOD += -DWIZCHIP_USE_MAX_BUFFER
|
||||
endif
|
||||
SRC_MOD += extmod/network_wiznet5k.c
|
||||
SRC_MOD += $(addprefix $(WIZNET5K_DIR)/,\
|
||||
Ethernet/W$(MICROPY_PY_NETWORK_WIZNET5K)/w$(MICROPY_PY_NETWORK_WIZNET5K).c \
|
||||
Ethernet/wizchip_conf.c \
|
||||
Ethernet/socket.c \
|
||||
Internet/DNS/dns.c \
|
||||
Internet/DHCP/dhcp.c \
|
||||
)
|
||||
endif
|
||||
|
||||
ifeq ($(MICROPY_SSL_MBEDTLS),1)
|
||||
CFLAGS_MOD += -DMBEDTLS_CONFIG_FILE='"mbedtls/mbedtls_config.h"'
|
||||
SRC_MOD += mbedtls/mbedtls_port.c
|
||||
CFLAGS += -DMBEDTLS_CONFIG_FILE='"mbedtls/mbedtls_config.h"'
|
||||
LIB_SRC_C += mbedtls/mbedtls_port.c
|
||||
endif
|
||||
|
||||
ifeq ($(MICROPY_PY_BLUETOOTH),1)
|
||||
|
||||
SRC_C += mpbthciport.c
|
||||
|
||||
ifeq ($(MICROPY_BLUETOOTH_NIMBLE),1)
|
||||
ifeq ($(MICROPY_BLUETOOTH_BTSTACK),1)
|
||||
$(error Cannot enable both NimBLE and BTstack at the same time)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(MICROPY_BLUETOOTH_NIMBLE),1)
|
||||
CFLAGS_MOD += -DMICROPY_PY_BLUETOOTH_ENABLE_L2CAP_CHANNELS=1
|
||||
include $(TOP)/extmod/nimble/nimble.mk
|
||||
SRC_C += mpnimbleport.c
|
||||
endif
|
||||
|
||||
ifeq ($(MICROPY_BLUETOOTH_BTSTACK),1)
|
||||
MICROPY_BLUETOOTH_BTSTACK_H4 ?= 1
|
||||
include $(TOP)/extmod/btstack/btstack.mk
|
||||
SRC_C += mpbtstackport.c
|
||||
MICROPY_BLUETOOTH_BTSTACK_H4 ?= 1
|
||||
endif
|
||||
|
||||
ifeq ($(MICROPY_PY_NETWORK_CYW43),1)
|
||||
DRIVERS_SRC_C += drivers/cyw43/cywbt.c
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
# SRC_O should be placed first to work around this LTO bug with binutils <2.35:
|
||||
@ -555,7 +503,6 @@ OBJ += $(PY_O)
|
||||
OBJ += $(addprefix $(BUILD)/, $(LIB_SRC_C:.c=.o))
|
||||
OBJ += $(LIBM_O)
|
||||
OBJ += $(addprefix $(BUILD)/, $(SHARED_SRC_C:.c=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(EXTMOD_SRC_C:.c=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(DRIVERS_SRC_C:.c=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(HAL_SRC_C:.c=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(USBDEV_SRC_C:.c=.o))
|
||||
@ -713,7 +660,7 @@ $(BUILD)/firmware.elf: $(OBJ)
|
||||
$(call GENERATE_ELF,$@,$^)
|
||||
|
||||
# List of sources for qstr extraction
|
||||
SRC_QSTR += $(SRC_C) $(SRC_CXX) $(SRC_MOD) $(SHARED_SRC_C) $(EXTMOD_SRC_C)
|
||||
SRC_QSTR += $(SRC_C) $(SRC_CXX) $(SHARED_SRC_C)
|
||||
# Append any auto-generated sources that are needed by sources listed in
|
||||
# SRC_QSTR
|
||||
SRC_QSTR_AUTO_DEPS += $(GEN_CDCINF_HEADER)
|
||||
|
@ -58,7 +58,7 @@ INC += -I../$(USBDEV_DIR)/core/inc -I../$(USBDEV_DIR)/class/inc
|
||||
# the compiler does not optimise these functions in terms of themselves.
|
||||
CFLAGS_BUILTIN ?= -ffreestanding -fno-builtin -fno-lto
|
||||
|
||||
CFLAGS += $(INC) -Wall -Wpointer-arith -Wdouble-promotion -Wfloat-conversion -Werror -std=gnu99 -nostdlib $(CFLAGS_MOD) $(CFLAGS_EXTRA)
|
||||
CFLAGS += $(INC) -Wall -Wpointer-arith -Wdouble-promotion -Wfloat-conversion -Werror -std=gnu99 -nostdlib $(CFLAGS_EXTRA)
|
||||
CFLAGS += -D$(CMSIS_MCU)
|
||||
CFLAGS += $(CFLAGS_MCU_$(MCU_SERIES))
|
||||
CFLAGS += $(COPT)
|
||||
|
@ -309,6 +309,14 @@ static inline mp_uint_t disable_irq(void) {
|
||||
#define MICROPY_PY_BLUETOOTH_HCI_READ_MODE MICROPY_PY_BLUETOOTH_HCI_READ_MODE_BYTE
|
||||
#endif
|
||||
|
||||
#ifndef MICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE
|
||||
#define MICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE (1)
|
||||
#endif
|
||||
|
||||
#ifndef MICROPY_PY_BLUETOOTH_ENABLE_L2CAP_CHANNELS
|
||||
#define MICROPY_PY_BLUETOOTH_ENABLE_L2CAP_CHANNELS (MICROPY_BLUETOOTH_NIMBLE)
|
||||
#endif
|
||||
|
||||
// We need an implementation of the log2 function which is not a macro
|
||||
#define MP_NEED_LOG2 (1)
|
||||
|
||||
|
@ -164,7 +164,10 @@ SRC_TEENSY = $(addprefix core/,\
|
||||
yield.c \
|
||||
)
|
||||
|
||||
OBJ = $(PY_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o) $(STM_SRC_C:.c=.o) $(SRC_TEENSY:.c=.o))
|
||||
OBJ += $(PY_O)
|
||||
OBJ += $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(STM_SRC_C:.c=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(SRC_TEENSY:.c=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(SHARED_SRC_C:.c=.o))
|
||||
OBJ += $(BUILD)/shared/runtime/gchelper_m3.o
|
||||
OBJ += $(GEN_PINS_SRC:.c=.o)
|
||||
|
@ -39,7 +39,7 @@ INC += -I$(BUILD)
|
||||
# compiler settings
|
||||
CWARN = -Wall -Werror
|
||||
CWARN += -Wextra -Wno-unused-parameter -Wpointer-arith -Wdouble-promotion -Wfloat-conversion
|
||||
CFLAGS += $(INC) $(CWARN) -std=gnu99 -DUNIX $(CFLAGS_MOD) $(COPT) -I$(VARIANT_DIR) $(CFLAGS_EXTRA)
|
||||
CFLAGS += $(INC) $(CWARN) -std=gnu99 -DUNIX $(COPT) -I$(VARIANT_DIR) $(CFLAGS_EXTRA)
|
||||
|
||||
# Debugging/Optimization
|
||||
ifdef DEBUG
|
||||
@ -142,35 +142,10 @@ endif
|
||||
|
||||
# If the variant enables it, enable modbluetooth.
|
||||
ifeq ($(MICROPY_PY_BLUETOOTH),1)
|
||||
|
||||
ifeq ($(MICROPY_BLUETOOTH_BTSTACK),1)
|
||||
HAVE_LIBUSB := $(shell (which pkg-config > /dev/null && pkg-config --exists libusb-1.0) 2>/dev/null && echo '1')
|
||||
|
||||
# Only one stack can be enabled.
|
||||
ifeq ($(MICROPY_BLUETOOTH_NIMBLE),1)
|
||||
ifeq ($(MICROPY_BLUETOOTH_BTSTACK),1)
|
||||
$(error Cannot enable both NimBLE and BTstack at the same time)
|
||||
endif
|
||||
endif
|
||||
|
||||
# Default to btstack, but a variant (or make command line) can set NimBLE
|
||||
# explicitly (which is always via H4 UART).
|
||||
ifneq ($(MICROPY_BLUETOOTH_NIMBLE),1)
|
||||
ifneq ($(MICROPY_BLUETOOTH_BTSTACK),1)
|
||||
MICROPY_BLUETOOTH_BTSTACK ?= 1
|
||||
endif
|
||||
endif
|
||||
|
||||
CFLAGS += -DMICROPY_PY_BLUETOOTH=1
|
||||
CFLAGS += -DMICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE=1
|
||||
|
||||
ifeq ($(MICROPY_BLUETOOTH_BTSTACK),1)
|
||||
|
||||
# Figure out which BTstack transport to use.
|
||||
ifeq ($(MICROPY_BLUETOOTH_BTSTACK_H4),1)
|
||||
ifeq ($(MICROPY_BLUETOOTH_BTSTACK_USB),1)
|
||||
$(error Cannot enable BTstack support for USB and H4 UART at the same time)
|
||||
endif
|
||||
else
|
||||
ifeq ($(HAVE_LIBUSB),1)
|
||||
# Default to btstack-over-usb.
|
||||
MICROPY_BLUETOOTH_BTSTACK_USB ?= 1
|
||||
@ -178,20 +153,9 @@ else
|
||||
# Fallback to HCI controller via a H4 UART (e.g. Zephyr on nRF) over a /dev/tty serial port.
|
||||
MICROPY_BLUETOOTH_BTSTACK_H4 ?= 1
|
||||
endif
|
||||
|
||||
SRC_BTSTACK_C += lib/btstack/platform/embedded/btstack_run_loop_embedded.c
|
||||
endif
|
||||
|
||||
# BTstack is enabled.
|
||||
include $(TOP)/extmod/btstack/btstack.mk
|
||||
SRC_BTSTACK += lib/btstack/platform/embedded/btstack_run_loop_embedded.c
|
||||
|
||||
else
|
||||
|
||||
# NimBLE is enabled.
|
||||
CFLAGS += -DMICROPY_PY_BLUETOOTH_ENABLE_L2CAP_CHANNELS=1
|
||||
include $(TOP)/extmod/nimble/nimble.mk
|
||||
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
ifeq ($(MICROPY_PY_FFI),1)
|
||||
@ -242,7 +206,6 @@ SRC_C += \
|
||||
mpbtstackport_h4.c \
|
||||
mpbtstackport_usb.c \
|
||||
mpnimbleport.c \
|
||||
$(SRC_MOD) \
|
||||
modtermios.c \
|
||||
modusocket.c \
|
||||
modffi.c \
|
||||
@ -256,17 +219,14 @@ SHARED_SRC_C += $(addprefix shared/,\
|
||||
)
|
||||
|
||||
SRC_CXX += \
|
||||
$(SRC_MOD_CXX)
|
||||
|
||||
OBJ = $(PY_O)
|
||||
OBJ += $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(SRC_CXX:.cpp=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(SHARED_SRC_C:.c=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(EXTMOD_SRC_C:.c=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(LIB_SRC_C:.c=.o))
|
||||
|
||||
# List of sources for qstr extraction
|
||||
SRC_QSTR += $(SRC_C) $(SRC_CXX) $(SHARED_SRC_C) $(EXTMOD_SRC_C)
|
||||
SRC_QSTR += $(SRC_C) $(SRC_CXX) $(SHARED_SRC_C)
|
||||
# Append any auto-generated sources that are needed by sources listed in
|
||||
# SRC_QSTR
|
||||
SRC_QSTR_AUTO_DEPS +=
|
||||
|
@ -240,3 +240,11 @@ static inline unsigned long mp_urandom_seed_init(void) {
|
||||
// Configure the implementation of machine.idle().
|
||||
#include <sched.h>
|
||||
#define MICROPY_UNIX_MACHINE_IDLE sched_yield();
|
||||
|
||||
#ifndef MICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE
|
||||
#define MICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE (1)
|
||||
#endif
|
||||
|
||||
#ifndef MICROPY_PY_BLUETOOTH_ENABLE_L2CAP_CHANNELS
|
||||
#define MICROPY_PY_BLUETOOTH_ENABLE_L2CAP_CHANNELS (MICROPY_BLUETOOTH_NIMBLE)
|
||||
#endif
|
||||
|
@ -32,7 +32,7 @@ INC += -I$(BUILD)
|
||||
INC += -I$(VARIANT_DIR)
|
||||
|
||||
# compiler settings
|
||||
CFLAGS += $(INC) -Wall -Wpointer-arith -Wdouble-promotion -Werror -std=gnu99 -DUNIX -D__USE_MINGW_ANSI_STDIO=1 $(CFLAGS_MOD) $(COPT) $(CFLAGS_EXTRA)
|
||||
CFLAGS += $(INC) -Wall -Wpointer-arith -Wdouble-promotion -Werror -std=gnu99 -DUNIX -D__USE_MINGW_ANSI_STDIO=1 $(COPT) $(CFLAGS_EXTRA)
|
||||
LDFLAGS += -lm -lbcrypt $(LDFLAGS_EXTRA)
|
||||
|
||||
# Debugging/Optimization
|
||||
@ -56,31 +56,26 @@ SRC_C = \
|
||||
realpath.c \
|
||||
init.c \
|
||||
fmode.c \
|
||||
$(SRC_MOD) \
|
||||
$(wildcard $(VARIANT_DIR)/*.c)
|
||||
|
||||
SHARED_SRC_C += $(addprefix shared/,\
|
||||
$(SHARED_SRC_C_EXTRA) \
|
||||
)
|
||||
|
||||
SRC_CXX += \
|
||||
$(SRC_MOD_CXX)
|
||||
|
||||
OBJ = $(PY_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(SRC_CXX:.cpp=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(SHARED_SRC_C:.c=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(EXTMOD_SRC_C:.c=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(LIB_SRC_C:.c=.o))
|
||||
|
||||
ifeq ($(MICROPY_USE_READLINE),1)
|
||||
CFLAGS_MOD += -DMICROPY_USE_READLINE=1
|
||||
CFLAGS += -DMICROPY_USE_READLINE=1
|
||||
SRC_C += shared/readline/readline.c
|
||||
endif
|
||||
|
||||
LIB += -lws2_32
|
||||
|
||||
# List of sources for qstr extraction
|
||||
SRC_QSTR += $(SRC_C) $(SRC_CXX) $(SHARED_SRC_C) $(EXTMOD_SRC_C)
|
||||
SRC_QSTR += $(SRC_C) $(SRC_CXX) $(SHARED_SRC_C)
|
||||
# Append any auto-generated sources that are needed by sources listed in
|
||||
# SRC_QSTR
|
||||
SRC_QSTR_AUTO_DEPS +=
|
||||
@ -89,7 +84,7 @@ ifneq ($(FROZEN_MANIFEST),)
|
||||
CFLAGS += -DMICROPY_QSTR_EXTRA_POOL=mp_qstr_frozen_const_pool -DMICROPY_MODULE_FROZEN_MPY=1 -DMPZ_DIG_SIZE=16
|
||||
endif
|
||||
|
||||
CXXFLAGS += $(filter-out -std=gnu99,$(CFLAGS) $(CXXFLAGS_MOD))
|
||||
CXXFLAGS += $(filter-out -std=gnu99,$(CFLAGS))
|
||||
|
||||
include $(TOP)/py/mkrules.mk
|
||||
|
||||
|
2
py/py.mk
2
py/py.mk
@ -207,7 +207,7 @@ endif
|
||||
|
||||
# Sources that may contain qstrings
|
||||
SRC_QSTR_IGNORE = py/nlr%
|
||||
SRC_QSTR += $(SRC_MOD) $(filter-out $(SRC_QSTR_IGNORE),$(PY_CORE_O_BASENAME:.o=.c))
|
||||
SRC_QSTR += $(filter-out $(SRC_QSTR_IGNORE),$(PY_CORE_O_BASENAME:.o=.c))
|
||||
|
||||
# Anything that depends on FORCE will be considered out-of-date
|
||||
FORCE:
|
||||
|
Loading…
Reference in New Issue
Block a user