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

Fix code size mtb tools path #20

Merged
merged 3 commits into from
Oct 14, 2024
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 boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ cy8ckit_062s2_ai.build.board.version=release-v4.3.2
# Upload settings
cy8ckit_062s2_ai.upload.tool=openocd
cy8ckit_062s2_ai.upload.protocol=openocd
cy8ckit_062s2_ai.upload.maximum_size=2097152
cy8ckit_062s2_ai.upload.target.cfg=psoc6_2m.cfg
####################################################
12 changes: 10 additions & 2 deletions mtb-libs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,20 @@ CY_GETLIBS_SHARED_NAME=mtb_shared
# software provided compiler by default).
CY_COMPILER_GCC_ARM_DIR=

# Replace backward slashes with forward slashes in a path
define replace_backslashes
$(subst \,/,$(1))
endef

# Define a new path with backward slashes replaced by forward slashes
CY_TOOLS_PATHS_NEW=$(call replace_backslashes,$(CY_TOOLS_PATHS))

# Default to the newest installed tools folder, or the users override (if it's
# found).
CY_TOOLS_DIR=$(lastword $(sort $(wildcard $(CY_TOOLS_PATHS))))
CY_TOOLS_DIR=$(lastword $(sort $(wildcard $(CY_TOOLS_PATHS_NEW))))

ifeq ($(CY_TOOLS_DIR),)
$(error Unable to find any of the available CY_TOOLS_PATHS -- $(CY_TOOLS_PATHS). On Windows, use forward slashes.)
$(error Unable to find any of the available CY_TOOLS_PATHS -- $(CY_TOOLS_PATHS_NEW). On Windows, use forward slashes.)
endif

$(info Tools Directory: $(CY_TOOLS_DIR))
Expand Down
12 changes: 6 additions & 6 deletions platform.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,18 @@ mtbshell={compiler.mtb_lib_tools.path}/modus-shell/bin/bash
# Prebuild Hooks

recipe.hooks.prebuild.1.pattern.windows=cmd /c if not exist "{build.flash_ld_path}" {libmanager}.exe --project {runtime.platform.path}/mtb-libs --add-bsp-name {build.variant} --add-bsp-version {build.board.version}
recipe.hooks.prebuild.2.pattern.windows=cmd /c if not exist "{build.lib_path}" {mtbshell}.exe -i -l -c "cd '{runtime.platform.path}/mtb-libs' && make getlibs BOARD={build.variant} CY_TOOLS_PATHS={compiler.mtb_lib_tools.path}"
recipe.hooks.prebuild.4.pattern.windows={mtbshell} -i -l -c "cd '{runtime.platform.path}/mtb-libs' && make build BOARD={build.variant} CY_TOOLS_PATHS={compiler.mtb_lib_tools.path}"
recipe.hooks.prebuild.2.pattern.windows=cmd /c if not exist "{build.lib_path}" {mtbshell}.exe -i -l -c "cd '{runtime.platform.path}/mtb-libs' && make getlibs BOARD={build.variant} CY_TOOLS_PATHS="{compiler.mtb_lib_tools.path}""
recipe.hooks.prebuild.3.pattern.windows={mtbshell} -i -l -c "cd '{runtime.platform.path}/mtb-libs' && make build BOARD={build.variant} CY_TOOLS_PATHS="{compiler.mtb_lib_tools.path}""

recipe.hooks.prebuild.1.pattern.linux=/bin/sh -c 'if [ ! -f "{build.flash_ld_path}" ]; then {libmanager} --project "{runtime.platform.path}/mtb-libs" --add-bsp-name {build.variant} --add-bsp-version {build.board.version}; fi'
recipe.hooks.prebuild.2.pattern.linux=/bin/sh -c 'if [ ! -f "{build.lib_path}" ]; then cd {runtime.platform.path}/mtb-libs && make getlibs BOARD={build.variant} CY_TOOLS_PATHS={compiler.mtb_lib_tools.path}; fi'
recipe.hooks.prebuild.4.pattern.linux=/bin/sh -c 'cd {runtime.platform.path}/mtb-libs && make build BOARD={build.variant} CY_TOOLS_PATHS={compiler.mtb_lib_tools.path}'
recipe.hooks.prebuild.3.pattern.linux=/bin/sh -c 'cd {runtime.platform.path}/mtb-libs && make build BOARD={build.variant} CY_TOOLS_PATHS={compiler.mtb_lib_tools.path}'

# Prebuild Hook to Fetch Compiler and Linker Flags from mtb-libs build

recipe.hooks.prebuild.5.pattern=python {runtime.platform.path}/tools/mtb_build_info.py ccxxflags {build.mtb_libs_board_build_path}/.cycompiler {build.mtb_libs_board_build_path}
recipe.hooks.prebuild.6.pattern=python {runtime.platform.path}/tools/mtb_build_info.py ldflags {build.mtb_libs_board_build_path}/.cylinker {runtime.platform.path}/mtb-libs {build.mtb_libs_board_build_path}
recipe.hooks.prebuild.7.pattern=python {runtime.platform.path}/tools/mtb_build_info.py inc_dirs {build.mtb_libs_board_build_path}/inclist.rsp {runtime.platform.path}/mtb-libs {build.mtb_libs_board_build_path}
recipe.hooks.prebuild.4.pattern=python {runtime.platform.path}/tools/mtb_build_info.py ccxxflags {build.mtb_libs_board_build_path}/.cycompiler {build.mtb_libs_board_build_path}
recipe.hooks.prebuild.5.pattern=python {runtime.platform.path}/tools/mtb_build_info.py ldflags {build.mtb_libs_board_build_path}/.cylinker {runtime.platform.path}/mtb-libs {build.mtb_libs_board_build_path}
recipe.hooks.prebuild.6.pattern=python {runtime.platform.path}/tools/mtb_build_info.py inc_dirs {build.mtb_libs_board_build_path}/inclist.rsp {runtime.platform.path}/mtb-libs {build.mtb_libs_board_build_path}
compiler.flags.from_file=@{build.mtb_libs_board_build_path}/compiler_flags.txt
compiler.elf_flags.from_file=@{build.mtb_libs_board_build_path}/linker_flags.txt
compiler.inc_dirs.from_file=@{build.mtb_libs_board_build_path}/inc_dirs.txt
Expand Down
Loading