mirror of https://github.com/rusefi/ChibiOS.git
Demo cleanup and optimization.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@16882 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
parent
ff5087f19e
commit
ace22db85a
|
@ -126,7 +126,7 @@ include $(CHIBIOS)/os/hal/lib/streams/streams.mk
|
||||||
include $(CHIBIOS)/os/various/fatfs_bindings/fatfs.mk
|
include $(CHIBIOS)/os/various/fatfs_bindings/fatfs.mk
|
||||||
|
|
||||||
# Define linker script file here
|
# Define linker script file here
|
||||||
LDSCRIPT= ./STM32L4R9xI_SB.ld
|
LDSCRIPT= $(STARTUPLD)/STM32L4R9xI.ld
|
||||||
|
|
||||||
# C sources that can be compiled in ARM or THUMB mode depending on the global
|
# C sources that can be compiled in ARM or THUMB mode depending on the global
|
||||||
# setting.
|
# setting.
|
||||||
|
|
|
@ -1,85 +0,0 @@
|
||||||
/*
|
|
||||||
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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* STM32L4R9xI memory setup.
|
|
||||||
*/
|
|
||||||
MEMORY
|
|
||||||
{
|
|
||||||
flash0 (rx) : org = 0x08000000, len = 2M /* Host code. */
|
|
||||||
flash1 (rx) : org = 0x00000000, len = 0
|
|
||||||
flash2 (rx) : org = 0x00000000, len = 0
|
|
||||||
flash3 (rx) : org = 0x00000000, len = 0
|
|
||||||
flash4 (rx) : org = 0x00000000, len = 0
|
|
||||||
flash5 (rx) : org = 0x00000000, len = 0
|
|
||||||
flash6 (rx) : org = 0x00000000, len = 0
|
|
||||||
flash7 (rx) : org = 0x00000000, len = 0
|
|
||||||
ram0 (wx) : org = 0x20000000, len = 640k - 256k /* Host data. */
|
|
||||||
ram1 (wx) : org = 0x20060000, len = 128k /* Sandbox 1. */
|
|
||||||
ram2 (wx) : org = 0x20080000, len = 128k /* Sandbox 2. */
|
|
||||||
ram3 (wx) : org = 0x00000000, len = 0
|
|
||||||
ram4 (wx) : org = 0x00000000, len = 0
|
|
||||||
ram5 (wx) : org = 0x00000000, len = 0
|
|
||||||
ram6 (wx) : org = 0x00000000, len = 0
|
|
||||||
ram7 (wx) : org = 0x00000000, len = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
/* For each data/text section two region are defined, a virtual region
|
|
||||||
and a load region (_LMA suffix).*/
|
|
||||||
|
|
||||||
/* Flash region to be used for exception vectors.*/
|
|
||||||
REGION_ALIAS("VECTORS_FLASH", flash0);
|
|
||||||
REGION_ALIAS("VECTORS_FLASH_LMA", flash0);
|
|
||||||
|
|
||||||
/* Flash region to be used for constructors and destructors.*/
|
|
||||||
REGION_ALIAS("XTORS_FLASH", flash0);
|
|
||||||
REGION_ALIAS("XTORS_FLASH_LMA", flash0);
|
|
||||||
|
|
||||||
/* Flash region to be used for code text.*/
|
|
||||||
REGION_ALIAS("TEXT_FLASH", flash0);
|
|
||||||
REGION_ALIAS("TEXT_FLASH_LMA", flash0);
|
|
||||||
|
|
||||||
/* Flash region to be used for read only data.*/
|
|
||||||
REGION_ALIAS("RODATA_FLASH", flash0);
|
|
||||||
REGION_ALIAS("RODATA_FLASH_LMA", flash0);
|
|
||||||
|
|
||||||
/* Flash region to be used for various.*/
|
|
||||||
REGION_ALIAS("VARIOUS_FLASH", flash0);
|
|
||||||
REGION_ALIAS("VARIOUS_FLASH_LMA", flash0);
|
|
||||||
|
|
||||||
/* Flash region to be used for RAM(n) initialization data.*/
|
|
||||||
REGION_ALIAS("RAM_INIT_FLASH_LMA", flash0);
|
|
||||||
|
|
||||||
/* RAM region to be used for Main stack. This stack accommodates the processing
|
|
||||||
of all exceptions and interrupts.*/
|
|
||||||
REGION_ALIAS("MAIN_STACK_RAM", ram0);
|
|
||||||
|
|
||||||
/* RAM region to be used for the process stack. This is the stack used by
|
|
||||||
the main() function.*/
|
|
||||||
REGION_ALIAS("PROCESS_STACK_RAM", ram0);
|
|
||||||
|
|
||||||
/* RAM region to be used for data segment.*/
|
|
||||||
REGION_ALIAS("DATA_RAM", ram0);
|
|
||||||
REGION_ALIAS("DATA_RAM_LMA", flash0);
|
|
||||||
|
|
||||||
/* RAM region to be used for BSS segment.*/
|
|
||||||
REGION_ALIAS("BSS_RAM", ram0);
|
|
||||||
|
|
||||||
/* RAM region to be used for the default heap.*/
|
|
||||||
REGION_ALIAS("HEAP_RAM", ram0);
|
|
||||||
|
|
||||||
/* Generic rules inclusion.*/
|
|
||||||
INCLUDE rules.ld
|
|
|
@ -836,7 +836,7 @@
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
||||||
#define PORT_USE_SYSCALL TRUE
|
#define PORT_USE_SYSCALL TRUE
|
||||||
#define PORT_SWITCHED_REGIONS_NUMBER 2
|
#define PORT_SWITCHED_REGIONS_NUMBER 1
|
||||||
|
|
||||||
#endif /* CHCONF_H */
|
#endif /* CHCONF_H */
|
||||||
|
|
||||||
|
|
|
@ -17,15 +17,11 @@
|
||||||
#include "ch.h"
|
#include "ch.h"
|
||||||
#include "hal.h"
|
#include "hal.h"
|
||||||
#include "sb.h"
|
#include "sb.h"
|
||||||
|
|
||||||
#include "chprintf.h"
|
#include "chprintf.h"
|
||||||
|
|
||||||
//#include "rt_test_root.h"
|
|
||||||
//#include "oslib_test_root.h"
|
|
||||||
|
|
||||||
#include "nullstreams.h"
|
#include "nullstreams.h"
|
||||||
|
|
||||||
#include "startup_defs.h"
|
#include "startup_defs.h"
|
||||||
|
|
||||||
#include "sdmon.h"
|
#include "sdmon.h"
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
@ -67,9 +63,6 @@ static const drv_streams_element_t sb1_streams[] = {
|
||||||
/* Sandbox objects.*/
|
/* Sandbox objects.*/
|
||||||
sb_class_t sbx1;
|
sb_class_t sbx1;
|
||||||
|
|
||||||
/* Privileged stacks for sandboxes.*/
|
|
||||||
static SB_STACK(sbx1stk);
|
|
||||||
|
|
||||||
/* Arguments and environments for SB1.*/
|
/* Arguments and environments for SB1.*/
|
||||||
static const char *sbx1_argv[] = {
|
static const char *sbx1_argv[] = {
|
||||||
"msh",
|
"msh",
|
||||||
|
@ -88,17 +81,16 @@ static const char *sbx1_envp[] = {
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Green LED blinker thread, times are in milliseconds.
|
* LED blinker thread, times are in milliseconds.
|
||||||
*/
|
*/
|
||||||
static THD_WORKING_AREA(waThread1, 256);
|
static THD_STACK(thd1_stack, 256);
|
||||||
static THD_FUNCTION(Thread1, arg) {
|
static THD_FUNCTION(thd1_func, arg) {
|
||||||
|
|
||||||
(void)arg;
|
(void)arg;
|
||||||
|
|
||||||
chRegSetThreadName("blinker");
|
|
||||||
while (true) {
|
while (true) {
|
||||||
palToggleLine(LINE_LED_GREEN);
|
palToggleLine(LINE_LED_GREEN);
|
||||||
chThdSleepMilliseconds(sdmon_ready ? 250 : 500);
|
chThdSleepMilliseconds(sdmon_ready ? 100 : 500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,7 +104,7 @@ static void SBHandler(eventid_t id) {
|
||||||
if (!sbIsThreadRunningX(&sbx1)) {
|
if (!sbIsThreadRunningX(&sbx1)) {
|
||||||
msg_t msg = sbWait(&sbx1);
|
msg_t msg = sbWait(&sbx1);
|
||||||
|
|
||||||
chprintf((BaseSequentialStream *)&SD2, "SB1 terminated (%08lx)\r\n", msg);
|
chprintf((BaseSequentialStream *)&SD2, "SBX1 terminated (%08lx)\r\n", msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,33 +135,26 @@ int main(void) {
|
||||||
vfsInit();
|
vfsInit();
|
||||||
sbHostInit();
|
sbHostInit();
|
||||||
|
|
||||||
/*
|
/* Starting a serial ports for I/O, initializing other streams too.*/
|
||||||
* Starting a serial ports for I/O, initializing other streams too.
|
|
||||||
*/
|
|
||||||
sdStart(&SD2, NULL);
|
sdStart(&SD2, NULL);
|
||||||
nullObjectInit(&nullstream);
|
nullObjectInit(&nullstream);
|
||||||
|
|
||||||
/*
|
/* Activating the card insertion monitor.*/
|
||||||
* Activates the card insertion monitor.
|
|
||||||
*/
|
|
||||||
sdmonInit();
|
sdmonInit();
|
||||||
|
|
||||||
/*
|
/* Spawning a blinker thread.*/
|
||||||
* Creating a blinker thread.
|
static thread_t thd1;
|
||||||
*/
|
static const THD_DECL_STATIC(thd1_desc, "blinker", thd1_stack,
|
||||||
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO+10, Thread1, NULL);
|
NORMALPRIO + 10, thd1_func, NULL, NULL);
|
||||||
|
chThdSpawnRunning(&thd1, &thd1_desc);
|
||||||
|
|
||||||
/*
|
/* Initializing an overlay VFS object as a root on top of a FatFS driver.
|
||||||
* Initializing an overlay VFS object as a root on top of a FatFS driver.
|
This is accessible from kernel space and covers the whole file system.*/
|
||||||
* This is accessible from kernel space and covers the whole file system.
|
|
||||||
*/
|
|
||||||
ffdrvObjectInit(&fatfs_driver);
|
ffdrvObjectInit(&fatfs_driver);
|
||||||
ovldrvObjectInit(&root_overlay_driver, (vfs_driver_c *)&fatfs_driver, NULL);
|
ovldrvObjectInit(&root_overlay_driver, (vfs_driver_c *)&fatfs_driver, NULL);
|
||||||
|
|
||||||
/*
|
/* Initializing overlay drivers for the two sandbox roots. Those also use
|
||||||
* Initializing overlay drivers for the two sandbox roots. Those also use
|
the FatFS driver but are restricted to "/sb1" and "/sb2" directories.*/
|
||||||
* the FatFS driver but are restricted to "/sb1" and "/sb2" directories.
|
|
||||||
*/
|
|
||||||
ovldrvObjectInit(&sb1_root_overlay_driver, (vfs_driver_c *)&fatfs_driver, "/sb1");
|
ovldrvObjectInit(&sb1_root_overlay_driver, (vfs_driver_c *)&fatfs_driver, "/sb1");
|
||||||
ret = ovldrvRegisterDriver(&sb1_root_overlay_driver,
|
ret = ovldrvRegisterDriver(&sb1_root_overlay_driver,
|
||||||
(vfs_driver_c *)stmdrvObjectInit(&sb1_dev_driver,
|
(vfs_driver_c *)stmdrvObjectInit(&sb1_dev_driver,
|
||||||
|
@ -179,33 +164,23 @@ int main(void) {
|
||||||
chSysHalt("VFS");
|
chSysHalt("VFS");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Sandbox object initialization.*/
|
||||||
* Sandbox objects initialization.
|
|
||||||
*/
|
|
||||||
sbObjectInit(&sbx1);
|
sbObjectInit(&sbx1);
|
||||||
sbSetRegion(&sbx1, 0, STARTUP_RAM1_BASE, STARTUP_RAM1_SIZE, SB_REG_IS_CODE_AND_DATA);
|
|
||||||
sbSetFileSystem(&sbx1, (vfs_driver_c *)&sb1_root_overlay_driver);
|
sbSetFileSystem(&sbx1, (vfs_driver_c *)&sb1_root_overlay_driver);
|
||||||
|
|
||||||
/*
|
/* Listening to sandbox events.*/
|
||||||
* Listening to sandbox events.
|
|
||||||
*/
|
|
||||||
chEvtRegister(&sb.termination_es, &elsb, (eventid_t)2);
|
chEvtRegister(&sb.termination_es, &elsb, (eventid_t)2);
|
||||||
|
|
||||||
/*
|
/* Normal main() thread activity, (re)spawning sandboxed application.*/
|
||||||
* Normal main() thread activity, in this demo it monitors the user button
|
|
||||||
* and checks for sandboxes state.
|
|
||||||
*/
|
|
||||||
while (true) {
|
while (true) {
|
||||||
chEvtDispatch(evhndl, chEvtWaitOneTimeout(ALL_EVENTS, TIME_MS2I(500)));
|
chEvtDispatch(evhndl, chEvtWaitOneTimeout(ALL_EVENTS, TIME_MS2I(500)));
|
||||||
|
|
||||||
if (sdmon_ready && !sbIsThreadRunningX(&sbx1)) {
|
if (sdmon_ready && !sbIsThreadRunningX(&sbx1)) {
|
||||||
|
|
||||||
/* Small delay before relaunching.*/
|
/* Small delay before relaunching.*/
|
||||||
chThdSleepMilliseconds(1000);
|
chThdSleepMilliseconds(500);
|
||||||
|
|
||||||
/*
|
/* Associating standard input, output and error to sandbox 1.*/
|
||||||
* Associating standard input, output and error to sandbox 1.
|
|
||||||
*/
|
|
||||||
ret = vfsDrvOpen((vfs_driver_c *)&sb1_root_overlay_driver,
|
ret = vfsDrvOpen((vfs_driver_c *)&sb1_root_overlay_driver,
|
||||||
"/dev/VSD1", VO_RDWR, &np);
|
"/dev/VSD1", VO_RDWR, &np);
|
||||||
if (CH_RET_IS_ERROR(ret)) {
|
if (CH_RET_IS_ERROR(ret)) {
|
||||||
|
@ -217,10 +192,8 @@ int main(void) {
|
||||||
sbRegisterDescriptor(&sbx1, STDERR_FILENO, (vfs_node_c *)roAddRef(np));
|
sbRegisterDescriptor(&sbx1, STDERR_FILENO, (vfs_node_c *)roAddRef(np));
|
||||||
vfsClose(np);
|
vfsClose(np);
|
||||||
|
|
||||||
/*
|
/* Running the sandbox with 56kB of extra heap space.*/
|
||||||
* Running the sandbox.
|
ret = sbExecDynamic(&sbx1, NORMALPRIO-10, 56*1024,
|
||||||
*/
|
|
||||||
ret = sbExecDynamic(&sbx1, NORMALPRIO-10, 8192,
|
|
||||||
"/bin/msh.elf", sbx1_argv, sbx1_envp);
|
"/bin/msh.elf", sbx1_argv, sbx1_envp);
|
||||||
if (CH_RET_IS_ERROR(ret)) {
|
if (CH_RET_IS_ERROR(ret)) {
|
||||||
chprintf((BaseSequentialStream *)&SD2, "SBX1 launch failed (%08lx)\r\n", ret);
|
chprintf((BaseSequentialStream *)&SD2, "SBX1 launch failed (%08lx)\r\n", ret);
|
||||||
|
|
|
@ -836,7 +836,7 @@
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
||||||
#define PORT_USE_SYSCALL TRUE
|
#define PORT_USE_SYSCALL TRUE
|
||||||
#define PORT_SWITCHED_REGIONS_NUMBER 2
|
#define PORT_SWITCHED_REGIONS_NUMBER 1
|
||||||
|
|
||||||
#endif /* CHCONF_H */
|
#endif /* CHCONF_H */
|
||||||
|
|
||||||
|
|
|
@ -17,15 +17,11 @@
|
||||||
#include "ch.h"
|
#include "ch.h"
|
||||||
#include "hal.h"
|
#include "hal.h"
|
||||||
#include "sb.h"
|
#include "sb.h"
|
||||||
|
|
||||||
#include "chprintf.h"
|
#include "chprintf.h"
|
||||||
|
|
||||||
//#include "rt_test_root.h"
|
|
||||||
//#include "oslib_test_root.h"
|
|
||||||
|
|
||||||
#include "nullstreams.h"
|
#include "nullstreams.h"
|
||||||
|
|
||||||
#include "startup_defs.h"
|
#include "startup_defs.h"
|
||||||
|
|
||||||
#include "sdmon.h"
|
#include "sdmon.h"
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
@ -88,17 +84,16 @@ static const char *sbx1_envp[] = {
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Green LED blinker thread, times are in milliseconds.
|
* LED blinker thread, times are in milliseconds.
|
||||||
*/
|
*/
|
||||||
static THD_WORKING_AREA(waThread1, 256);
|
static THD_STACK(thd1_stack, 256);
|
||||||
static THD_FUNCTION(Thread1, arg) {
|
static THD_FUNCTION(thd1_func, arg) {
|
||||||
|
|
||||||
(void)arg;
|
(void)arg;
|
||||||
|
|
||||||
chRegSetThreadName("blinker");
|
|
||||||
while (true) {
|
while (true) {
|
||||||
palToggleLine(LINE_LED_GREEN);
|
palToggleLine(LINE_LED_GREEN);
|
||||||
chThdSleepMilliseconds(sdmon_ready ? 250 : 500);
|
chThdSleepMilliseconds(sdmon_ready ? 100 : 500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,7 +107,7 @@ static void SBHandler(eventid_t id) {
|
||||||
if (!sbIsThreadRunningX(&sbx1)) {
|
if (!sbIsThreadRunningX(&sbx1)) {
|
||||||
msg_t msg = sbWait(&sbx1);
|
msg_t msg = sbWait(&sbx1);
|
||||||
|
|
||||||
chprintf((BaseSequentialStream *)&SD2, "SB1 terminated (%08lx)\r\n", msg);
|
chprintf((BaseSequentialStream *)&SD2, "SBX1 terminated (%08lx)\r\n", msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,33 +138,26 @@ int main(void) {
|
||||||
vfsInit();
|
vfsInit();
|
||||||
sbHostInit();
|
sbHostInit();
|
||||||
|
|
||||||
/*
|
/* Starting a serial ports for I/O, initializing other streams too.*/
|
||||||
* Starting a serial ports for I/O, initializing other streams too.
|
|
||||||
*/
|
|
||||||
sdStart(&SD2, NULL);
|
sdStart(&SD2, NULL);
|
||||||
nullObjectInit(&nullstream);
|
nullObjectInit(&nullstream);
|
||||||
|
|
||||||
/*
|
/* Activating the card insertion monitor.*/
|
||||||
* Activates the card insertion monitor.
|
|
||||||
*/
|
|
||||||
sdmonInit();
|
sdmonInit();
|
||||||
|
|
||||||
/*
|
/* Spawning a blinker thread.*/
|
||||||
* Creating a blinker thread.
|
static thread_t thd1;
|
||||||
*/
|
static const THD_DECL_STATIC(thd1_desc, "blinker", thd1_stack,
|
||||||
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO+10, Thread1, NULL);
|
NORMALPRIO + 10, thd1_func, NULL, NULL);
|
||||||
|
chThdSpawnRunning(&thd1, &thd1_desc);
|
||||||
|
|
||||||
/*
|
/* Initializing an overlay VFS object as a root on top of a FatFS driver.
|
||||||
* Initializing an overlay VFS object as a root on top of a FatFS driver.
|
This is accessible from kernel space and covers the whole file system.*/
|
||||||
* This is accessible from kernel space and covers the whole file system.
|
|
||||||
*/
|
|
||||||
ffdrvObjectInit(&fatfs_driver);
|
ffdrvObjectInit(&fatfs_driver);
|
||||||
ovldrvObjectInit(&root_overlay_driver, (vfs_driver_c *)&fatfs_driver, NULL);
|
ovldrvObjectInit(&root_overlay_driver, (vfs_driver_c *)&fatfs_driver, NULL);
|
||||||
|
|
||||||
/*
|
/* Initializing overlay drivers for the two sandbox roots. Those also use
|
||||||
* Initializing overlay drivers for the two sandbox roots. Those also use
|
the FatFS driver but are restricted to "/sb1" and "/sb2" directories.*/
|
||||||
* the FatFS driver but are restricted to "/sb1" and "/sb2" directories.
|
|
||||||
*/
|
|
||||||
ovldrvObjectInit(&sb1_root_overlay_driver, (vfs_driver_c *)&fatfs_driver, "/sb1");
|
ovldrvObjectInit(&sb1_root_overlay_driver, (vfs_driver_c *)&fatfs_driver, "/sb1");
|
||||||
ret = ovldrvRegisterDriver(&sb1_root_overlay_driver,
|
ret = ovldrvRegisterDriver(&sb1_root_overlay_driver,
|
||||||
(vfs_driver_c *)stmdrvObjectInit(&sb1_dev_driver,
|
(vfs_driver_c *)stmdrvObjectInit(&sb1_dev_driver,
|
||||||
|
@ -179,33 +167,24 @@ int main(void) {
|
||||||
chSysHalt("VFS");
|
chSysHalt("VFS");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Sandbox object initialization.*/
|
||||||
* Sandbox objects initialization.
|
|
||||||
*/
|
|
||||||
sbObjectInit(&sbx1);
|
sbObjectInit(&sbx1);
|
||||||
sbSetRegion(&sbx1, 0, STARTUP_RAM1_BASE, STARTUP_RAM1_SIZE, SB_REG_IS_CODE_AND_DATA);
|
sbSetRegion(&sbx1, 0, STARTUP_RAM1_BASE, STARTUP_RAM1_SIZE, SB_REG_IS_CODE_AND_DATA);
|
||||||
sbSetFileSystem(&sbx1, (vfs_driver_c *)&sb1_root_overlay_driver);
|
sbSetFileSystem(&sbx1, (vfs_driver_c *)&sb1_root_overlay_driver);
|
||||||
|
|
||||||
/*
|
/* Listening to sandbox events.*/
|
||||||
* Listening to sandbox events.
|
|
||||||
*/
|
|
||||||
chEvtRegister(&sb.termination_es, &elsb, (eventid_t)2);
|
chEvtRegister(&sb.termination_es, &elsb, (eventid_t)2);
|
||||||
|
|
||||||
/*
|
/* Normal main() thread activity, (re)spawning sandboxed application.*/
|
||||||
* Normal main() thread activity, in this demo it monitors the user button
|
|
||||||
* and checks for sandboxes state.
|
|
||||||
*/
|
|
||||||
while (true) {
|
while (true) {
|
||||||
chEvtDispatch(evhndl, chEvtWaitOneTimeout(ALL_EVENTS, TIME_MS2I(500)));
|
chEvtDispatch(evhndl, chEvtWaitOneTimeout(ALL_EVENTS, TIME_MS2I(500)));
|
||||||
|
|
||||||
if (sdmon_ready && !sbIsThreadRunningX(&sbx1)) {
|
if (sdmon_ready && !sbIsThreadRunningX(&sbx1)) {
|
||||||
|
|
||||||
/* Small delay before relaunching.*/
|
/* Small delay before relaunching.*/
|
||||||
chThdSleepMilliseconds(1000);
|
chThdSleepMilliseconds(500);
|
||||||
|
|
||||||
/*
|
/* Associating standard input, output and error to sandbox 1.*/
|
||||||
* Associating standard input, output and error to sandbox 1.
|
|
||||||
*/
|
|
||||||
ret = vfsDrvOpen((vfs_driver_c *)&sb1_root_overlay_driver,
|
ret = vfsDrvOpen((vfs_driver_c *)&sb1_root_overlay_driver,
|
||||||
"/dev/VSD1", VO_RDWR, &np);
|
"/dev/VSD1", VO_RDWR, &np);
|
||||||
if (CH_RET_IS_ERROR(ret)) {
|
if (CH_RET_IS_ERROR(ret)) {
|
||||||
|
|
|
@ -272,7 +272,6 @@ static void ShellHandler(eventid_t id) {
|
||||||
shelltp = NULL;
|
shelltp = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* LED blinker thread, times are in milliseconds.
|
* LED blinker thread, times are in milliseconds.
|
||||||
*/
|
*/
|
||||||
|
@ -315,9 +314,7 @@ int main(void) {
|
||||||
/* Board-dependent setup code.*/
|
/* Board-dependent setup code.*/
|
||||||
portab_setup();
|
portab_setup();
|
||||||
|
|
||||||
/*
|
/* Spawning a blinker thread.*/
|
||||||
* Spawning a blinker thread.
|
|
||||||
*/
|
|
||||||
static thread_t thd1;
|
static thread_t thd1;
|
||||||
static const THD_DECL_STATIC(thd1_desc, "blinker", thd1_stack,
|
static const THD_DECL_STATIC(thd1_desc, "blinker", thd1_stack,
|
||||||
NORMALPRIO + 10, thd1_func, NULL, NULL);
|
NORMALPRIO + 10, thd1_func, NULL, NULL);
|
||||||
|
|
Loading…
Reference in New Issue