forked from Imagelibrary/rtems
Port of RTEMS to the Texas Instruments C3x/C4x DSP families including
a BSP (c4xsim) supporting the simulator included with gdb. This port was done by Joel Sherrill and Jennifer Averett of OAR Corporation. Also included with this port is a space/time optimization to eliminate FP context switch management on CPUs without hardware or software FP. An issue with this port was that sizeof(unsigned32) = sizeof(unsigned8) on this CPU. This required addressing alignment checks and assumptions as well as fixing code that assumed sizeof(unsigned32) == 4.
This commit is contained in:
@@ -1,2 +1,4 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
configure
|
||||
aclocal.m4
|
||||
|
||||
2
c/src/lib/libbsp/c4x/c4xsim/wrapup/.cvsignore
Normal file
2
c/src/lib/libbsp/c4x/c4xsim/wrapup/.cvsignore
Normal file
@@ -0,0 +1,2 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
13
c/src/lib/libbsp/c4x/shared/.cvsignore
Normal file
13
c/src/lib/libbsp/c4x/shared/.cvsignore
Normal file
@@ -0,0 +1,13 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
aclocal.m4
|
||||
config.cache
|
||||
config.guess
|
||||
config.log
|
||||
config.status
|
||||
config.sub
|
||||
configure
|
||||
depcomp
|
||||
install-sh
|
||||
missing
|
||||
mkinstalldirs
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
char *rtems_progname;
|
||||
|
||||
rtems_interrupt_level bsp_isr_level;
|
||||
extern rtems_interrupt_level bsp_isr_level;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
||||
@@ -82,9 +82,9 @@ void RTEMS_Malloc_Initialize(
|
||||
/* DOES NOT RETURN!!! */
|
||||
}
|
||||
|
||||
if (u32_address & (CPU_ALIGNMENT-1)) {
|
||||
if (u32_address & (CPU_HEAP_ALIGNMENT-1)) {
|
||||
old_address = u32_address;
|
||||
u32_address = (u32_address + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
|
||||
u32_address = (u32_address + CPU_HEAP_ALIGNMENT) & ~(CPU_HEAP_ALIGNMENT-1);
|
||||
|
||||
/*
|
||||
* adjust the length by whatever we aligned by
|
||||
|
||||
@@ -525,7 +525,11 @@ rtems_monitor_task(
|
||||
|
||||
debugee = _Thread_Executing;
|
||||
rp = &debugee->Registers;
|
||||
#if (CPU_HARDWARE_FP == TRUE) || (CPU_SOFTWARE_FP == TRUE)
|
||||
fp = (rtems_context_fp *) debugee->fp_context; /* possibly 0 */
|
||||
#else
|
||||
fp = 0;
|
||||
#endif
|
||||
|
||||
if (0 == rtems_monitor_command_read(command_buffer, &argc, argv))
|
||||
continue;
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#include "fsm.h"
|
||||
|
||||
static void fsm_timeout __P((void *));
|
||||
static void fsm_rconfreq __P((fsm *, int, u_char *, int));
|
||||
static void fsm_rconfreq __P((fsm *, u_char, u_char *, int));
|
||||
static void fsm_rconfack __P((fsm *, int, u_char *, int));
|
||||
static void fsm_rconfnakrej __P((fsm *, int, int, u_char *, int));
|
||||
static void fsm_rtermreq __P((fsm *, int, u_char *, int));
|
||||
|
||||
@@ -135,7 +135,7 @@ void fsm_open __P((fsm *));
|
||||
void fsm_close __P((fsm *, char *));
|
||||
void fsm_input __P((fsm *, u_char *, int));
|
||||
void fsm_protreject __P((fsm *));
|
||||
void fsm_sdata __P((fsm *, int, int, u_char *, int));
|
||||
void fsm_sdata __P((fsm *, u_char, u_char, u_char *, int));
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -72,7 +72,7 @@ static void upap_rauthreq __P((upap_state *, u_char *, int, int));
|
||||
static void upap_rauthack __P((upap_state *, u_char *, int, int));
|
||||
static void upap_rauthnak __P((upap_state *, u_char *, int, int));
|
||||
static void upap_sauthreq __P((upap_state *));
|
||||
static void upap_sresp __P((upap_state *, int, int, char *, int));
|
||||
static void upap_sresp __P((upap_state *, u_char, u_char, char *, int));
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -5,7 +5,11 @@
|
||||
AUTOMAKE_OPTIONS = foreign 1.4
|
||||
ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal
|
||||
|
||||
if rpc_not_supported
|
||||
SUBDIRS =
|
||||
else
|
||||
SUBDIRS = include src
|
||||
endif
|
||||
|
||||
EXTRA_DIST = README_RTEMS
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ RTEMS_CANONICALIZE_TOOLS
|
||||
RTEMS_CHECK_NETWORKING(RTEMS_BSP)
|
||||
|
||||
AM_CONDITIONAL(HAS_NETWORKING,test "$HAS_NETWORKING" = "yes")
|
||||
AM_CONDITIONAL(rpc_not_supported, test "$RTEMS_CPU" = "c4x")
|
||||
|
||||
RTEMS_PROJECT_ROOT
|
||||
|
||||
|
||||
@@ -356,7 +356,9 @@ uninitialized =
|
||||
(sizeof _Thread_Ready_chain) +
|
||||
(sizeof _Thread_Executing) +
|
||||
(sizeof _Thread_Heir) +
|
||||
#if (CPU_HARDWARE_FP == 1) || (CPU_SOFTWARE_FP == 1)
|
||||
(sizeof _Thread_Allocated_fp) +
|
||||
#endif
|
||||
(sizeof _Thread_Internal_information) +
|
||||
(sizeof _Thread_Idle) +
|
||||
|
||||
|
||||
@@ -281,7 +281,9 @@ rtems_task Low_task(
|
||||
_Thread_Disable_dispatch();
|
||||
|
||||
Timer_initialize();
|
||||
#if (CPU_HARDWARE_FP == 1) || (CPU_SOFTWARE_FP == 1)
|
||||
_Context_Restore_fp( &_Thread_Executing->fp_context );
|
||||
#endif
|
||||
_Context_Switch( &executing->Registers, &_Thread_Executing->Registers );
|
||||
}
|
||||
|
||||
@@ -306,8 +308,10 @@ rtems_task Floating_point_task_1(
|
||||
_Thread_Disable_dispatch();
|
||||
|
||||
Timer_initialize();
|
||||
#if (CPU_HARDWARE_FP == 1) || (CPU_SOFTWARE_FP == 1)
|
||||
_Context_Save_fp( &executing->fp_context );
|
||||
_Context_Restore_fp( &_Thread_Executing->fp_context );
|
||||
#endif
|
||||
_Context_Switch( &executing->Registers, &_Thread_Executing->Registers );
|
||||
/* switch to Floating_point_task_2 */
|
||||
|
||||
@@ -327,8 +331,10 @@ rtems_task Floating_point_task_1(
|
||||
_Thread_Disable_dispatch();
|
||||
|
||||
Timer_initialize();
|
||||
#if (CPU_HARDWARE_FP == 1) || (CPU_SOFTWARE_FP == 1)
|
||||
_Context_Save_fp( &executing->fp_context );
|
||||
_Context_Restore_fp( &_Thread_Executing->fp_context );
|
||||
#endif
|
||||
_Context_Switch( &executing->Registers, &_Thread_Executing->Registers );
|
||||
/* switch to Floating_point_task_2 */
|
||||
}
|
||||
@@ -356,8 +362,10 @@ rtems_task Floating_point_task_2(
|
||||
_Thread_Disable_dispatch();
|
||||
|
||||
Timer_initialize();
|
||||
#if (CPU_HARDWARE_FP == 1) || (CPU_SOFTWARE_FP == 1)
|
||||
_Context_Save_fp( &executing->fp_context );
|
||||
_Context_Restore_fp( &_Thread_Executing->fp_context );
|
||||
#endif
|
||||
_Context_Switch( &executing->Registers, &_Thread_Executing->Registers );
|
||||
/* switch to Floating_point_task_1 */
|
||||
|
||||
@@ -493,6 +501,7 @@ void complete_test( void )
|
||||
0
|
||||
);
|
||||
|
||||
#if (CPU_HARDWARE_FP == 1) || (CPU_SOFTWARE_FP == 1)
|
||||
put_time(
|
||||
"fp context switch: restore 1st FP task",
|
||||
context_switch_restore_1st_fp_time,
|
||||
@@ -524,6 +533,12 @@ void complete_test( void )
|
||||
0,
|
||||
0
|
||||
);
|
||||
#else
|
||||
puts( "fp context switch: restore 1st FP task - NA" );
|
||||
puts( "fp context switch: save idle, restore initialized - NA" );
|
||||
puts( "fp context switch: save idle, restore idle - NA" );
|
||||
puts( "fp context switch: save initialized, restore initialized - NA" );
|
||||
#endif
|
||||
|
||||
put_time(
|
||||
"_Thread_Resume",
|
||||
|
||||
@@ -13,8 +13,8 @@ LIB = $(PROJECT_RELEASE)/lib/librtemsall${LIB_VARIANT}.a
|
||||
|
||||
if HAS_NETWORKING
|
||||
LIBNETWORKING = $(PROJECT_RELEASE)/lib/libnetworking$(LIB_VARIANT).a \
|
||||
$(PROJECT_RELEASE)/lib/librpc$(LIB_VARIANT).a \
|
||||
$(PROJECT_RELEASE)/lib/libxdr$(LIB_VARIANT).a
|
||||
$(wildcard $(PROJECT_RELEASE)/lib/librpc$(LIB_VARIANT).a) \
|
||||
$(wildcard $(PROJECT_RELEASE)/lib/libxdr$(LIB_VARIANT).a)
|
||||
endif
|
||||
|
||||
if HAS_RDBG
|
||||
|
||||
@@ -82,9 +82,9 @@ void RTEMS_Malloc_Initialize(
|
||||
/* DOES NOT RETURN!!! */
|
||||
}
|
||||
|
||||
if (u32_address & (CPU_ALIGNMENT-1)) {
|
||||
if (u32_address & (CPU_HEAP_ALIGNMENT-1)) {
|
||||
old_address = u32_address;
|
||||
u32_address = (u32_address + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
|
||||
u32_address = (u32_address + CPU_HEAP_ALIGNMENT) & ~(CPU_HEAP_ALIGNMENT-1);
|
||||
|
||||
/*
|
||||
* adjust the length by whatever we aligned by
|
||||
|
||||
@@ -525,7 +525,11 @@ rtems_monitor_task(
|
||||
|
||||
debugee = _Thread_Executing;
|
||||
rp = &debugee->Registers;
|
||||
#if (CPU_HARDWARE_FP == TRUE) || (CPU_SOFTWARE_FP == TRUE)
|
||||
fp = (rtems_context_fp *) debugee->fp_context; /* possibly 0 */
|
||||
#else
|
||||
fp = 0;
|
||||
#endif
|
||||
|
||||
if (0 == rtems_monitor_command_read(command_buffer, &argc, argv))
|
||||
continue;
|
||||
|
||||
@@ -5,7 +5,11 @@
|
||||
AUTOMAKE_OPTIONS = foreign 1.4
|
||||
ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal
|
||||
|
||||
if rpc_not_supported
|
||||
SUBDIRS =
|
||||
else
|
||||
SUBDIRS = include src
|
||||
endif
|
||||
|
||||
EXTRA_DIST = README_RTEMS
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#include "fsm.h"
|
||||
|
||||
static void fsm_timeout __P((void *));
|
||||
static void fsm_rconfreq __P((fsm *, int, u_char *, int));
|
||||
static void fsm_rconfreq __P((fsm *, u_char, u_char *, int));
|
||||
static void fsm_rconfack __P((fsm *, int, u_char *, int));
|
||||
static void fsm_rconfnakrej __P((fsm *, int, int, u_char *, int));
|
||||
static void fsm_rtermreq __P((fsm *, int, u_char *, int));
|
||||
|
||||
@@ -135,7 +135,7 @@ void fsm_open __P((fsm *));
|
||||
void fsm_close __P((fsm *, char *));
|
||||
void fsm_input __P((fsm *, u_char *, int));
|
||||
void fsm_protreject __P((fsm *));
|
||||
void fsm_sdata __P((fsm *, int, int, u_char *, int));
|
||||
void fsm_sdata __P((fsm *, u_char, u_char, u_char *, int));
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -72,7 +72,7 @@ static void upap_rauthreq __P((upap_state *, u_char *, int, int));
|
||||
static void upap_rauthack __P((upap_state *, u_char *, int, int));
|
||||
static void upap_rauthnak __P((upap_state *, u_char *, int, int));
|
||||
static void upap_sauthreq __P((upap_state *));
|
||||
static void upap_sresp __P((upap_state *, int, int, char *, int));
|
||||
static void upap_sresp __P((upap_state *, u_char, u_char, char *, int));
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -63,7 +63,9 @@ void _Thread_Handler_initialization(
|
||||
_Context_Switch_necessary = FALSE;
|
||||
_Thread_Executing = NULL;
|
||||
_Thread_Heir = NULL;
|
||||
#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
|
||||
_Thread_Allocated_fp = NULL;
|
||||
#endif
|
||||
|
||||
_Thread_Do_post_task_switch_extension = 0;
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@ void _Thread_Close(
|
||||
|
||||
_User_extensions_Thread_delete( the_thread );
|
||||
|
||||
#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
|
||||
#if ( CPU_USE_DEFERRED_FP_SWITCH == TRUE )
|
||||
if ( _Thread_Is_allocated_fp( the_thread ) )
|
||||
_Thread_Deallocate_fp();
|
||||
@@ -60,7 +61,8 @@ void _Thread_Close(
|
||||
the_thread->fp_context = NULL;
|
||||
|
||||
if ( the_thread->Start.fp_context )
|
||||
(void) _Workspace_Free( the_thread->Start.fp_context );
|
||||
(void) _Workspace_Free( the_thread->Start.fp_context );
|
||||
#endif
|
||||
|
||||
_Thread_Stack_Free( the_thread );
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ void _Thread_Dispatch( void )
|
||||
* operations.
|
||||
*/
|
||||
|
||||
#if ( CPU_HARDWARE_FP == TRUE )
|
||||
#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
|
||||
#if ( CPU_USE_DEFERRED_FP_SWITCH == TRUE )
|
||||
if ( (heir->fp_context != NULL) && !_Thread_Is_allocated_fp( heir ) ) {
|
||||
if ( _Thread_Allocated_fp != NULL )
|
||||
|
||||
@@ -95,6 +95,7 @@ boolean _Thread_Initialize(
|
||||
* Allocate the floating point area for this thread
|
||||
*/
|
||||
|
||||
#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
|
||||
if ( is_fp ) {
|
||||
|
||||
fp_area = _Workspace_Allocate( CONTEXT_FP_SIZE );
|
||||
@@ -109,6 +110,7 @@ boolean _Thread_Initialize(
|
||||
|
||||
the_thread->fp_context = fp_area;
|
||||
the_thread->Start.fp_context = fp_area;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Allocate the extensions area for this thread
|
||||
|
||||
@@ -45,11 +45,13 @@ void _Thread_Load_environment(
|
||||
{
|
||||
boolean is_fp = FALSE;
|
||||
|
||||
#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
|
||||
if ( the_thread->Start.fp_context ) {
|
||||
the_thread->fp_context = the_thread->Start.fp_context;
|
||||
_Context_Initialize_fp( &the_thread->fp_context );
|
||||
is_fp = TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
the_thread->do_post_task_switch_extension = FALSE;
|
||||
the_thread->is_preemptible = the_thread->Start.is_preemptible;
|
||||
|
||||
@@ -50,7 +50,8 @@ START_BASE=
|
||||
# will be able to override parts of the compilers specs and link using gcc.
|
||||
|
||||
define make-exe
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) -o $(basename $@).exe \
|
||||
$(LINK.c) $(AM_CFLAGS) $(AM_LDFLAGS) \
|
||||
$(LDLIBS) -o $@ \
|
||||
$(LINK_OBJS) $(LINK_LIBS)
|
||||
$(NM) -g -n $@ > $(basename $@).num
|
||||
$(SIZE) $@
|
||||
|
||||
@@ -356,7 +356,9 @@ uninitialized =
|
||||
(sizeof _Thread_Ready_chain) +
|
||||
(sizeof _Thread_Executing) +
|
||||
(sizeof _Thread_Heir) +
|
||||
#if (CPU_HARDWARE_FP == 1) || (CPU_SOFTWARE_FP == 1)
|
||||
(sizeof _Thread_Allocated_fp) +
|
||||
#endif
|
||||
(sizeof _Thread_Internal_information) +
|
||||
(sizeof _Thread_Idle) +
|
||||
|
||||
|
||||
@@ -281,7 +281,9 @@ rtems_task Low_task(
|
||||
_Thread_Disable_dispatch();
|
||||
|
||||
Timer_initialize();
|
||||
#if (CPU_HARDWARE_FP == 1) || (CPU_SOFTWARE_FP == 1)
|
||||
_Context_Restore_fp( &_Thread_Executing->fp_context );
|
||||
#endif
|
||||
_Context_Switch( &executing->Registers, &_Thread_Executing->Registers );
|
||||
}
|
||||
|
||||
@@ -306,8 +308,10 @@ rtems_task Floating_point_task_1(
|
||||
_Thread_Disable_dispatch();
|
||||
|
||||
Timer_initialize();
|
||||
#if (CPU_HARDWARE_FP == 1) || (CPU_SOFTWARE_FP == 1)
|
||||
_Context_Save_fp( &executing->fp_context );
|
||||
_Context_Restore_fp( &_Thread_Executing->fp_context );
|
||||
#endif
|
||||
_Context_Switch( &executing->Registers, &_Thread_Executing->Registers );
|
||||
/* switch to Floating_point_task_2 */
|
||||
|
||||
@@ -327,8 +331,10 @@ rtems_task Floating_point_task_1(
|
||||
_Thread_Disable_dispatch();
|
||||
|
||||
Timer_initialize();
|
||||
#if (CPU_HARDWARE_FP == 1) || (CPU_SOFTWARE_FP == 1)
|
||||
_Context_Save_fp( &executing->fp_context );
|
||||
_Context_Restore_fp( &_Thread_Executing->fp_context );
|
||||
#endif
|
||||
_Context_Switch( &executing->Registers, &_Thread_Executing->Registers );
|
||||
/* switch to Floating_point_task_2 */
|
||||
}
|
||||
@@ -356,8 +362,10 @@ rtems_task Floating_point_task_2(
|
||||
_Thread_Disable_dispatch();
|
||||
|
||||
Timer_initialize();
|
||||
#if (CPU_HARDWARE_FP == 1) || (CPU_SOFTWARE_FP == 1)
|
||||
_Context_Save_fp( &executing->fp_context );
|
||||
_Context_Restore_fp( &_Thread_Executing->fp_context );
|
||||
#endif
|
||||
_Context_Switch( &executing->Registers, &_Thread_Executing->Registers );
|
||||
/* switch to Floating_point_task_1 */
|
||||
|
||||
@@ -493,6 +501,7 @@ void complete_test( void )
|
||||
0
|
||||
);
|
||||
|
||||
#if (CPU_HARDWARE_FP == 1) || (CPU_SOFTWARE_FP == 1)
|
||||
put_time(
|
||||
"fp context switch: restore 1st FP task",
|
||||
context_switch_restore_1st_fp_time,
|
||||
@@ -524,6 +533,12 @@ void complete_test( void )
|
||||
0,
|
||||
0
|
||||
);
|
||||
#else
|
||||
puts( "fp context switch: restore 1st FP task - NA" );
|
||||
puts( "fp context switch: save idle, restore initialized - NA" );
|
||||
puts( "fp context switch: save idle, restore idle - NA" );
|
||||
puts( "fp context switch: save initialized, restore initialized - NA" );
|
||||
#endif
|
||||
|
||||
put_time(
|
||||
"_Thread_Resume",
|
||||
|
||||
Reference in New Issue
Block a user