examples/NonArduino/Tock: Support RISC-V and bump libtock-c (#1082)
* examples/NonArduino/Tock: Support building for RISC-V Signed-off-by: Alistair Francis <alistair@alistair23.me> * examples/NonArduino/Tock: Update to newer libtock-c Signed-off-by: Alistair Francis <alistair@alistair23.me> --------- Signed-off-by: Alistair Francis <alistair@alistair23.me>
This commit is contained in:
parent
1b2b8bd67b
commit
2f85326fec
10 changed files with 174 additions and 111 deletions
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
|
@ -226,7 +226,7 @@ jobs:
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get install -y gcc-arm-none-eabi
|
sudo apt-get install -y gcc-arm-none-eabi gcc-riscv64-unknown-elf
|
||||||
cargo install elf2tab
|
cargo install elf2tab
|
||||||
|
|
||||||
- name: Build the example
|
- name: Build the example
|
||||||
|
|
2
examples/NonArduino/Tock/.gitignore
vendored
2
examples/NonArduino/Tock/.gitignore
vendored
|
@ -1,2 +1,2 @@
|
||||||
build/
|
build-*
|
||||||
TockApp.tab
|
TockApp.tab
|
||||||
|
|
|
@ -29,7 +29,11 @@ project(tock-sx1261)
|
||||||
|
|
||||||
set(LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/libtock-c/userland_generic.ld)
|
set(LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/libtock-c/userland_generic.ld)
|
||||||
|
|
||||||
include("tock.cmake")
|
if (RISCV_BUILD)
|
||||||
|
include("tock-riscv.cmake")
|
||||||
|
else()
|
||||||
|
include("tock-arm.cmake")
|
||||||
|
endif()
|
||||||
|
|
||||||
# when using debuggers such as gdb, the following line can be used
|
# when using debuggers such as gdb, the following line can be used
|
||||||
#set(CMAKE_BUILD_TYPE Debug)
|
#set(CMAKE_BUILD_TYPE Debug)
|
||||||
|
@ -43,17 +47,61 @@ add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../../../../RadioLib" "${CMAKE_CUR
|
||||||
add_executable(${PROJECT_NAME} main.cpp)
|
add_executable(${PROJECT_NAME} main.cpp)
|
||||||
|
|
||||||
# link with RadioLib and libtock-c
|
# link with RadioLib and libtock-c
|
||||||
target_link_libraries(${PROJECT_NAME} PUBLIC
|
# The build system for libtock-c is a bit odd and the version of libraries
|
||||||
|
# built changes based on compiler version.
|
||||||
|
if (RISCV_BUILD)
|
||||||
|
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/libtock-c/lib/libtock-libc++-13.2.0")
|
||||||
|
target_link_libraries(${PROJECT_NAME} PUBLIC
|
||||||
|
RadioLib
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/libtock-c/libtock/build/rv32imc/libtock.a
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/libtock-c/lib/libtock-libc++-13.2.0/riscv/lib/gcc/riscv64-unknown-elf/13.2.0/rv32i/ilp32/libgcc.a
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/libtock-c/lib/libtock-libc++-13.2.0/riscv/riscv64-unknown-elf/lib/rv32i/ilp32/libstdc++.a
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/libtock-c/lib/libtock-newlib-4.3.0.20230120/riscv/riscv64-unknown-elf/lib/rv32i/ilp32/libc.a
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/libtock-c/lib/libtock-newlib-4.3.0.20230120/riscv/riscv64-unknown-elf/lib/rv32i/ilp32/libm.a
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(RadioLib AFTER PUBLIC
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/libtock-c/lib/libtock-newlib-4.3.0.20230120/riscv/riscv64-unknown-elf/include/
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
target_link_libraries(${PROJECT_NAME} PUBLIC
|
||||||
|
RadioLib
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/libtock-c/libtock/build/rv32imc/libtock.a
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/libtock-c/lib/libtock-libc++-10.5.0/riscv/lib/gcc/riscv64-unknown-elf/10.5.0/rv32i/ilp32/libgcc.a
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/libtock-c/lib/libtock-libc++-10.5.0/riscv/riscv64-unknown-elf/lib/rv32i/ilp32/libstdc++.a
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/libtock-c/lib/libtock-newlib-4.2.0.20211231/riscv/riscv64-unknown-elf/lib/rv32i/ilp32/libc.a
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/libtock-c/lib/libtock-newlib-4.2.0.20211231/riscv/riscv64-unknown-elf/lib/rv32i/ilp32/libm.a
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(RadioLib AFTER PUBLIC
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/libtock-c/lib/libtock-newlib-4.2.0.20211231/riscv/riscv64-unknown-elf/include/
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/libtock-c/lib/libtock-libc++-13.2.0")
|
||||||
|
target_link_libraries(${PROJECT_NAME} PUBLIC
|
||||||
RadioLib
|
RadioLib
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/libtock-c/libtock/build/cortex-m4/libtock.a
|
${CMAKE_CURRENT_SOURCE_DIR}/libtock-c/libtock/build/cortex-m4/libtock.a
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/libtock-c/libc++/cortex-m/libgcc.a
|
${CMAKE_CURRENT_SOURCE_DIR}/libtock-c/lib/libtock-libc++-13.2.0/arm/lib/gcc/arm-none-eabi/13.2.0/libgcc.a
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/libtock-c/libc++/cortex-m/libstdc++.a
|
${CMAKE_CURRENT_SOURCE_DIR}/libtock-c/lib/libtock-libc++-13.2.0/arm/arm-none-eabi/lib/libstdc++.a
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/libtock-c/newlib/cortex-m/v7-m/libc.a
|
${CMAKE_CURRENT_SOURCE_DIR}/libtock-c/lib/libtock-newlib-4.3.0.20230120/arm/arm-none-eabi/lib/libc.a
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/libtock-c/newlib/cortex-m/v7-m/libm.a
|
${CMAKE_CURRENT_SOURCE_DIR}/libtock-c/lib/libtock-newlib-4.3.0.20230120/arm/arm-none-eabi/lib/libm.a
|
||||||
)
|
)
|
||||||
|
else()
|
||||||
|
target_link_libraries(${PROJECT_NAME} PUBLIC
|
||||||
|
RadioLib
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/libtock-c/libtock/build/cortex-m4/libtock.a
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/libtock-c/lib/libtock-libc++-10.5.0/arm/lib/gcc/arm-none-eabi/10.5.0/libgcc.a
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/libtock-c/lib/libtock-libc++-10.5.0/arm/arm-none-eabi/lib/libstdc++.a
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/libtock-c/lib/libtock-newlib-4.2.0.20211231/arm/arm-none-eabi/lib/libc.a
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/libtock-c/lib/libtock-newlib-4.2.0.20211231/arm/arm-none-eabi/lib/libm.a
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
target_include_directories(${PROJECT_NAME} PUBLIC
|
target_include_directories(${PROJECT_NAME} PUBLIC
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/libtock-c
|
${CMAKE_CURRENT_SOURCE_DIR}/libtock-c
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,10 @@ This has been tested on the
|
||||||
but will work on any LoRa compatible Tock board (currently only the
|
but will work on any LoRa compatible Tock board (currently only the
|
||||||
expLoRaBLE board).
|
expLoRaBLE board).
|
||||||
|
|
||||||
|
libtock-c by default is bulit for RISC-V and ARM. RadioLib is also built
|
||||||
|
for both architectures by default. You can skip the RISC-V RadioLib build
|
||||||
|
by setting the `SKIP_RISCV` varaible.
|
||||||
|
|
||||||
The RadioLib example can be built with:
|
The RadioLib example can be built with:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
|
@ -24,5 +28,5 @@ $ ./build.sh
|
||||||
Then in the Tock repo you can flash the kernel and app with:
|
Then in the Tock repo you can flash the kernel and app with:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ make flash; APP=RadioLib/examples/NonArduino/Tock/build/tock-sx1261.tbf make flash-app
|
$ make flash; APP=RadioLib/examples/NonArduino/Tock/build-arm/tock-sx1261.tbf make flash-app
|
||||||
```
|
```
|
||||||
|
|
|
@ -1,20 +1,30 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
rm -rf ./build
|
rm -rf ./build-*
|
||||||
|
|
||||||
cd libtock-c/libtock
|
cd libtock-c/examples/cxx_hello
|
||||||
make -j4
|
make -j4
|
||||||
cd ../../
|
cd ../../../
|
||||||
|
|
||||||
mkdir -p build
|
mkdir -p build-arm
|
||||||
cd build
|
cd build-arm
|
||||||
|
|
||||||
cmake -G "CodeBlocks - Unix Makefiles" ..
|
cmake -G "CodeBlocks - Unix Makefiles" ..
|
||||||
make -j4
|
make -j4
|
||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
|
if ! env | grep SKIP_RISCV; then
|
||||||
|
mkdir -p build-riscv
|
||||||
|
cd build-riscv
|
||||||
|
|
||||||
|
cmake -G "CodeBlocks - Unix Makefiles" -DRISCV_BUILD=1 ..
|
||||||
|
make -j4
|
||||||
|
|
||||||
|
cd ..
|
||||||
|
fi
|
||||||
|
|
||||||
elf2tab -n radio-lib --stack 4096 --app-heap 2048 --kernel-heap 2048 \
|
elf2tab -n radio-lib --stack 4096 --app-heap 2048 --kernel-heap 2048 \
|
||||||
--kernel-major 2 --kernel-minor 1 \
|
--kernel-major 2 --kernel-minor 1 \
|
||||||
-v ./build/tock-sx1261
|
-v ./build-arm/tock-sx1261
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 1c1f4c0810aa0fbd50aa91a11aaa7c05d2abb1bc
|
Subproject commit 44bf89c545953d8859faf101d4b4a4b6a151fe6c
|
|
@ -25,8 +25,6 @@
|
||||||
# This is copied from https://github.com/Lora-net/LoRaMac-node/pull/1390
|
# This is copied from https://github.com/Lora-net/LoRaMac-node/pull/1390
|
||||||
# and has been relicensed by the original author
|
# and has been relicensed by the original author
|
||||||
|
|
||||||
include("toolchain-arm-none-eabi.cmake")
|
|
||||||
|
|
||||||
if(NOT DEFINED LINKER_SCRIPT)
|
if(NOT DEFINED LINKER_SCRIPT)
|
||||||
message(FATAL_ERROR "No linker script defined")
|
message(FATAL_ERROR "No linker script defined")
|
||||||
endif(NOT DEFINED LINKER_SCRIPT)
|
endif(NOT DEFINED LINKER_SCRIPT)
|
||||||
|
@ -40,6 +38,22 @@ set(STACK_SIZE 4096)
|
||||||
set(APP_HEAP_SIZE 2048)
|
set(APP_HEAP_SIZE 2048)
|
||||||
set(KERNEL_HEAP_SIZE 2048)
|
set(KERNEL_HEAP_SIZE 2048)
|
||||||
|
|
||||||
|
set(TOOLCHAIN arm-none-eabi)
|
||||||
|
|
||||||
|
find_program(TOOLCHAIN_PREFIX ${TOOLCHAIN}-gcc NO_CACHE)
|
||||||
|
get_filename_component(TOOLCHAIN_PREFIX ${TOOLCHAIN_PREFIX} DIRECTORY)
|
||||||
|
|
||||||
|
set(TOOLCHAIN_BIN_DIR ${TOOLCHAIN_PREFIX}/../bin)
|
||||||
|
set(TOOLCHAIN_INC_DIR ${TOOLCHAIN_PREFIX}/../${TOOLCHAIN}/include)
|
||||||
|
set(TOOLCHAIN_LIB_DIR ${TOOLCHAIN_PREFIX}/../${TOOLCHAIN}/lib)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------------
|
||||||
|
# Set compilers
|
||||||
|
#---------------------------------------------------------------------------------------
|
||||||
|
set(CMAKE_C_COMPILER ${TOOLCHAIN_BIN_DIR}/${TOOLCHAIN}-gcc CACHE INTERNAL "C Compiler")
|
||||||
|
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_BIN_DIR}/${TOOLCHAIN}-g++ CACHE INTERNAL "C++ Compiler")
|
||||||
|
set(CMAKE_ASM_COMPILER ${TOOLCHAIN_BIN_DIR}/${TOOLCHAIN}-gcc CACHE INTERNAL "ASM Compiler")
|
||||||
|
|
||||||
# Object build options
|
# Object build options
|
||||||
set(OBJECT_GEN_FLAGS "-mthumb -g2 -fno-builtin -mcpu=cortex-m4 -Wall -Wextra -pedantic -Wno-unused-parameter -ffunction-sections -fdata-sections -fomit-frame-pointer -mabi=aapcs -fno-unroll-loops -ffast-math -ftree-vectorize -frecord-gcc-switches -gdwarf-2 -Os -fdata-sections -ffunction-sections -fstack-usage -Wl,--emit-relocs -fPIC -mthumb -mfloat-abi=soft -msingle-pic-base -mpic-register=r9 -mno-pic-data-is-text-relative -D__TOCK__ -DSVCALL_AS_NORMAL_FUNCTION -DSOFTDEVICE_s130")
|
set(OBJECT_GEN_FLAGS "-mthumb -g2 -fno-builtin -mcpu=cortex-m4 -Wall -Wextra -pedantic -Wno-unused-parameter -ffunction-sections -fdata-sections -fomit-frame-pointer -mabi=aapcs -fno-unroll-loops -ffast-math -ftree-vectorize -frecord-gcc-switches -gdwarf-2 -Os -fdata-sections -ffunction-sections -fstack-usage -Wl,--emit-relocs -fPIC -mthumb -mfloat-abi=soft -msingle-pic-base -mpic-register=r9 -mno-pic-data-is-text-relative -D__TOCK__ -DSVCALL_AS_NORMAL_FUNCTION -DSOFTDEVICE_s130")
|
||||||
|
|
76
examples/NonArduino/Tock/tock-riscv.cmake
Normal file
76
examples/NonArduino/Tock/tock-riscv.cmake
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
# Tock target specific CMake file
|
||||||
|
#
|
||||||
|
# Licensed under the MIT License
|
||||||
|
#
|
||||||
|
# Copyright (c) 2023 Alistair Francis <alistair@alistair23.me>
|
||||||
|
#
|
||||||
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
# of this software and associated documentation files (the "Software"), to deal
|
||||||
|
# in the Software without restriction, including without limitation the rights
|
||||||
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
# copies of the Software, and to permit persons to whom the Software is
|
||||||
|
# furnished to do so, subject to the following conditions:
|
||||||
|
#
|
||||||
|
# The above copyright notice and this permission notice shall be included in all
|
||||||
|
# copies or substantial portions of the Software.
|
||||||
|
#
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
# SOFTWARE.
|
||||||
|
#
|
||||||
|
# This is copied from https://github.com/Lora-net/LoRaMac-node/pull/1390
|
||||||
|
# and has been relicensed by the original author
|
||||||
|
|
||||||
|
if(NOT DEFINED LINKER_SCRIPT)
|
||||||
|
message(FATAL_ERROR "No linker script defined")
|
||||||
|
endif(NOT DEFINED LINKER_SCRIPT)
|
||||||
|
message("Linker script: ${LINKER_SCRIPT}")
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------------
|
||||||
|
# Set compiler/linker flags
|
||||||
|
#---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
set(STACK_SIZE 4096)
|
||||||
|
set(APP_HEAP_SIZE 2048)
|
||||||
|
set(KERNEL_HEAP_SIZE 2048)
|
||||||
|
|
||||||
|
find_program(TOOLCHAIN
|
||||||
|
NAMES
|
||||||
|
riscv64-none-elf-gcc
|
||||||
|
riscv32-none-elf-gcc
|
||||||
|
riscv64-elf-gcc
|
||||||
|
riscv32-unknown-elf-gcc
|
||||||
|
riscv64-unknown-elf-gcc
|
||||||
|
riscv64-unknown-elf-clang
|
||||||
|
riscv32-unknown-elf-clang
|
||||||
|
NO_CACHE)
|
||||||
|
|
||||||
|
get_filename_component(TOOLCHAIN_PREFIX ${TOOLCHAIN} DIRECTORY)
|
||||||
|
|
||||||
|
get_filename_component(TOOLCHAIN ${TOOLCHAIN} NAME)
|
||||||
|
string(REPLACE "-gcc" "" TOOLCHAIN ${TOOLCHAIN})
|
||||||
|
|
||||||
|
set(TOOLCHAIN_BIN_DIR ${TOOLCHAIN_PREFIX}/../bin)
|
||||||
|
set(TOOLCHAIN_INC_DIR ${TOOLCHAIN_PREFIX}/../${TOOLCHAIN}/include)
|
||||||
|
set(TOOLCHAIN_LIB_DIR ${TOOLCHAIN_PREFIX}/../${TOOLCHAIN}/lib)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------------
|
||||||
|
# Set compilers
|
||||||
|
#---------------------------------------------------------------------------------------
|
||||||
|
set(CMAKE_C_COMPILER ${TOOLCHAIN_BIN_DIR}/${TOOLCHAIN}-gcc CACHE INTERNAL "C Compiler")
|
||||||
|
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_BIN_DIR}/${TOOLCHAIN}-g++ CACHE INTERNAL "C++ Compiler")
|
||||||
|
set(CMAKE_ASM_COMPILER ${TOOLCHAIN_BIN_DIR}/${TOOLCHAIN}-gcc CACHE INTERNAL "ASM Compiler")
|
||||||
|
|
||||||
|
# Object build options
|
||||||
|
set(OBJECT_GEN_FLAGS "-march=rv32i -mabi=ilp32 -mcmodel=medlow -g2 -fno-builtin -Wall -Wextra -pedantic -Wno-unused-parameter -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-unroll-loops -ffast-math -ftree-vectorize -frecord-gcc-switches -gdwarf-2 -Os -fdata-sections -ffunction-sections -fstack-usage -Wl,--emit-relocs -D__TOCK__ -DSVCALL_AS_NORMAL_FUNCTION -DSOFTDEVICE_s130")
|
||||||
|
|
||||||
|
set(CMAKE_C_FLAGS "${OBJECT_GEN_FLAGS} -std=gnu99 " CACHE INTERNAL "C Compiler options")
|
||||||
|
set(CMAKE_CXX_FLAGS "${OBJECT_GEN_FLAGS} -std=c++20 " CACHE INTERNAL "C++ Compiler options")
|
||||||
|
set(CMAKE_ASM_FLAGS "${OBJECT_GEN_FLAGS} -x assembler-with-cpp " CACHE INTERNAL "ASM Compiler options")
|
||||||
|
|
||||||
|
# Linker flags
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--gc-sections -march=rv32i -mabi=ilp32 -mcmodel=medlow -T${LINKER_SCRIPT} -Wl,-Map=${CMAKE_PROJECT_NAME}.map -Xlinker --defsym=STACK_SIZE=${STACK_SIZE} -Xlinker --defsym=APP_HEAP_SIZE=${APP_HEAP_SIZE} -Xlinker --defsym=KERNEL_HEAP_SIZE=${KERNEL_HEAP_SIZE} -nostdlib -Wl,--start-group" CACHE INTERNAL "Linker options")
|
|
@ -1,90 +0,0 @@
|
||||||
# Arm specific CMake file
|
|
||||||
#
|
|
||||||
# This is copied from:
|
|
||||||
# https://github.com/Lora-net/LoRaMac-node/blob/2bf36bde72f68257eb96b5c00900619546bedca8/cmake/toolchain-arm-none-eabi.cmake
|
|
||||||
#
|
|
||||||
# The below file is licensed as Revised BSD License
|
|
||||||
# See https://github.com/Lora-net/LoRaMac-node/blob/master/LICENSE for details
|
|
||||||
|
|
||||||
##
|
|
||||||
## ______ _
|
|
||||||
## / _____) _ | |
|
|
||||||
## ( (____ _____ ____ _| |_ _____ ____| |__
|
|
||||||
## \____ \| ___ | (_ _) ___ |/ ___) _ \
|
|
||||||
## _____) ) ____| | | || |_| ____( (___| | | |
|
|
||||||
## (______/|_____)_|_|_| \__)_____)\____)_| |_|
|
|
||||||
## (C)2013-2017 Semtech
|
|
||||||
## ___ _____ _ ___ _ _____ ___ ___ ___ ___
|
|
||||||
## / __|_ _/_\ / __| |/ / __/ _ \| _ \/ __| __|
|
|
||||||
## \__ \ | |/ _ \ (__| ' <| _| (_) | / (__| _|
|
|
||||||
## |___/ |_/_/ \_\___|_|\_\_| \___/|_|_\\___|___|
|
|
||||||
## embedded.connectivity.solutions.==============
|
|
||||||
##
|
|
||||||
## License: Revised BSD License, see LICENSE.TXT file included in the project
|
|
||||||
## Authors: Johannes Bruder ( STACKFORCE ), Miguel Luis ( Semtech )
|
|
||||||
##
|
|
||||||
##
|
|
||||||
## CMake arm-none-eabi toolchain file
|
|
||||||
##
|
|
||||||
|
|
||||||
# Append current directory to CMAKE_MODULE_PATH for making device specific cmake modules visible
|
|
||||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
|
|
||||||
|
|
||||||
# Target definition
|
|
||||||
set(CMAKE_SYSTEM_NAME Generic)
|
|
||||||
set(CMAKE_SYSTEM_PROCESSOR ARM)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
# Set toolchain paths
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
set(TOOLCHAIN arm-none-eabi)
|
|
||||||
|
|
||||||
find_program(TOOLCHAIN_PREFIX ${TOOLCHAIN}-gcc NO_CACHE)
|
|
||||||
get_filename_component(TOOLCHAIN_PREFIX ${TOOLCHAIN_PREFIX} DIRECTORY)
|
|
||||||
|
|
||||||
set(TOOLCHAIN_BIN_DIR ${TOOLCHAIN_PREFIX}/../bin)
|
|
||||||
set(TOOLCHAIN_INC_DIR ${TOOLCHAIN_PREFIX}/../${TOOLCHAIN}/include)
|
|
||||||
set(TOOLCHAIN_LIB_DIR ${TOOLCHAIN_PREFIX}/../${TOOLCHAIN}/lib)
|
|
||||||
|
|
||||||
# Set system depended extensions
|
|
||||||
if(WIN32)
|
|
||||||
set(TOOLCHAIN_EXT ".exe" )
|
|
||||||
else()
|
|
||||||
set(TOOLCHAIN_EXT "" )
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Perform compiler test with static library
|
|
||||||
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
# Preset some general GCC Options
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# Options for DEBUG build
|
|
||||||
# -Og enables optimizations that do not interfere with debugging
|
|
||||||
# -g produce debugging information in the operating system's native format
|
|
||||||
set(CMAKE_C_FLAGS_DEBUG "-Og -g -DDEBUG" CACHE INTERNAL "C Compiler options for debug build type")
|
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "-Og -g -DDEBUG" CACHE INTERNAL "C++ Compiler options for debug build type")
|
|
||||||
set(CMAKE_ASM_FLAGS_DEBUG "-g" CACHE INTERNAL "ASM Compiler options for debug build type")
|
|
||||||
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "" CACHE INTERNAL "Linker options for debug build type")
|
|
||||||
|
|
||||||
# Options for RELEASE build
|
|
||||||
# -Os Optimize for size. -Os enables all -O2 optimizations
|
|
||||||
set(CMAKE_C_FLAGS_RELEASE "-Os" CACHE INTERNAL "C Compiler options for release build type")
|
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "-Os" CACHE INTERNAL "C++ Compiler options for release build type")
|
|
||||||
set(CMAKE_ASM_FLAGS_RELEASE "" CACHE INTERNAL "ASM Compiler options for release build type")
|
|
||||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "" CACHE INTERNAL "Linker options for release build type")
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
# Set compilers
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
set(CMAKE_C_COMPILER ${TOOLCHAIN_BIN_DIR}/${TOOLCHAIN}-gcc${TOOLCHAIN_EXT} CACHE INTERNAL "C Compiler")
|
|
||||||
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_BIN_DIR}/${TOOLCHAIN}-g++${TOOLCHAIN_EXT} CACHE INTERNAL "C++ Compiler")
|
|
||||||
set(CMAKE_ASM_COMPILER ${TOOLCHAIN_BIN_DIR}/${TOOLCHAIN}-gcc${TOOLCHAIN_EXT} CACHE INTERNAL "ASM Compiler")
|
|
||||||
|
|
||||||
set(CMAKE_FIND_ROOT_PATH ${TOOLCHAIN_PREFIX}/${${TOOLCHAIN}} ${CMAKE_PREFIX_PATH})
|
|
||||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
|
||||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
|
||||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
|
||||||
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "FSK4.h"
|
#include "FSK4.h"
|
||||||
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#if !RADIOLIB_EXCLUDE_FSK4
|
#if !RADIOLIB_EXCLUDE_FSK4
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue