diff --git a/common.cmake b/common.cmake new file mode 100644 index 0000000000000000000000000000000000000000..d6ce9bf0df1cd87465fa3998d31c6a6c9d01ba9b --- /dev/null +++ b/common.cmake @@ -0,0 +1,30 @@ +# Source based off https://git.soton.ac.uk/sts1u16/iclib/ -> common.cmake +# paths + +set(CMAKE_TOOLCHAIN_FILE + ${CMAKE_CURRENT_LIST_DIR}/msp430-toolchain.cmake) + +# Force compiler detection so we can set up flags +enable_language(C) + +include_directories($ENV{MSP_GCC_ROOT}/include) # MSP430 headers +add_compile_options( + -std=c99 + -mcpu=msp430 + -mmcu=msp430fr5994 + -msmall + -mhwmult=none + -fno-common + -Wall + ) + +# Linker scripts +#set(CMAKE_EXE_LINKER_FLAGS +# "${CMAKE_EXE_LINKER_FLAGS} -T ${CMAKE_SOURCE_DIR}/../msp430fr5994.ld ") + +# Add to search path for linker scripts (xx_symbols.ld, included by main linker script) +link_directories( + $ENV{MSP430_GCC_ROOT}/include + $ENV{MSP430_GCC_ROOT}/msp430-elf/lib/430/ + $ENV{MSP430_GCC_ROOT}/lib/gcc/msp430-elf/7.3.1/430 + ) diff --git a/msp430-toolchain.cmake b/msp430-toolchain.cmake new file mode 100644 index 0000000000000000000000000000000000000000..b90ba6c45dd4b5d70d5397e3bc1a1a8d348cabd9 --- /dev/null +++ b/msp430-toolchain.cmake @@ -0,0 +1,33 @@ +# Toolchain cmake file for msp430-gcc toolchain +# See https://git.soton.ac.uk/sts1u16/iclib/tree/fused-dev + +INCLUDE(CMakeForceCompiler) + +# Find toolchain programs +find_program(MSP430-GCC msp430-elf-gcc $ENV{MSP430_GCC_ROOT}/bin) +find_program(MSP430-GXX msp430-elf-g++ $ENV{MSP430_GCC_ROOT}/bin) +find_program(MSP430-OBJCOPY msp430-elf-objcopy $ENV{MSP430_GCC_ROOT}/bin) + # find_program(MSP430-SIZE msp430-elf-size $ENV{MSP430_GCC_ROOT}/bin) # No size function on my system +find_program(MSP430-OBJDUMP msp430-elf-objdump $ENV{MSP430_GCC_ROOT}/bin) +find_program(MSPDEBUG mspdebug) + +# Define toolchain +set(CMAKE_SYSTEM_NAME Generic) +set(CMAKE_ASM_COMPILER ${MSP430-GCC} CACHE INTERNAL "") +set(CMAKE_C_COMPILER ${MSP430-GCC} CACHE INTERNAL "") +set(CMAKE_CXX_COMPIER ${MSP430-GXX} CACHE INTERNAL "") + +# Prevent CMake from testing the compilers +set(CMAKE_C_COMPILER_WORKS 1 CACHE INTERNAL "") +set(CMAKE_CXX_COMPILER_WORKS 1 CACHE INTERNAL "") + +#Debug by default +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build." FORCE) +endif(NOT CMAKE_BUILD_TYPE) + +function(add_msp_upload EXECUTABLE) + add_custom_target(upload_${EXECUTABLE} + COMMAND ${MSPDEBUG} tilib "prog ${EXECUTABLE}.elf" + DEPENDS ${EXECUTABLE}) +endfunction(add_msp_upload) diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..ccf3db33d050df76dc5a5057ce6eddc3db3f7d99 --- /dev/null +++ b/source/CMakeLists.txt @@ -0,0 +1,24 @@ +cmake_minimum_required(VERSION 2.8) + +include(${CMAKE_CURRENT_LIST_DIR}/../common.cmake) + +add_subdirectory(lib) + +project(radio_power_test) +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + +include_directories( + ${MSP_GCC_ROOT}/include + ${CMAKE_SOURCE_DIR} + ) +link_directories( + ${MSP_GCC_ROOT}/include + ) + + +add_executable(${PROJECT_NAME}_rxer test/main_txer.c) +target_link_libraries(${PROJECT_NAME}_rxer hal_mcu ) + +add_executable(${PROJECT_NAME}_txer test/main_rxer.c) +target_compile_definitions(${PROJECT_NAME}_rxer PUBLIC TXER) +target_link_libraries(${PROJECT_NAME}_txer hibernus zeta util spi) diff --git a/source/lib/CMakeLists.txt b/source/lib/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..6d3bec45f6ab70ad090acf9380044adf17f91924 --- /dev/null +++ b/source/lib/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 2.8) + +include(${CMAKE_SOURCE_DIR}/../common.cmake) + +add_subdirectory(hal_mcu) +add_subdirectory(radio_drv) diff --git a/source/lib/hal_mcu/CMakeLists.txt b/source/lib/hal_mcu/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..b93e14c24af30ec462678cdc56560351767cf1e6 --- /dev/null +++ b/source/lib/hal_mcu/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 2.8) + +include(${CMAKE_SOURCE_DIR}/../common.cmake) + +add_library( + hal_mcu + STATIC + hal_f2_timerA0.c + hal_f2_timerB0.c + hal_f5_timerB0.c + hal_mcu.c + ) diff --git a/source/lib/hal_mcu/hal_mcu.c b/source/lib/hal_mcu/hal_mcu.c index b010c542a2a29ddd7d2244caacd25f2d08ded35b..ed39e749b90f8f28cb543ee48c333f196d9aafaa 100644 --- a/source/lib/hal_mcu/hal_mcu.c +++ b/source/lib/hal_mcu/hal_mcu.c @@ -36,7 +36,7 @@ *******************************************************************************/ #include "msp430.h" -#include "../hal_spi/hal_spi_rf.h" +#include "../radio_drv/hal_spi_rf.h" #if defined (__MSP430F5438A__) /******************************************************************************* diff --git a/source/lib/radio_drv/CMakeLists.txt b/source/lib/radio_drv/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..c900444a23d6699819e91240c150eebd7e356c72 --- /dev/null +++ b/source/lib/radio_drv/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 2.8) + +include(${CMAKE_SOURCE_DIR}/../common.cmake) + + +add_library( + radio_drv + STATIC + hal_spi_rf.c + cc1190_drv/cc1190_drv.c + cc1101_drv/cc1101_drv.c + cc1101_drv/cc1101_utils.c + cc112x_drv/cc112x_drv.c + cc112x_drv/cc112x_utils.c + ) diff --git a/source/test/main_rxer.c b/source/test/main_rxer.c new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/source/test/main_txer.c b/source/test/main_txer.c new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391