• R/O
  • SSH
  • HTTPS

chibios: Commit


Commit MetaInfo

Revisión15643 (tree)
Tiempo2022-05-29 16:03:53
Autorgdisirio

Log Message

Hosted RT compiling, to be tested.

Cambiar Resumen

Diferencia incremental

--- trunk/demos/STM32/RT-STM32G474RE-NUCLEO64-SB_HOST_STATIC/main.c (revision 15642)
+++ trunk/demos/STM32/RT-STM32G474RE-NUCLEO64-SB_HOST_STATIC/main.c (revision 15643)
@@ -220,10 +220,10 @@
220220 MPU_RASR_SIZE_64K |
221221 MPU_RASR_ENABLE);
222222 mpuConfigureRegion(MPU_REGION_1,
223- 0x2001E000U,
223+ 0x20018000U,
224224 MPU_RASR_ATTR_AP_RW_RW |
225225 MPU_RASR_ATTR_CACHEABLE_WB_WA |
226- MPU_RASR_SIZE_8K |
226+ MPU_RASR_SIZE_32K |
227227 MPU_RASR_ENABLE);
228228
229229 /* Starting sandboxed thread 1.*/
--- trunk/demos/various/SB-CLIENT-32k-08078000-4k-2001F000/main.c (revision 15642)
+++ trunk/demos/various/SB-CLIENT-32k-08078000-4k-2001F000/main.c (nonexistent)
@@ -1,40 +0,0 @@
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 <stdio.h>
18-
19-#include "sbuser.h"
20-
21-/*
22- * Application entry point.
23- */
24-int main(void) {
25-
26-#if 0
27- /* Test for exception on interrupt.*/
28- asm volatile ("mov r0, #64");
29- asm volatile ("mov sp, r0");
30- while (true) {
31- }
32-#endif
33- while (true) {
34- msg_t msg = sbMsgWait();
35- printf("#2 Hello World (%u)!!\r\n", (unsigned)msg);
36-// sbFileWrite(1U, (const uint8_t *)"#2 Hello World!!\r\n", 15U);
37- sbMsgReply(msg);
38-// sbSleepMilliseconds(500);
39- }
40-}
--- trunk/demos/various/SB-CLIENT-32k-08078000-4k-2001F000/Makefile (revision 15642)
+++ trunk/demos/various/SB-CLIENT-32k-08078000-4k-2001F000/Makefile (nonexistent)
@@ -1,192 +0,0 @@
1-##############################################################################
2-# Build global options
3-# NOTE: Can be overridden externally.
4-#
5-
6-# Compiler options here.
7-ifeq ($(USE_OPT),)
8- USE_OPT = -O0 -ggdb -fomit-frame-pointer --specs=nano.specs
9-endif
10-
11-# C specific options here (added to USE_OPT).
12-ifeq ($(USE_COPT),)
13- USE_COPT =
14-endif
15-
16-# C++ specific options here (added to USE_OPT).
17-ifeq ($(USE_CPPOPT),)
18- USE_CPPOPT = -fno-rtti
19-endif
20-
21-# Enable this if you want the linker to remove unused code and data.
22-ifeq ($(USE_LINK_GC),)
23- USE_LINK_GC = yes
24-endif
25-
26-# Linker extra options here.
27-ifeq ($(USE_LDOPT),)
28- USE_LDOPT =
29-endif
30-
31-# Enable this if you want link time optimizations (LTO).
32-ifeq ($(USE_LTO),)
33- USE_LTO = yes
34-endif
35-
36-# Enable this if you want to see the full log while compiling.
37-ifeq ($(USE_VERBOSE_COMPILE),)
38- USE_VERBOSE_COMPILE = no
39-endif
40-
41-# If enabled, this option makes the build process faster by not compiling
42-# modules not used in the current configuration.
43-ifeq ($(USE_SMART_BUILD),)
44- USE_SMART_BUILD = yes
45-endif
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.
57-ifeq ($(USE_PROCESS_STACKSIZE),)
58- USE_PROCESS_STACKSIZE = 0x400
59-endif
60-
61-# Stack size to the allocated to the Cortex-M main/exceptions stack. This
62-# stack is used for processing interrupts and exceptions.
63-ifeq ($(USE_EXCEPTIONS_STACKSIZE),)
64- USE_EXCEPTIONS_STACKSIZE = 0x400
65-endif
66-
67-# Enables the use of FPU (no, softfp, hard).
68-ifeq ($(USE_FPU),)
69- USE_FPU = no
70-endif
71-
72-# FPU-related options.
73-ifeq ($(USE_FPU_OPT),)
74- USE_FPU_OPT = -mfloat-abi=$(USE_FPU) -mfpu=fpv4-sp-d16
75-endif
76-
77-#
78-# Architecture or project specific options
79-##############################################################################
80-
81-##############################################################################
82-# Project, target, sources and paths
83-#
84-
85-# Define project name here
86-PROJECT = sb
87-
88-# Target settings.
89-MCU = cortex-m4
90-
91-# Imported source files and paths.
92-CHIBIOS := ../../..
93-CONFDIR := ./cfg
94-BUILDDIR := ./build
95-DEPDIR := ./.dep
96-
97-# Licensing files.
98-include $(CHIBIOS)/os/license/license.mk
99-# Startup files.
100-include $(CHIBIOS)/os/common/startup/ARMCMx-SB/compilers/GCC/mk/startup.mk
101-# Common files.
102-include $(CHIBIOS)/os/common/utils/utils.mk
103-# HAL-OSAL files (optional).
104-#include $(CHIBIOS)/os/hal/hal.mk
105-#include $(CHIBIOS)/os/hal/ports/STM32/STM32L4xx/platform.mk
106-#include $(CHIBIOS)/os/hal/boards/ST_STM32L476_DISCOVERY/board.mk
107-#include $(CHIBIOS)/os/hal/osal/rt-nil/osal.mk
108-# RTOS files (optional).
109-#include $(CHIBIOS)/os/rt/rt.mk
110-#include $(CHIBIOS)/os/common/ports/ARMv7-M/compilers/GCC/mk/port.mk
111-include $(CHIBIOS)/os/sb/user/sbuser.mk
112-# Auto-build files in ./source recursively.
113-include $(CHIBIOS)/tools/mk/autobuild.mk
114-# Other files (optional).
115-#include $(CHIBIOS)/os/test/test.mk
116-#include $(CHIBIOS)/test/rt/rt_test.mk
117-#include $(CHIBIOS)/test/oslib/oslib_test.mk
118-
119-# Define linker script file here.
120-LDSCRIPT= ./sandbox.ld
121-
122-# C sources that can be compiled in ARM or THUMB mode depending on the global
123-# setting.
124-CSRC = $(ALLCSRC) \
125- $(TESTSRC) \
126- main.c
127-
128-# C++ sources that can be compiled in ARM or THUMB mode depending on the global
129-# setting.
130-CPPSRC = $(ALLCPPSRC)
131-
132-# List ASM source files here.
133-ASMSRC = $(ALLASMSRC)
134-
135-# List ASM with preprocessor source files here.
136-ASMXSRC = $(ALLXASMSRC)
137-
138-# Inclusion directories.
139-INCDIR = $(CONFDIR) $(ALLINC) $(TESTINC)
140-
141-# Define C warning options here.
142-CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes
143-
144-# Define C++ warning options here.
145-CPPWARN = -Wall -Wextra -Wundef
146-
147-#
148-# Project, target, sources and paths
149-##############################################################################
150-
151-##############################################################################
152-# Start of user section
153-#
154-
155-# List all user C define here, like -D_DEBUG=1
156-UDEFS =
157-
158-# Define ASM defines here
159-UADEFS =
160-
161-# List all user directories here
162-UINCDIR =
163-
164-# List the user directory to look for the libraries here
165-ULIBDIR =
166-
167-# List all user libraries here
168-ULIBS =
169-
170-#
171-# End of user section
172-##############################################################################
173-
174-##############################################################################
175-# Common rules
176-#
177-
178-RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk
179-include $(RULESPATH)/arm-none-eabi.mk
180-include $(RULESPATH)/rules.mk
181-
182-#
183-# Common rules
184-##############################################################################
185-
186-##############################################################################
187-# Custom rules
188-#
189-
190-#
191-# Custom rules
192-##############################################################################
--- trunk/demos/various/sbtest/main.c (revision 15642)
+++ trunk/demos/various/sbtest/main.c (nonexistent)
@@ -1,24 +0,0 @@
1-#include <stdbool.h>
2-
3-int bssvar;
4-int datavar = 5;
5-const int rodatavar = 18;
6-
7-static void foo(void);
8-
9-static void xxx(void) {
10-
11-}
12-
13-int main(void) {
14-
15- foo();
16-
17- while (true) {
18- xxx();
19- }
20-}
21-
22-static void foo(void) {
23-
24-}
--- trunk/demos/various/sbtest/Makefile (revision 15642)
+++ trunk/demos/various/sbtest/Makefile (nonexistent)
@@ -1,48 +0,0 @@
1-CROSS?=arm-none-eabi-
2-CC=$(CROSS)gcc
3-LD=$(CROSS)gcc
4-STRIP=$(CROSS)strip
5-SIZE=$(CROSS)size
6-
7-SRC=main.c start.c
8-
9-OPT?=0
10-
11-CFLAGS=-mcpu=cortex-m3 -mthumb -O$(OPT) -ggdb3 \
12- -mword-relocations -mlong-calls -fno-common
13-
14-LDFLAGS=-r -Bsymbolic -nostartfiles \
15- -mcpu=cortex-m3 -mthumb -mlong-calls -fno-common \
16- -T sandbox.ld
17-
18-OBJS=$(SRC:.c=.o)
19-DEPS=$(SRC:.c=.d)
20-
21-all: app.elf
22-
23--include $(DEPS)
24-
25-%.o: %.c $(MAKEFILE_LIST)
26- @echo " CC $<"
27- @$(CC) -MMD $(CFLAGS) -o $@ -c $<
28-
29-app.elf: $(OBJS)
30- @echo " LINK $@"
31- @$(LD) $(LDFLAGS) -o $@ $^
32- @$(STRIP) -g -o app-striped.elf $@
33- @$(SIZE) --common $@
34- @echo " Creating list..."
35- @$(CROSS)objdump -hpxdSsrt app.elf > app.elf.list
36- @$(CROSS)readelf -atSln app.elf > app.elf.read
37-
38-.PHONY: clean all list
39-
40-clean:
41- @echo " CLEAN"
42- @rm -fR $(OBJS) $(DEPS) *.elf
43- @rm -f app.elf.list app.elf.read oocd.log
44-
45-list:
46- @echo " Creating list..."
47- @$(CROSS)objdump -hpxdSsrt app.elf > app.elf.list
48- @$(CROSS)readelf -atSln app.elf > app.elf.read
--- trunk/demos/various/sbtest/start.c (revision 15642)
+++ trunk/demos/various/sbtest/start.c (nonexistent)
@@ -1,7 +0,0 @@
1-extern void main(void);
2-
3-void (*mainptr)(void) = main;
4-
5-void _start(void) {
6- main();
7-}
--- trunk/demos/various/SB-CLIENT-32k-08070000-4k-2001E000/main.c (revision 15642)
+++ trunk/demos/various/SB-CLIENT-32k-08070000-4k-2001E000/main.c (nonexistent)
@@ -1,52 +0,0 @@
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 <stdio.h>
18-
19-#include "ch.h"
20-
21-/*
22- * Blinker thread, times are in milliseconds.
23- */
24-static THD_WORKING_AREA(waThread1, 256);
25-static THD_FUNCTION(Thread1, arg) {
26-
27- (void)arg;
28-
29- chRegSetThreadName("blinker");
30- while (true) {
31-// palToggleLine(LINE_LED_GREEN);
32- printf("#1 blink!!\r\n");
33- chThdSleepMilliseconds(500);
34- }
35-}
36-
37-/*
38- * Application entry point.
39- */
40-int main(void) {
41-
42- chSysInit();
43-
44- /*
45- * Creating a blinker thread.
46- */
47- chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO+10, Thread1, NULL);
48-
49- while (true) {
50- chThdSleepMilliseconds(500);
51- }
52-}
--- trunk/demos/various/SB-CLIENT-32k-08070000-4k-2001E000/Makefile (revision 15642)
+++ trunk/demos/various/SB-CLIENT-32k-08070000-4k-2001E000/Makefile (nonexistent)
@@ -1,192 +0,0 @@
1-##############################################################################
2-# Build global options
3-# NOTE: Can be overridden externally.
4-#
5-
6-# Compiler options here.
7-ifeq ($(USE_OPT),)
8- USE_OPT = -O0 -ggdb -fomit-frame-pointer --specs=nano.specs
9-endif
10-
11-# C specific options here (added to USE_OPT).
12-ifeq ($(USE_COPT),)
13- USE_COPT =
14-endif
15-
16-# C++ specific options here (added to USE_OPT).
17-ifeq ($(USE_CPPOPT),)
18- USE_CPPOPT = -fno-rtti
19-endif
20-
21-# Enable this if you want the linker to remove unused code and data.
22-ifeq ($(USE_LINK_GC),)
23- USE_LINK_GC = yes
24-endif
25-
26-# Linker extra options here.
27-ifeq ($(USE_LDOPT),)
28- USE_LDOPT =
29-endif
30-
31-# Enable this if you want link time optimizations (LTO).
32-ifeq ($(USE_LTO),)
33- USE_LTO = yes
34-endif
35-
36-# Enable this if you want to see the full log while compiling.
37-ifeq ($(USE_VERBOSE_COMPILE),)
38- USE_VERBOSE_COMPILE = no
39-endif
40-
41-# If enabled, this option makes the build process faster by not compiling
42-# modules not used in the current configuration.
43-ifeq ($(USE_SMART_BUILD),)
44- USE_SMART_BUILD = yes
45-endif
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.
57-ifeq ($(USE_PROCESS_STACKSIZE),)
58- USE_PROCESS_STACKSIZE = 0x400
59-endif
60-
61-# Stack size to the allocated to the Cortex-M main/exceptions stack. This
62-# stack is used for processing interrupts and exceptions.
63-ifeq ($(USE_EXCEPTIONS_STACKSIZE),)
64- USE_EXCEPTIONS_STACKSIZE = 0x400
65-endif
66-
67-# Enables the use of FPU (no, softfp, hard).
68-ifeq ($(USE_FPU),)
69- USE_FPU = no
70-endif
71-
72-# FPU-related options.
73-ifeq ($(USE_FPU_OPT),)
74- USE_FPU_OPT = -mfloat-abi=$(USE_FPU) -mfpu=fpv4-sp-d16
75-endif
76-
77-#
78-# Architecture or project specific options
79-##############################################################################
80-
81-##############################################################################
82-# Project, target, sources and paths
83-#
84-
85-# Define project name here
86-PROJECT = sb
87-
88-# Target settings.
89-MCU = cortex-m4
90-
91-# Imported source files and paths.
92-CHIBIOS := ../../..
93-CONFDIR := ./cfg
94-BUILDDIR := ./build
95-DEPDIR := ./.dep
96-
97-# Licensing files.
98-include $(CHIBIOS)/os/license/license.mk
99-# Startup files.
100-include $(CHIBIOS)/os/common/startup/ARMCMx-SB/compilers/GCC/mk/startup.mk
101-# Common files.
102-include $(CHIBIOS)/os/common/utils/utils.mk
103-# HAL-OSAL files (optional).
104-#include $(CHIBIOS)/os/hal/hal.mk
105-#include $(CHIBIOS)/os/hal/ports/STM32/STM32L4xx/platform.mk
106-#include $(CHIBIOS)/os/hal/boards/ST_STM32L476_DISCOVERY/board.mk
107-#include $(CHIBIOS)/os/hal/osal/rt-nil/osal.mk
108-# RTOS files (optional).
109-include $(CHIBIOS)/os/rt/rt.mk
110-include $(CHIBIOS)/os/common/ports/ARMvx-M-SB/compilers/GCC/mk/port.mk
111-include $(CHIBIOS)/os/sb/user/sbuser.mk
112-# Auto-build files in ./source recursively.
113-include $(CHIBIOS)/tools/mk/autobuild.mk
114-# Other files (optional).
115-#include $(CHIBIOS)/os/test/test.mk
116-#include $(CHIBIOS)/test/rt/rt_test.mk
117-#include $(CHIBIOS)/test/oslib/oslib_test.mk
118-
119-# Define linker script file here.
120-LDSCRIPT= ./sandbox.ld
121-
122-# C sources that can be compiled in ARM or THUMB mode depending on the global
123-# setting.
124-CSRC = $(ALLCSRC) \
125- $(TESTSRC) \
126- main.c
127-
128-# C++ sources that can be compiled in ARM or THUMB mode depending on the global
129-# setting.
130-CPPSRC = $(ALLCPPSRC)
131-
132-# List ASM source files here.
133-ASMSRC = $(ALLASMSRC)
134-
135-# List ASM with preprocessor source files here.
136-ASMXSRC = $(ALLXASMSRC)
137-
138-# Inclusion directories.
139-INCDIR = $(CONFDIR) $(ALLINC) $(TESTINC)
140-
141-# Define C warning options here.
142-CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes
143-
144-# Define C++ warning options here.
145-CPPWARN = -Wall -Wextra -Wundef
146-
147-#
148-# Project, target, sources and paths
149-##############################################################################
150-
151-##############################################################################
152-# Start of user section
153-#
154-
155-# List all user C define here, like -D_DEBUG=1
156-UDEFS =
157-
158-# Define ASM defines here
159-UADEFS =
160-
161-# List all user directories here
162-UINCDIR =
163-
164-# List the user directory to look for the libraries here
165-ULIBDIR =
166-
167-# List all user libraries here
168-ULIBS =
169-
170-#
171-# End of user section
172-##############################################################################
173-
174-##############################################################################
175-# Common rules
176-#
177-
178-RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk
179-include $(RULESPATH)/arm-none-eabi.mk
180-include $(RULESPATH)/rules.mk
181-
182-#
183-# Common rules
184-##############################################################################
185-
186-##############################################################################
187-# Custom rules
188-#
189-
190-#
191-# Custom rules
192-##############################################################################
--- trunk/demos/various/SB-CLIENT-32k-08070000-16k-20018000/cfg/chconf.h (nonexistent)
+++ trunk/demos/various/SB-CLIENT-32k-08070000-16k-20018000/cfg/chconf.h (revision 15643)
@@ -0,0 +1,840 @@
1+/*
2+ ChibiOS - Copyright (C) 2006..2020 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+ * @file rt/templates/chconf.h
19+ * @brief Configuration file template.
20+ * @details A copy of this file must be placed in each project directory, it
21+ * contains the application specific kernel settings.
22+ *
23+ * @addtogroup config
24+ * @details Kernel related settings and hooks.
25+ * @{
26+ */
27+
28+#ifndef CHCONF_H
29+#define CHCONF_H
30+
31+#define _CHIBIOS_RT_CONF_
32+#define _CHIBIOS_RT_CONF_VER_7_0_
33+
34+/*===========================================================================*/
35+/**
36+ * @name System settings
37+ * @{
38+ */
39+/*===========================================================================*/
40+
41+/**
42+ * @brief Handling of instances.
43+ * @note If enabled then threads assigned to various instances can
44+ * interact each other using the same synchronization objects.
45+ * If disabled then each OS instance is a separate world, no
46+ * direct interactions are handled by the OS.
47+ */
48+#if !defined(CH_CFG_SMP_MODE)
49+#define CH_CFG_SMP_MODE FALSE
50+#endif
51+
52+/** @} */
53+
54+/*===========================================================================*/
55+/**
56+ * @name System timers settings
57+ * @{
58+ */
59+/*===========================================================================*/
60+
61+/**
62+ * @brief System time counter resolution.
63+ * @note Allowed values are 16, 32 or 64 bits.
64+ */
65+#if !defined(CH_CFG_ST_RESOLUTION)
66+#define CH_CFG_ST_RESOLUTION 32
67+#endif
68+
69+/**
70+ * @brief System tick frequency.
71+ * @details Frequency of the system timer that drives the system ticks. This
72+ * setting also defines the system tick time unit.
73+ */
74+#if !defined(CH_CFG_ST_FREQUENCY)
75+#define CH_CFG_ST_FREQUENCY 1000
76+#endif
77+
78+/**
79+ * @brief Time intervals data size.
80+ * @note Allowed values are 16, 32 or 64 bits.
81+ */
82+#if !defined(CH_CFG_INTERVALS_SIZE)
83+#define CH_CFG_INTERVALS_SIZE 32
84+#endif
85+
86+/**
87+ * @brief Time types data size.
88+ * @note Allowed values are 16 or 32 bits.
89+ */
90+#if !defined(CH_CFG_TIME_TYPES_SIZE)
91+#define CH_CFG_TIME_TYPES_SIZE 32
92+#endif
93+
94+/**
95+ * @brief Time delta constant for the tick-less mode.
96+ * @note If this value is zero then the system uses the classic
97+ * periodic tick. This value represents the minimum number
98+ * of ticks that is safe to specify in a timeout directive.
99+ * The value one is not valid, timeouts are rounded up to
100+ * this value.
101+ */
102+#if !defined(CH_CFG_ST_TIMEDELTA)
103+#define CH_CFG_ST_TIMEDELTA 0
104+#endif
105+
106+/** @} */
107+
108+/*===========================================================================*/
109+/**
110+ * @name Kernel parameters and options
111+ * @{
112+ */
113+/*===========================================================================*/
114+
115+/**
116+ * @brief Round robin interval.
117+ * @details This constant is the number of system ticks allowed for the
118+ * threads before preemption occurs. Setting this value to zero
119+ * disables the preemption for threads with equal priority and the
120+ * round robin becomes cooperative. Note that higher priority
121+ * threads can still preempt, the kernel is always preemptive.
122+ * @note Disabling the round robin preemption makes the kernel more compact
123+ * and generally faster.
124+ * @note The round robin preemption is not supported in tickless mode and
125+ * must be set to zero in that case.
126+ */
127+#if !defined(CH_CFG_TIME_QUANTUM)
128+#define CH_CFG_TIME_QUANTUM 0
129+#endif
130+
131+/**
132+ * @brief Idle thread automatic spawn suppression.
133+ * @details When this option is activated the function @p chSysInit()
134+ * does not spawn the idle thread. The application @p main()
135+ * function becomes the idle thread and must implement an
136+ * infinite loop.
137+ */
138+#if !defined(CH_CFG_NO_IDLE_THREAD)
139+#define CH_CFG_NO_IDLE_THREAD FALSE
140+#endif
141+
142+/**
143+ * @brief Kernel hardening level.
144+ * @details This option is the level of functional-safety checks enabled
145+ * in the kerkel. The meaning is:
146+ * - 0: No checks, maximum performance.
147+ * - 1: Reasonable checks.
148+ * - 2: All checks.
149+ * .
150+ */
151+#if !defined(CH_CFG_HARDENING_LEVEL)
152+#define CH_CFG_HARDENING_LEVEL 0
153+#endif
154+
155+/** @} */
156+
157+/*===========================================================================*/
158+/**
159+ * @name Performance options
160+ * @{
161+ */
162+/*===========================================================================*/
163+
164+/**
165+ * @brief OS optimization.
166+ * @details If enabled then time efficient rather than space efficient code
167+ * is used when two possible implementations exist.
168+ *
169+ * @note This is not related to the compiler optimization options.
170+ * @note The default is @p TRUE.
171+ */
172+#if !defined(CH_CFG_OPTIMIZE_SPEED)
173+#define CH_CFG_OPTIMIZE_SPEED TRUE
174+#endif
175+
176+/** @} */
177+
178+/*===========================================================================*/
179+/**
180+ * @name Subsystem options
181+ * @{
182+ */
183+/*===========================================================================*/
184+
185+/**
186+ * @brief Time Measurement APIs.
187+ * @details If enabled then the time measurement APIs are included in
188+ * the kernel.
189+ *
190+ * @note The default is @p TRUE.
191+ */
192+#if !defined(CH_CFG_USE_TM)
193+#define CH_CFG_USE_TM TRUE
194+#endif
195+
196+/**
197+ * @brief Time Stamps APIs.
198+ * @details If enabled then the time stamps APIs are included in the kernel.
199+ *
200+ * @note The default is @p TRUE.
201+ */
202+#if !defined(CH_CFG_USE_TIMESTAMP)
203+#define CH_CFG_USE_TIMESTAMP TRUE
204+#endif
205+
206+/**
207+ * @brief Threads registry APIs.
208+ * @details If enabled then the registry APIs are included in the kernel.
209+ *
210+ * @note The default is @p TRUE.
211+ */
212+#if !defined(CH_CFG_USE_REGISTRY)
213+#define CH_CFG_USE_REGISTRY TRUE
214+#endif
215+
216+/**
217+ * @brief Threads synchronization APIs.
218+ * @details If enabled then the @p chThdWait() function is included in
219+ * the kernel.
220+ *
221+ * @note The default is @p TRUE.
222+ */
223+#if !defined(CH_CFG_USE_WAITEXIT)
224+#define CH_CFG_USE_WAITEXIT TRUE
225+#endif
226+
227+/**
228+ * @brief Semaphores APIs.
229+ * @details If enabled then the Semaphores APIs are included in the kernel.
230+ *
231+ * @note The default is @p TRUE.
232+ */
233+#if !defined(CH_CFG_USE_SEMAPHORES)
234+#define CH_CFG_USE_SEMAPHORES TRUE
235+#endif
236+
237+/**
238+ * @brief Semaphores queuing mode.
239+ * @details If enabled then the threads are enqueued on semaphores by
240+ * priority rather than in FIFO order.
241+ *
242+ * @note The default is @p FALSE. Enable this if you have special
243+ * requirements.
244+ * @note Requires @p CH_CFG_USE_SEMAPHORES.
245+ */
246+#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY)
247+#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
248+#endif
249+
250+/**
251+ * @brief Mutexes APIs.
252+ * @details If enabled then the mutexes APIs are included in the kernel.
253+ *
254+ * @note The default is @p TRUE.
255+ */
256+#if !defined(CH_CFG_USE_MUTEXES)
257+#define CH_CFG_USE_MUTEXES TRUE
258+#endif
259+
260+/**
261+ * @brief Enables recursive behavior on mutexes.
262+ * @note Recursive mutexes are heavier and have an increased
263+ * memory footprint.
264+ *
265+ * @note The default is @p FALSE.
266+ * @note Requires @p CH_CFG_USE_MUTEXES.
267+ */
268+#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE)
269+#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE
270+#endif
271+
272+/**
273+ * @brief Conditional Variables APIs.
274+ * @details If enabled then the conditional variables APIs are included
275+ * in the kernel.
276+ *
277+ * @note The default is @p TRUE.
278+ * @note Requires @p CH_CFG_USE_MUTEXES.
279+ */
280+#if !defined(CH_CFG_USE_CONDVARS)
281+#define CH_CFG_USE_CONDVARS TRUE
282+#endif
283+
284+/**
285+ * @brief Conditional Variables APIs with timeout.
286+ * @details If enabled then the conditional variables APIs with timeout
287+ * specification are included in the kernel.
288+ *
289+ * @note The default is @p TRUE.
290+ * @note Requires @p CH_CFG_USE_CONDVARS.
291+ */
292+#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT)
293+#define CH_CFG_USE_CONDVARS_TIMEOUT TRUE
294+#endif
295+
296+/**
297+ * @brief Events Flags APIs.
298+ * @details If enabled then the event flags APIs are included in the kernel.
299+ *
300+ * @note The default is @p TRUE.
301+ */
302+#if !defined(CH_CFG_USE_EVENTS)
303+#define CH_CFG_USE_EVENTS TRUE
304+#endif
305+
306+/**
307+ * @brief Events Flags APIs with timeout.
308+ * @details If enabled then the events APIs with timeout specification
309+ * are included in the kernel.
310+ *
311+ * @note The default is @p TRUE.
312+ * @note Requires @p CH_CFG_USE_EVENTS.
313+ */
314+#if !defined(CH_CFG_USE_EVENTS_TIMEOUT)
315+#define CH_CFG_USE_EVENTS_TIMEOUT TRUE
316+#endif
317+
318+/**
319+ * @brief Synchronous Messages APIs.
320+ * @details If enabled then the synchronous messages APIs are included
321+ * in the kernel.
322+ *
323+ * @note The default is @p TRUE.
324+ */
325+#if !defined(CH_CFG_USE_MESSAGES)
326+#define CH_CFG_USE_MESSAGES TRUE
327+#endif
328+
329+/**
330+ * @brief Synchronous Messages queuing mode.
331+ * @details If enabled then messages are served by priority rather than in
332+ * FIFO order.
333+ *
334+ * @note The default is @p FALSE. Enable this if you have special
335+ * requirements.
336+ * @note Requires @p CH_CFG_USE_MESSAGES.
337+ */
338+#if !defined(CH_CFG_USE_MESSAGES_PRIORITY)
339+#define CH_CFG_USE_MESSAGES_PRIORITY FALSE
340+#endif
341+
342+/**
343+ * @brief Dynamic Threads APIs.
344+ * @details If enabled then the dynamic threads creation APIs are included
345+ * in the kernel.
346+ *
347+ * @note The default is @p TRUE.
348+ * @note Requires @p CH_CFG_USE_WAITEXIT.
349+ * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS.
350+ */
351+#if !defined(CH_CFG_USE_DYNAMIC)
352+#define CH_CFG_USE_DYNAMIC TRUE
353+#endif
354+
355+/** @} */
356+
357+/*===========================================================================*/
358+/**
359+ * @name OSLIB options
360+ * @{
361+ */
362+/*===========================================================================*/
363+
364+/**
365+ * @brief Mailboxes APIs.
366+ * @details If enabled then the asynchronous messages (mailboxes) APIs are
367+ * included in the kernel.
368+ *
369+ * @note The default is @p TRUE.
370+ * @note Requires @p CH_CFG_USE_SEMAPHORES.
371+ */
372+#if !defined(CH_CFG_USE_MAILBOXES)
373+#define CH_CFG_USE_MAILBOXES TRUE
374+#endif
375+
376+/**
377+ * @brief Memory checks APIs.
378+ * @details If enabled then the memory checks APIs are included in the kernel.
379+ *
380+ * @note The default is @p TRUE.
381+ */
382+#if !defined(CH_CFG_USE_MEMCHECKS)
383+#define CH_CFG_USE_MEMCHECKS TRUE
384+#endif
385+
386+/**
387+ * @brief Core Memory Manager APIs.
388+ * @details If enabled then the core memory manager APIs are included
389+ * in the kernel.
390+ *
391+ * @note The default is @p TRUE.
392+ */
393+#if !defined(CH_CFG_USE_MEMCORE)
394+#define CH_CFG_USE_MEMCORE TRUE
395+#endif
396+
397+/**
398+ * @brief Managed RAM size.
399+ * @details Size of the RAM area to be managed by the OS. If set to zero
400+ * then the whole available RAM is used. The core memory is made
401+ * available to the heap allocator and/or can be used directly through
402+ * the simplified core memory allocator.
403+ *
404+ * @note In order to let the OS manage the whole RAM the linker script must
405+ * provide the @p __heap_base__ and @p __heap_end__ symbols.
406+ * @note Requires @p CH_CFG_USE_MEMCORE.
407+ */
408+#if !defined(CH_CFG_MEMCORE_SIZE)
409+#define CH_CFG_MEMCORE_SIZE 0
410+#endif
411+
412+/**
413+ * @brief Heap Allocator APIs.
414+ * @details If enabled then the memory heap allocator APIs are included
415+ * in the kernel.
416+ *
417+ * @note The default is @p TRUE.
418+ * @note Requires @p CH_CFG_USE_MEMCORE and either @p CH_CFG_USE_MUTEXES or
419+ * @p CH_CFG_USE_SEMAPHORES.
420+ * @note Mutexes are recommended.
421+ */
422+#if !defined(CH_CFG_USE_HEAP)
423+#define CH_CFG_USE_HEAP TRUE
424+#endif
425+
426+/**
427+ * @brief Memory Pools Allocator APIs.
428+ * @details If enabled then the memory pools allocator APIs are included
429+ * in the kernel.
430+ *
431+ * @note The default is @p TRUE.
432+ */
433+#if !defined(CH_CFG_USE_MEMPOOLS)
434+#define CH_CFG_USE_MEMPOOLS TRUE
435+#endif
436+
437+/**
438+ * @brief Objects FIFOs APIs.
439+ * @details If enabled then the objects FIFOs APIs are included
440+ * in the kernel.
441+ *
442+ * @note The default is @p TRUE.
443+ */
444+#if !defined(CH_CFG_USE_OBJ_FIFOS)
445+#define CH_CFG_USE_OBJ_FIFOS TRUE
446+#endif
447+
448+/**
449+ * @brief Pipes APIs.
450+ * @details If enabled then the pipes APIs are included
451+ * in the kernel.
452+ *
453+ * @note The default is @p TRUE.
454+ */
455+#if !defined(CH_CFG_USE_PIPES)
456+#define CH_CFG_USE_PIPES TRUE
457+#endif
458+
459+/**
460+ * @brief Objects Caches APIs.
461+ * @details If enabled then the objects caches APIs are included
462+ * in the kernel.
463+ *
464+ * @note The default is @p TRUE.
465+ */
466+#if !defined(CH_CFG_USE_OBJ_CACHES)
467+#define CH_CFG_USE_OBJ_CACHES TRUE
468+#endif
469+
470+/**
471+ * @brief Delegate threads APIs.
472+ * @details If enabled then the delegate threads APIs are included
473+ * in the kernel.
474+ *
475+ * @note The default is @p TRUE.
476+ */
477+#if !defined(CH_CFG_USE_DELEGATES)
478+#define CH_CFG_USE_DELEGATES TRUE
479+#endif
480+
481+/**
482+ * @brief Jobs Queues APIs.
483+ * @details If enabled then the jobs queues APIs are included
484+ * in the kernel.
485+ *
486+ * @note The default is @p TRUE.
487+ */
488+#if !defined(CH_CFG_USE_JOBS)
489+#define CH_CFG_USE_JOBS TRUE
490+#endif
491+
492+/** @} */
493+
494+/*===========================================================================*/
495+/**
496+ * @name Objects factory options
497+ * @{
498+ */
499+/*===========================================================================*/
500+
501+/**
502+ * @brief Objects Factory APIs.
503+ * @details If enabled then the objects factory APIs are included in the
504+ * kernel.
505+ *
506+ * @note The default is @p FALSE.
507+ */
508+#if !defined(CH_CFG_USE_FACTORY)
509+#define CH_CFG_USE_FACTORY TRUE
510+#endif
511+
512+/**
513+ * @brief Maximum length for object names.
514+ * @details If the specified length is zero then the name is stored by
515+ * pointer but this could have unintended side effects.
516+ */
517+#if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH)
518+#define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8
519+#endif
520+
521+/**
522+ * @brief Enables the registry of generic objects.
523+ */
524+#if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY)
525+#define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE
526+#endif
527+
528+/**
529+ * @brief Enables factory for generic buffers.
530+ */
531+#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS)
532+#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE
533+#endif
534+
535+/**
536+ * @brief Enables factory for semaphores.
537+ */
538+#if !defined(CH_CFG_FACTORY_SEMAPHORES)
539+#define CH_CFG_FACTORY_SEMAPHORES TRUE
540+#endif
541+
542+/**
543+ * @brief Enables factory for mailboxes.
544+ */
545+#if !defined(CH_CFG_FACTORY_MAILBOXES)
546+#define CH_CFG_FACTORY_MAILBOXES TRUE
547+#endif
548+
549+/**
550+ * @brief Enables factory for objects FIFOs.
551+ */
552+#if !defined(CH_CFG_FACTORY_OBJ_FIFOS)
553+#define CH_CFG_FACTORY_OBJ_FIFOS TRUE
554+#endif
555+
556+/**
557+ * @brief Enables factory for Pipes.
558+ */
559+#if !defined(CH_CFG_FACTORY_PIPES) || defined(__DOXYGEN__)
560+#define CH_CFG_FACTORY_PIPES TRUE
561+#endif
562+
563+/** @} */
564+
565+/*===========================================================================*/
566+/**
567+ * @name Debug options
568+ * @{
569+ */
570+/*===========================================================================*/
571+
572+/**
573+ * @brief Debug option, kernel statistics.
574+ *
575+ * @note The default is @p FALSE.
576+ */
577+#if !defined(CH_DBG_STATISTICS)
578+#define CH_DBG_STATISTICS TRUE
579+#endif
580+
581+/**
582+ * @brief Debug option, system state check.
583+ * @details If enabled the correct call protocol for system APIs is checked
584+ * at runtime.
585+ *
586+ * @note The default is @p FALSE.
587+ */
588+#if !defined(CH_DBG_SYSTEM_STATE_CHECK)
589+#define CH_DBG_SYSTEM_STATE_CHECK TRUE
590+#endif
591+
592+/**
593+ * @brief Debug option, parameters checks.
594+ * @details If enabled then the checks on the API functions input
595+ * parameters are activated.
596+ *
597+ * @note The default is @p FALSE.
598+ */
599+#if !defined(CH_DBG_ENABLE_CHECKS)
600+#define CH_DBG_ENABLE_CHECKS TRUE
601+#endif
602+
603+/**
604+ * @brief Debug option, consistency checks.
605+ * @details If enabled then all the assertions in the kernel code are
606+ * activated. This includes consistency checks inside the kernel,
607+ * runtime anomalies and port-defined checks.
608+ *
609+ * @note The default is @p FALSE.
610+ */
611+#if !defined(CH_DBG_ENABLE_ASSERTS)
612+#define CH_DBG_ENABLE_ASSERTS TRUE
613+#endif
614+
615+/**
616+ * @brief Debug option, trace buffer.
617+ * @details If enabled then the trace buffer is activated.
618+ *
619+ * @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
620+ */
621+#if !defined(CH_DBG_TRACE_MASK)
622+#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL
623+#endif
624+
625+/**
626+ * @brief Trace buffer entries.
627+ * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
628+ * different from @p CH_DBG_TRACE_MASK_DISABLED.
629+ */
630+#if !defined(CH_DBG_TRACE_BUFFER_SIZE)
631+#define CH_DBG_TRACE_BUFFER_SIZE 128
632+#endif
633+
634+/**
635+ * @brief Debug option, stack checks.
636+ * @details If enabled then a runtime stack check is performed.
637+ *
638+ * @note The default is @p FALSE.
639+ * @note The stack check is performed in a architecture/port dependent way.
640+ * It may not be implemented or some ports.
641+ * @note The default failure mode is to halt the system with the global
642+ * @p panic_msg variable set to @p NULL.
643+ */
644+#if !defined(CH_DBG_ENABLE_STACK_CHECK)
645+#define CH_DBG_ENABLE_STACK_CHECK FALSE
646+#endif
647+
648+/**
649+ * @brief Debug option, stacks initialization.
650+ * @details If enabled then the threads working area is filled with a byte
651+ * value when a thread is created. This can be useful for the
652+ * runtime measurement of the used stack.
653+ *
654+ * @note The default is @p FALSE.
655+ */
656+#if !defined(CH_DBG_FILL_THREADS)
657+#define CH_DBG_FILL_THREADS TRUE
658+#endif
659+
660+/**
661+ * @brief Debug option, threads profiling.
662+ * @details If enabled then a field is added to the @p thread_t structure that
663+ * counts the system ticks occurred while executing the thread.
664+ *
665+ * @note The default is @p FALSE.
666+ * @note This debug option is not currently compatible with the
667+ * tickless mode.
668+ */
669+#if !defined(CH_DBG_THREADS_PROFILING)
670+#define CH_DBG_THREADS_PROFILING FALSE
671+#endif
672+
673+/** @} */
674+
675+/*===========================================================================*/
676+/**
677+ * @name Kernel hooks
678+ * @{
679+ */
680+/*===========================================================================*/
681+
682+/**
683+ * @brief System structure extension.
684+ * @details User fields added to the end of the @p ch_system_t structure.
685+ */
686+#define CH_CFG_SYSTEM_EXTRA_FIELDS \
687+ /* Add system custom fields here.*/
688+
689+/**
690+ * @brief System initialization hook.
691+ * @details User initialization code added to the @p chSysInit() function
692+ * just before interrupts are enabled globally.
693+ */
694+#define CH_CFG_SYSTEM_INIT_HOOK() { \
695+ /* Add system initialization code here.*/ \
696+}
697+
698+/**
699+ * @brief OS instance structure extension.
700+ * @details User fields added to the end of the @p os_instance_t structure.
701+ */
702+#define CH_CFG_OS_INSTANCE_EXTRA_FIELDS \
703+ /* Add OS instance custom fields here.*/
704+
705+/**
706+ * @brief OS instance initialization hook.
707+ *
708+ * @param[in] oip pointer to the @p os_instance_t structure
709+ */
710+#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) { \
711+ /* Add OS instance initialization code here.*/ \
712+}
713+
714+/**
715+ * @brief Threads descriptor structure extension.
716+ * @details User fields added to the end of the @p thread_t structure.
717+ */
718+#define CH_CFG_THREAD_EXTRA_FIELDS \
719+ /* Add threads custom fields here.*/
720+
721+/**
722+ * @brief Threads initialization hook.
723+ * @details User initialization code added to the @p _thread_init() function.
724+ *
725+ * @note It is invoked from within @p _thread_init() and implicitly from all
726+ * the threads creation APIs.
727+ *
728+ * @param[in] tp pointer to the @p thread_t structure
729+ */
730+#define CH_CFG_THREAD_INIT_HOOK(tp) { \
731+ /* Add threads initialization code here.*/ \
732+}
733+
734+/**
735+ * @brief Threads finalization hook.
736+ * @details User finalization code added to the @p chThdExit() API.
737+ *
738+ * @param[in] tp pointer to the @p thread_t structure
739+ */
740+#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
741+ /* Add threads finalization code here.*/ \
742+}
743+
744+/**
745+ * @brief Context switch hook.
746+ * @details This hook is invoked just before switching between threads.
747+ *
748+ * @param[in] ntp thread being switched in
749+ * @param[in] otp thread being switched out
750+ */
751+#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
752+ /* Context switch code here.*/ \
753+}
754+
755+/**
756+ * @brief ISR enter hook.
757+ */
758+#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
759+ /* IRQ prologue code here.*/ \
760+}
761+
762+/**
763+ * @brief ISR exit hook.
764+ */
765+#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
766+ /* IRQ epilogue code here.*/ \
767+}
768+
769+/**
770+ * @brief Idle thread enter hook.
771+ * @note This hook is invoked within a critical zone, no OS functions
772+ * should be invoked from here.
773+ * @note This macro can be used to activate a power saving mode.
774+ */
775+#define CH_CFG_IDLE_ENTER_HOOK() { \
776+ /* Idle-enter code here.*/ \
777+}
778+
779+/**
780+ * @brief Idle thread leave hook.
781+ * @note This hook is invoked within a critical zone, no OS functions
782+ * should be invoked from here.
783+ * @note This macro can be used to deactivate a power saving mode.
784+ */
785+#define CH_CFG_IDLE_LEAVE_HOOK() { \
786+ /* Idle-leave code here.*/ \
787+}
788+
789+/**
790+ * @brief Idle Loop hook.
791+ * @details This hook is continuously invoked by the idle thread loop.
792+ */
793+#define CH_CFG_IDLE_LOOP_HOOK() { \
794+ /* Idle loop code here.*/ \
795+}
796+
797+/**
798+ * @brief System tick event hook.
799+ * @details This hook is invoked in the system tick handler immediately
800+ * after processing the virtual timers queue.
801+ */
802+#define CH_CFG_SYSTEM_TICK_HOOK() { \
803+ /* System tick event code here.*/ \
804+}
805+
806+/**
807+ * @brief System halt hook.
808+ * @details This hook is invoked in case to a system halting error before
809+ * the system is halted.
810+ */
811+#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
812+ /* System halt code here.*/ \
813+}
814+
815+/**
816+ * @brief Trace hook.
817+ * @details This hook is invoked each time a new record is written in the
818+ * trace buffer.
819+ */
820+#define CH_CFG_TRACE_HOOK(tep) { \
821+ /* Trace code here.*/ \
822+}
823+
824+/**
825+ * @brief Runtime Faults Collection Unit hook.
826+ * @details This hook is invoked each time new faults are collected and stored.
827+ */
828+#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) { \
829+ /* Faults handling code here.*/ \
830+}
831+
832+/** @} */
833+
834+/*===========================================================================*/
835+/* Port-specific settings (override port settings defaulted in chcore.h). */
836+/*===========================================================================*/
837+
838+#endif /* CHCONF_H */
839+
840+/** @} */
--- trunk/demos/various/SB-CLIENT-32k-08070000-16k-20018000/Makefile (nonexistent)
+++ trunk/demos/various/SB-CLIENT-32k-08070000-16k-20018000/Makefile (revision 15643)
@@ -0,0 +1,192 @@
1+##############################################################################
2+# Build global options
3+# NOTE: Can be overridden externally.
4+#
5+
6+# Compiler options here.
7+ifeq ($(USE_OPT),)
8+ USE_OPT = -O0 -ggdb -fomit-frame-pointer --specs=nano.specs
9+endif
10+
11+# C specific options here (added to USE_OPT).
12+ifeq ($(USE_COPT),)
13+ USE_COPT =
14+endif
15+
16+# C++ specific options here (added to USE_OPT).
17+ifeq ($(USE_CPPOPT),)
18+ USE_CPPOPT = -fno-rtti
19+endif
20+
21+# Enable this if you want the linker to remove unused code and data.
22+ifeq ($(USE_LINK_GC),)
23+ USE_LINK_GC = yes
24+endif
25+
26+# Linker extra options here.
27+ifeq ($(USE_LDOPT),)
28+ USE_LDOPT =
29+endif
30+
31+# Enable this if you want link time optimizations (LTO).
32+ifeq ($(USE_LTO),)
33+ USE_LTO = yes
34+endif
35+
36+# Enable this if you want to see the full log while compiling.
37+ifeq ($(USE_VERBOSE_COMPILE),)
38+ USE_VERBOSE_COMPILE = no
39+endif
40+
41+# If enabled, this option makes the build process faster by not compiling
42+# modules not used in the current configuration.
43+ifeq ($(USE_SMART_BUILD),)
44+ USE_SMART_BUILD = yes
45+endif
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.
57+ifeq ($(USE_PROCESS_STACKSIZE),)
58+ USE_PROCESS_STACKSIZE = 0x400
59+endif
60+
61+# Stack size to the allocated to the Cortex-M main/exceptions stack. This
62+# stack is used for processing interrupts and exceptions.
63+ifeq ($(USE_EXCEPTIONS_STACKSIZE),)
64+ USE_EXCEPTIONS_STACKSIZE = 0x400
65+endif
66+
67+# Enables the use of FPU (no, softfp, hard).
68+ifeq ($(USE_FPU),)
69+ USE_FPU = no
70+endif
71+
72+# FPU-related options.
73+ifeq ($(USE_FPU_OPT),)
74+ USE_FPU_OPT = -mfloat-abi=$(USE_FPU) -mfpu=fpv4-sp-d16
75+endif
76+
77+#
78+# Architecture or project specific options
79+##############################################################################
80+
81+##############################################################################
82+# Project, target, sources and paths
83+#
84+
85+# Define project name here
86+PROJECT = sb
87+
88+# Target settings.
89+MCU = cortex-m4
90+
91+# Imported source files and paths.
92+CHIBIOS := ../../..
93+CONFDIR := ./cfg
94+BUILDDIR := ./build
95+DEPDIR := ./.dep
96+
97+# Licensing files.
98+include $(CHIBIOS)/os/license/license.mk
99+# Startup files.
100+include $(CHIBIOS)/os/common/startup/ARMCMx-SB/compilers/GCC/mk/startup.mk
101+# Common files.
102+include $(CHIBIOS)/os/common/utils/utils.mk
103+# HAL-OSAL files (optional).
104+#include $(CHIBIOS)/os/hal/hal.mk
105+#include $(CHIBIOS)/os/hal/ports/STM32/STM32L4xx/platform.mk
106+#include $(CHIBIOS)/os/hal/boards/ST_STM32L476_DISCOVERY/board.mk
107+#include $(CHIBIOS)/os/hal/osal/rt-nil/osal.mk
108+# RTOS files (optional).
109+include $(CHIBIOS)/os/rt/rt.mk
110+include $(CHIBIOS)/os/common/ports/ARMvx-M-SB/compilers/GCC/mk/port.mk
111+include $(CHIBIOS)/os/sb/user/sbuser.mk
112+# Auto-build files in ./source recursively.
113+include $(CHIBIOS)/tools/mk/autobuild.mk
114+# Other files (optional).
115+#include $(CHIBIOS)/os/test/test.mk
116+#include $(CHIBIOS)/test/rt/rt_test.mk
117+#include $(CHIBIOS)/test/oslib/oslib_test.mk
118+
119+# Define linker script file here.
120+LDSCRIPT= ./sandbox.ld
121+
122+# C sources that can be compiled in ARM or THUMB mode depending on the global
123+# setting.
124+CSRC = $(ALLCSRC) \
125+ $(TESTSRC) \
126+ main.c
127+
128+# C++ sources that can be compiled in ARM or THUMB mode depending on the global
129+# setting.
130+CPPSRC = $(ALLCPPSRC)
131+
132+# List ASM source files here.
133+ASMSRC = $(ALLASMSRC)
134+
135+# List ASM with preprocessor source files here.
136+ASMXSRC = $(ALLXASMSRC)
137+
138+# Inclusion directories.
139+INCDIR = $(CONFDIR) $(ALLINC) $(TESTINC)
140+
141+# Define C warning options here.
142+CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes
143+
144+# Define C++ warning options here.
145+CPPWARN = -Wall -Wextra -Wundef
146+
147+#
148+# Project, target, sources and paths
149+##############################################################################
150+
151+##############################################################################
152+# Start of user section
153+#
154+
155+# List all user C define here, like -D_DEBUG=1
156+UDEFS =
157+
158+# Define ASM defines here
159+UADEFS =
160+
161+# List all user directories here
162+UINCDIR =
163+
164+# List the user directory to look for the libraries here
165+ULIBDIR =
166+
167+# List all user libraries here
168+ULIBS =
169+
170+#
171+# End of user section
172+##############################################################################
173+
174+##############################################################################
175+# Common rules
176+#
177+
178+RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk
179+include $(RULESPATH)/arm-none-eabi.mk
180+include $(RULESPATH)/rules.mk
181+
182+#
183+# Common rules
184+##############################################################################
185+
186+##############################################################################
187+# Custom rules
188+#
189+
190+#
191+# Custom rules
192+##############################################################################
--- trunk/demos/various/SB-CLIENT-32k-08070000-16k-20018000/main.c (nonexistent)
+++ trunk/demos/various/SB-CLIENT-32k-08070000-16k-20018000/main.c (revision 15643)
@@ -0,0 +1,52 @@
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 <stdio.h>
18+
19+#include "ch.h"
20+
21+/*
22+ * Blinker thread, times are in milliseconds.
23+ */
24+static THD_WORKING_AREA(waThread1, 256);
25+static THD_FUNCTION(Thread1, arg) {
26+
27+ (void)arg;
28+
29+ chRegSetThreadName("blinker");
30+ while (true) {
31+// palToggleLine(LINE_LED_GREEN);
32+ printf("#1 blink!!\r\n");
33+ chThdSleepMilliseconds(500);
34+ }
35+}
36+
37+/*
38+ * Application entry point.
39+ */
40+int main(void) {
41+
42+ chSysInit();
43+
44+ /*
45+ * Creating a blinker thread.
46+ */
47+ chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO+10, Thread1, NULL);
48+
49+ while (true) {
50+ chThdSleepMilliseconds(500);
51+ }
52+}
--- trunk/demos/various/SB-CLIENT-32k-08078000-16k-2001C000/Makefile (nonexistent)
+++ trunk/demos/various/SB-CLIENT-32k-08078000-16k-2001C000/Makefile (revision 15643)
@@ -0,0 +1,192 @@
1+##############################################################################
2+# Build global options
3+# NOTE: Can be overridden externally.
4+#
5+
6+# Compiler options here.
7+ifeq ($(USE_OPT),)
8+ USE_OPT = -O0 -ggdb -fomit-frame-pointer --specs=nano.specs
9+endif
10+
11+# C specific options here (added to USE_OPT).
12+ifeq ($(USE_COPT),)
13+ USE_COPT =
14+endif
15+
16+# C++ specific options here (added to USE_OPT).
17+ifeq ($(USE_CPPOPT),)
18+ USE_CPPOPT = -fno-rtti
19+endif
20+
21+# Enable this if you want the linker to remove unused code and data.
22+ifeq ($(USE_LINK_GC),)
23+ USE_LINK_GC = yes
24+endif
25+
26+# Linker extra options here.
27+ifeq ($(USE_LDOPT),)
28+ USE_LDOPT =
29+endif
30+
31+# Enable this if you want link time optimizations (LTO).
32+ifeq ($(USE_LTO),)
33+ USE_LTO = yes
34+endif
35+
36+# Enable this if you want to see the full log while compiling.
37+ifeq ($(USE_VERBOSE_COMPILE),)
38+ USE_VERBOSE_COMPILE = no
39+endif
40+
41+# If enabled, this option makes the build process faster by not compiling
42+# modules not used in the current configuration.
43+ifeq ($(USE_SMART_BUILD),)
44+ USE_SMART_BUILD = yes
45+endif
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.
57+ifeq ($(USE_PROCESS_STACKSIZE),)
58+ USE_PROCESS_STACKSIZE = 0x400
59+endif
60+
61+# Stack size to the allocated to the Cortex-M main/exceptions stack. This
62+# stack is used for processing interrupts and exceptions.
63+ifeq ($(USE_EXCEPTIONS_STACKSIZE),)
64+ USE_EXCEPTIONS_STACKSIZE = 0x400
65+endif
66+
67+# Enables the use of FPU (no, softfp, hard).
68+ifeq ($(USE_FPU),)
69+ USE_FPU = no
70+endif
71+
72+# FPU-related options.
73+ifeq ($(USE_FPU_OPT),)
74+ USE_FPU_OPT = -mfloat-abi=$(USE_FPU) -mfpu=fpv4-sp-d16
75+endif
76+
77+#
78+# Architecture or project specific options
79+##############################################################################
80+
81+##############################################################################
82+# Project, target, sources and paths
83+#
84+
85+# Define project name here
86+PROJECT = sb
87+
88+# Target settings.
89+MCU = cortex-m4
90+
91+# Imported source files and paths.
92+CHIBIOS := ../../..
93+CONFDIR := ./cfg
94+BUILDDIR := ./build
95+DEPDIR := ./.dep
96+
97+# Licensing files.
98+include $(CHIBIOS)/os/license/license.mk
99+# Startup files.
100+include $(CHIBIOS)/os/common/startup/ARMCMx-SB/compilers/GCC/mk/startup.mk
101+# Common files.
102+include $(CHIBIOS)/os/common/utils/utils.mk
103+# HAL-OSAL files (optional).
104+#include $(CHIBIOS)/os/hal/hal.mk
105+#include $(CHIBIOS)/os/hal/ports/STM32/STM32L4xx/platform.mk
106+#include $(CHIBIOS)/os/hal/boards/ST_STM32L476_DISCOVERY/board.mk
107+#include $(CHIBIOS)/os/hal/osal/rt-nil/osal.mk
108+# RTOS files (optional).
109+#include $(CHIBIOS)/os/rt/rt.mk
110+#include $(CHIBIOS)/os/common/ports/ARMv7-M/compilers/GCC/mk/port.mk
111+include $(CHIBIOS)/os/sb/user/sbuser.mk
112+# Auto-build files in ./source recursively.
113+include $(CHIBIOS)/tools/mk/autobuild.mk
114+# Other files (optional).
115+#include $(CHIBIOS)/os/test/test.mk
116+#include $(CHIBIOS)/test/rt/rt_test.mk
117+#include $(CHIBIOS)/test/oslib/oslib_test.mk
118+
119+# Define linker script file here.
120+LDSCRIPT= ./sandbox.ld
121+
122+# C sources that can be compiled in ARM or THUMB mode depending on the global
123+# setting.
124+CSRC = $(ALLCSRC) \
125+ $(TESTSRC) \
126+ main.c
127+
128+# C++ sources that can be compiled in ARM or THUMB mode depending on the global
129+# setting.
130+CPPSRC = $(ALLCPPSRC)
131+
132+# List ASM source files here.
133+ASMSRC = $(ALLASMSRC)
134+
135+# List ASM with preprocessor source files here.
136+ASMXSRC = $(ALLXASMSRC)
137+
138+# Inclusion directories.
139+INCDIR = $(CONFDIR) $(ALLINC) $(TESTINC)
140+
141+# Define C warning options here.
142+CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes
143+
144+# Define C++ warning options here.
145+CPPWARN = -Wall -Wextra -Wundef
146+
147+#
148+# Project, target, sources and paths
149+##############################################################################
150+
151+##############################################################################
152+# Start of user section
153+#
154+
155+# List all user C define here, like -D_DEBUG=1
156+UDEFS =
157+
158+# Define ASM defines here
159+UADEFS =
160+
161+# List all user directories here
162+UINCDIR =
163+
164+# List the user directory to look for the libraries here
165+ULIBDIR =
166+
167+# List all user libraries here
168+ULIBS =
169+
170+#
171+# End of user section
172+##############################################################################
173+
174+##############################################################################
175+# Common rules
176+#
177+
178+RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk
179+include $(RULESPATH)/arm-none-eabi.mk
180+include $(RULESPATH)/rules.mk
181+
182+#
183+# Common rules
184+##############################################################################
185+
186+##############################################################################
187+# Custom rules
188+#
189+
190+#
191+# Custom rules
192+##############################################################################
--- trunk/demos/various/SB-CLIENT-32k-08078000-16k-2001C000/main.c (nonexistent)
+++ trunk/demos/various/SB-CLIENT-32k-08078000-16k-2001C000/main.c (revision 15643)
@@ -0,0 +1,40 @@
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 <stdio.h>
18+
19+#include "sbuser.h"
20+
21+/*
22+ * Application entry point.
23+ */
24+int main(void) {
25+
26+#if 0
27+ /* Test for exception on interrupt.*/
28+ asm volatile ("mov r0, #64");
29+ asm volatile ("mov sp, r0");
30+ while (true) {
31+ }
32+#endif
33+ while (true) {
34+ msg_t msg = sbMsgWait();
35+ printf("#2 Hello World (%u)!!\r\n", (unsigned)msg);
36+// sbFileWrite(1U, (const uint8_t *)"#2 Hello World!!\r\n", 15U);
37+ sbMsgReply(msg);
38+// sbSleepMilliseconds(500);
39+ }
40+}
--- trunk/os/common/ports/ARMvx-M-SB/chcore.c (nonexistent)
+++ trunk/os/common/ports/ARMvx-M-SB/chcore.c (revision 15643)
@@ -0,0 +1,77 @@
1+/*
2+ ChibiOS - Copyright (C) 2006,2007,2008,2009,2010,2011,2012,2013,2014,
3+ 2015,2016,2017,2018,2019,2020,2021 Giovanni Di Sirio.
4+
5+ This file is part of ChibiOS.
6+
7+ ChibiOS is free software; you can redistribute it and/or modify
8+ it under the terms of the GNU General Public License as published by
9+ the Free Software Foundation version 3 of the License.
10+
11+ ChibiOS is distributed in the hope that it will be useful,
12+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+ GNU General Public License for more details.
15+
16+ You should have received a copy of the GNU General Public License
17+ along with this program. If not, see <http://www.gnu.org/licenses/>.
18+*/
19+
20+/**
21+ * @file ARMvx-M-SB/chcore.c
22+ * @brief ARMvx-M-SB port code.
23+ *
24+ * @addtogroup ARMVXM_SB_CORE
25+ * @{
26+ */
27+
28+#include "ch.h"
29+
30+/*===========================================================================*/
31+/* Module local definitions. */
32+/*===========================================================================*/
33+
34+/*===========================================================================*/
35+/* Module exported variables. */
36+/*===========================================================================*/
37+
38+/*===========================================================================*/
39+/* Module local types. */
40+/*===========================================================================*/
41+
42+/*===========================================================================*/
43+/* Module local variables. */
44+/*===========================================================================*/
45+
46+/*===========================================================================*/
47+/* Module local functions. */
48+/*===========================================================================*/
49+
50+/*===========================================================================*/
51+/* Module interrupt handlers. */
52+/*===========================================================================*/
53+
54+/*===========================================================================*/
55+/* Module exported functions. */
56+/*===========================================================================*/
57+
58+/**
59+ * @brief Port-related initialization code.
60+ *
61+ * @param[in, out] oip pointer to the @p os_instance_t structure
62+ *
63+ * @notapi
64+ */
65+void port_init(os_instance_t *oip) {
66+
67+ (void)oip;
68+
69+ /* Starting in a known IRQ configuration.*/
70+ port_disable();
71+
72+ /* Enabling alarm VRQ.*/
73+ __sb_vrq_seten(1U << 0);
74+ sbSetAlarm(sbGetFrequency() / CH_CFG_ST_FREQUENCY, true);
75+}
76+
77+/** @} */
--- trunk/os/common/ports/ARMvx-M-SB/chcore.h (revision 15642)
+++ trunk/os/common/ports/ARMvx-M-SB/chcore.h (revision 15643)
@@ -28,15 +28,17 @@
2828 #ifndef CHCORE_H
2929 #define CHCORE_H
3030
31-/*===========================================================================*/
32-/* Module constants. */
33-/*===========================================================================*/
34-
3531 /* The following code is not processed when the file is included from an
3632 asm module because those intrinsic macros are not necessarily defined
3733 by the assembler too.*/
3834 #if !defined(_FROM_ASM_)
3935
36+#include "sbuser.h"
37+
38+/*===========================================================================*/
39+/* Module constants. */
40+/*===========================================================================*/
41+
4042 /**
4143 * @brief Compiler name and version.
4244 */
@@ -259,55 +261,6 @@
259261 */
260262 #define PORT_THD_FUNCTION(tname, arg) void tname(void *arg)
261263
262-/* By default threads have no syscall context information.*/
263-#if (PORT_USE_SYSCALL == TRUE) || defined(__DOXYGEN__)
264- #define __PORT_SETUP_CONTEXT_SYSCALL(tp, wtop) \
265- (tp)->ctx.syscall.psp = (uint32_t)(wtop); \
266- (tp)->ctx.syscall.p = NULL;
267-#else
268- #define __PORT_SETUP_CONTEXT_SYSCALL(tp, wtop)
269-#endif
270-
271-/* By default threads have all regions disabled.*/
272-#if (PORT_SWITCHED_REGIONS_NUMBER == 0) || defined(__DOXYGEN__)
273- #define __PORT_SETUP_CONTEXT_MPU(tp)
274-
275-#elif (PORT_SWITCHED_REGIONS_NUMBER == 1) || defined(__DOXYGEN__)
276- #define __PORT_SETUP_CONTEXT_MPU(tp) \
277- (tp)->ctx.sp->regions[0].rbar = 0U; \
278- (tp)->ctx.sp->regions[0].rasr = 0U
279-
280-#elif (PORT_SWITCHED_REGIONS_NUMBER == 2) || defined(__DOXYGEN__)
281- #define __PORT_SETUP_CONTEXT_MPU(tp) \
282- (tp)->ctx.sp->regions[0].rbar = 0U; \
283- (tp)->ctx.sp->regions[0].rasr = 0U; \
284- (tp)->ctx.sp->regions[1].rbar = 0U; \
285- (tp)->ctx.sp->regions[1].rasr = 0U
286-
287-#elif (PORT_SWITCHED_REGIONS_NUMBER == 3) || defined(__DOXYGEN__)
288- #define __PORT_SETUP_CONTEXT_MPU(tp) \
289- (tp)->ctx.sp->regions[0].rbar = 0U; \
290- (tp)->ctx.sp->regions[0].rasr = 0U; \
291- (tp)->ctx.sp->regions[1].rbar = 0U; \
292- (tp)->ctx.sp->regions[1].rasr = 0U; \
293- (tp)->ctx.sp->regions[2].rbar = 0U; \
294- (tp)->ctx.sp->regions[2].rasr = 0U
295-
296-#elif (PORT_SWITCHED_REGIONS_NUMBER == 4) || defined(__DOXYGEN__)
297- #define __PORT_SETUP_CONTEXT_MPU(tp) \
298- (tp)->ctx.sp->regions[0].rbar = 0U; \
299- (tp)->ctx.sp->regions[0].rasr = 0U; \
300- (tp)->ctx.sp->regions[1].rbar = 0U; \
301- (tp)->ctx.sp->regions[1].rasr = 0U; \
302- (tp)->ctx.sp->regions[2].rbar = 0U; \
303- (tp)->ctx.sp->regions[2].rasr = 0U; \
304- (tp)->ctx.sp->regions[3].rbar = 0U; \
305- (tp)->ctx.sp->regions[3].rasr = 0U
306-
307-#else
308- /* Note, checked above.*/
309-#endif
310-
311264 /**
312265 * @brief Platform dependent part of the @p chThdCreateI() API.
313266 * @details This code usually setup the context switching frame represented
@@ -319,28 +272,19 @@
319272 (tp)->ctx.sp->r4 = (uint32_t)(pf); \
320273 (tp)->ctx.sp->r5 = (uint32_t)(arg); \
321274 (tp)->ctx.sp->lr = (uint32_t)__port_thread_start; \
322- __PORT_SETUP_CONTEXT_MPU(tp); \
323- __PORT_SETUP_CONTEXT_SYSCALL(tp, wtop); \
324275 } while (false)
325276
326277 /**
327278 * @brief Context switch area size.
328279 */
329-#if (CORTEX_SIMPLIFIED_PRIORITY == TRUE) || defined(__DOXYGEN__)
330280 #define PORT_WA_CTX_SIZE (sizeof (struct port_intctx) + \
331281 sizeof (struct port_extctx))
332-#else
333-#define PORT_WA_CTX_SIZE (sizeof (struct port_intctx) + \
334- sizeof (struct port_extctx) + \
335- sizeof (struct port_extctx))
336-#endif
337282
338283 /**
339284 * @brief Computes the thread working area global size.
340285 * @note There is no need to perform alignments in this macro.
341286 */
342-#define PORT_WA_SIZE(n) ((size_t)PORT_GUARD_PAGE_SIZE + \
343- (size_t)PORT_WA_CTX_SIZE + \
287+#define PORT_WA_SIZE(n) ((size_t)PORT_WA_CTX_SIZE + \
344288 (size_t)(n) + \
345289 (size_t)PORT_INT_REQUIRED_STACK)
346290
@@ -352,15 +296,9 @@
352296 * @param[in] s the name to be assigned to the stack array
353297 * @param[in] n the stack size to be assigned to the thread
354298 */
355-#if (PORT_ENABLE_GUARD_PAGES == FALSE) || defined(__DOXYGEN__)
356- #define PORT_WORKING_AREA(s, n) \
357- stkalign_t s[THD_WORKING_AREA_SIZE(n) / sizeof (stkalign_t)]
299+#define PORT_WORKING_AREA(s, n) \
300+ stkalign_t s[THD_WORKING_AREA_SIZE(n) / sizeof (stkalign_t)]
358301
359-#else
360- #define PORT_WORKING_AREA(s, n) \
361- ALIGNED_VAR(32) stkalign_t s[THD_WORKING_AREA_SIZE(n) / sizeof (stkalign_t)]
362-#endif
363-
364302 /**
365303 * @brief IRQ prologue code.
366304 * @details This macro must be inserted at the start of all IRQ handlers
@@ -373,7 +311,7 @@
373311 * @details This macro must be inserted at the end of all IRQ handlers
374312 * enabled to invoke system APIs.
375313 */
376-#define PORT_IRQ_EPILOGUE() __port_irq_epilogue()
314+#define PORT_IRQ_EPILOGUE()
377315
378316 /**
379317 * @brief IRQ handler function declaration.
@@ -413,24 +351,13 @@
413351 #define port_switch(ntp, otp) __port_switch(ntp, otp)
414352
415353 #else
416- #if PORT_ENABLE_GUARD_PAGES == FALSE
417- #define port_switch(ntp, otp) do { \
418- struct port_intctx *r13 = (struct port_intctx *)__get_PSP(); \
419- if ((stkalign_t *)(void *)(r13 - 1) < (otp)->wabase) { \
420- chSysHalt("stack overflow"); \
421- } \
422- __port_switch(ntp, otp); \
423- } while (false)
424-
425- #else
426- #define port_switch(ntp, otp) do { \
427- __port_switch(ntp, otp); \
428- \
429- /* Setting up the guard page for the switched-in thread.*/ \
430- mpuSetRegionAddress(PORT_USE_GUARD_MPU_REGION, \
431- chThdGetSelfX()->wabase); \
432- } while (false)
433- #endif
354+ #define port_switch(ntp, otp) do { \
355+ struct port_intctx *r13 = (struct port_intctx *)__get_PSP(); \
356+ if ((stkalign_t *)(void *)(r13 - 1) < (otp)->wabase) { \
357+ chSysHalt("stack overflow"); \
358+ } \
359+ __port_switch(ntp, otp); \
360+ } while (false)
434361 #endif
435362
436363 /*===========================================================================*/
@@ -439,18 +366,14 @@
439366
440367 #if !defined(_FROM_ASM_)
441368
369+extern bool __sb_in_vrq;
370+
442371 #ifdef __cplusplus
443372 extern "C" {
444373 #endif
445374 void port_init(os_instance_t *oip);
446- void __port_irq_epilogue(void);
447375 void __port_switch(thread_t *ntp, thread_t *otp);
448376 void __port_thread_start(void);
449- void __port_switch_from_isr(void);
450- void __port_exit_from_isr(void);
451-#if PORT_USE_SYSCALL == TRUE
452- void port_unprivileged_jump(uint32_t pc, uint32_t psp);
453-#endif
454377 #ifdef __cplusplus
455378 }
456379 #endif
@@ -464,15 +387,9 @@
464387 *
465388 * @return The interrupts status.
466389 */
467-__STATIC_FORCEINLINE syssts_t port_get_irq_status(void) {
468- syssts_t sts;
390+static inline syssts_t port_get_irq_status(void) {
469391
470-#if CORTEX_SIMPLIFIED_PRIORITY == FALSE
471- sts = (syssts_t)__get_BASEPRI();
472-#else /* CORTEX_SIMPLIFIED_PRIORITY */
473- sts = (syssts_t)__get_PRIMASK();
474-#endif /* CORTEX_SIMPLIFIED_PRIORITY */
475- return sts;
392+ return (syssts_t)__sb_vrq_getisr();
476393 }
477394
478395 /**
@@ -484,13 +401,9 @@
484401 * @retval false the word specified a disabled interrupts status.
485402 * @retval true the word specified an enabled interrupts status.
486403 */
487-__STATIC_FORCEINLINE bool port_irq_enabled(syssts_t sts) {
404+static inline bool port_irq_enabled(syssts_t sts) {
488405
489-#if CORTEX_SIMPLIFIED_PRIORITY == FALSE
490- return sts == (syssts_t)CORTEX_BASEPRI_DISABLED;
491-#else /* CORTEX_SIMPLIFIED_PRIORITY */
492- return (sts & (syssts_t)1) == (syssts_t)0;
493-#endif /* CORTEX_SIMPLIFIED_PRIORITY */
406+ return (bool)((sts & 1U) == (syssts_t)0);
494407 }
495408
496409 /**
@@ -500,106 +413,70 @@
500413 * @retval false not running in ISR mode.
501414 * @retval true running in ISR mode.
502415 */
503-__STATIC_FORCEINLINE bool port_is_isr_context(void) {
416+static inline bool port_is_isr_context(void) {
504417
505- return (bool)((__get_IPSR() & 0x1FFU) != 0U);
418+ return __sb_in_vrq;
506419 }
507420
508421 /**
509422 * @brief Kernel-lock action.
510- * @details In this port this function raises the base priority to kernel
511- * level.
423+ * @details Global disable in this port.
512424 */
513-__STATIC_FORCEINLINE void port_lock(void) {
425+static inline void port_lock(void) {
514426
515-#if CORTEX_SIMPLIFIED_PRIORITY == FALSE
516-#if defined(__CM7_REV)
517-#if __CM7_REV <= 1
518- __disable_irq();
519-#endif
520-#endif
521- __set_BASEPRI(CORTEX_BASEPRI_KERNEL);
522-#if defined(__CM7_REV)
523-#if __CM7_REV <= 1
524- __enable_irq();
525-#endif
526-#endif
527-#else /* CORTEX_SIMPLIFIED_PRIORITY */
528- __disable_irq();
529-#endif /* CORTEX_SIMPLIFIED_PRIORITY */
427+ __sb_vrq_disable();
530428 }
531429
532430 /**
533431 * @brief Kernel-unlock action.
534- * @details In this port this function lowers the base priority to user
535- * level.
432+ * @details Global enable in this port.
536433 */
537-__STATIC_FORCEINLINE void port_unlock(void) {
434+static inline void port_unlock(void) {
538435
539-#if CORTEX_SIMPLIFIED_PRIORITY == FALSE
540- __set_BASEPRI(CORTEX_BASEPRI_DISABLED);
541-#else /* CORTEX_SIMPLIFIED_PRIORITY */
542- __enable_irq();
543-#endif /* CORTEX_SIMPLIFIED_PRIORITY */
436+ __sb_vrq_enable();
544437 }
545438
546439 /**
547440 * @brief Kernel-lock action from an interrupt handler.
548- * @details In this port this function raises the base priority to kernel
549- * level.
550- * @note Same as @p port_lock() in this port.
441+ * @note Empty in this port.
551442 */
552-__STATIC_FORCEINLINE void port_lock_from_isr(void) {
443+static inline void port_lock_from_isr(void) {
553444
554- port_lock();
555445 }
556446
557447 /**
558448 * @brief Kernel-unlock action from an interrupt handler.
559- * @details In this port this function lowers the base priority to user
560- * level.
561- * @note Same as @p port_unlock() in this port.
449+ * @note Empty in this port.
562450 */
563-__STATIC_FORCEINLINE void port_unlock_from_isr(void) {
451+static inline void port_unlock_from_isr(void) {
564452
565- port_unlock();
566453 }
567454
568455 /**
569456 * @brief Disables all the interrupt sources.
570- * @note In this port it disables all the interrupt sources by raising
571- * the priority mask to level 0.
457+ * @details Global disable in this port.
572458 */
573-__STATIC_FORCEINLINE void port_disable(void) {
459+static inline void port_disable(void) {
574460
575- __disable_irq();
461+ __sb_vrq_disable();
576462 }
577463
578464 /**
579465 * @brief Disables the interrupt sources below kernel-level priority.
580- * @note Interrupt sources above kernel level remains enabled.
581- * @note In this port it raises/lowers the base priority to kernel level.
466+ * @note Same as disabling globally in this port.
582467 */
583-__STATIC_FORCEINLINE void port_suspend(void) {
468+static inline void port_suspend(void) {
584469
585-#if (CORTEX_SIMPLIFIED_PRIORITY == FALSE) || defined(__DOXYGEN__)
586- __set_BASEPRI(CORTEX_BASEPRI_KERNEL);
587- __enable_irq();
588-#else
589- __disable_irq();
590-#endif
470+ __sb_vrq_disable();
591471 }
592472
593473 /**
594474 * @brief Enables all the interrupt sources.
595- * @note In this port it lowers the base priority to user level.
475+ * @details Global enable in this port.
596476 */
597-__STATIC_FORCEINLINE void port_enable(void) {
477+static inline void port_enable(void) {
598478
599-#if (CORTEX_SIMPLIFIED_PRIORITY == FALSE) || defined(__DOXYGEN__)
600- __set_BASEPRI(CORTEX_BASEPRI_DISABLED);
601-#endif
602- __enable_irq();
479+ __sb_vrq_enable();
603480 }
604481
605482 /**
@@ -608,13 +485,12 @@
608485 * The simplest implementation is an empty function or macro but this
609486 * would not take advantage of architecture-specific power saving
610487 * modes.
611- * @note Implemented as an inlined @p WFI instruction.
488+ * @note Implemented as a VRQ-wait which releases the CPU to the sandbox
489+ * host OS.
612490 */
613-__STATIC_FORCEINLINE void port_wait_for_interrupt(void) {
491+static inline void port_wait_for_interrupt(void) {
614492
615-#if CORTEX_ENABLE_WFI_IDLE == TRUE
616- __WFI();
617-#endif
493+ __sb_vrq_wait();
618494 }
619495
620496 /**
@@ -622,9 +498,9 @@
622498 *
623499 * @return The realtime counter value.
624500 */
625-__STATIC_FORCEINLINE rtcnt_t port_rt_get_counter_value(void) {
501+static inline rtcnt_t port_rt_get_counter_value(void) {
626502
627- return DWT->CYCCNT;
503+ return (rtcnt_t)sbGetSystemTime();
628504 }
629505
630506 #endif /* !defined(_FROM_ASM_) */
@@ -636,7 +512,7 @@
636512 #if !defined(_FROM_ASM_)
637513
638514 #if CH_CFG_ST_TIMEDELTA > 0
639-#include "chcore_timer.h"
515+#error "tickless mode not implemented in this port"
640516 #endif /* CH_CFG_ST_TIMEDELTA > 0 */
641517
642518 #endif /* !defined(_FROM_ASM_) */
--- trunk/os/sb/user/sbuser.h (revision 15642)
+++ trunk/os/sb/user/sbuser.h (revision 15643)
@@ -112,7 +112,7 @@
112112 /**
113113 * @brief Type of a message.
114114 */
115-typedef uint32_t msg_t;
115+typedef int32_t msg_t;
116116
117117 /**
118118 * @brief Type of an event mask.
Show on old repository browser