Skip to content

Commit

Permalink
chore(Other): Add zephyr related wrappers and system files in MSDK (#990
Browse files Browse the repository at this point in the history
)

Signed-off-by: Sadik Ozer <[email protected]>
  • Loading branch information
ozersa authored Apr 16, 2024
1 parent 0038d43 commit 790ad99
Show file tree
Hide file tree
Showing 31 changed files with 3,601 additions and 14 deletions.
31 changes: 17 additions & 14 deletions .github/workflows/scripts/zephyr-hal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ else
hal_adi="./hal_adi"
fi

src="${msdk}/Libraries"
dst="${hal_adi}/MAX/Libraries"

root_dir=$(pwd)

# Get SHA
Expand All @@ -24,29 +21,35 @@ cd ${root_dir}


# Cleanup hal_adi
rm -rf ${dst}/CMSIS/*
rm -rf ${dst}/PeriphDrivers/*
rm -rf ${hal_adi}/MAX/

# Create parent folder
mkdir -p ${hal_adi}/MAX/Libraries/CMSIS
mkdir -p ${hal_adi}/MAX/Libraries/PeriphDrivers

# Copy zephyr wrappers, system files and cmakefiles
cp -rf ${msdk}/Libraries/zephyr/MAX/* ${hal_adi}/MAX/

# Copy CMSIS folder
cp -rf ${src}/CMSIS/Device ${dst}/CMSIS/
cp -rf ${src}/CMSIS/Include ${dst}/CMSIS/
cp -rf ${msdk}/Libraries/CMSIS/Device ${hal_adi}/MAX/Libraries/CMSIS/
cp -rf ${msdk}/Libraries/CMSIS/Include ${hal_adi}/MAX/Libraries/CMSIS/

# Copy PeriphDrivers folder
cp -rf ${src}/PeriphDrivers/Include ${dst}/PeriphDrivers/
cp -rf ${src}/PeriphDrivers/Source ${dst}/PeriphDrivers/
cp -rf ${msdk}/Libraries/PeriphDrivers/Include ${hal_adi}/MAX/Libraries/PeriphDrivers/
cp -rf ${msdk}/Libraries/PeriphDrivers/Source ${hal_adi}/MAX/Libraries/PeriphDrivers/

# Remove unneeded files
rm -rf ${dst}/CMSIS/Device/Maxim/GCC
rm -rf ${dst}/CMSIS/Device/Maxim/MAX*/Source/IAR
rm -rf ${dst}/CMSIS/Device/Maxim/MAX*/Source/GCC
rm -rf ${dst}/CMSIS/Device/Maxim/MAX*/Source/ARM
rm -rf ${hal_adi}/MAX/Libraries/CMSIS/Device/Maxim/GCC
rm -rf ${hal_adi}/MAX/Libraries/CMSIS/Device/Maxim/MAX*/Source/IAR
rm -rf ${hal_adi}/MAX/Libraries/CMSIS/Device/Maxim/MAX*/Source/GCC
rm -rf ${hal_adi}/MAX/Libraries/CMSIS/Device/Maxim/MAX*/Source/ARM

# Check either dirty or clean
cd ${hal_adi}
if [[ -n $(git status -s) ]]; then
echo "New change exist need to be pushed"
# Set new SHA
echo "${msdk_head}" > MAX/Libraries/msdk_sha
echo "${msdk_head}" > MAX/msdk_sha
else
# No need to push to hal_adi
echo "No any change in hal_adi"
Expand Down
62 changes: 62 additions & 0 deletions Libraries/zephyr/MAX/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
##############################################################################
#
# Copyright (C) 2023-2024 Analog Devices, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################


if (${CONFIG_SOC} MATCHES "max32666")
set(TARGET_LC "max32665")
elseif (${CONFIG_SOC} MATCHES "max326651")
set(TARGET_LC "max32650")
else ()
set(TARGET_LC ${CONFIG_SOC})
endif()
string(TOUPPER ${TARGET_LC} TARGET_UC)

zephyr_compile_definitions(
-DTARGET=${TARGET_UC}
-DMSDK_NO_GPIO_CLK_INIT=1
-DMSDK_NO_LOCKING=1
)

get_filename_component(MSDK_LIBRARY_DIR "./Libraries" ABSOLUTE)
set(MSDK_CMSIS_DIR ${MSDK_LIBRARY_DIR}/CMSIS/Device/Maxim/${TARGET_UC})
set(MSDK_PERIPH_DIR ${MSDK_LIBRARY_DIR}/PeriphDrivers)
set(MSDK_PERIPH_SRC_DIR ${MSDK_PERIPH_DIR}/Source)
set(MSDK_PERIPH_INC_DIR ${MSDK_PERIPH_DIR}/Include/${TARGET_UC})

zephyr_include_directories(
./Include
${MSDK_CMSIS_DIR}/Include
${MSDK_PERIPH_INC_DIR}
)

add_subdirectory_ifdef(CONFIG_SOC_MAX32520 Source/MAX32520)
add_subdirectory_ifdef(CONFIG_SOC_MAX32570 Source/MAX32570)
add_subdirectory_ifdef(CONFIG_SOC_MAX32572 Source/MAX32572)
add_subdirectory_ifdef(CONFIG_SOC_MAX32650 Source/MAX32650)
add_subdirectory_ifdef(CONFIG_SOC_MAX32655 Source/MAX32655)
add_subdirectory_ifdef(CONFIG_SOC_MAX32660 Source/MAX32660)
add_subdirectory_ifdef(CONFIG_SOC_MAX32662 Source/MAX32662)
add_subdirectory_ifdef(CONFIG_SOC_MAX32665 Source/MAX32665)
add_subdirectory_ifdef(CONFIG_SOC_MAX32666 Source/MAX32665)
add_subdirectory_ifdef(CONFIG_SOC_MAX32670 Source/MAX32670)
add_subdirectory_ifdef(CONFIG_SOC_MAX32672 Source/MAX32672)
add_subdirectory_ifdef(CONFIG_SOC_MAX32675 Source/MAX32675)
add_subdirectory_ifdef(CONFIG_SOC_MAX32680 Source/MAX32680)
add_subdirectory_ifdef(CONFIG_SOC_MAX32690 Source/MAX32690)
add_subdirectory_ifdef(CONFIG_SOC_MAX78000 Source/MAX78000)
add_subdirectory_ifdef(CONFIG_SOC_MAX78002 Source/MAX78002)
Loading

0 comments on commit 790ad99

Please sign in to comment.