This commit is contained in:
Nanosonde 2020-10-15 16:31:40 +02:00
parent 7141d4e154
commit 3f4542181b
9 changed files with 21 additions and 152 deletions

View File

@ -13,7 +13,6 @@ include(cc13xx)
# Find dependencies
find_package(SimpleLinkCC13X0SDK_nortos REQUIRED)
find_package(Xdctools REQUIRED)
#
# Target
@ -34,7 +33,6 @@ include_directories(
"${CMAKE_CURRENT_SOURCE_DIR}/../../src/knx"
"${CMAKE_CURRENT_SOURCE_DIR}/RTT"
${SimpleLinkCC13X0SDK_INCLUDE_DIRS}
${Xdctools_INCLUDE_DIRS}
)
add_definitions(-DMASK_VERSION=0x07B0 -Wno-unknown-pragmas)

View File

@ -1,2 +1,2 @@
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_PREFIX_PATH="~/ti/simplelink_cc13x0_sdk_4_10_02_04;~/ti/xdctools_3_51_03_28_core" -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchain-arm-none-eabi.cmake ..
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_PREFIX_PATH="~/ti/simplelink_cc13x0_sdk_4_10_02_04" -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchain-arm-none-eabi.cmake ..

View File

@ -1,23 +0,0 @@
##
## Author: Johannes Bruder
## License: See LICENSE.TXT file included in the project
##
##
## Find TI's xdctools
##
include(FindPackageHandleStandardArgs)
# Find the path to xdc headers
find_path(Xdctools_HEADER_DIR NAMES "std.h" PATH_SUFFIXES "packages/xdc")
message("Content of Xdctools_HEADER_DIR:" ${Xdctools_HEADER_DIR})
# Set according include path
set(Xdctools_INCLUDE_DIR "${Xdctools_HEADER_DIR}/../../packages")
message("Content of Xdctools_INCLUDE_DIR:" ${Xdctools_INCLUDE_DIR})
find_package_handle_standard_args(Xdctools DEFAULT_MSG
Xdctools_INCLUDE_DIR)
set(Xdctools_INCLUDE_DIRS ${Xdctools_INCLUDE_DIR})

View File

@ -1,45 +0,0 @@
# About
The aim of this project is to provide a software development environment based on CMake, GCC and openOCD for several bare metal ARM platforms.
# Requirements
* CMake >= 3.6
* GCC arm-none-abi
* Linux Arch: `arm-none-eabi-gcc` `arm-none-eabi-binutils` `arm-none-eabi-newlib`
* Ubuntu packages: Since the package of the official repo is very old it is recommended to use this [PPA](https://launchpad.net/~team-gcc-arm-embedded/+archive/ubuntu/ppa)
# Features
* General CMake Toolchain file for arm-none-eabi-gcc
* Target specific extension of Toolchain file
# Usage
Add this project as git submodule to your repository:
git submodule add https://github.com/jobroe/cmake-arm-embedded.git cmake
Set the Linker Script and include the target specific cmake module in your project CMakeLists.txt e.g.:
```
set(LINKER_SCRIPT "${Gecko_SDK_PATH}/platform/Device/SiliconLabs/EFR32MG12P/Source/GCC/efr32mg12p.ld")
include(efr32mg)
```
Go to your project root directory, create build directory and enter it:
mkdir build
cd build
run to configure:
cmake -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-arm-none-eabi.cmake ..
and finally to build:
make

View File

@ -1,30 +0,0 @@
##
## Author: Johannes Bruder
## License: See LICENSE.TXT file included in the project
##
##
## EFR32MG target specific CMake file
##
if(NOT DEFINED LINKER_SCRIPT)
message(FATAL_ERROR "No linker script defined")
endif(NOT DEFINED LINKER_SCRIPT)
message("Linker script: ${LINKER_SCRIPT}")
#---------------------------------------------------------------------------------------
# Set target specific compiler/linker flags
#---------------------------------------------------------------------------------------
# Object build options
# -mcpu=cortex-m4 SepcifiesTarget ARM processor.
# -mfpu=fpv4-sp-d16 Specifies floating-point hardware.
# -mfloat-abi=softfp Allows the generation of code using hardware floating-point instructions, but still uses the soft-float calling conventions.
set(OBJECT_GEN_FLAGS "-mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OBJECT_GEN_FLAGS}" CACHE INTERNAL "C Compiler options")
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} ${OBJECT_GEN_FLAGS}" CACHE INTERNAL "C++ Compiler options")
set(CMAKE_ASM_FLAGS "${CMAKE_C_FLAGS} ${OBJECT_GEN_FLAGS}" CACHE INTERNAL "ASM Compiler options")
# Linker flags
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -T${LINKER_SCRIPT}" CACHE INTERNAL "Linker options")

View File

@ -1,40 +0,0 @@
##
## Author: Johannes Bruder
## License: See LICENSE.TXT file included in the project
##
## Collection of functions to generate different GDB debugging configurations
##
# Get the path of this module
set(CURRENT_MODULE_DIR ${CMAKE_CURRENT_LIST_DIR})
#---------------------------------------------------------------------------------------
# Set tools
#---------------------------------------------------------------------------------------
set(GDB_BIN ${TOOLCHAIN_BIN_DIR}/${TOOLCHAIN}-gdb${TOOLCHAIN_EXT})
if(NOT OPENOCD_BIN)
if(CMAKE_HOST_SYSTEM_NAME STREQUAL Linux)
set(OPENOCD_BIN "/usr/bin/openocd" CACHE STRING "OpenOCD executable")
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL Darwin)
set(OPENOCD_BIN "/usr/local/bin/openocd" CACHE STRING "OpenOCD executable")
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL Windows)
set(OPENOCD_BIN "C:/openocd/bin/openocd.exe" CACHE STRING "OpenOCD executable")
endif()
endif()
#---------------------------------------------------------------------------------------
# Generates a GDB run script for debugging with STLINKv1/v2/v2-1 programmer and texane stlink tool.
# More infos check: https://github.com/texane/stlink
#---------------------------------------------------------------------------------------
function(generate_run_gdb_stlink TARGET)
get_target_property( TARGET_NAME ${TARGET} NAME )
configure_file(${CURRENT_MODULE_DIR}/stlink-run.gdb.in ${PROJECT_BINARY_DIR}/stlink-run.gdb @ONLY)
endfunction()
#---------------------------------------------------------------------------------------
# Generates a GDB run script for debugging with any supported programmer and openOCD.
#---------------------------------------------------------------------------------------
function(generate_run_gdb_openocd TARGET)
get_target_property( TARGET_NAME ${TARGET} NAME )
configure_file(${CURRENT_MODULE_DIR}/openocd-run.gdb.in ${PROJECT_BINARY_DIR}/openocd-run.gdb @ONLY)
endfunction()

View File

@ -1,5 +0,0 @@
file @TARGET_NAME@
target extended-remote localhost:3333
monitor reset halt
load
thbreak main

View File

@ -1,6 +0,0 @@
file @TARGET_NAME@
target extended localhost:4242
monitor reset halt
shell sleep 1
load
thbreak main

View File

@ -0,0 +1,20 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Cortex Debug",
"cwd": "${workspaceRoot}",
"executable": "./build/knx-cc1310",
"request": "launch",
"type": "cortex-debug",
"servertype": "jlink",
"serverpath": "/opt/SEGGER/JLink/JLinkGDBServerCLExe",
"device": "CC1310F128",
"interface": "jtag",
"runToMain": false,
}
]
}