Fixed G4 SB demos.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@16249 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
parent
b37650e6ab
commit
f2e2656b74
|
@ -23,7 +23,6 @@
|
|||
|
||||
#include "startup_defs.h"
|
||||
|
||||
|
||||
/* Sandbox objects.*/
|
||||
sb_class_t sbx1, sbx2;
|
||||
|
||||
|
@ -108,8 +107,8 @@ static null_stream_c nullstream;
|
|||
|
||||
/* Stream to be exposed under /dev as files.*/
|
||||
static const drv_streams_element_t streams[] = {
|
||||
{"VSIO1", (BaseSequentialStream *)&SIOD1.chn}, /* TODO */
|
||||
{"null", (BaseSequentialStream *)&nullstream.stm}, /* TODO */
|
||||
{"VSIO1", (BaseSequentialStream *)oopGetIf(&SIOD1, chn)},
|
||||
{"null", (BaseSequentialStream *)oopGetIf(&nullstream, stm)},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
|
@ -259,7 +258,7 @@ static THD_FUNCTION(Thread1, arg) {
|
|||
chRegSetThreadName("messenger");
|
||||
while (true) {
|
||||
chThdSleepMilliseconds(500);
|
||||
// sbSendMessage(&sbx2, (msg_t)i);
|
||||
sbSendMessage(&sbx2, (msg_t)i);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
@ -268,7 +267,6 @@ static THD_FUNCTION(Thread1, arg) {
|
|||
* Application entry point.
|
||||
*/
|
||||
int main(void) {
|
||||
// unsigned i = 1U;
|
||||
event_listener_t el1;
|
||||
msg_t ret;
|
||||
|
||||
|
|
|
@ -99,10 +99,11 @@ include $(CHIBIOS)/os/license/license.mk
|
|||
# Startup files.
|
||||
include $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_stm32g4xx.mk
|
||||
# Common files.
|
||||
include $(CHIBIOS)/os/common/utils/utils.mk
|
||||
include $(CHIBIOS)/os/common/oop/oop.mk
|
||||
include $(CHIBIOS)/os/common/lib/lib.mk
|
||||
# HAL-OSAL files (optional).
|
||||
include $(CHIBIOS)/os/hal/hal.mk
|
||||
include $(CHIBIOS)/os/hal/ports/STM32/STM32G4xx/platform.mk
|
||||
include $(CHIBIOS)/os/xhal/hal.mk
|
||||
include $(CHIBIOS)/os/xhal/ports/STM32/STM32G4xx/platform.mk
|
||||
include $(CHIBIOS)/os/hal/boards/ST_NUCLEO64_G474RE/board.mk
|
||||
include $(CHIBIOS)/os/hal/osal/rt-nil/osal.mk
|
||||
# RTOS files (optional).
|
||||
|
@ -120,7 +121,6 @@ include $(CHIBIOS)/tools/mk/autobuild.mk
|
|||
include $(CHIBIOS)/os/test/test.mk
|
||||
include $(CHIBIOS)/test/rt/rt_test.mk
|
||||
include $(CHIBIOS)/test/oslib/oslib_test.mk
|
||||
include $(CHIBIOS)/os/hal/lib/streams/streams.mk
|
||||
|
||||
# Define linker script file here
|
||||
LDSCRIPT= ./STM32G474xE_SB.ld
|
||||
|
@ -159,7 +159,7 @@ CPPWARN = -Wall -Wextra -Wundef
|
|||
#
|
||||
|
||||
# List all user C define here, like -D_DEBUG=1
|
||||
UDEFS =
|
||||
UDEFS = -DOOP_USE_LEGACY
|
||||
|
||||
# Define ASM defines here
|
||||
UADEFS =
|
||||
|
|
|
@ -142,7 +142,7 @@
|
|||
* @brief Enables the SERIAL subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_SERIAL TRUE
|
||||
#define HAL_USE_SERIAL FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
|
@ -304,7 +304,7 @@
|
|||
/*
|
||||
* SERIAL driver system settings.
|
||||
*/
|
||||
#define STM32_SERIAL_USE_USART1 TRUE
|
||||
#define STM32_SERIAL_USE_USART1 FALSE
|
||||
#define STM32_SERIAL_USE_USART2 FALSE
|
||||
#define STM32_SERIAL_USE_USART3 FALSE
|
||||
#define STM32_SERIAL_USE_UART4 FALSE
|
||||
|
@ -314,7 +314,7 @@
|
|||
/*
|
||||
* SIO driver system settings.
|
||||
*/
|
||||
#define STM32_SIO_USE_USART1 FALSE
|
||||
#define STM32_SIO_USE_USART1 TRUE
|
||||
#define STM32_SIO_USE_USART2 FALSE
|
||||
#define STM32_SIO_USE_USART3 FALSE
|
||||
#define STM32_SIO_USE_UART4 FALSE
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
#include "startup_defs.h"
|
||||
|
||||
|
||||
/* Sandbox objects.*/
|
||||
sb_class_t sbx1, sbx2;
|
||||
|
||||
|
@ -104,12 +103,12 @@ static vfs_streams_driver_c dev_driver;
|
|||
symbol is expected.*/
|
||||
vfs_driver_c *vfs_root = (vfs_driver_c *)&root_overlay_driver;
|
||||
|
||||
static NullStream nullstream;
|
||||
static null_stream_c nullstream;
|
||||
|
||||
/* Stream to be exposed under /dev as files.*/
|
||||
static const drv_streams_element_t streams[] = {
|
||||
{"VSD1", (BaseSequentialStream *)&SD1},
|
||||
{"null", (BaseSequentialStream *)&nullstream},
|
||||
{"VSIO1", (BaseSequentialStream *)oopGetIf(&SIOD1, chn)},
|
||||
{"null", (BaseSequentialStream *)oopGetIf(&nullstream, stm)},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
|
@ -201,7 +200,7 @@ static void start_sb2(void) {
|
|||
|
||||
/*
|
||||
* Associating standard input, output and error to sandbox 2.*/
|
||||
ret = vfsOpen("/dev/VSD1", 0, &np);
|
||||
ret = vfsOpen("/dev/VSIO1", 0, &np);
|
||||
if (CH_RET_IS_ERROR(ret)) {
|
||||
chSysHalt("VFS");
|
||||
}
|
||||
|
@ -240,7 +239,6 @@ static THD_FUNCTION(Thread1, arg) {
|
|||
* Application entry point.
|
||||
*/
|
||||
int main(void) {
|
||||
// unsigned i = 1U;
|
||||
event_listener_t el1;
|
||||
msg_t ret;
|
||||
|
||||
|
@ -261,8 +259,8 @@ int main(void) {
|
|||
/*
|
||||
* Starting a serial port for I/O, initializing other streams too.
|
||||
*/
|
||||
sdStart(&SD1, NULL);
|
||||
nullObjectInit(&nullstream);
|
||||
drvStart(&SIOD1);
|
||||
nullstmObjectInit(&nullstream);
|
||||
|
||||
/*
|
||||
* Creating a messenger thread.
|
||||
|
@ -273,10 +271,11 @@ int main(void) {
|
|||
* Initializing an overlay VFS object as a root, no overlaid driver,
|
||||
* registering a streams VFS driver on the VFS overlay root as "/dev".
|
||||
*/
|
||||
drvOverlayObjectInit(&root_overlay_driver, NULL, NULL);
|
||||
ret = drvOverlayRegisterDriver(&root_overlay_driver,
|
||||
drvStreamsObjectInit(&dev_driver, &streams[0]),
|
||||
"dev");
|
||||
ovldrvObjectInit(&root_overlay_driver, NULL, NULL);
|
||||
ret = ovldrvRegisterDriver(&root_overlay_driver,
|
||||
(vfs_driver_c *)stmdrvObjectInit(&dev_driver,
|
||||
&streams[0]),
|
||||
"dev");
|
||||
if (CH_RET_IS_ERROR(ret)) {
|
||||
chSysHalt("VFS");
|
||||
}
|
||||
|
@ -323,13 +322,13 @@ int main(void) {
|
|||
if (chEvtWaitOneTimeout(ALL_EVENTS, TIME_MS2I(500)) != (eventmask_t)0) {
|
||||
|
||||
if (!sbIsThreadRunningX(&sbx1)) {
|
||||
chprintf((BaseSequentialStream *)&SD1, "SB1 terminated\r\n");
|
||||
chprintf(oopGetIf(&SIOD1, chn), "SB1 terminated\r\n");
|
||||
chThdSleepMilliseconds(100);
|
||||
start_sb1();
|
||||
}
|
||||
|
||||
if (!sbIsThreadRunningX(&sbx2)) {
|
||||
chprintf((BaseSequentialStream *)&SD1, "SB2 terminated\r\n");
|
||||
chprintf(oopGetIf(&SIOD1, chn), "SB2 terminated\r\n");
|
||||
chThdSleepMilliseconds(100);
|
||||
start_sb2();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue