aboutsummaryrefslogtreecommitdiff
path: root/lib/chibios/demos/STM32/RT-STM32L476-DISCOVERY-SB_CLIENT2
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chibios/demos/STM32/RT-STM32L476-DISCOVERY-SB_CLIENT2')
-rw-r--r--lib/chibios/demos/STM32/RT-STM32L476-DISCOVERY-SB_CLIENT2/Makefile191
-rw-r--r--lib/chibios/demos/STM32/RT-STM32L476-DISCOVERY-SB_CLIENT2/main.c50
-rw-r--r--lib/chibios/demos/STM32/RT-STM32L476-DISCOVERY-SB_CLIENT2/sandbox.ld33
3 files changed, 274 insertions, 0 deletions
diff --git a/lib/chibios/demos/STM32/RT-STM32L476-DISCOVERY-SB_CLIENT2/Makefile b/lib/chibios/demos/STM32/RT-STM32L476-DISCOVERY-SB_CLIENT2/Makefile
new file mode 100644
index 000000000..6310399f8
--- /dev/null
+++ b/lib/chibios/demos/STM32/RT-STM32L476-DISCOVERY-SB_CLIENT2/Makefile
@@ -0,0 +1,191 @@
1##############################################################################
2# Build global options
3# NOTE: Can be overridden externally.
4#
5
6# Compiler options here.
7ifeq ($(USE_OPT),)
8 USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16
9endif
10
11# C specific options here (added to USE_OPT).
12ifeq ($(USE_COPT),)
13 USE_COPT =
14endif
15
16# C++ specific options here (added to USE_OPT).
17ifeq ($(USE_CPPOPT),)
18 USE_CPPOPT = -fno-rtti
19endif
20
21# Enable this if you want the linker to remove unused code and data.
22ifeq ($(USE_LINK_GC),)
23 USE_LINK_GC = yes
24endif
25
26# Linker extra options here.
27ifeq ($(USE_LDOPT),)
28 USE_LDOPT =
29endif
30
31# Enable this if you want link time optimizations (LTO).
32ifeq ($(USE_LTO),)
33 USE_LTO = yes
34endif
35
36# Enable this if you want to see the full log while compiling.
37ifeq ($(USE_VERBOSE_COMPILE),)
38 USE_VERBOSE_COMPILE = no
39endif
40
41# If enabled, this option makes the build process faster by not compiling
42# modules not used in the current configuration.
43ifeq ($(USE_SMART_BUILD),)
44 USE_SMART_BUILD = yes
45endif
46
47#
48# Build global options
49##############################################################################
50
51##############################################################################
52# Architecture or project specific options
53#
54
55# Stack size to be allocated to the Cortex-M process stack. This stack is
56# the stack used by the main() thread.
57ifeq ($(USE_PROCESS_STACKSIZE),)
58 USE_PROCESS_STACKSIZE = 0x400
59endif
60
61# Stack size to the allocated to the Cortex-M main/exceptions stack. This
62# stack is used for processing interrupts and exceptions.
63ifeq ($(USE_EXCEPTIONS_STACKSIZE),)
64 USE_EXCEPTIONS_STACKSIZE = 0x400
65endif
66
67# Enables the use of FPU (no, softfp, hard).
68ifeq ($(USE_FPU),)
69 USE_FPU = no
70endif
71
72# FPU-related options.
73ifeq ($(USE_FPU_OPT),)
74 USE_FPU_OPT = -mfloat-abi=$(USE_FPU) -mfpu=fpv4-sp-d16
75endif
76
77#
78# Architecture or project specific options
79##############################################################################
80
81##############################################################################
82# Project, target, sources and paths
83#
84
85# Define project name here
86PROJECT = ch
87
88# Target settings.
89MCU = cortex-m4
90
91# Imported source files and paths.
92CHIBIOS := ../../..
93CONFDIR := ./cfg
94BUILDDIR := ./build
95DEPDIR := ./.dep
96
97# Licensing files.
98include $(CHIBIOS)/os/license/license.mk
99# Startup files.
100include $(CHIBIOS)/os/common/startup/ARMCMx-SB/compilers/GCC/mk/startup.mk
101# HAL-OSAL files (optional).
102#include $(CHIBIOS)/os/hal/hal.mk
103#include $(CHIBIOS)/os/hal/ports/STM32/STM32L4xx/platform.mk
104#include $(CHIBIOS)/os/hal/boards/ST_STM32L476_DISCOVERY/board.mk
105#include $(CHIBIOS)/os/hal/osal/rt-nil/osal.mk
106# RTOS files (optional).
107#include $(CHIBIOS)/os/rt/rt.mk
108#include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk
109include $(CHIBIOS)/os/sb/user/sbuser.mk
110# Auto-build files in ./source recursively.
111include $(CHIBIOS)/tools/mk/autobuild.mk
112# Other files (optional).
113#include $(CHIBIOS)/test/lib/test.mk
114#include $(CHIBIOS)/test/rt/rt_test.mk
115#include $(CHIBIOS)/test/oslib/oslib_test.mk
116
117# Define linker script file here.
118LDSCRIPT= ./sandbox.ld
119
120# C sources that can be compiled in ARM or THUMB mode depending on the global
121# setting.
122CSRC = $(ALLCSRC) \
123 $(TESTSRC) \
124 $(CHIBIOS)/os/sb/various/syscalls.c \
125 main.c
126
127# C++ sources that can be compiled in ARM or THUMB mode depending on the global
128# setting.
129CPPSRC = $(ALLCPPSRC)
130
131# List ASM source files here.
132ASMSRC = $(ALLASMSRC)
133
134# List ASM with preprocessor source files here.
135ASMXSRC = $(ALLXASMSRC)
136
137# Inclusion directories.
138INCDIR = $(CONFDIR) $(ALLINC) $(TESTINC)
139
140# Define C warning options here.
141CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes
142
143# Define C++ warning options here.
144CPPWARN = -Wall -Wextra -Wundef
145
146#
147# Project, target, sources and paths
148##############################################################################
149
150##############################################################################
151# Start of user section
152#
153
154# List all user C define here, like -D_DEBUG=1
155UDEFS =
156
157# Define ASM defines here
158UADEFS =
159
160# List all user directories here
161UINCDIR =
162
163# List the user directory to look for the libraries here
164ULIBDIR =
165
166# List all user libraries here
167ULIBS =
168
169#
170# End of user section
171##############################################################################
172
173##############################################################################
174# Common rules
175#
176
177RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk
178include $(RULESPATH)/arm-none-eabi.mk
179include $(RULESPATH)/rules.mk
180
181#
182# Common rules
183##############################################################################
184
185##############################################################################
186# Custom rules
187#
188
189#
190# Custom rules
191##############################################################################
diff --git a/lib/chibios/demos/STM32/RT-STM32L476-DISCOVERY-SB_CLIENT2/main.c b/lib/chibios/demos/STM32/RT-STM32L476-DISCOVERY-SB_CLIENT2/main.c
new file mode 100644
index 000000000..28f417ce1
--- /dev/null
+++ b/lib/chibios/demos/STM32/RT-STM32L476-DISCOVERY-SB_CLIENT2/main.c
@@ -0,0 +1,50 @@
1/*
2 ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15*/
16
17#include <stdint.h>
18#include <stdbool.h>
19#include <stddef.h>
20#include <stdio.h>
21
22#include "sbuser.h"
23
24/*
25 * Application entry point.
26 */
27int main(void) {
28
29 /* API layer initialization.*/
30 sbApiInit();
31
32 /*
33 * Normal main() activity, in this demo it does nothing except
34 * sleeping in a loop.
35 */
36#if 0
37 /* Test for exception on interrupt.*/
38 asm volatile ("mov r0, #64");
39 asm volatile ("mov sp, r0");
40 while (true) {
41 }
42#endif
43 while (true) {
44 msg_t msg = sbMsgWait();
45 printf("#2 Hello World (%u)!!\r\n", (unsigned)msg);
46// sbFileWrite(1U, (const uint8_t *)"#2 Hello World!!\r\n", 15U);
47 sbMsgReply(msg);
48// sbSleepMilliseconds(500);
49 }
50}
diff --git a/lib/chibios/demos/STM32/RT-STM32L476-DISCOVERY-SB_CLIENT2/sandbox.ld b/lib/chibios/demos/STM32/RT-STM32L476-DISCOVERY-SB_CLIENT2/sandbox.ld
new file mode 100644
index 000000000..820e090bc
--- /dev/null
+++ b/lib/chibios/demos/STM32/RT-STM32L476-DISCOVERY-SB_CLIENT2/sandbox.ld
@@ -0,0 +1,33 @@
1/*
2 ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15*/
16
17/*
18 * Sandbox memory setup.
19 */
20MEMORY
21{
22 flash0 (rx) : org = 0x080F8000, len = 32k
23 ram0 (wx) : org = 0x20017000, len = 4k
24}
25
26/* Flash region to be used for exception vectors.*/
27REGION_ALIAS("CODE_SPACE", flash0);
28
29/* RAM region to be used for data.*/
30REGION_ALIAS("DATA_SPACE", ram0);
31
32/* Generic rules inclusion.*/
33INCLUDE rules.ld