Makefile & mpconfigport for atmel-samd with wiznet

This commit is contained in:
Nick Moore 2018-10-04 21:59:25 +10:00
parent d33f6214f1
commit f9bda0ff93
3 changed files with 76 additions and 4 deletions

View File

@ -123,7 +123,6 @@ endif
CFLAGS += $(INC) -Wall -Werror -std=gnu11 -nostdlib $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT)
ifeq ($(CHIP_FAMILY), samd21)
CFLAGS += \
-mthumb \
@ -287,6 +286,25 @@ SRC_C = \
freetouch/adafruit_ptc.c \
supervisor/shared/memory.c
ifeq ($(MICROPY_PY_NETWORK),1)
CFLAGS += -DMICROPY_PY_NETWORK=1
SRC_MOD += lib/netutils/netutils.c
ifneq ($(MICROPY_PY_WIZNET5K),0)
WIZNET5K_DIR=drivers/wiznet5k
INC += -I$(TOP)/$(WIZNET5K_DIR)
CFLAGS_MOD += -DMICROPY_PY_WIZNET5K=$(MICROPY_PY_WIZNET5K) -D_WIZCHIP_=$(MICROPY_PY_WIZNET5K)
SRC_MOD += $(addprefix $(WIZNET5K_DIR)/,\
ethernet/w$(MICROPY_PY_WIZNET5K)/w$(MICROPY_PY_WIZNET5K).c \
ethernet/wizchip_conf.c \
ethernet/socket.c \
internet/dns/dns.c \
)
endif # MICROPY_PY_WIZNET5K
endif # MICROPY_PY_NETWORK
# Choose which flash filesystem impl to use.
# (Right now INTERNAL_FLASH_FILESYSTEM and SPI_FLASH_FILESYSTEM are mutually exclusive.
# But that might not be true in the future.)
@ -362,7 +380,6 @@ SRC_LIBM = $(addprefix lib/,\
)
endif
# These don't have corresponding files in each port but are still located in
# shared-bindings to make it clear what the contents of the modules are.
SRC_BINDINGS_ENUMS = \
@ -401,6 +418,13 @@ SRC_SHARED_MODULE = \
uheap/__init__.c \
ustack/__init__.c
ifeq ($(MICROPY_PY_NETWORK),1)
SRC_SHARED_MODULE += socket/__init__.c network/__init__.c
ifneq ($(MICROPY_PY_WIZNET5K),0)
SRC_SHARED_MODULE += wiznet/__init__.c
endif
endif
# SAMRs don't have a DAC
ifneq ($(CHIP_VARIANT),SAMR21G18A)
SRC_COMMON_HAL += \
@ -441,6 +465,7 @@ ifeq ($(INTERNAL_LIBM),1)
OBJ += $(addprefix $(BUILD)/, $(SRC_LIBM:.c=.o))
endif
OBJ += $(addprefix $(BUILD)/, $(SRC_S:.s=.o))
OBJ += $(addprefix $(BUILD)/, $(SRC_MOD:.c=.o))
SRC_QSTR += $(SRC_C) $(SRC_SUPERVISOR) $(SRC_COMMON_HAL_EXPANDED) $(SRC_SHARED_MODULE_EXPANDED) $(STM_SRC_C)
# Sources that only hold QSTRs after pre-processing.

View File

@ -67,6 +67,18 @@
#define MICROPY_FLOAT_HIGH_QUALITY_HASH (1)
#define MICROPY_STREAMS_NON_BLOCK (1)
#ifndef MICROPY_PY_NETWORK
#define MICROPY_PY_NETWORK (0)
#endif
#ifndef MICROPY_PY_WIZNET5K
#define MICROPY_PY_WIZNET5K (0)
#endif
#ifndef MICROPY_PY_CC3K
#define MICROPY_PY_CC3K (0)
#endif
// fatfs configuration used in ffconf.h
#define MICROPY_FATFS_ENABLE_LFN (1)
#define MICROPY_FATFS_LFN_CODE_PAGE (437) /* 1=SFN/ANSI 437=LFN/U.S.(OEM) */
@ -84,6 +96,7 @@
#define MICROPY_VFS (1)
#define MICROPY_VFS_FAT (1)
#define MICROPY_PY_MACHINE (1)
#define MICROPY_MODULE_BUILTIN_INIT (1)
#define MICROPY_MODULE_WEAK_LINKS (0)
#define MICROPY_REPL_AUTO_INDENT (1)
#define MICROPY_HW_ENABLE_DAC (1)
@ -121,6 +134,9 @@ typedef unsigned mp_uint_t; // must be pointer size
typedef long mp_off_t;
// XXX check we don't need this
#define MICROPY_THREAD_YIELD()
#define MP_PLAT_PRINT_STRN(str, len) mp_hal_stdout_tx_strn_cooked(str, len)
#define mp_type_fileio mp_type_vfs_fat_fileio
@ -194,6 +210,9 @@ extern const struct _mp_obj_module_t gamepad_module;
extern const struct _mp_obj_module_t stage_module;
extern const struct _mp_obj_module_t touchio_module;
extern const struct _mp_obj_module_t usb_hid_module;
extern const struct _mp_obj_module_t network_module;
extern const struct _mp_obj_module_t socket_module;
extern const struct _mp_obj_module_t wiznet_module;
// Internal flash size dependent settings.
#if BOARD_FLASH_SIZE > 192000
@ -234,11 +253,26 @@ extern const struct _mp_obj_module_t usb_hid_module;
#endif
#ifdef CIRCUITPY_DISPLAYIO
#define DISPLAYIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_displayio), (mp_obj_t)&displayio_module },
#define DISPLAYIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_displayio), (mp_obj_t)&displayio_module },
#else
#define DISPLAYIO_MODULE
#define DISPLAYIO_MODULE
#endif
#if MICROPY_PY_NETWORK
#define NETWORK_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_network), (mp_obj_t)&network_module },
#define SOCKET_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_socket), (mp_obj_t)&socket_module },
#if MICROPY_PY_WIZNET5K
#define WIZNET_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_wiznet), (mp_obj_t)&wiznet_module },
#else
#define WIZNET_MODULE
#endif
#else
#define NETWORK_MODULE
#define SOCKET_MODULE
#define WIZNET_MODULE
#endif
#ifndef EXTRA_BUILTIN_MODULES
#define EXTRA_BUILTIN_MODULES \
AUDIOIO_MODULE \
@ -246,6 +280,9 @@ extern const struct _mp_obj_module_t usb_hid_module;
{ MP_OBJ_NEW_QSTR(MP_QSTR_bitbangio), (mp_obj_t)&bitbangio_module }, \
DISPLAYIO_MODULE \
I2CSLAVE_MODULE \
NETWORK_MODULE \
SOCKET_MODULE \
WIZNET_MODULE \
{ MP_OBJ_NEW_QSTR(MP_QSTR_rotaryio), (mp_obj_t)&rotaryio_module }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_gamepad),(mp_obj_t)&gamepad_module }
#endif
@ -345,6 +382,12 @@ extern const struct _mp_obj_module_t usb_hid_module;
#include "peripherals/samd/dma.h"
#if MICROPY_PY_NETWORK
#define NETWORK_ROOT_POINTERS mp_obj_list_t mod_network_nic_list;
#else
#define NETWORK_ROOT_POINTERS
#endif
#define MICROPY_PORT_ROOT_POINTERS \
const char *readline_hist[8]; \
vstr_t *repl_line; \
@ -352,6 +395,7 @@ extern const struct _mp_obj_module_t usb_hid_module;
mp_obj_t rtc_time_source; \
FLASH_ROOT_POINTERS \
mp_obj_t gamepad_singleton; \
NETWORK_ROOT_POINTERS \
void run_background_tasks(void);
#define MICROPY_VM_HOOK_LOOP run_background_tasks();

View File

@ -16,3 +16,6 @@ endif
INTERNAL_LIBM = 1
MICROPY_PY_NETWORK = 1
MICROPY_PY_WIZNET5K = 5500