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:
Giovanni Di Sirio 2023-05-20 09:03:14 +00:00
parent b37650e6ab
commit f2e2656b74
5 changed files with 24 additions and 27 deletions

View File

@ -23,7 +23,6 @@
#include "startup_defs.h" #include "startup_defs.h"
/* Sandbox objects.*/ /* Sandbox objects.*/
sb_class_t sbx1, sbx2; sb_class_t sbx1, sbx2;
@ -108,8 +107,8 @@ static null_stream_c nullstream;
/* Stream to be exposed under /dev as files.*/ /* Stream to be exposed under /dev as files.*/
static const drv_streams_element_t streams[] = { static const drv_streams_element_t streams[] = {
{"VSIO1", (BaseSequentialStream *)&SIOD1.chn}, /* TODO */ {"VSIO1", (BaseSequentialStream *)oopGetIf(&SIOD1, chn)},
{"null", (BaseSequentialStream *)&nullstream.stm}, /* TODO */ {"null", (BaseSequentialStream *)oopGetIf(&nullstream, stm)},
{NULL, NULL} {NULL, NULL}
}; };
@ -259,7 +258,7 @@ static THD_FUNCTION(Thread1, arg) {
chRegSetThreadName("messenger"); chRegSetThreadName("messenger");
while (true) { while (true) {
chThdSleepMilliseconds(500); chThdSleepMilliseconds(500);
// sbSendMessage(&sbx2, (msg_t)i); sbSendMessage(&sbx2, (msg_t)i);
i++; i++;
} }
} }
@ -268,7 +267,6 @@ static THD_FUNCTION(Thread1, arg) {
* Application entry point. * Application entry point.
*/ */
int main(void) { int main(void) {
// unsigned i = 1U;
event_listener_t el1; event_listener_t el1;
msg_t ret; msg_t ret;

View File

@ -99,10 +99,11 @@ include $(CHIBIOS)/os/license/license.mk
# Startup files. # Startup files.
include $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_stm32g4xx.mk include $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_stm32g4xx.mk
# Common files. # 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). # HAL-OSAL files (optional).
include $(CHIBIOS)/os/hal/hal.mk include $(CHIBIOS)/os/xhal/hal.mk
include $(CHIBIOS)/os/hal/ports/STM32/STM32G4xx/platform.mk include $(CHIBIOS)/os/xhal/ports/STM32/STM32G4xx/platform.mk
include $(CHIBIOS)/os/hal/boards/ST_NUCLEO64_G474RE/board.mk include $(CHIBIOS)/os/hal/boards/ST_NUCLEO64_G474RE/board.mk
include $(CHIBIOS)/os/hal/osal/rt-nil/osal.mk include $(CHIBIOS)/os/hal/osal/rt-nil/osal.mk
# RTOS files (optional). # RTOS files (optional).
@ -120,7 +121,6 @@ include $(CHIBIOS)/tools/mk/autobuild.mk
include $(CHIBIOS)/os/test/test.mk include $(CHIBIOS)/os/test/test.mk
include $(CHIBIOS)/test/rt/rt_test.mk include $(CHIBIOS)/test/rt/rt_test.mk
include $(CHIBIOS)/test/oslib/oslib_test.mk include $(CHIBIOS)/test/oslib/oslib_test.mk
include $(CHIBIOS)/os/hal/lib/streams/streams.mk
# Define linker script file here # Define linker script file here
LDSCRIPT= ./STM32G474xE_SB.ld LDSCRIPT= ./STM32G474xE_SB.ld
@ -159,7 +159,7 @@ CPPWARN = -Wall -Wextra -Wundef
# #
# List all user C define here, like -D_DEBUG=1 # List all user C define here, like -D_DEBUG=1
UDEFS = UDEFS = -DOOP_USE_LEGACY
# Define ASM defines here # Define ASM defines here
UADEFS = UADEFS =

View File

@ -142,7 +142,7 @@
* @brief Enables the SERIAL subsystem. * @brief Enables the SERIAL subsystem.
*/ */
#if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__) #if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__)
#define HAL_USE_SERIAL TRUE #define HAL_USE_SERIAL FALSE
#endif #endif
/** /**

View File

@ -304,7 +304,7 @@
/* /*
* SERIAL driver system settings. * 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_USART2 FALSE
#define STM32_SERIAL_USE_USART3 FALSE #define STM32_SERIAL_USE_USART3 FALSE
#define STM32_SERIAL_USE_UART4 FALSE #define STM32_SERIAL_USE_UART4 FALSE
@ -314,7 +314,7 @@
/* /*
* SIO driver system settings. * 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_USART2 FALSE
#define STM32_SIO_USE_USART3 FALSE #define STM32_SIO_USE_USART3 FALSE
#define STM32_SIO_USE_UART4 FALSE #define STM32_SIO_USE_UART4 FALSE

View File

@ -23,7 +23,6 @@
#include "startup_defs.h" #include "startup_defs.h"
/* Sandbox objects.*/ /* Sandbox objects.*/
sb_class_t sbx1, sbx2; sb_class_t sbx1, sbx2;
@ -104,12 +103,12 @@ static vfs_streams_driver_c dev_driver;
symbol is expected.*/ symbol is expected.*/
vfs_driver_c *vfs_root = (vfs_driver_c *)&root_overlay_driver; 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.*/ /* Stream to be exposed under /dev as files.*/
static const drv_streams_element_t streams[] = { static const drv_streams_element_t streams[] = {
{"VSD1", (BaseSequentialStream *)&SD1}, {"VSIO1", (BaseSequentialStream *)oopGetIf(&SIOD1, chn)},
{"null", (BaseSequentialStream *)&nullstream}, {"null", (BaseSequentialStream *)oopGetIf(&nullstream, stm)},
{NULL, NULL} {NULL, NULL}
}; };
@ -201,7 +200,7 @@ static void start_sb2(void) {
/* /*
* Associating standard input, output and error to sandbox 2.*/ * 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)) { if (CH_RET_IS_ERROR(ret)) {
chSysHalt("VFS"); chSysHalt("VFS");
} }
@ -240,7 +239,6 @@ static THD_FUNCTION(Thread1, arg) {
* Application entry point. * Application entry point.
*/ */
int main(void) { int main(void) {
// unsigned i = 1U;
event_listener_t el1; event_listener_t el1;
msg_t ret; msg_t ret;
@ -261,8 +259,8 @@ int main(void) {
/* /*
* Starting a serial port for I/O, initializing other streams too. * Starting a serial port for I/O, initializing other streams too.
*/ */
sdStart(&SD1, NULL); drvStart(&SIOD1);
nullObjectInit(&nullstream); nullstmObjectInit(&nullstream);
/* /*
* Creating a messenger thread. * Creating a messenger thread.
@ -273,10 +271,11 @@ int main(void) {
* Initializing an overlay VFS object as a root, no overlaid driver, * Initializing an overlay VFS object as a root, no overlaid driver,
* registering a streams VFS driver on the VFS overlay root as "/dev". * registering a streams VFS driver on the VFS overlay root as "/dev".
*/ */
drvOverlayObjectInit(&root_overlay_driver, NULL, NULL); ovldrvObjectInit(&root_overlay_driver, NULL, NULL);
ret = drvOverlayRegisterDriver(&root_overlay_driver, ret = ovldrvRegisterDriver(&root_overlay_driver,
drvStreamsObjectInit(&dev_driver, &streams[0]), (vfs_driver_c *)stmdrvObjectInit(&dev_driver,
"dev"); &streams[0]),
"dev");
if (CH_RET_IS_ERROR(ret)) { if (CH_RET_IS_ERROR(ret)) {
chSysHalt("VFS"); chSysHalt("VFS");
} }
@ -323,13 +322,13 @@ int main(void) {
if (chEvtWaitOneTimeout(ALL_EVENTS, TIME_MS2I(500)) != (eventmask_t)0) { if (chEvtWaitOneTimeout(ALL_EVENTS, TIME_MS2I(500)) != (eventmask_t)0) {
if (!sbIsThreadRunningX(&sbx1)) { if (!sbIsThreadRunningX(&sbx1)) {
chprintf((BaseSequentialStream *)&SD1, "SB1 terminated\r\n"); chprintf(oopGetIf(&SIOD1, chn), "SB1 terminated\r\n");
chThdSleepMilliseconds(100); chThdSleepMilliseconds(100);
start_sb1(); start_sb1();
} }
if (!sbIsThreadRunningX(&sbx2)) { if (!sbIsThreadRunningX(&sbx2)) {
chprintf((BaseSequentialStream *)&SD1, "SB2 terminated\r\n"); chprintf(oopGetIf(&SIOD1, chn), "SB2 terminated\r\n");
chThdSleepMilliseconds(100); chThdSleepMilliseconds(100);
start_sb2(); start_sb2();
} }