Skip to content

Cmake: Implement CMake build of Tiva arch #16238

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

Merged
merged 1 commit into from
Apr 19, 2025
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
123 changes: 7 additions & 116 deletions arch/arm/src/tiva/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,123 +20,14 @@
#
# ##############################################################################

if(CONFIG_ARCH_CHIP_LM)
set(ARCH_CHIP lm)
elseif(CONFIG_ARCH_CHIP_TM4C)
set(ARCH_CHIP tm4c)
elseif(CONFIG_ARCH_CHIP_CC13X0)
set(ARCH_CHIP cc13xx)
elseif(CONFIG_ARCH_CHIP_CC13X2)
set(ARCH_CHIP cc13xx)
endif()

set(SRCS)

if(NOT CONFIG_ARCH_IDLE_CUSTOM)
list(APPEND SRCS tiva_idle.c)
endif()
# Paths to source files

list(APPEND SRCS tiva_allocateheap.c tiva_irq.c tiva_lowputc.c tiva_serial.c)
list(APPEND SRCS tiva_ssi.c)
add_subdirectory(common)

if(CONFIG_ARCH_CHIP_LM3S)
list(APPEND SRCS lmxx_tm4c_start.c lm3s_gpio.c lmxx_tm4c_gpioirq.c)
list(APPEND SRCS lm4xx_tm3c_sysctrl.c)
elseif(CONFIG_ARCH_CHIP_LM4F)
list(APPEND SRCS lmxx_tm4c_start.c lm4f_gpio.c lmxx_tm4c_gpioirq.c)
list(APPEND SRCS lm4xx_tm3c_sysctrl.c)
if(CONFIG_ARCH_CHIP_LM)
add_subdirectory(lm)
elseif(CONFIG_ARCH_CHIP_TM4C)
list(APPEND SRCS lmxx_tm4c_start.c tm4c_gpio.c lmxx_tm4c_gpioirq.c)
if(CONFIG_ARCH_CHIP_TM4C129)
list(APPEND SRCS tm4c129_sysctrl.c)
else()
list(APPEND SRCS lm4xx_tm3c_sysctrl.c)
endif()

elseif(CONFIG_ARCH_CHIP_CC13X0)
list(APPEND SRCS cc13xx_start.c cc13xx_prcm.c cc13xx_chipinfo.c cc13xx_gpio.c)
list(APPEND SRCS cc13xx_gpioirq.c cc13xx_enableclks.c cc13xx_enablepwr.c)
list(APPEND SRCS cc13x0_trim.c cc13x0_rom.c)
elseif(CONFIG_ARCH_CHIP_CC13X2)
list(APPEND SRCS cc13xx_start.c cc13xx_prcm.c cc13xx_chipinfo.c cc13xx_gpio.c)
list(APPEND SRCS cc13xx_gpioirq.c cc13xx_enableclks.c cc13xx_enablepwr.c)
list(APPEND SRCS cc13x2_aux_sysif.c)
if(CONFIG_ARCH_CHIP_CC13XX_V1)
list(APPEND SRCS cc13x2_v1_trim.c cc13x2_cc26x2_v1_rom.c)
else()
list(APPEND SRCS cc13x2_v2_trim.c)
endif()
endif()

if(CONFIG_DEBUG_GPIO_INFO)
list(APPEND SRCS tiva_dumpgpio.c)
add_subdirectory(tm4c)
elseif((CONFIG_ARCH_CHIP_CC13X0) OR (CONFIG_ARCH_CHIP_CC13X2))
add_subdirectory(cc13xx)
endif()

if(NOT CONFIG_SCHED_TICKLESS)
list(APPEND SRCS tiva_timerisr.c)
endif()

if(CONFIG_BUILD_PROTECTED)
list(APPEND SRCS tiva_userspace.c tiva_mpuinit.c)
endif()

if(CONFIG_TIVA_I2C)
list(APPEND SRCS tiva_i2c.c)
endif()

if(CONFIG_TIVA_PWM)
list(APPEND SRCS tiva_pwm.c)
endif()

if(CONFIG_TIVA_QEI)
list(APPEND SRCS tiva_qencoder.c)
endif()

if(CONFIG_TIVA_TIMER)
list(APPEND SRCS tiva_timerlib.c)
if(CONFIG_TIVA_TIMER32_PERIODIC)
list(APPEND SRCS tiva_timerlow32.c)
endif()
endif()

if(CONFIG_TIVA_ADC)
list(APPEND SRCS tiva_adclow.c)
list(APPEND SRCS tiva_adclib.c)
endif()

if(CONFIG_TIVA_CAN)
list(APPEND SRCS tiva_can.c)
endif()

if(CONFIG_TIVA_ETHERNET)
if(CONFIG_ARCH_CHIP_LM3S)
list(APPEND SRCS lm3s_ethernet.c)
endif()
if(CONFIG_ARCH_CHIP_TM4C)
list(APPEND SRCS tm4c_ethernet.c)
endif()
endif()

if(CONFIG_TIVA_FLASH)
list(APPEND SRCS tiva_flash.c)
endif()

if(CONFIG_TIVA_EEPROM)
list(APPEND SRCS tiva_eeprom.c)
endif()

if(CONFIG_TIVA_HCIUART)
list(APPEND SRCS tiva_hciuart.c)
endif()

set(COMMON_SRCS)

foreach(src ${SRCS})
if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/common/${src})
list(APPEND COMMON_SRCS common/${src})
else()
list(APPEND COMMON_SRCS ${ARCH_CHIP}/${src})
endif()
endforeach()

target_sources(arch PRIVATE ${COMMON_SRCS})
60 changes: 60 additions & 0 deletions arch/arm/src/tiva/cc13xx/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# ##############################################################################
# arch/arm/src/tiva/cc13xx/CMakeLists.txt
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. The ASF licenses this
# file to you 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_ARCH_CHIP_CC13X0) OR (CONFIG_ARCH_CHIP_CC13X2))
set(SRCS)

if(CONFIG_ARCH_CHIP_CC13X0)
list(
APPEND
SRCS
cc13xx_start.c
cc13xx_prcm.c
cc13xx_chipinfo.c
cc13xx_gpio.c
cc13xx_gpioirq.c
cc13xx_enableclks.c
cc13xx_enablepwr.c
cc13x0_trim.c
cc13x0_rom.c)
elseif(CONFIG_ARCH_CHIP_CC13X2)
list(
APPEND
SRCS
cc13xx_start.c
cc13xx_prcm.c
cc13xx_chipinfo.c
cc13xx_gpio.c
cc13xx_gpioirq.c
cc13xx_enableclks.c
cc13xx_enablepwr.c
cc13x2_aux_sysif.c)
if(CONFIG_ARCH_CHIP_CC13XX_V1)
list(APPEND SRCS cc13x2_v1_trim.c cc13x2_cc26x2_v1_rom.c)
else()
list(APPEND SRCS cc13x2_v2_trim.c)
endif()
endif()

target_sources(arch PRIVATE ${SRCS})

endif()
102 changes: 102 additions & 0 deletions arch/arm/src/tiva/common/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# ##############################################################################
# arch/arm/src/tiva/common/CMakeLists.txt
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. The ASF licenses this
# file to you 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(NOT CONFIG_ARCH_IDLE_CUSTOM)
list(APPEND SRCS tiva_idle.c)
endif()

list(
APPEND
SRCS
tiva_allocateheap.c
tiva_irq.c
tiva_lowputc.c
tiva_serial.c
tiva_ssi.c)

if(CONFIG_ARCH_CHIP_LM3S)
list(APPEND SRCS lmxx_tm4c_start.c lmxx_tm4c_gpioirq.c lm4xx_tm3c_sysctrl.c)
elseif(CONFIG_ARCH_CHIP_LM4F)
list(APPEND SRCS lmxx_tm4c_start.c lmxx_tm4c_gpioirq.c lm4xx_tm3c_sysctrl.c)
elseif(CONFIG_ARCH_CHIP_TM4C)
list(APPEND SRCS lmxx_tm4c_start.c lmxx_tm4c_gpioirq.c)
if(NOT CONFIG_ARCH_CHIP_TM4C129)
list(APPEND SRCS lm4xx_tm3c_sysctrl.c)
endif()
endif()

if(CONFIG_DEBUG_GPIO_INFO)
list(APPEND SRCS tiva_dumpgpio.c)
endif()

if(NOT CONFIG_SCHED_TICKLESS)
list(APPEND SRCS tiva_timerisr.c)
endif()

if(CONFIG_BUILD_PROTECTED)
list(APPEND SRCS tiva_userspace.c tiva_mpuinit.c)
endif()

if(CONFIG_TIVA_I2C)
list(APPEND SRCS tiva_i2c.c)
endif()

if(CONFIG_TIVA_PWM)
list(APPEND SRCS tiva_pwm.c)
endif()

if(CONFIG_TIVA_QEI)
list(APPEND SRCS tiva_qencoder.c)
endif()

if(CONFIG_TIVA_TIMER)
list(APPEND SRCS tiva_timerlib.c)
if(CONFIG_TIVA_TIMER32_PERIODIC)
list(APPEND SRCS tiva_timerlow32.c)
endif()
endif()

if(CONFIG_TIVA_ADC)
list(APPEND SRCS tiva_adclow.c tiva_adclib.c)
endif()

if(CONFIG_TIVA_CHAR_DEV_CAN)
list(APPEND SRCS tiva_can.c)
endif()

if(CONFIG_TIVA_SOCKET_CAN)
list(APPEND SRCS tiva_sock_can.c)
endif()

if(CONFIG_TIVA_FLASH)
list(APPEND SRCS tiva_flash.c)
endif()

if(CONFIG_TIVA_EEPROM)
list(APPEND SRCS tiva_eeprom.c)
endif()

if(CONFIG_TIVA_HCIUART)
list(APPEND SRCS tiva_hciuart.c)
endif()

target_sources(arch PRIVATE ${SRCS})
38 changes: 38 additions & 0 deletions arch/arm/src/tiva/lm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# ##############################################################################
# arch/arm/src/tiva/lm/CMakeLists.txt
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. The ASF licenses this
# file to you 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_ARCH_CHIP_LM)
set(SRCS)

if(CONFIG_ARCH_CHIP_LM3S)
list(APPEND SRCS lm3s_gpio.c)
elseif(CONFIG_ARCH_CHIP_LM4F)
list(APPEND SRCS lm4f_gpio.c)
endif()

if((CONFIG_TIVA_ETHERNET) AND (CONFIG_ARCH_CHIP_LM3S))
list(APPEND SRCS lm3s_ethernet.c)
endif()

target_sources(arch PRIVATE ${SRCS})

endif()
38 changes: 38 additions & 0 deletions arch/arm/src/tiva/tm4c/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# ##############################################################################
# arch/arm/src/tiva/tm4c/CMakeLists.txt
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. The ASF licenses this
# file to you 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_ARCH_CHIP_TM4C)
set(SRCS)

list(APPEND SRCS tm4c_gpio.c)

if(CONFIG_ARCH_CHIP_TM4C129)
list(APPEND SRCS tm4c129_sysctrl.c)
endif()

if(CONFIG_TIVA_ETHERNET)
list(APPEND SRCS tm4c_ethernet.c)
endif()

target_sources(arch PRIVATE ${SRCS})

endif()
Loading
Loading