Skip to content

Commit

Permalink
ports/psoc6: Adapting deps and config for multi bsp.
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 26, 2023
1 parent a348ccd commit d028718
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 24 deletions.
7 changes: 7 additions & 0 deletions ports/psoc6/boards/CY8CPROTO-062-4343W/mpconfigboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,10 @@
#define MICROPY_HW_BOARD_NAME "CY8CPROTO-062-4343W"

#define MICROPY_PY_NETWORK_HOSTNAME_DEFAULT "CY8C-062-4343W"

#define MICROPY_GC_HEAP_SIZE (256 * 1024) // 256 KB

#define MICROPY_PY_HASHLIB (1)
#define MICROPY_PY_HASHLIB_MD5 (1)
#define MICROPY_PY_HASHLIB_SHA1 (1)
#define MICROPY_PY_HASHLIB_SHA256 (1)
8 changes: 8 additions & 0 deletions ports/psoc6/boards/CY8CPROTO-063-BLE/mpconfigboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,11 @@
#define MICROPY_HW_BOARD_NAME "CY8CPROTO-063-BLE"

#define MICROPY_PY_NETWORK_HOSTNAME_DEFAULT "CY8C-063-BLE"

#define MICROPY_GC_HEAP_SIZE (64 * 1024) // 64 KB

#define MICROPY_PY_HASHLIB (0)
#define MICROPY_PY_HASHLIB_MD5 (0)
#define MICROPY_PY_HASHLIB_SHA1 (0)
#define MICROPY_PY_HASHLIB_SHA256 (0)

4 changes: 2 additions & 2 deletions ports/psoc6/boards/CY8CPROTO-063-BLE/mpconfigboard.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROZEN_MANIFEST ?= boards/manifest.py
MICROPY_PY_SSL = 1
MICROPY_PSOC6_SSL_MBEDTLS = 1
MICROPY_PY_SSL = 0
MICROPY_PSOC6_SSL_MBEDTLS = 0
BOARD_VERSION=release-v4.2.0
5 changes: 1 addition & 4 deletions ports/psoc6/modules/psoc6/psoc6_flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

#elif defined(CYBLE_416045_02_device)
#define DEVICE_FLASH_SIZE (0x00100000) // 1MB
#define DEVICE_FLASH_BASE_ADDRESS (0x100A0000) // Where is this value coming from??
#define DEVICE_FLASH_BASE_ADDRESS (0x100E0000) // Where is this value coming from??

#else
#error "MCU not supported."
Expand All @@ -53,9 +53,6 @@

#define FLASH_BASE_TRUE (0x10000000)

// #define FLASH_BASE (0x101A0000)
// #define FLASH_SIZE (0x00200000 - (FLASH_BASE - FLASH_BASE_TRUE))

#define FLASH_BASE DEVICE_FLASH_BASE_ADDRESS
#define FLASH_SIZE (DEVICE_FLASH_SIZE - (FLASH_BASE - FLASH_BASE_TRUE))

Expand Down
20 changes: 6 additions & 14 deletions ports/psoc6/mpconfigport.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@
// Control over Python builtins
#define MICROPY_PY_IO_BUFFEREDWRITER (1)
#define MICROPY_PY_SELECT (1)
// TODO: Remove this
// This is defined per board, and by the mpconfigboard.mk
// #ifndef MICROPY_PY_SSL
// #define MICROPY_PY_SSL (1)
// #endif
#define MICROPY_PY_IO (1)
#define MICROPY_PY_IO_IOBASE (1)
#define MICROPY_PY_BINASCII (1)
Expand All @@ -60,8 +55,9 @@
// #define MICROPY_GC_STACK_ENTRY_TYPE uint16_t
#define MICROPY_GC_STACK_ENTRY_TYPE uint32_t
#define MICROPY_ENABLE_GC (1)
// #define MICROPY_GC_HEAP_SIZE (256 * 1024) //256 kb sectors -> 1 sector (0.25 of 2 MB flash)
#define MICROPY_GC_HEAP_SIZE (128 * 1024) // 32 kb
#define MICROPY_ENABLE_FINALISER (1)



#define MICROPY_MEM_STATS (1)
#define MICROPY_MALLOC_USES_ALLOCATED_SIZE (1)
Expand Down Expand Up @@ -135,14 +131,10 @@
#define MICROPY_FATFS_LFN_CODE_PAGE 437 /* 1=SFN/ANSI 437=LFN/U.S.(OEM) */
#define MICROPY_FATFS_RPATH (2)

#define MICROPY_PY_CRYPTOLIB (1)
#define MICROPY_PY_CRYPTOLIB_CTR (1)
#define MICROPY_PY_CRYPTOLIB_CONSTS (1)
#define MICROPY_PY_CRYPTOLIB (MICROPY_PY_SSL)
#define MICROPY_PY_CRYPTOLIB_CTR (MICROPY_PY_SSL)
#define MICROPY_PY_CRYPTOLIB_CONSTS (MICROPY_PY_SSL)

#define MICROPY_PY_HASHLIB (1)
#define MICROPY_PY_HASHLIB_MD5 (1)
#define MICROPY_PY_HASHLIB_SHA1 (1)
#define MICROPY_PY_HASHLIB_SHA256 (1)

#define MP_STATE_PORT MP_STATE_VM

Expand Down
1 change: 0 additions & 1 deletion ports/psoc6/mpconfigport.mk
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
MICROPY_VFS_LFS2=1

MICROPY_PY_SSL=1
16 changes: 14 additions & 2 deletions ports/psoc6/mtb-libs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,16 @@ VERBOSE=
# ... then code in directories named COMPONENT_foo and COMPONENT_bar will be
# added to the build
#
COMPONENTS+=FREERTOS MBEDTLS
COMPONENTS+=FREERTOS

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

ifeq ($(MICROPY_PY_SSL),1)
COMPONENTS+=MBEDTLS
endif

# Like COMPONENTS, but disable optional code that was enabled by default.
DISABLE_COMPONENTS=

Expand All @@ -108,7 +112,7 @@ 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)
DEFINES+= CYBSP_WIFI_CAPABLE
Expand All @@ -121,13 +125,21 @@ DEFINES+= CYBSP_WIFI_CAPABLE
DEFINES+=CY_WIFI_HOST_WAKE_SW_FORCE=0
endif

ifeq ($(MICROPY_PY_SSL),1)
DEFINES+=MBEDTLS_USER_CONFIG_FILE='"mbedtls_config.h"'
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)/../..

ifeq ($(MICROPY_PY_SSL),1)
MBEDTLS_CONF_DIR = $(MPY_PSOC6_PORT_DIR)/mbedtls
MBEDTLS_MPY_CONF_DIR = $(MPY_TOP_DIR)/extmod/mbedtls
INCLUDES+= $(MBEDTLS_CONF_DIR) $(MBEDTLS_MPY_CONF_DIR)
endif

ifeq ($(MICROPY_PY_NETWORK),1)
LWIP_OPTS_DIR = $(MPY_PSOC6_PORT_DIR)/lwip_inc
Expand Down
6 changes: 5 additions & 1 deletion ports/psoc6/mtb-libs/makefile_mtb.mk
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ ifeq ($(MICROPY_PY_EXT_FLASH),1)
MTB_DEPS_DIRS += ext_flash
endif

ifeq ($(MICROPY_PY_SSL), 1)
MTB_DEPS_DIRS += crypto
endif

# The ModusToolbox expects all the .mtb files to be in the /deps folder.
# The feature specific dependencies organized in folders are directly copied
# to the deps/ root folder
Expand Down Expand Up @@ -83,7 +87,7 @@ mtb_deinit: clean

# Some of the configuration variables are passed to the ModusToolbox
# Makefile to include/exclude certain middleware libraries and components
MPY_MTB_MAKE_VARS = MICROPY_PY_NETWORK=$(MICROPY_PY_NETWORK)
MPY_MTB_MAKE_VARS = MICROPY_PY_NETWORK=$(MICROPY_PY_NETWORK) MICROPY_PY_SSL=$(MICROPY_PY_SSL)

# build MTB project
mtb_build:
Expand Down

0 comments on commit d028718

Please sign in to comment.