diff options
author | Daniel Hellstrom <daniel@gaisler.com> | 2020-05-08 14:09:20 +0200 |
---|---|---|
committer | Daniel Hellstrom <daniel@gaisler.com> | 2020-09-09 23:35:27 +0200 |
commit | 88fbbc5210710451f48db33f0b0639d6bdc9859c (patch) | |
tree | 277f895cb70614a1803e6b241026b5d3bad846eb | |
parent | 2444d2db810bb9dc95a74791cae24935e998d36a (diff) |
leon3: add BSP specific default RTEMS config
Provide a BSP specific default RTEMS configuration mainly intended
to simplify for POSIX targets bring-up
-rw-r--r-- | bsps/sparc/shared/config/default-configuration-bsp.c | 107 | ||||
-rw-r--r-- | bsps/sparc/shared/config/dummy-networking-bsp.c | 38 | ||||
-rw-r--r-- | c/src/lib/libbsp/sparc/leon2/Makefile.am | 4 | ||||
-rw-r--r-- | c/src/lib/libbsp/sparc/leon3/Makefile.am | 4 |
4 files changed, 153 insertions, 0 deletions
diff --git a/bsps/sparc/shared/config/default-configuration-bsp.c b/bsps/sparc/shared/config/default-configuration-bsp.c new file mode 100644 index 0000000000..ac2dd971e1 --- /dev/null +++ b/bsps/sparc/shared/config/default-configuration-bsp.c @@ -0,0 +1,107 @@ +/* + * Default configuration file + * + * COPYRIGHT (c) 1989-2008. + * 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 <stdlib.h> +#include <string.h> + +#include <rtems.h> + +int main( int argc, char **argv ); + +static void Init( rtems_task_argument arg ) +{ + const char *boot_cmdline = *((const char **) arg); + char *cmdline = NULL; + int argc = 0; + char **argv = NULL; + int result; + + if ( boot_cmdline != NULL ) { + size_t n = strlen( boot_cmdline ) + 1; + + cmdline = malloc( n ); + if ( cmdline != NULL ) { + char* command; + + memcpy( cmdline, boot_cmdline, n); + + command = cmdline; + + /* + * Break the line up into arguments with "" being ignored. + */ + while ( true ) { + command = strtok( command, " \t\r\n" ); + if ( command == NULL ) + break; + + ++argc; + command = '\0'; + } + + /* + * If there are arguments, allocate enough memory for the argv + * array to be passed into main(). + * + * NOTE: If argc is 0, then argv will be NULL. + */ + argv = calloc( argc, sizeof( *argv ) ); + if ( argv != NULL ) { + int a; + + command = cmdline; + argv[ 0 ] = command; + + for ( a = 1; a < argc; ++a ) { + command += strlen( command ) + 1; + argv[ a ] = command; + } + } else { + argc = 0; + } + } + } + + result = main( argc, argv ); + + free( argv ); + free( cmdline ); + + exit( result ); +} + +/* configuration information */ + +/* This is enough to get a basic main() up. */ +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE +#define CONFIGURE_UNIFIED_WORK_AREAS +#define CONFIGURE_STACK_CHECKER_ENABLED + +/* on smaller architectures lower the number or resources */ +#define CONFIGURE_UNLIMITED_OBJECTS +#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 8 +#define CONFIGURE_MAXIMUM_DRIVERS 16 +#define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 32 + +/* Include basic device drivers needed to call delays */ +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER + +#define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK + +#define CONFIGURE_MAXIMUM_PROCESSORS CPU_MAXIMUM_PROCESSORS + +#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT +#define CONFIGURE_INIT_TASK_STACK_SIZE (32*1024) + +#define CONFIGURE_INIT + +#include <rtems/confdefs.h> diff --git a/bsps/sparc/shared/config/dummy-networking-bsp.c b/bsps/sparc/shared/config/dummy-networking-bsp.c new file mode 100644 index 0000000000..cca73770f3 --- /dev/null +++ b/bsps/sparc/shared/config/dummy-networking-bsp.c @@ -0,0 +1,38 @@ +/* + * Dummy configuration file + * + * COPYRIGHT (c) 1989-2008. + * 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> + +/* Loopback Network Configuration */ +#if defined(RTEMS_NETWORKING) + #include <rtems/rtems_bsdnet.h> + #include <sys/socket.h> + #include <netinet/in.h> + + struct rtems_bsdnet_config rtems_bsdnet_config = { + NULL, /* Network interface */ + NULL, /* Use fixed network configuration */ + 0, /* Default network task priority */ + 0, /* Default mbuf capacity */ + 0, /* Default mbuf cluster capacity */ + "testSystem", /* Host name */ + "nowhere.com", /* Domain name */ + "127.0.0.1", /* Gateway */ + "127.0.0.1", /* Log host */ + {"127.0.0.1" }, /* Name server(s) */ + {"127.0.0.1" }, /* NTP server(s) */ + 1, /* sb_efficiency */ + 0, /* udp_tx_buf_size */ + 0, /* udp_rx_buf_size */ + 0, /* tcp_tx_buf_size */ + 0 /* tcp_rx_buf_size */ + }; +#endif diff --git a/c/src/lib/libbsp/sparc/leon2/Makefile.am b/c/src/lib/libbsp/sparc/leon2/Makefile.am index 946a7d4664..b739c96f99 100644 --- a/c/src/lib/libbsp/sparc/leon2/Makefile.am +++ b/c/src/lib/libbsp/sparc/leon2/Makefile.am @@ -70,6 +70,10 @@ librtemsbsp_a_SOURCES += ../../../../../../bsps/sparc/leon2/net/leon_smc91111.c librtemsbsp_a_SOURCES += ../../../../../../bsps/sparc/leon2/net/leon_open_eth.c endif +# provides default RTEMS configuration for this BSP +project_lib_LIBRARIES += librtemsdefaultconfigbsp.a +librtemsdefaultconfigbsp_a_SOURCES = ../../../../../../bsps/sparc/shared/config/default-configuration-bsp.c +librtemsdefaultconfigbsp_a_SOURCES += ../../../../../../bsps/sparc/shared/config/dummy-networking-bsp.c include $(srcdir)/../../../../../../bsps/shared/irq-sources.am include $(srcdir)/../../../../../../bsps/shared/grlib-sources.am diff --git a/c/src/lib/libbsp/sparc/leon3/Makefile.am b/c/src/lib/libbsp/sparc/leon3/Makefile.am index f989ab1e81..bf5b855048 100644 --- a/c/src/lib/libbsp/sparc/leon3/Makefile.am +++ b/c/src/lib/libbsp/sparc/leon3/Makefile.am @@ -101,6 +101,10 @@ librtemsbsp_a_SOURCES += ../../../../../../bsps/sparc/leon3/mpci/lock.c librtemsbsp_a_SOURCES += ../../../../../../bsps/sparc/leon3/mpci/mpisr.c endif +# provides default RTEMS configuration for this BSP +project_lib_LIBRARIES += librtemsdefaultconfigbsp.a +librtemsdefaultconfigbsp_a_SOURCES = ../../../../../../bsps/sparc/shared/config/default-configuration-bsp.c +librtemsdefaultconfigbsp_a_SOURCES += ../../../../../../bsps/sparc/shared/config/dummy-networking-bsp.c include $(srcdir)/../../../../../../bsps/shared/irq-sources.am include $(srcdir)/../../../../../../bsps/shared/grlib-sources.am |