-
Notifications
You must be signed in to change notification settings - Fork 409
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
examples/NonArduino/Tock: Support RISC-V and bump libtock-c (#1082)
* examples/NonArduino/Tock: Support building for RISC-V Signed-off-by: Alistair Francis <[email protected]> * examples/NonArduino/Tock: Update to newer libtock-c Signed-off-by: Alistair Francis <[email protected]> --------- Signed-off-by: Alistair Francis <[email protected]>
- Loading branch information
1 parent
1b2b8bd
commit 2f85326
Showing
10 changed files
with
174 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
build/ | ||
build-* | ||
TockApp.tab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,30 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
rm -rf ./build | ||
rm -rf ./build-* | ||
|
||
cd libtock-c/libtock | ||
cd libtock-c/examples/cxx_hello | ||
make -j4 | ||
cd ../../ | ||
cd ../../../ | ||
|
||
mkdir -p build | ||
cd build | ||
mkdir -p build-arm | ||
cd build-arm | ||
|
||
cmake -G "CodeBlocks - Unix Makefiles" .. | ||
make -j4 | ||
|
||
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 \ | ||
--kernel-major 2 --kernel-minor 1 \ | ||
-v ./build/tock-sx1261 | ||
-v ./build-arm/tock-sx1261 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# Tock target specific CMake file | ||
# | ||
# Licensed under the MIT License | ||
# | ||
# Copyright (c) 2023 Alistair Francis <[email protected]> | ||
# | ||
# 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") |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
#include "FSK4.h" | ||
#include <stdlib.h> | ||
#include <math.h> | ||
#if !RADIOLIB_EXCLUDE_FSK4 | ||
|
||
|