Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Board configuration for 063-ble #90

Merged
merged 4 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ports_psoc6.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ jobs:
matrix:
board:
- CY8CPROTO-062-4343W
- CY8CPROTO-063-BLE
steps:
- uses: actions/checkout@v3
- name: Download binaries
Expand Down
2 changes: 2 additions & 0 deletions ports/psoc6/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/mtb_shared
../../tools/psoc6/local-devs.yml
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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I get it right these are defines for mpy extended modules which means they are by default already defined (as 0?) in one of the mpy extmod files. Only if they have to be redefined to 1 , then needs to be included either common to port or board. or?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, I just have removed them from the file.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have only kept in the old board, and removed it in the 063-BLE.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect!

#define MICROPY_PY_HASHLIB_MD5 (1)
#define MICROPY_PY_HASHLIB_SHA1 (1)
#define MICROPY_PY_HASHLIB_SHA256 (1)
4 changes: 4 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,7 @@
#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


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
19 changes: 16 additions & 3 deletions ports/psoc6/modules/psoc6/psoc6_flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,23 @@
// MTB includes
#include "cyhal.h"

#define FLASH_BASE_TRUE (0x10000000)
#if defined(CY8C624ABZI_S2D44)
#define DEVICE_FLASH_SIZE (0x00200000) // 2MB
#define DEVICE_FLASH_BASE_ADDRESS (0x101A0000) // Where is this value coming from??

#define FLASH_BASE (0x101A0000)
#define FLASH_SIZE (0x00200000 - (FLASH_BASE - FLASH_BASE_TRUE))
#elif defined(CYBLE_416045_02_device)
#define DEVICE_FLASH_SIZE (0x00100000) // 1MB
#define DEVICE_FLASH_BASE_ADDRESS (0x100E0000) // Where is this value coming from??

#else
#error "MCU not supported."
#endif


#define FLASH_BASE_TRUE (0x10000000)

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

#define FLASH_SECTOR_SIZE (0x200)
#define BLOCK_SIZE_BYTES (FLASH_SECTOR_SIZE)
Expand Down
19 changes: 6 additions & 13 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,7 +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)
#define MICROPY_ENABLE_FINALISER (1)



#define MICROPY_MEM_STATS (1)
#define MICROPY_MALLOC_USES_ALLOCATED_SIZE (1)
Expand Down Expand Up @@ -134,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
Loading