Skip to content

Commit 216776f

Browse files
committed
boards: Tock: Initial commit of Tock support
Signed-off-by: Alistair Francis <[email protected]>
1 parent 7f25f7a commit 216776f

File tree

16 files changed

+1399
-1
lines changed

16 files changed

+1399
-1
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ The [Porting Guide](https://stackforce.github.io/LoRaMac-doc/LoRaMac-doc-v4.5.1/
6262
* SAMR34
6363
* [SAMR34 platform documentation](doc/SAMR34-platform.md)
6464

65+
* Tock
66+
* [Tock](doc/Tock.md)
67+
6568
## Getting Started
6669

6770
### Prerequisites

cmake/tock.cmake

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
##
2+
## ______ _
3+
## / _____) _ | |
4+
## ( (____ _____ ____ _| |_ _____ ____| |__
5+
## \____ \| ___ | (_ _) ___ |/ ___) _ \
6+
## _____) ) ____| | | || |_| ____( (___| | | |
7+
## (______/|_____)_|_|_| \__)_____)\____)_| |_|
8+
## (C)2013-2017 Semtech
9+
## ___ _____ _ ___ _ _____ ___ ___ ___ ___
10+
## / __|_ _/_\ / __| |/ / __/ _ \| _ \/ __| __|
11+
## \__ \ | |/ _ \ (__| ' <| _| (_) | / (__| _|
12+
## |___/ |_/_/ \_\___|_|\_\_| \___/|_|_\\___|___|
13+
## embedded.connectivity.solutions.==============
14+
##
15+
## License: Revised BSD License, see LICENSE.TXT file included in the project
16+
## Authors: Johannes Bruder ( STACKFORCE ), Miguel Luis ( Semtech )
17+
##
18+
##
19+
## STM32L1 target specific CMake file
20+
##
21+
22+
if(NOT DEFINED LINKER_SCRIPT)
23+
message(FATAL_ERROR "No linker script defined")
24+
endif(NOT DEFINED LINKER_SCRIPT)
25+
message("Linker script: ${LINKER_SCRIPT}")
26+
27+
28+
#---------------------------------------------------------------------------------------
29+
# Set compiler/linker flags
30+
#---------------------------------------------------------------------------------------
31+
32+
set(STACK_SIZE 2048)
33+
set(APP_HEAP_SIZE 1024)
34+
set(KERNEL_HEAP_SIZE 1024)
35+
36+
# Object build options
37+
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")
38+
39+
set(CMAKE_C_FLAGS "${OBJECT_GEN_FLAGS} -std=gnu99 " CACHE INTERNAL "C Compiler options")
40+
set(CMAKE_CXX_FLAGS "${OBJECT_GEN_FLAGS} -std=c++11 " CACHE INTERNAL "C++ Compiler options")
41+
set(CMAKE_ASM_FLAGS "${OBJECT_GEN_FLAGS} -x assembler-with-cpp " CACHE INTERNAL "ASM Compiler options")
42+
43+
# Linker flags
44+
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--gc-sections --specs=nano.specs --specs=nosys.specs -mthumb -g2 -mcpu=cortex-m4 -mabi=aapcs -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")

doc/Tock.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# TockNAMote72 platform support documents
2+
3+
This is support for the [Tock](https://github.com/tock/tock) operating system,
4+
allowing the library to run as a userspace application on Tock boards.

src/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,17 @@ elseif(BOARD STREQUAL B-L072Z-LRWAN1)
183183

184184
# Configure radio
185185
set(RADIO sx1276 CACHE INTERNAL "Radio sx1276 selected")
186+
187+
elseif(BOARD STREQUAL Tock)
188+
# Configure toolchain for Tock
189+
set(LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/boards/Tock/libtock-c/userland_generic.ld)
190+
include(tock)
191+
192+
# Build platform specific board implementation
193+
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/boards/Tock)
194+
195+
# Configure radio
196+
set(RADIO sx126x CACHE INTERNAL "Radio sx126x selected")
186197
endif()
187198

188199
#---------------------------------------------------------------------------------------

src/apps/ping-pong/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,12 @@ target_include_directories(${PROJECT_NAME} PUBLIC
8383

8484
set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 11)
8585

86-
target_link_libraries(${PROJECT_NAME} m)
86+
target_link_libraries(${PROJECT_NAME}
87+
${CMAKE_CURRENT_SOURCE_DIR}/../../boards/Tock/libtock-c/newlib/cortex-m/v7-m/libc.a
88+
${CMAKE_CURRENT_SOURCE_DIR}/../../boards/Tock/libtock-c/newlib/cortex-m/v7-m/libm.a
89+
${CMAKE_CURRENT_SOURCE_DIR}/../../boards/Tock/libtock-c/libtock/build/cortex-m4/libtock.a
90+
)
91+
8792

8893
#---------------------------------------------------------------------------------------
8994
# Debugging and Binutils

0 commit comments

Comments
 (0)