Skip to content

Commit

Permalink
ports/psoc6: Reworking base MTB example prior externalizing.
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 Aug 8, 2023
1 parent 7d0014b commit 5348248
Show file tree
Hide file tree
Showing 171 changed files with 17 additions and 10 deletions.
5 changes: 3 additions & 2 deletions ports/psoc6/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# TODO: get active board from mtb-base-example makefile
BOARD ?= CY8CPROTO-062-4343W
BOARD_DIR = boards/$(BOARD)

Expand Down Expand Up @@ -39,7 +40,7 @@ include $(TOP)/py/py.mk
include $(TOP)/extmod/extmod.mk

# get path to this file
MPY_MAIN_BUILD_DIR := $(dir $(MPY_DIR_OF_MAIN_MAKEFILE))/$(BUILD)
MPY_MAIN_BUILD_DIR := $(dir $(MPY_DIR_OF_MAIN_MAKEFILE))$(BUILD)

$(info MPY_PATH_TO_MAIN_MAKEFILE : $(MPY_PATH_TO_MAIN_MAKEFILE))
$(info MPY_DIR_OF_MAIN_MAKEFILE : $(MPY_DIR_OF_MAIN_MAKEFILE))
Expand Down Expand Up @@ -198,7 +199,7 @@ $(MPY_MAIN_BUILD_DIR)/firmware.hex: $(MPY_MAIN_BUILD_DIR)/firmware.elf


# include adapter makefile
include $(BOARD_DIR)/makefile_mtb.mk
include makefile_mtb.mk

# include py core make definitions
include $(TOP)/py/mkrules.mk
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ MPY_DIR_OF_MTB_ADAPTER_MAKEFILE := $(dir $(MPY_PATH_TO_MTB_ADAPTER_MAKEFILE))


# get variable definitions from main makefile
MPY_MTB_MAIN_MAKEFILE := $(MPY_DIR_OF_MTB_ADAPTER_MAKEFILE)/Makefile
MTB_BASE_EXAMPLE_MAKEFILE_DIR := $(MPY_DIR_OF_MTB_ADAPTER_MAKEFILE)boards/mtb-base-example
MPY_MTB_MAIN_MAKEFILE := $(MTB_BASE_EXAMPLE_MAKEFILE_DIR)/Makefile
MPY_MTB_TARGET := $(shell egrep '^ *TARGET' $(MPY_MTB_MAIN_MAKEFILE) | sed 's/^.*= *//g')
MPY_MTB_CONFIG ?= $(shell egrep '^ *CONFIG' $(MPY_MTB_MAIN_MAKEFILE) | sed 's/^.*= *//g')

MPY_MTB_BOARD_BUILD_DIR := $(MPY_DIR_OF_MTB_ADAPTER_MAKEFILE)/$(BUILD)
MPY_MTB_BOARD_BUILD_DIR := $(MTB_BASE_EXAMPLE_MAKEFILE_DIR)/$(BUILD)
MPY_MTB_BOARD_BUILD_OUTPUT_DIR := $(MPY_MTB_BOARD_BUILD_DIR)/$(MPY_MTB_TARGET)/$(MPY_MTB_CONFIG)

MPY_MTB_LIB_NAME = $(file < $(MPY_MTB_BOARD_BUILD_OUTPUT_DIR)/artifact.rsp)
Expand All @@ -35,26 +36,30 @@ $(info MPY_MTB_BOARD_BUILD_DIR : $(MPY_MTB_BOARD_BUILD_DIR))
$(info MPY_MTB_BOARD_BUILD_OUTPUT_DIR : $(MPY_MTB_BOARD_BUILD_OUTPUT_DIR))


mpy_mtb_init_base_prj:
$(info Create a mtb-example-hal-hello-world base project for $(BOARD))
project-creator-cli --board-id $(BOARD) --app-id mtb-example-hal-hello-world --user-app-name $(MTB_APP_DIR_NAME) --target-dir boards/$(BOARD)

# init MTB project
mpy_mtb_init:
$(info )
$(info Initializing $(BOARD) ...)
$(Q) cd $(BOARD_DIR); $(MAKE) getlibs
$(Q) cd $(MTB_BASE_EXAMPLE_MAKEFILE_DIR); $(MAKE) getlibs


# Remove MTB retrieved lib and dependencies
mpy_mtb_deinit:
$(info )
$(info Removing mtb_shared and libs folder ...)
-$(Q) rm -rf boards/$(BOARD)/libs
-$(Q) rm -rf $(MTB_BASE_EXAMPLE_MAKEFILE_DIR)/libs
-$(Q) rm -rf boards/mtb_shared


# build MTB project
mpy_mtb_build:
$(info )
$(info Building $(BOARD) in $(CONFIG) mode using MTB ...)
$(Q) cd $(BOARD_DIR); $(MAKE) CONFIG=$(MPY_MTB_CONFIG) build
$(Q) cd $(MTB_BASE_EXAMPLE_MAKEFILE_DIR); $(MAKE) CONFIG=$(MPY_MTB_CONFIG) build


mpy_mtb_clean:
Expand All @@ -67,20 +72,21 @@ mpy_mtb_clean:
mpy_define_mtb_vars: mpy_mtb_build
@:
$(eval MPY_MTB_INCLUDE_DIRS = $(file < $(MPY_MTB_BOARD_BUILD_OUTPUT_DIR)/inclist.rsp))
$(eval INC += $(subst -I,-I$(BOARD_DIR)/,$(MPY_MTB_INCLUDE_DIRS)))
$(eval INC += $(subst -I,-I$(MTB_BASE_EXAMPLE_MAKEFILE_DIR)/,$(MPY_MTB_INCLUDE_DIRS)))
$(eval INC += -I$(BOARD_DIR))
$(eval MPY_MTB_LIBRARIES = $(file < $(MPY_MTB_BOARD_BUILD_OUTPUT_DIR)/liblist.rsp))
$(eval LIBS += $(MPY_MTB_BOARD_BUILD_OUTPUT_DIR)/$(MPY_MTB_LIB_NAME))
# $(eval LIBS += $(MPY_MTB_LIBRARIES) $(MPY_MTB_BOARD_BUILD_OUTPUT_DIR)/$(MPY_MTB_LIB_NAME))
$(eval CFLAGS += -mcpu=cortex-m4 --specs=nano.specs -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -mthumb -ffunction-sections -fdata-sections -ffat-lto-objects -g -Wall -pipe -DCOMPONENT_4343W -DCOMPONENT_APP_CY8CPROTO_062_4343W -DCOMPONENT_CAT1 -DCOMPONENT_CAT1A -DCOMPONENT_CM0P_SLEEP -DCOMPONENT_CM4 -DCOMPONENT_CM4_0 -DCOMPONENT_Debug -DCOMPONENT_GCC_ARM -DCOMPONENT_HCI_UART -DCOMPONENT_MURATA_1DX -DCOMPONENT_MW_ABSTRACTION_RTOS -DCOMPONENT_MW_CAT1CM0P -DCOMPONENT_MW_CLIB_SUPPORT -DCOMPONENT_MW_CMSIS -DCOMPONENT_MW_CONNECTIVITY_UTILITIES -DCOMPONENT_MW_CORE_LIB -DCOMPONENT_MW_CORE_MAKE -DCOMPONENT_MW_CY_MBEDTLS_ACCELERATION -DCOMPONENT_MW_FREERTOS -DCOMPONENT_MW_LWIP -DCOMPONENT_MW_LWIP_FREERTOS_INTEGRATION -DCOMPONENT_MW_LWIP_NETWORK_INTERFACE_INTEGRATION -DCOMPONENT_MW_MBEDTLS -DCOMPONENT_MW_MTB_HAL_CAT1 -DCOMPONENT_MW_MTB_PDL_CAT1 -DCOMPONENT_MW_RECIPE_MAKE_CAT1A -DCOMPONENT_MW_RETARGET_IO -DCOMPONENT_MW_SECURE_SOCKETS -DCOMPONENT_MW_SERIAL_FLASH -DCOMPONENT_MW_WHD_BSP_INTEGRATION -DCOMPONENT_MW_WIFI_CONNECTION_MANAGER -DCOMPONENT_MW_WIFI_CORE_FREERTOS_LWIP_MBEDTLS -DCOMPONENT_MW_WIFI_HOST_DRIVER -DCOMPONENT_MW_WPA3_EXTERNAL_SUPPLICANT -DCOMPONENT_PSOC6_02 -DCOMPONENT_SOFTFP -DCOMPONENT_WIFI_INTERFACE_SDIO -DCORE_NAME_CM4_0=1 -DCY8C624ABZI_S2D44 -DCYBSP_WIFI_CAPABLE -DCY_APPNAME_mtb_example_wifi_scan -DCY_RETARGET_IO_CONVERT_LF_TO_CRLF -DCY_RTOS_AWARE -DCY_SUPPORTS_DEVICE_VALIDATION -DCY_TARGET_BOARD=APP_CY8CPROTO_062_4343W -DCY_USING_HAL -DCY_WIFI_HOST_WAKE_SW_FORCE=0 -DDEBUG -DMBEDTLS_USER_CONFIG_FILE=mbedtls_user_config.h -DTARGET_APP_CY8CPROTO_062_4343W -DCOMPONENT_FREERTOS -DCOMPONENT_LWIP -DCOMPONENT_MBEDTLS)
$(eval CXXFLAGS += $(CFLAGS))
$(eval LDFLAGS += -mcpu=cortex-m4 --specs=nano.specs -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -mthumb -ffunction-sections -fdata-sections -ffat-lto-objects -g -Wall -pipe -Wl,--gc-sections -T$(MPY_DIR_OF_MTB_ADAPTER_MAKEFILE)/bsps/TARGET_APP_CY8CPROTO-062-4343W/COMPONENT_CM4/TOOLCHAIN_GCC_ARM/linker.ld -Wl,-Map,$(BUILD)/firmware.map -Wl,--start-group -Wl,--end-group -Wl,--print-memory-usage)
$(eval LDFLAGS += -mcpu=cortex-m4 --specs=nano.specs -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -mthumb -ffunction-sections -fdata-sections -ffat-lto-objects -g -Wall -pipe -Wl,--gc-sections -T$(MTB_BASE_EXAMPLE_MAKEFILE_DIR)/bsps/TARGET_APP_CY8CPROTO-062-4343W/COMPONENT_CM4/TOOLCHAIN_GCC_ARM/linker.ld -Wl,-Map,$(BUILD)/firmware.map -Wl,--start-group -Wl,--end-group -Wl,--print-memory-usage)
$(eval QSTR_GEN_CFLAGS += $(INC) $(CFLAGS))

mpy_program: $(MPY_MAIN_BUILD_DIR)/firmware.hex
@:
$(info )
$(info Programming using openocd ...)
$(OPENOCD_HOME)/bin/openocd -s $(OPENOCD_HOME)/scripts -s $(MPY_DIR_OF_MTB_ADAPTER_MAKEFILE)/bsps/TARGET_APP_CY8CPROTO-062-4343W/config/GeneratedSource -c "source [find interface/kitprog3.cfg]; $(SERIAL_ADAPTER_CMD) ; source [find target/psoc6_2m.cfg]; psoc6 allow_efuse_program off; psoc6 sflash_restrictions 1; program $(MPY_DIR_OF_MAIN_MAKEFILE)/build/firmware.hex verify reset exit;"
$(OPENOCD_HOME)/bin/openocd -s $(OPENOCD_HOME)/scripts -s $(MTB_BASE_EXAMPLE_MAKEFILE_DIR)/bsps/TARGET_APP_CY8CPROTO-062-4343W/config/GeneratedSource -c "source [find interface/kitprog3.cfg]; $(SERIAL_ADAPTER_CMD) ; source [find target/psoc6_2m.cfg]; psoc6 allow_efuse_program off; psoc6 sflash_restrictions 1; program $(MPY_DIR_OF_MAIN_MAKEFILE)/build/firmware.hex verify reset exit;"
$(info Programming done.)

# Use this target to program multiple attached target devices
Expand Down

0 comments on commit 5348248

Please sign in to comment.