gdbarmsim: Remove

Closes #3611.
This commit is contained in:
Joel Sherrill
2020-03-19 15:55:26 -05:00
parent ab42b3e100
commit 37e7cc5f4c
27 changed files with 0 additions and 1531 deletions

View File

@@ -1,5 +0,0 @@
#
# The GDB ARM Simulator does not have a tick interrupt.
#
include: testdata/require-tick-isr.tcfg

View File

@@ -1,18 +0,0 @@
#
# Config file for GDB ARM Simulator as arm1136jf-s (FPU)
#
include $(RTEMS_ROOT)/make/custom/default.cfg
RTEMS_CPU=arm
# This contains the compiler options necessary to select the CPU model
# and (hopefully) optimize for it.
CPU_CFLAGS = -mcpu=arm1136jf-s
# optimize flag: typically -O2
CFLAGS_OPTIMIZE_V = -O2 -g
# Add CFLAGS and LDFLAGS for compiling and linking with per item sections
CFLAGS_OPTIMIZE_V += -ffunction-sections -fdata-sections
LDFLAGS = -Wl,--gc-sections

View File

@@ -1,5 +0,0 @@
#
# The GDB ARM Simulator does not have a tick interrupt.
#
include: testdata/require-tick-isr.tcfg

View File

@@ -1,18 +0,0 @@
#
# Config file for GDB ARM Simulator as arm1136j-s (no FPU)
#
include $(RTEMS_ROOT)/make/custom/default.cfg
RTEMS_CPU=arm
# This contains the compiler options necessary to select the CPU model
# and (hopefully) optimize for it.
CPU_CFLAGS = -mcpu=arm1136j-s
# optimize flag: typically -O2
CFLAGS_OPTIMIZE_V = -O2 -g
# Add CFLAGS and LDFLAGS for compiling and linking with per item sections
CFLAGS_OPTIMIZE_V += -ffunction-sections -fdata-sections
LDFLAGS = -Wl,--gc-sections

View File

@@ -1,5 +0,0 @@
#
# The GDB ARM Simulator does not have a tick interrupt.
#
include: testdata/require-tick-isr.tcfg

View File

@@ -1,18 +0,0 @@
#
# Config file for GDB ARM Simulator as arm7tdmi
#
include $(RTEMS_ROOT)/make/custom/default.cfg
RTEMS_CPU=arm
# This contains the compiler options necessary to select the CPU model
# and (hopefully) optimize for it.
CPU_CFLAGS = -mcpu=arm7tdmi
# optimize flag: typically -O2
CFLAGS_OPTIMIZE_V = -O2 -g
# Add CFLAGS and LDFLAGS for compiling and linking with per item sections
CFLAGS_OPTIMIZE_V += -ffunction-sections -fdata-sections
LDFLAGS = -Wl,--gc-sections

View File

@@ -1,5 +0,0 @@
#
# The GDB ARM Simulator does not have a tick interrupt.
#
include: testdata/require-tick-isr.tcfg

View File

@@ -1,18 +0,0 @@
#
# Config file for GDB ARM Simulator as arm920
#
include $(RTEMS_ROOT)/make/custom/default.cfg
RTEMS_CPU=arm
# This contains the compiler options necessary to select the CPU model
# and (hopefully) optimize for it.
CPU_CFLAGS = -mcpu=arm920
# optimize flag: typically -O2
CFLAGS_OPTIMIZE_V = -O2 -g
# Add CFLAGS and LDFLAGS for compiling and linking with per item sections
CFLAGS_OPTIMIZE_V += -ffunction-sections -fdata-sections
LDFLAGS = -Wl,--gc-sections

View File

@@ -1,5 +0,0 @@
#
# The GDB ARM Simulator does not have a tick interrupt.
#
include: testdata/require-tick-isr.tcfg

View File

@@ -1,19 +0,0 @@
#
# Config file for GDB ARM Simulator as cortex-a9
#
include $(RTEMS_ROOT)/make/custom/default.cfg
RTEMS_CPU=arm
# This contains the compiler options necessary to select the CPU model
# and (hopefully) optimize for it.
# CPU_CFLAGS = -mcpu=arm920 -mstructure-size-boundary=8
CPU_CFLAGS = -mcpu=cortex-a9
# optimize flag: typically -O2
CFLAGS_OPTIMIZE_V = -O2 -g
# Add CFLAGS and LDFLAGS for compiling and linking with per item sections
CFLAGS_OPTIMIZE_V += -ffunction-sections -fdata-sections
LDFLAGS = -Wl,--gc-sections

View File

@@ -1,58 +0,0 @@
/*
* COPYRIGHT (c) 1989-2009.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.org/license/LICENSE.
*/
#include <bsp.h>
#include <bsp/console-polled.h>
#include <rtems/libio.h>
#include <stdlib.h>
#include <assert.h>
/*
* console_initialize_hardware
*
* This routine initializes the console hardware.
*
*/
void console_initialize_hardware(void)
{
return;
}
/*
* console_outbyte_polled
*
* This routine transmits a character using polling.
*/
void console_outbyte_polled(
int port,
char ch
)
{
gdbarmsim_writec(ch);
}
/*
* console_inbyte_nonblocking
*
* This routine polls for a character.
*/
int console_inbyte_nonblocking(
int port
)
{
return -1;
}
#include <rtems/bspIo.h>
static void MyBSP_output_char(char c) { console_outbyte_polled( 0, c ); }
BSP_output_char_function_type BSP_output_char = MyBSP_output_char;
BSP_polling_getchar_function_type BSP_poll_char = NULL;

View File

@@ -1,11 +0,0 @@
## This file was generated by "./boostrap -H".
include_HEADERS =
include_HEADERS += ../../../../../../bsps/arm/gdbarmsim/include/bsp.h
include_HEADERS += include/bspopts.h
include_HEADERS += ../../../../../../bsps/arm/gdbarmsim/include/tm27.h
include_bspdir = $(includedir)/bsp
include_bsp_HEADERS =
include_bsp_HEADERS += ../../../../../../bsps/arm/gdbarmsim/include/bsp/irq.h
include_bsp_HEADERS += ../../../../../../bsps/arm/gdbarmsim/include/bsp/swi.h

View File

@@ -1,85 +0,0 @@
/**
* @file
*
* @ingroup RTEMSBSPsARMGDBSim
*
* @brief Global BSP definitions.
*/
/*
* COPYRIGHT (c) 1989-2009.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.org/license/LICENSE.
*/
#ifndef LIBBSP_ARM_GDBARMSIM_BSP_H
#define LIBBSP_ARM_GDBARMSIM_BSP_H
/**
* @defgroup RTEMSBSPsARMGDBSim GDB Simulator
*
* @ingroup RTEMSBSPsARM
*
* @brief GDB Simulator Board Support Package.
*
* @{
*/
#include <bspopts.h>
#include <bsp/default-initial-extension.h>
#include <rtems.h>
#include <sys/stat.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Support for simulated clock tick
*/
void *clock_driver_sim_idle_body(uintptr_t);
#define BSP_IDLE_TASK_BODY clock_driver_sim_idle_body
/*
* Access to the GDB simulator.
*
* NOTE: Full list possible is included. Not all are available in BSP.
*/
int gdbarmsim_system(const char *);
int gdbarmsim_rename(const char *, const char *);
int gdbarmsim__isatty(int);
/* clock_t gdbarmsim_times(struct tms *); */
int gdbarmsim_gettimeofday(struct timeval *, void *);
int gdbarmsim_unlink(const char *);
int gdbarmsim_link(void);
int gdbarmsim_stat(const char *, struct stat *);
int gdbarmsim_fstat(int, struct stat *);
int gdbarmsim_swistat(int fd, struct stat * st);
int gdbarmsim_close(int);
clock_t gdbarmsim_clock(void);
int gdbarmsim_swiclose(int);
int gdbarmsim_open(const char *, int, ...);
int gdbarmsim_swiopen(const char *, int);
int gdbarmsim_writec(const char c);
int gdbarmsim_write(int, char *, int);
int gdbarmsim_swiwrite(int, char *, int);
int gdbarmsim_lseek(int, int, int);
int gdbarmsim_swilseek(int, int, int);
int gdbarmsim_read(int, char *, int);
int gdbarmsim_swiread(int, char *, int);
void initialise_monitor_handles(void);
#ifdef __cplusplus
}
#endif
/** @} */
#endif /* _BSP_H */

View File

@@ -1,95 +0,0 @@
/**
* @file
*
* @ingroup bsp_interrupt
*
* @brief Dummy interrupt definitions.
*/
/*
* Copyright (c) 2008
* Embedded Brains GmbH
* Obere Lagerstr. 30
* D-82178 Puchheim
* Germany
* rtems@embedded-brains.de
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.org/license/LICENSE.
*/
#ifndef LIBBSP_ARM_DUMMY_IRQ_H
#define LIBBSP_ARM_DUMMY_IRQ_H
#ifndef ASM
#include <rtems.h>
#include <rtems/irq.h>
#include <rtems/irq-extension.h>
/**
* @addtogroup bsp_interrupt
*
* @{
*/
#define DUMMY_IRQ_WDT 0
#define DUMMY_IRQ_SOFTWARE 1
#define DUMMY_IRQ_ARM_CORE_0 2
#define DUMMY_IRQ_ARM_CORE_1 3
#define DUMMY_IRQ_TIMER_0 4
#define DUMMY_IRQ_TIMER_1 5
#define DUMMY_IRQ_UART_0 6
#define DUMMY_IRQ_UART_1 7
#define DUMMY_IRQ_PWM 8
#define DUMMY_IRQ_I2C_0 9
#define DUMMY_IRQ_SPI_SSP_0 10
#define DUMMY_IRQ_SSP_1 11
#define DUMMY_IRQ_PLL 12
#define DUMMY_IRQ_RTC 13
#define DUMMY_IRQ_EINT_0 14
#define DUMMY_IRQ_EINT_1 15
#define DUMMY_IRQ_EINT_2 16
#define DUMMY_IRQ_EINT_3 17
#define DUMMY_IRQ_ADC_0 18
#define DUMMY_IRQ_I2C_1 19
#define DUMMY_IRQ_BOD 20
#define DUMMY_IRQ_ETHERNET 21
#define DUMMY_IRQ_USB 22
#define DUMMY_IRQ_CAN 23
#define DUMMY_IRQ_SD_MMC 24
#define DUMMY_IRQ_DMA 25
#define DUMMY_IRQ_TIMER_2 26
#define DUMMY_IRQ_TIMER_3 27
#define DUMMY_IRQ_UART_2 28
#define DUMMY_IRQ_UART_3 29
#define DUMMY_IRQ_I2C_2 30
#define DUMMY_IRQ_I2S 31
#define DUMMY_IRQ_PRIORITY_VALUE_MIN 0U
#define DUMMY_IRQ_PRIORITY_VALUE_MAX 15U
/**
* @brief Minimum vector number.
*/
#define BSP_INTERRUPT_VECTOR_MIN DUMMY_IRQ_WDT
/**
* @brief Maximum vector number.
*/
#define BSP_INTERRUPT_VECTOR_MAX DUMMY_IRQ_I2S
void bsp_interrupt_dispatch(void);
#if 0
void lpc24xx_irq_set_priority( rtems_vector_number vector, unsigned priority);
unsigned lpc24xx_irq_priority( rtems_vector_number vector);
#endif
/** @} */
#endif /* ASM */
#endif /* LIBBSP_ARM_DUMMY_IRQ_H */

View File

@@ -1,110 +0,0 @@
/**
* @file
*
* @ingroup RTEMSBSPsARMGDBSim
*
* @brief Software interrupt definitions.
*/
/**
* @defgroup gdbarmsim_swi SWI Definitions
*
* @ingroup RTEMSBSPsARMGDBSim
*
* @brief Software interrupt definitions.
*/
/*
* Copied from libgloss 1 Oct 2009.
* Minor modifications to work with RTEMS.
*/
/* SWI numbers for RDP (Demon) monitor. */
#define SWI_WriteC 0x0
#define SWI_Write0 0x2
#define SWI_ReadC 0x4
#define SWI_CLI 0x5
#define SWI_GetEnv 0x10
#define SWI_Exit 0x11
#define SWI_EnterOS 0x16
#define SWI_GetErrno 0x60
#define SWI_Clock 0x61
#define SWI_Time 0x63
#define SWI_Remove 0x64
#define SWI_Rename 0x65
#define SWI_Open 0x66
#define SWI_Close 0x68
#define SWI_Write 0x69
#define SWI_Read 0x6a
#define SWI_Seek 0x6b
#define SWI_Flen 0x6c
#define SWI_IsTTY 0x6e
#define SWI_TmpNam 0x6f
#define SWI_InstallHandler 0x70
#define SWI_GenerateError 0x71
/* Now the SWI numbers and reason codes for RDI (Angel) monitors. */
#define AngelSWI_ARM 0x123456
#ifdef __thumb__
#define AngelSWI 0xAB
#else
#define AngelSWI AngelSWI_ARM
#endif
/* For Thumb-2 code use the BKPT instruction instead of SWI. */
#ifdef __thumb2__
#define AngelSWIInsn "bkpt"
#define AngelSWIAsm bkpt
#else
#define AngelSWIInsn "swi"
#define AngelSWIAsm swi
#endif
/* The reason codes: */
#define AngelSWI_Reason_Open 0x01
#define AngelSWI_Reason_Close 0x02
#define AngelSWI_Reason_WriteC 0x03
#define AngelSWI_Reason_Write0 0x04
#define AngelSWI_Reason_Write 0x05
#define AngelSWI_Reason_Read 0x06
#define AngelSWI_Reason_ReadC 0x07
#define AngelSWI_Reason_IsTTY 0x09
#define AngelSWI_Reason_Seek 0x0A
#define AngelSWI_Reason_FLen 0x0C
#define AngelSWI_Reason_TmpNam 0x0D
#define AngelSWI_Reason_Remove 0x0E
#define AngelSWI_Reason_Rename 0x0F
#define AngelSWI_Reason_Clock 0x10
#define AngelSWI_Reason_Time 0x11
#define AngelSWI_Reason_System 0x12
#define AngelSWI_Reason_Errno 0x13
#define AngelSWI_Reason_GetCmdLine 0x15
#define AngelSWI_Reason_HeapInfo 0x16
#define AngelSWI_Reason_EnterSVC 0x17
#define AngelSWI_Reason_ReportException 0x18
#define ADP_Stopped_ApplicationExit ((2 << 16) + 38)
#define ADP_Stopped_RunTimeError ((2 << 16) + 35)
#if defined(ARM_RDI_MONITOR) && !defined(__ASSEMBLER__)
static inline int
do_AngelSWI (int reason, void * arg)
{
int value;
__asm__ volatile ("mov r0, %1; mov r1, %2; " AngelSWIInsn " %a3; mov %0, r0"
: "=r" (value) /* Outputs */
: "r" (reason), "r" (arg), "i" (AngelSWI) /* Inputs */
: "r0", "r1", "r2", "r3", "ip", "lr", "memory", "cc"
/* Clobbers r0 and r1, and lr if in supervisor mode */);
/* Accordingly to page 13-77 of ARM DUI 0040D other registers
can also be clobbered. Some memory positions may also be
changed by a system call, so they should not be kept in
registers. Note: we are assuming the manual is right and
Angel is respecting the APCS. */
return value;
}
#endif

View File

@@ -1 +0,0 @@
#include <rtems/tm27-default.h>

View File

@@ -1,50 +0,0 @@
/**
* @file
*
* @ingroup bsp_interrupt
*
* @brief GDB ARM Simulator interrupt support.
*/
/*
* Copyright (c) 2008-2012 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
* Obere Lagerstr. 30
* 82178 Puchheim
* Germany
* <rtems@embedded-brains.de>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.org/license/LICENSE.
*/
#include <rtems/score/armv4.h>
#include <bsp.h>
#include <bsp/irq.h>
#include <bsp/irq-generic.h>
#ifdef ARM_MULTILIB_ARCH_V4
void bsp_interrupt_dispatch(void)
{
/* Read current vector number */
/* rtems_vector_number vector = VICVectAddr; */
rtems_vector_number vector = 0;
/* Enable interrupts in program status register */
uint32_t psr = _ARMV4_Status_irq_enable();
/* Dispatch interrupt handlers */
bsp_interrupt_handler_dispatch(vector);
/* Restore program status register */
_ARMV4_Status_restore(psr);
/* Acknowledge interrupt */
//VICVectAddr = 0;
}
#endif /* ARM_MULTILIB_ARCH_V4 */

View File

@@ -1,71 +0,0 @@
/**
* @file
*
* @ingroup bsp_interrupt
*
* @brief GDB ARM Simulator interrupt support.
*/
/*
* Copyright (c) 2008-2012 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
* Obere Lagerstr. 30
* 82178 Puchheim
* Germany
* <rtems@embedded-brains.de>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.org/license/LICENSE.
*/
#include <rtems/score/armv4.h>
#include <rtems/score/armv7m.h>
#include <bsp.h>
#include <bsp/irq.h>
#include <bsp/irq-generic.h>
#include <bsp/linker-symbols.h>
/*
* Prototypes
*/
void lpc24xx_irq_set_priority(rtems_vector_number, unsigned);
unsigned lpc24xx_irq_get_priority(rtems_vector_number);
static inline bool lpc24xx_irq_is_valid(rtems_vector_number vector)
{
return vector <= BSP_INTERRUPT_VECTOR_MAX;
}
void lpc24xx_irq_set_priority(rtems_vector_number vector, unsigned priority)
{
}
unsigned lpc24xx_irq_get_priority(rtems_vector_number vector)
{
return 0; /* bogus value to avoid warning */
}
#ifdef ARM_MULTILIB_ARCH_V4
void bsp_interrupt_vector_enable(rtems_vector_number vector)
{
bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
}
void bsp_interrupt_vector_disable(rtems_vector_number vector)
{
bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
}
rtems_status_code bsp_interrupt_facility_initialize(void)
{
/* Install the IRQ exception handler */
_CPU_ISR_install_vector(ARM_EXCEPTION_IRQ, _ARMV4_Exception_interrupt, NULL);
return RTEMS_SUCCESSFUL;
}
#endif /* ARM_MULTILIB_ARCH_V4 */

View File

@@ -1,9 +0,0 @@
%rename endfile old_endfile
%rename startfile old_startfile
*startfile:
%{!qrtems: %(old_startfile)} \
%{!nostdlib: %{qrtems: crti.o%s crtbegin.o%s}}
*endfile:
%{!qrtems: %(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s}

View File

@@ -1,17 +0,0 @@
/*
* COPYRIGHT (c) 1989-2009.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.org/license/LICENSE.
*/
#include <rtems.h>
#include <bsp/bootcard.h>
#include <bsp/swi.h>
void bsp_reset( void )
{
__asm__ ("swi %a0" :: "i" (SWI_Exit));
}

View File

@@ -1,22 +0,0 @@
/*
* COPYRIGHT (c) 1989-2009.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.org/license/LICENSE.
*/
#include <bsp.h>
#include <bsp/bootcard.h>
void initialise_monitor_handles(void);
/*
* This routine would usually do the bulk of the system initialization.
* But if a BSP doesn't need to do anything, it can use this version.
*/
void bsp_start( void )
{
initialise_monitor_handles(void);
}

View File

@@ -1,20 +0,0 @@
/*
* Copyright (c) 2014 Chris Johns <chrisj@rtems.org> All rights reserved.
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.org/license/LICENSE.
*/
#include <bsp.h>
#include <bsp/start.h>
#
BSP_START_TEXT_SECTION void bsp_start_hook_0(void)
{
}
BSP_START_TEXT_SECTION void bsp_start_hook_1(void)
{
bsp_start_copy_sections();
bsp_start_clear_bss();
}

View File

@@ -1,23 +0,0 @@
MEMORY {
RAM : ORIGIN = 0x00000000, LENGTH = 4M
}
REGION_ALIAS ("REGION_START", RAM);
REGION_ALIAS ("REGION_VECTOR", RAM);
REGION_ALIAS ("REGION_TEXT", RAM);
REGION_ALIAS ("REGION_TEXT_LOAD", RAM);
REGION_ALIAS ("REGION_RODATA", RAM);
REGION_ALIAS ("REGION_RODATA_LOAD", RAM);
REGION_ALIAS ("REGION_DATA", RAM);
REGION_ALIAS ("REGION_DATA_LOAD", RAM);
REGION_ALIAS ("REGION_FAST_TEXT", RAM);
REGION_ALIAS ("REGION_FAST_TEXT_LOAD", RAM);
REGION_ALIAS ("REGION_FAST_DATA", RAM);
REGION_ALIAS ("REGION_FAST_DATA_LOAD", RAM);
REGION_ALIAS ("REGION_BSS", RAM);
REGION_ALIAS ("REGION_WORK", RAM);
REGION_ALIAS ("REGION_STACK", RAM);
REGION_ALIAS ("REGION_NOCACHE", RAM);
REGION_ALIAS ("REGION_NOCACHE_LOAD", RAM);
INCLUDE linkcmds.armv4

View File

@@ -1,763 +0,0 @@
/*
* Copied from libgloss 1 Oct 2009.
* Minor modifications to work with RTEMS.
*/
/* Support files for GNU libc. Files in the system namespace go here.
Files in the C namespace (ie those that do not start with an
underscore) go in .c. */
/*
* Rename all the functions present here to stop then clashing with RTEMS
* names.
*/
#include <_ansi.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/fcntl.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <sys/time.h>
#include <sys/times.h>
#include <errno.h>
#include <reent.h>
#include <unistd.h>
#include <sys/wait.h>
#include <bsp/swi.h>
#include <bsp.h>
/* Forward prototypes. */
static int checkerror(int);
static int error(int);
static int get_errno(void);
/* Struct used to keep track of the file position, just so we
can implement fseek(fh,x,SEEK_CUR). */
struct fdent
{
int handle;
int pos;
};
#define MAX_OPEN_FILES 20
/* User file descriptors (fd) are integer indexes into
the openfiles[] array. Error checking is done by using
findslot().
This openfiles array is manipulated directly by only
these 5 functions:
findslot() - Translate entry.
newslot() - Find empty entry.
initilise_monitor_handles() - Initialize entries.
_swiopen() - Initialize entry.
_close() - Handle stdout == stderr case.
Every other function must use findslot(). */
static struct fdent openfiles [MAX_OPEN_FILES];
static struct fdent* findslot (int);
static int newslot (void);
/* Register name faking - works in collusion with the linker. */
register char * stack_ptr __asm__ ("sp");
/* following is copied from libc/stdio/local.h to check std streams */
extern void __sinit(struct _reent *);
#define CHECK_INIT(ptr) \
do \
{ \
if ((ptr) && !(ptr)->__sdidinit) \
__sinit (ptr); \
} \
while (0)
static int monitor_stdin;
static int monitor_stdout;
static int monitor_stderr;
/* Return a pointer to the structure associated with
the user file descriptor fd. */
static struct fdent*
findslot (int fd)
{
CHECK_INIT(_REENT);
/* User file descriptor is out of range. */
if ((unsigned int)fd >= MAX_OPEN_FILES)
return NULL;
/* User file descriptor is open? */
if (openfiles[fd].handle == -1)
return NULL;
/* Valid. */
return &openfiles[fd];
}
/* Return the next lowest numbered free file
structure, or -1 if we can't find one. */
static int
newslot (void)
{
int i;
for (i = 0; i < MAX_OPEN_FILES; i++)
if (openfiles[i].handle == -1)
break;
if (i == MAX_OPEN_FILES)
return -1;
return i;
}
void
initialise_monitor_handles (void)
{
int i;
/* Open the standard file descriptors by opening the special
* teletype device, ":tt", read-only to obtain a descritpor for
* standard input and write-only to obtain a descriptor for standard
* output. Finally, open ":tt" in append mode to obtain a descriptor
* for standard error. Since this is a write mode, most kernels will
* probably return the same value as for standard output, but the
* kernel can differentiate the two using the mode flag and return a
* different descriptor for standard error.
*/
#ifdef ARM_RDI_MONITOR
int volatile block[3];
block[0] = (int) ":tt";
block[2] = 3; /* length of filename */
block[1] = 0; /* mode "r" */
monitor_stdin = do_AngelSWI (AngelSWI_Reason_Open, (void *) block);
block[0] = (int) ":tt";
block[2] = 3; /* length of filename */
block[1] = 4; /* mode "w" */
monitor_stdout = do_AngelSWI (AngelSWI_Reason_Open, (void *) block);
block[0] = (int) ":tt";
block[2] = 3; /* length of filename */
block[1] = 8; /* mode "a" */
monitor_stderr = do_AngelSWI (AngelSWI_Reason_Open, (void *) block);
#else
int fh;
const char * name;
name = ":tt";
__asm__ ("mov r0,%2; mov r1, #0; swi %a1; mov %0, r0"
: "=r"(fh)
: "i" (SWI_Open),"r"(name)
: "r0","r1");
monitor_stdin = fh;
name = ":tt";
__asm__ ("mov r0,%2; mov r1, #4; swi %a1; mov %0, r0"
: "=r"(fh)
: "i" (SWI_Open),"r"(name)
: "r0","r1");
monitor_stdout = fh;
name = ":tt";
__asm__ ("mov r0,%2; mov r1, #8; swi %a1; mov %0, r0"
: "=r"(fh)
: "i" (SWI_Open),"r"(name)
: "r0","r1");
monitor_stderr = fh;
#endif
/* If we failed to open stderr, redirect to stdout. */
if (monitor_stderr == -1)
monitor_stderr = monitor_stdout;
for (i = 0; i < MAX_OPEN_FILES; i ++)
openfiles[i].handle = -1;
openfiles[0].handle = monitor_stdin;
openfiles[0].pos = 0;
openfiles[1].handle = monitor_stdout;
openfiles[1].pos = 0;
openfiles[2].handle = monitor_stderr;
openfiles[2].pos = 0;
}
static int
get_errno (void)
{
#ifdef ARM_RDI_MONITOR
return do_AngelSWI (AngelSWI_Reason_Errno, NULL);
#else
register int r0 __asm__ ("r0");
__asm__ ("swi %a1" : "=r"(r0) : "i" (SWI_GetErrno));
return r0;
#endif
}
/* Set errno and return result. */
static int
error (int result)
{
errno = get_errno ();
return result;
}
/* Check the return and set errno appropriately. */
static int
checkerror (int result)
{
if (result == -1)
return error (-1);
return result;
}
/* fh, is a valid internal file handle.
ptr, is a null terminated string.
len, is the length in bytes to read.
Returns the number of bytes *not* written. */
int
gdbarmsim_swiread (int fh,
char * ptr,
int len)
{
#ifdef ARM_RDI_MONITOR
int block[3];
block[0] = fh;
block[1] = (int) ptr;
block[2] = len;
return checkerror (do_AngelSWI (AngelSWI_Reason_Read, block));
#else
register int r0 __asm__ ("r0");
register int r1 __asm__ ("r1");
register int r2 __asm__ ("r2");
r0 = fh;
r1 = (int)ptr;
r2 = len;
__asm__ ("swi %a4"
: "=r" (r0)
: "0"(r0), "r"(r1), "r"(r2), "i"(SWI_Read));
return checkerror (r0);
#endif
}
/* fd, is a valid user file handle.
Translates the return of _swiread into
bytes read. */
int
gdbarmsim_read (int fd,
char * ptr,
int len)
{
int res;
struct fdent *pfd;
pfd = findslot (fd);
if (pfd == NULL)
{
errno = EBADF;
return -1;
}
res = gdbarmsim_swiread (pfd->handle, ptr, len);
if (res == -1)
return res;
pfd->pos += len - res;
/* res == len is not an error,
at least if we want feof() to work. */
return len - res;
}
/* fd, is a user file descriptor. */
int
gdbarmsim_swilseek (int fd,
int ptr,
int dir)
{
int res;
struct fdent *pfd;
/* Valid file descriptor? */
pfd = findslot (fd);
if (pfd == NULL)
{
errno = EBADF;
return -1;
}
/* Valid whence? */
if ((dir != SEEK_CUR)
&& (dir != SEEK_SET)
&& (dir != SEEK_END))
{
errno = EINVAL;
return -1;
}
/* Convert SEEK_CUR to SEEK_SET */
if (dir == SEEK_CUR)
{
ptr = pfd->pos + ptr;
/* The resulting file offset would be negative. */
if (ptr < 0)
{
errno = EINVAL;
if ((pfd->pos > 0) && (ptr > 0))
errno = EOVERFLOW;
return -1;
}
dir = SEEK_SET;
}
#ifdef ARM_RDI_MONITOR
int block[2];
if (dir == SEEK_END)
{
block[0] = pfd->handle;
res = checkerror (do_AngelSWI (AngelSWI_Reason_FLen, block));
if (res == -1)
return -1;
ptr += res;
}
/* This code only does absolute seeks. */
block[0] = pfd->handle;
block[1] = ptr;
res = checkerror (do_AngelSWI (AngelSWI_Reason_Seek, block));
#else
if (dir == SEEK_END)
{
__asm__ ("mov r0, %2; swi %a1; mov %0, r0"
: "=r" (res)
: "i" (SWI_Flen), "r" (pfd->handle)
: "r0");
checkerror (res);
if (res == -1)
return -1;
ptr += res;
}
/* This code only does absolute seeks. */
__asm__ ("mov r0, %2; mov r1, %3; swi %a1; mov %0, r0"
: "=r" (res)
: "i" (SWI_Seek), "r" (pfd->handle), "r" (ptr)
: "r0", "r1");
checkerror (res);
#endif
/* At this point ptr is the current file position. */
if (res >= 0)
{
pfd->pos = ptr;
return ptr;
}
else
return -1;
}
int
gdbarmsim_lseek (int fd,
int ptr,
int dir)
{
return gdbarmsim_swilseek (fd, ptr, dir);
}
/* write a single character out the hosts stdout */
int
gdbarmsim_writec (const char c)
{
#ifdef ARM_RDI_MONITOR
int block[1];
block[0] = ((int) c) & 0xff;;
return checkerror (do_AngelSWI (AngelSWI_Reason_WriteC, block));
#else
register int r0 __asm__ ("r0");
r0 = ((int) c) & 0xff;
__asm__ ("swi %a2"
: "=r" (r0)
: "0"(r0), "i"(SWI_WriteC));
return checkerror (r0);
#endif
}
/* fh, is a valid internal file handle.
Returns the number of bytes *not* written. */
int
gdbarmsim_swiwrite (int fh,
char * ptr,
int len)
{
#ifdef ARM_RDI_MONITOR
int block[3];
block[0] = fh;
block[1] = (int) ptr;
block[2] = len;
return checkerror (do_AngelSWI (AngelSWI_Reason_Write, block));
#else
register int r0 __asm__ ("r0");
register int r1 __asm__ ("r1");
register int r2 __asm__ ("r2");
r0 = fh;
r1 = (int)ptr;
r2 = len;
__asm__ ("swi %a4"
: "=r" (r0)
: "0"(r0), "r"(r1), "r"(r2), "i"(SWI_Write));
return checkerror (r0);
#endif
}
/* fd, is a user file descriptor. */
int
gdbarmsim_write (int fd,
char * ptr,
int len)
{
int res;
struct fdent *pfd;
pfd = findslot (fd);
if (pfd == NULL)
{
errno = EBADF;
return -1;
}
res = gdbarmsim_swiwrite (pfd->handle, ptr,len);
/* Clearly an error. */
if (res < 0)
return -1;
pfd->pos += len - res;
/* We wrote 0 bytes?
Retrieve errno just in case. */
if ((len - res) == 0)
return error (0);
return (len - res);
}
int
gdbarmsim_swiopen (const char * path, int flags)
{
int aflags = 0, fh;
#ifdef ARM_RDI_MONITOR
int block[3];
#endif
int fd = newslot ();
if (fd == -1)
{
errno = EMFILE;
return -1;
}
/* It is an error to open a file that already exists. */
if ((flags & O_CREAT)
&& (flags & O_EXCL))
{
struct stat st;
int res;
res = gdbarmsim_stat (path, &st);
if (res != -1)
{
errno = EEXIST;
return -1;
}
}
/* The flags are Unix-style, so we need to convert them. */
#ifdef O_BINARY
if (flags & O_BINARY)
aflags |= 1;
#endif
/* In O_RDONLY we expect aflags == 0. */
if (flags & O_RDWR)
aflags |= 2;
if ((flags & O_CREAT)
|| (flags & O_TRUNC)
|| (flags & O_WRONLY))
aflags |= 4;
if (flags & O_APPEND)
{
/* Can't ask for w AND a; means just 'a'. */
aflags &= ~4;
aflags |= 8;
}
#ifdef ARM_RDI_MONITOR
block[0] = (int) path;
block[2] = strlen (path);
block[1] = aflags;
fh = do_AngelSWI (AngelSWI_Reason_Open, block);
#else
__asm__ ("mov r0,%2; mov r1, %3; swi %a1; mov %0, r0"
: "=r"(fh)
: "i" (SWI_Open),"r"(path),"r"(aflags)
: "r0","r1");
#endif
/* Return a user file descriptor or an error. */
if (fh >= 0)
{
openfiles[fd].handle = fh;
openfiles[fd].pos = 0;
return fd;
}
else
return error (fh);
}
int
gdbarmsim_open (const char * path, int flags, ...)
{
return gdbarmsim_swiopen (path, flags);
}
/* fh, is a valid internal file handle. */
int
gdbarmsim_swiclose (int fh)
{
#ifdef ARM_RDI_MONITOR
return checkerror (do_AngelSWI (AngelSWI_Reason_Close, &fh));
#else
register int r0 __asm__ ("r0");
r0 = fh;
__asm__ ("swi %a2"
: "=r"(r0)
: "0"(r0), "i" (SWI_Close));
return checkerror (r0);
#endif
}
/* fd, is a user file descriptor. */
int
gdbarmsim_close (int fd)
{
int res;
struct fdent *pfd;
pfd = findslot (fd);
if (pfd == NULL)
{
errno = EBADF;
return -1;
}
/* Handle stderr == stdout. */
if ((fd == 1 || fd == 2)
&& (openfiles[1].handle == openfiles[2].handle))
{
pfd->handle = -1;
return 0;
}
/* Attempt to close the handle. */
res = gdbarmsim_swiclose (pfd->handle);
/* Reclaim handle? */
if (res == 0)
pfd->handle = -1;
return res;
}
int
gdbarmsim_swistat (int fd, struct stat * st)
{
struct fdent *pfd;
int res;
pfd = findslot (fd);
if (pfd == NULL)
{
errno = EBADF;
return -1;
}
/* Always assume a character device,
with 1024 byte blocks. */
st->st_mode |= S_IFCHR;
st->st_blksize = 1024;
#ifdef ARM_RDI_MONITOR
res = checkerror (do_AngelSWI (AngelSWI_Reason_FLen, &pfd->handle));
#else
__asm__ ("mov r0, %2; swi %a1; mov %0, r0"
: "=r" (res)
: "i" (SWI_Flen), "r" (pfd->handle)
: "r0");
checkerror (res);
#endif
if (res == -1)
return -1;
/* Return the file size. */
st->st_size = res;
return 0;
}
int
gdbarmsim_fstat (int fd, struct stat * st)
{
memset (st, 0, sizeof (* st));
return gdbarmsim_swistat (fd, st);
}
int
gdbarmsim_stat (const char *fname, struct stat *st)
{
int fd, res;
memset (st, 0, sizeof (* st));
/* The best we can do is try to open the file readonly.
If it exists, then we can guess a few things about it. */
if ((fd = gdbarmsim_open (fname, O_RDONLY)) == -1)
return -1;
st->st_mode |= S_IFREG | S_IREAD;
res = gdbarmsim_swistat (fd, st);
/* Not interested in the error. */
gdbarmsim_close (fd);
return res;
}
int
gdbarmsim_unlink (const char *path)
{
int res;
#ifdef ARM_RDI_MONITOR
int block[2];
block[0] = (int)path;
block[1] = strlen(path);
res = do_AngelSWI (AngelSWI_Reason_Remove, block);
#else
register int r0 __asm__ ("r0");
r0 = (int)path;
__asm__ ("swi %a2"
: "=r"(r0)
: "0"(r0), "i" (SWI_Remove));
res = r0;
#endif
if (res == -1)
return error (res);
return 0;
}
/* Return a clock that ticks at 100Hz. */
clock_t
gdbarmsim_clock (void)
{
clock_t timeval;
#ifdef ARM_RDI_MONITOR
timeval = do_AngelSWI (AngelSWI_Reason_Clock,NULL);
#else
__asm__ ("swi %a1; mov %0, r0" : "=r" (timeval): "i" (SWI_Clock) : "r0");
#endif
return timeval;
}
int
gdbarmsim__isatty (int fd)
{
struct fdent *pfd;
pfd = findslot (fd);
if (pfd == NULL)
{
errno = EBADF;
return -1;
}
#ifdef ARM_RDI_MONITOR
return checkerror (do_AngelSWI (AngelSWI_Reason_IsTTY, &pfd->handle));
#else
register int r0 __asm__ ("r0");
r0 = pfd->handle;
__asm__ ("swi %a2"
: "=r" (r0)
: "0"(r0), "i" (SWI_IsTTY));
return checkerror (r0);
#endif
}
int
gdbarmsim_system (const char *s)
{
#ifdef ARM_RDI_MONITOR
int block[2];
int e;
/* Hmmm. The ARM debug interface specification doesn't say whether
SYS_SYSTEM does the right thing with a null argument, or assign any
meaning to its return value. Try to do something reasonable.... */
if (!s)
return 1; /* maybe there is a shell available? we can hope. :-P */
block[0] = (int)s;
block[1] = strlen (s);
e = checkerror (do_AngelSWI (AngelSWI_Reason_System, block));
if ((e >= 0) && (e < 256))
{
/* We have to convert e, an exit status to the encoded status of
the command. To avoid hard coding the exit status, we simply
loop until we find the right position. */
int exit_code;
for (exit_code = e; e && WEXITSTATUS (e) != exit_code; e <<= 1)
continue;
}
return e;
#else
register int r0 __asm__ ("r0");
r0 = (int)s;
__asm__ ("swi %a2"
: "=r" (r0)
: "0"(r0), "i" (SWI_CLI));
return checkerror (r0);
#endif
}
int
gdbarmsim_rename (const char * oldpath, const char * newpath)
{
#ifdef ARM_RDI_MONITOR
int block[4];
block[0] = (int)oldpath;
block[1] = strlen(oldpath);
block[2] = (int)newpath;
block[3] = strlen(newpath);
return checkerror (do_AngelSWI (AngelSWI_Reason_Rename, block)) ? -1 : 0;
#else
register int r0 __asm__ ("r0");
register int r1 __asm__ ("r1");
r0 = (int)oldpath;
r1 = (int)newpath;
__asm__ ("swi %a3"
: "=r" (r0)
: "0" (r0), "r" (r1), "i" (SWI_Rename));
return checkerror (r0);
#endif
}

View File

@@ -14,8 +14,6 @@ AC_DEFUN([RTEMS_CHECK_BSPDIR],
AC_CONFIG_SUBDIRS([csb337]);; AC_CONFIG_SUBDIRS([csb337]);;
edb7312 ) edb7312 )
AC_CONFIG_SUBDIRS([edb7312]);; AC_CONFIG_SUBDIRS([edb7312]);;
gdbarmsim )
AC_CONFIG_SUBDIRS([gdbarmsim]);;
gumstix ) gumstix )
AC_CONFIG_SUBDIRS([gumstix]);; AC_CONFIG_SUBDIRS([gumstix]);;
imx ) imx )

View File

@@ -1,57 +0,0 @@
ACLOCAL_AMFLAGS = -I ../../../../aclocal
include $(top_srcdir)/../../../../automake/compile.am
include $(top_srcdir)/../../bsp.am
dist_project_lib_DATA = ../../../../../../bsps/arm/gdbarmsim/start/bsp_specs
noinst_PROGRAMS =
start.$(OBJEXT): ../../../../../../bsps/arm/shared/start/start.S
$(CPPASCOMPILE) -o $@ -c $<
project_lib_DATA = start.$(OBJEXT)
project_lib_DATA += linkcmds
project_lib_LIBRARIES = librtemsbsp.a
librtemsbsp_a_SOURCES =
# startup
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspgetworkarea-default.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspstart-empty.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspfatal-default.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/gdbarmsim/start/bspreset.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/getentropy/getentropy-cpucounter.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/sbrk.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/gdbarmsim/start/syscalls.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterfrequency.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/cpucounter/cpucounterread.c
# console
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/serial/console-polled.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/gdbarmsim/console/console-io.c
# clock
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/clock/clock-simidle.c
# timer
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/btimer/btimer-stub.c
# start hooks
librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/gdbarmsim/start/bspstarthooks.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/shared/start/bsp-start-memcpy.S
# IRQ
librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/gdbarmsim/irq/irq.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/gdbarmsim/irq/irq-dispatch.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/irq/irq-default-handler.c
# Cache
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/cache/nocache.c
# Shared
if shared
librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/shared/cp15/arm-cp15-set-exception-handler.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/shared/cp15/arm-cp15-set-ttb-entries.c
endif
include $(srcdir)/../../../../../../bsps/shared/irq-sources.am
include $(srcdir)/../../../../../../bsps/shared/shared-sources.am
include $(srcdir)/../../../../../../bsps/arm/gdbarmsim/headers.am

View File

@@ -1,21 +0,0 @@
## Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
AC_INIT([rtems-c-src-lib-libbsp-arm-gdbarmsim],[_RTEMS_VERSION],[https://devel.rtems.org/newticket])
RTEMS_TOP(../../../../../..)
RTEMS_SOURCE_TOP
RTEMS_BUILD_TOP
RTEMS_BSP_LINKCMDS
RTEMS_CANONICAL_TARGET_CPU
AM_INIT_AUTOMAKE([no-define nostdinc foreign 1.12.2])
RTEMS_BSP_CONFIGURE
RTEMS_BSP_CLEANUP_OPTIONS
AM_CONDITIONAL(shared, test "$RTEMS_BSP" = "armcortexa9")
# Explicitly list all Makefiles here
AC_CONFIG_FILES([Makefile])
AC_OUTPUT