mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-10-06 10:59:48 +08:00
bsps/moxie/moxiesim: Exit the simulator on reset
The BSP used the reset loop, so the simulator never stopped. Every test ran to completion and then spun until the test runner killed it. The output was lost, because the standard output of the simulator is buffered and is flushed by the exit of its process. The simulator stops if the application issues the exit system call. Use it and pass a status which tells a successful run from a fatal error. Update #5701. Assisted-by: Claude:claude-opus-5 claude-code Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
This commit is contained in:
committed by
Kinsey Moore
parent
db08506d40
commit
cf5c60a725
@@ -4,6 +4,7 @@
|
||||
* COPYRIGHT (c) 2011 Anthony Green <green@moxielogic.com>
|
||||
*/
|
||||
|
||||
#define SYS_exit 1
|
||||
#define SYS_write 5
|
||||
|
||||
.section .text
|
||||
@@ -12,4 +13,13 @@
|
||||
_sys_write:
|
||||
swi SYS_write
|
||||
ret
|
||||
|
||||
/*
|
||||
* Terminate the simulator. The exit status is passed in $r0.
|
||||
*/
|
||||
.align 2
|
||||
.global _sys_exit
|
||||
_sys_exit:
|
||||
swi SYS_exit
|
||||
ret
|
||||
.end
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/* SPDX-License-Identifier: BSD-2-Clause */
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @ingroup RTEMSBSPsMoxieMoxieSim
|
||||
*
|
||||
* @brief Moxiesim Reset Support
|
||||
*
|
||||
* The Moxie GDB simulator terminates on the SYS_exit system call. Nothing
|
||||
* else stops it, and it flushes its buffered console output only when it
|
||||
* terminates.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2026 embedded brains GmbH & Co. KG
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <bsp/bootcard.h>
|
||||
|
||||
void _sys_exit( int status );
|
||||
|
||||
void bsp_reset( rtems_fatal_source source, rtems_fatal_code code )
|
||||
{
|
||||
int status;
|
||||
|
||||
if ( source == RTEMS_FATAL_SOURCE_EXIT && code == 0 ) {
|
||||
status = 0;
|
||||
} else {
|
||||
status = 1;
|
||||
}
|
||||
|
||||
_sys_exit( status );
|
||||
RTEMS_UNREACHABLE();
|
||||
}
|
||||
@@ -43,12 +43,12 @@ links:
|
||||
source:
|
||||
- bsps/moxie/moxiesim/console/console-io.c
|
||||
- bsps/moxie/moxiesim/console/syscalls.S
|
||||
- bsps/moxie/moxiesim/start/bspreset.c
|
||||
- bsps/shared/cache/nocache.c
|
||||
- bsps/shared/dev/btimer/btimer-cpucounter.c
|
||||
- bsps/shared/dev/clock/clock-simidle.c
|
||||
- bsps/shared/dev/getentropy/getentropy-cpucounter.c
|
||||
- bsps/shared/dev/serial/console-polled.c
|
||||
- bsps/shared/start/bspreset-loop.c
|
||||
- bsps/shared/start/bspstart-empty.c
|
||||
- bsps/shared/start/gettargethash-default.c
|
||||
- bsps/shared/start/sbrk.c
|
||||
|
||||
Reference in New Issue
Block a user