diff --git a/demos/STM32/RT-STM32G474RE-NUCLEO64-SB_HOST_STATIC/STM32G474xE_SB.ld b/demos/STM32/RT-STM32G474RE-NUCLEO64-SB_HOST_STATIC/STM32G474xE_SB.ld index 956cde2d3..0d4fee4a7 100644 --- a/demos/STM32/RT-STM32G474RE-NUCLEO64-SB_HOST_STATIC/STM32G474xE_SB.ld +++ b/demos/STM32/RT-STM32G474RE-NUCLEO64-SB_HOST_STATIC/STM32G474xE_SB.ld @@ -28,8 +28,8 @@ MEMORY flash6 (rx) : org = 0x00000000, len = 0 flash7 (rx) : org = 0x00000000, len = 0 ram0 (wx) : org = 0x20000000, len = 128k - 8k /* Host data. */ - ram1 (wx) : org = 0x2001C000, len = 4k /* Sandbox 1 data. */ - ram2 (wx) : org = 0x2001E000, len = 4k /* Sandbox 2 data. */ + ram1 (wx) : org = 0x2001E000, len = 4k /* Sandbox 1 data. */ + ram2 (wx) : org = 0x2001F000, len = 4k /* Sandbox 2 data. */ ram3 (wx) : org = 0x00000000, len = 0 ram4 (wx) : org = 0x00000000, len = 0 ram5 (wx) : org = 0x00000000, len = 0 diff --git a/demos/STM32/RT-STM32G474RE-NUCLEO64-SB_HOST_STATIC/main.c b/demos/STM32/RT-STM32G474RE-NUCLEO64-SB_HOST_STATIC/main.c index 0c103c175..6853d687c 100644 --- a/demos/STM32/RT-STM32G474RE-NUCLEO64-SB_HOST_STATIC/main.c +++ b/demos/STM32/RT-STM32G474RE-NUCLEO64-SB_HOST_STATIC/main.c @@ -73,7 +73,7 @@ int main(void) { MPU_RASR_SIZE_64K | MPU_RASR_ENABLE); mpuConfigureRegion(MPU_REGION_1, - 0x20020000U, + 0x2001E000U, MPU_RASR_ATTR_AP_RW_RW | MPU_RASR_ATTR_CACHEABLE_WB_WA | MPU_RASR_SIZE_4K | @@ -83,8 +83,8 @@ int main(void) { .wbase = waUnprivileged1, .wend = THD_WORKING_AREA_END(waUnprivileged1), .prio = NORMALPRIO + 1, - .u_pc = 0x08070001U, - .u_psp = 0x20020000U, + .u_pc = 0x08070011U, + .u_psp = 0x2001F000U, .arg = NULL }; chThdCreateUnprivileged(&utd); diff --git a/demos/various/SB-CLIENT-08070000-2001C000/.cproject b/demos/various/SB-CLIENT-08070000-2001C000/.cproject new file mode 100644 index 000000000..8bfa04627 --- /dev/null +++ b/demos/various/SB-CLIENT-08070000-2001C000/.cproject @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/demos/various/SB-CLIENT-08070000-2001C000/.project b/demos/various/SB-CLIENT-08070000-2001C000/.project new file mode 100644 index 000000000..a777ec6bf --- /dev/null +++ b/demos/various/SB-CLIENT-08070000-2001C000/.project @@ -0,0 +1,33 @@ + + + SB-CLIENT-08070000-2001C000 + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + os + 2 + CHIBIOS/os + + + diff --git a/demos/various/SB-CLIENT-08070000-2001C000/Makefile b/demos/various/SB-CLIENT-08070000-2001C000/Makefile new file mode 100644 index 000000000..c986da7d8 --- /dev/null +++ b/demos/various/SB-CLIENT-08070000-2001C000/Makefile @@ -0,0 +1,191 @@ +############################################################################## +# Build global options +# NOTE: Can be overridden externally. +# + +# Compiler options here. +ifeq ($(USE_OPT),) + USE_OPT = -O0 -ggdb -fomit-frame-pointer -falign-functions=16 +endif + +# C specific options here (added to USE_OPT). +ifeq ($(USE_COPT),) + USE_COPT = +endif + +# C++ specific options here (added to USE_OPT). +ifeq ($(USE_CPPOPT),) + USE_CPPOPT = -fno-rtti +endif + +# Enable this if you want the linker to remove unused code and data. +ifeq ($(USE_LINK_GC),) + USE_LINK_GC = yes +endif + +# Linker extra options here. +ifeq ($(USE_LDOPT),) + USE_LDOPT = +endif + +# Enable this if you want link time optimizations (LTO). +ifeq ($(USE_LTO),) + USE_LTO = yes +endif + +# Enable this if you want to see the full log while compiling. +ifeq ($(USE_VERBOSE_COMPILE),) + USE_VERBOSE_COMPILE = no +endif + +# If enabled, this option makes the build process faster by not compiling +# modules not used in the current configuration. +ifeq ($(USE_SMART_BUILD),) + USE_SMART_BUILD = yes +endif + +# +# Build global options +############################################################################## + +############################################################################## +# Architecture or project specific options +# + +# Stack size to be allocated to the Cortex-M process stack. This stack is +# the stack used by the main() thread. +ifeq ($(USE_PROCESS_STACKSIZE),) + USE_PROCESS_STACKSIZE = 0x400 +endif + +# Stack size to the allocated to the Cortex-M main/exceptions stack. This +# stack is used for processing interrupts and exceptions. +ifeq ($(USE_EXCEPTIONS_STACKSIZE),) + USE_EXCEPTIONS_STACKSIZE = 0x400 +endif + +# Enables the use of FPU (no, softfp, hard). +ifeq ($(USE_FPU),) + USE_FPU = no +endif + +# FPU-related options. +ifeq ($(USE_FPU_OPT),) + USE_FPU_OPT = -mfloat-abi=$(USE_FPU) -mfpu=fpv4-sp-d16 +endif + +# +# Architecture or project specific options +############################################################################## + +############################################################################## +# Project, target, sources and paths +# + +# Define project name here +PROJECT = sb + +# Target settings. +MCU = cortex-m4 + +# Imported source files and paths. +CHIBIOS := ../../.. +CONFDIR := ./cfg +BUILDDIR := ./build +DEPDIR := ./.dep + +# Licensing files. +include $(CHIBIOS)/os/license/license.mk +# Startup files. +include $(CHIBIOS)/os/common/startup/ARMCMx-SB/compilers/GCC/mk/startup.mk +# HAL-OSAL files (optional). +#include $(CHIBIOS)/os/hal/hal.mk +#include $(CHIBIOS)/os/hal/ports/STM32/STM32L4xx/platform.mk +#include $(CHIBIOS)/os/hal/boards/ST_STM32L476_DISCOVERY/board.mk +#include $(CHIBIOS)/os/hal/osal/rt-nil/osal.mk +# RTOS files (optional). +#include $(CHIBIOS)/os/rt/rt.mk +#include $(CHIBIOS)/os/common/ports/ARMv7-M/compilers/GCC/mk/port.mk +include $(CHIBIOS)/os/sb/user/sbuser.mk +# Auto-build files in ./source recursively. +include $(CHIBIOS)/tools/mk/autobuild.mk +# Other files (optional). +#include $(CHIBIOS)/os/test/test.mk +#include $(CHIBIOS)/test/rt/rt_test.mk +#include $(CHIBIOS)/test/oslib/oslib_test.mk + +# Define linker script file here. +LDSCRIPT= ./sandbox.ld + +# C sources that can be compiled in ARM or THUMB mode depending on the global +# setting. +CSRC = $(ALLCSRC) \ + $(TESTSRC) \ + $(CHIBIOS)/os/sb/various/syscalls.c \ + main.c + +# C++ sources that can be compiled in ARM or THUMB mode depending on the global +# setting. +CPPSRC = $(ALLCPPSRC) + +# List ASM source files here. +ASMSRC = $(ALLASMSRC) + +# List ASM with preprocessor source files here. +ASMXSRC = $(ALLXASMSRC) + +# Inclusion directories. +INCDIR = $(CONFDIR) $(ALLINC) $(TESTINC) + +# Define C warning options here. +CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes + +# Define C++ warning options here. +CPPWARN = -Wall -Wextra -Wundef + +# +# Project, target, sources and paths +############################################################################## + +############################################################################## +# Start of user section +# + +# List all user C define here, like -D_DEBUG=1 +UDEFS = + +# Define ASM defines here +UADEFS = + +# List all user directories here +UINCDIR = + +# List the user directory to look for the libraries here +ULIBDIR = + +# List all user libraries here +ULIBS = + +# +# End of user section +############################################################################## + +############################################################################## +# Common rules +# + +RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk +include $(RULESPATH)/arm-none-eabi.mk +include $(RULESPATH)/rules.mk + +# +# Common rules +############################################################################## + +############################################################################## +# Custom rules +# + +# +# Custom rules +############################################################################## diff --git a/demos/various/SB-CLIENT-08070000-2001C000/main.c b/demos/various/SB-CLIENT-08070000-2001C000/main.c new file mode 100644 index 000000000..d2a4880a3 --- /dev/null +++ b/demos/various/SB-CLIENT-08070000-2001C000/main.c @@ -0,0 +1,50 @@ +/* + ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include +#include +#include +#include + +#include "sbuser.h" + +/* + * Application entry point. + */ +int main(void) { + + /* API layer initialization.*/ + sbApiInit(); + + /* + * Normal main() activity, in this demo it does nothing except + * sleeping in a loop. + */ +#if 0 + /* Test for exception on interrupt.*/ + asm volatile ("mov r0, #64"); + asm volatile ("mov sp, r0"); + while (true) { + } +#endif + while (true) { + msg_t msg = sbMsgWait(); + printf("#1 Hello World (%u)!!\r\n", (unsigned)msg); +// sbFileWrite(1U, (const uint8_t *)"#1 Hello World!!\r\n", 15U); + sbMsgReply(msg); +// sbSleepMilliseconds(500); + } +} diff --git a/demos/various/SB-CLIENT-08070000-2001C000/sandbox.ld b/demos/various/SB-CLIENT-08070000-2001C000/sandbox.ld new file mode 100644 index 000000000..9012ae2b3 --- /dev/null +++ b/demos/various/SB-CLIENT-08070000-2001C000/sandbox.ld @@ -0,0 +1,33 @@ +/* + ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +/* + * Sandbox memory setup. + */ +MEMORY +{ + flash0 (rx) : org = 0x08070000, len = 32k + ram0 (wx) : org = 0x2001C000, len = 4k +} + +/* Flash region to be used for exception vectors.*/ +REGION_ALIAS("CODE_SPACE", flash0); + +/* RAM region to be used for data.*/ +REGION_ALIAS("DATA_SPACE", ram0); + +/* Generic rules inclusion.*/ +INCLUDE rules.ld