Skip to content

Commit

Permalink
ports/psoc6: Config modifications for new board SSL inclusion.
Browse files Browse the repository at this point in the history
Signed-off-by: enriquezgarc <enriquezgarcia.external@infineon.com>
  • Loading branch information
jaenrig-ifx committed Sep 1, 2023
1 parent cd6daec commit 499cded
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 38 deletions.
10 changes: 8 additions & 2 deletions ports/psoc6/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,17 @@ MOD_SRC_C += $(addprefix modules/,\
psoc6/modpsoc6.c \
psoc6/psoc6_fatfs.c \
psoc6/psoc6_flash.c \
psoc6/psoc6_qspi_flash.c \
)

ifeq ($(MICROPY_PY_EXT_FLASH),1)
CFLAGS += -DMICROPY_ENABLE_EXT_QSPI_FLASH=1
MOD_SRC_C += $(addprefix modules/psoc6/,\
psoc6_qspi_flash.c \
)
endif

ifeq ($(MICROPY_PY_NETWORK_IFX_WCM),1)
CFLAGS += -DMICROPY_PY_NETWORK_IFX_WCM=1 -Wno-stringop-truncation
CFLAGS += -DMICROPY_PY_NETWORK=1 -DMICROPY_PY_NETWORK_IFX_WCM=1 -Wno-stringop-truncation
MOD_SRC_C += $(addprefix modules/network/,\
network_ifx_wcm.c \
)
Expand Down
10 changes: 0 additions & 10 deletions ports/psoc6/boards/CY8CPROTO-062-4343W/mpconfigboard.h
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
// Board and hardware specific configuration
#define MICROPY_HW_MCU_NAME "PSoC62"
#define MICROPY_HW_BOARD_NAME "CY8CPROTO-062-4343W"
// #define MICROPY_HW_FLASH_STORAGE_BYTES (0x200000)

// Enable USB Mass Storage with FatFS filesystem.
// #define MICROPY_HW_USB_MSC (1)

// PSoC6 port specific
// set to 1 to enable filesystem to be loaded on external qspi flash
// if set to 0, filesystem is located in an allotted area of internal flash of PSoC6
#define MICROPY_ENABLE_EXT_QSPI_FLASH (1)

#define MICROPY_PY_NETWORK (1)
#define MICROPY_PY_NETWORK_HOSTNAME_DEFAULT "CY8C-062-4343W"
6 changes: 2 additions & 4 deletions ports/psoc6/boards/CY8CPROTO-063-BLE/mpconfigboard.mk
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
FROZEN_MANIFEST ?= boards/manifest.py
MICROPY_PY_NETWORK_IFX_WCM = 0
MICROPY_PY_NETWORK = 0
MICROPY_PSOC6_LWIP = 0
MICROPY_PSOC6_SSL_MBEDTLS = 0
MICROPY_PY_SSL = 1
MICROPY_PSOC6_SSL_MBEDTLS = 1
BOARD_VERSION=release-v4.2.0
7 changes: 5 additions & 2 deletions ports/psoc6/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@

// MTB includes
#include "cybsp.h"
#include "cybsp_wifi.h"
#include "cy_retarget_io.h"
#include "cyhal.h"
#include "cy_wcm.h"

// FreeRTOS header file
#include <FreeRTOS.h>
Expand All @@ -28,6 +26,11 @@
#include "shared/runtime/pyexec.h"
#include "extmod/modnetwork.h"

#if MICROPY_PY_NETWORK
#include "cybsp_wifi.h"
#include "cy_wcm.h"
#endif

#if MICROPY_PY_LWIP
#include "lwip/init.h"
#include "lwip/apps/mdns.h"
Expand Down
2 changes: 1 addition & 1 deletion ports/psoc6/mbedtls/mbedtls_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@
#include "mbedtls_config_common.h"
// #endif

// #undef MBEDTLS_ENTROPY_HARDWARE_ALT
#undef MBEDTLS_ENTROPY_HARDWARE_ALT

#endif /* PSOC6_MPY_MBEDTLS_USER_CONFIG_HEADER */
4 changes: 0 additions & 4 deletions ports/psoc6/mpconfigport.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,6 @@
#define MICROPY_FATFS_LFN_CODE_PAGE 437 /* 1=SFN/ANSI 437=LFN/U.S.(OEM) */
#define MICROPY_FATFS_RPATH (2)

// set to 1 to enable filesystem to be loaded on external qspi flash
// if set to 0, filesystem is located in an allotted area of internal flash of PSoC6
#define MICROPY_ENABLE_EXT_QSPI_FLASH (1)

#define MICROPY_PY_CRYPTOLIB (1)
#define MICROPY_PY_CRYPTOLIB_CTR (1)
#define MICROPY_PY_CRYPTOLIB_CONSTS (1)
Expand Down
26 changes: 11 additions & 15 deletions ports/psoc6/mtb-libs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ MTB_TYPE=COMBINED
# configurations. If TARGET is manually edited, ensure TARGET_<BSP>.mtb with a
# valid URL exists in the application, run 'make getlibs' to fetch BSP contents
# and update or regenerate launch configurations for your IDE.
TARGET=APP_CY8CPROTO-063-BLE
TARGET=APP_CY8CPROTO-062-4343W

# # Board dependencies
# ifeq ($(TARGET),APP_CY8CPROTO-062-4343W)
Expand Down Expand Up @@ -92,10 +92,10 @@ VERBOSE=
# ... then code in directories named COMPONENT_foo and COMPONENT_bar will be
# added to the build
#
COMPONENTS+=FREERTOS
COMPONENTS+=FREERTOS MBEDTLS

ifeq ($(MICROPY_PY_NETWORK),1)
COMPONENTS+= LWIP MBEDTLS
COMPONENTS+= LWIP
endif

# Like COMPONENTS, but disable optional code that was enabled by default.
Expand All @@ -108,35 +108,31 @@ DISABLE_COMPONENTS=
SOURCES=

DEFINES=CY_RETARGET_IO_CONVERT_LF_TO_CRLF CY_RTOS_AWARE
DEFINES+=MBEDTLS_USER_CONFIG_FILE='"mbedtls_config.h"'

ifeq ($(MICROPY_PY_NETWORK),1)
# Custom configuration of mbedtls library.
MBEDTLSFLAGS = MBEDTLS_USER_CONFIG_FILE='"mbedtls_config.h"'
DEFINES+=$(MBEDTLSFLAGS) CYBSP_WIFI_CAPABLE
DEFINES+= CYBSP_WIFI_CAPABLE

# TODO: This is only for the CYCPROTO_BOARD??
# CY8CPROTO-062-4343W board shares the same GPIO for the user button (USER BTN1)
# and the CYW4343W host wake up pin. Since this example uses the GPIO for
# interfacing with the user button, the SDIO interrupt to wake up the host is
# disabled by setting CY_WIFI_HOST_WAKE_SW_FORCE to '0'.
DEFINES+=CY_WIFI_HOST_WAKE_SW_FORCE=0

# Logging options, but not yet working
# DEFINES += LWIP_DEBUG=1 ENABLE_CONNECTIVITY_MIDDLEWARE_LOGS ENABLE_WCM_LOGS ENABLE_SECURE_SOCKETS_LOGS
endif

# Like SOURCES, but for include directories. Value should be paths to
# directories (without a leading -I).
MPY_PSOC6_PORT_DIR = ../
MPY_TOP_DIR = $(MPY_PSOC6_PORT_DIR)/../..
LWIP_OPTS_DIR = $(MPY_PSOC6_PORT_DIR)/lwip_inc
MBEDTLS_CONF_DIR = $(MPY_PSOC6_PORT_DIR)/mbedtls
MBEDTLS_MPY_CONF_DIR = $(MPY_TOP_DIR)/extmod/mbedtls
INCLUDES= $(LWIP_OPTS_DIR) $(MBEDTLS_CONF_DIR) $(MBEDTLS_MPY_CONF_DIR)
#../mtb_shared/wifi-host-driver/release-v2.5.0/External/rtos ../mtb_shared/lwip/STABLE-2_1_2_RELEASE/src/include ../../lwip_inc
INCLUDES+= $(MBEDTLS_CONF_DIR) $(MBEDTLS_MPY_CONF_DIR)

ifeq ($(MICROPY_PY_NETWORK),1)
LWIP_OPTS_DIR = $(MPY_PSOC6_PORT_DIR)/lwip_inc
INCLUDES+= $(LWIP_OPTS_DIR)
endif
# Add additional defines to the build process (without a leading -D).
#DEFINES=CY_RETARGET_IO_CONVERT_LF_TO_CRLF=1 CY_WIFI_HOST_WAKE_SW_FORCE=0
## WPRINT_ENABLE_WHD_INFO WPRINT_ENABLE_WHD_DEBUG WPRINT_ENABLE_WHD_DATA_LOG WHD_IOCTL_LOG_ENABLE LWIP_DEBUG

# Select softfp or hardfp floating point. Default is softfp.
VFP_SELECT=
Expand Down

0 comments on commit 499cded

Please sign in to comment.