RTEMS on Virtex 4

Gempeler Stefan Stefan.Gempeler at nanotronic.ch
Mon Jun 3 09:43:23 UTC 2013


Hi Sebastian and Joel,,

 

thank you very much for your fast replies. Sorry if I ruined your
weekend, Joel ;-)

 

> you execute the program out of the RAM?
 

Yes, that's the plan. No additional memory (costs).

 

> printf() and the Termios interface (do you need it?) needs a lot of
code space
> and the PowerPC code itself is not very dense.  It is possible to
strip down a
> RTEMS system, but in general RTEMS is not a ultra low code size
system.
 

I use the printk() to write data to the UART (also changed the printf()
in c/src/lib/libbsp/powerpc/virtex/startup/bspstart.c:
bsp_XAssertHandler() to printk() -> no printf() in elf file).

Hmm, when I set

#define CONFIGURE_TERMIOS_DISABLED

I get no output anymore. We use the UART as a simple debug console
(output can be directly written to UART, input interrupt driven).

 

> Can you post your hello world version? And how you configured RTEMS.

 

The changes I made in the virtex BSP c/src/lib/libbsp/powerpc/virtex:

-          configure.ac :  changed
RTEMS_BSPOPTS_SET([RTEMS_XPARAMETERS_H],[*],[\<xparameters_dflt.h\>]) to
RTEMS_BSPOPTS_SET([RTEMS_XPARAMETERS_H],[*],[\"/home/me/code/ml410/ppc40
5_0/include/xparameters.h\"])

-          console/consolelite.c : removed the entries "/dev/ttyS1" to
"/dev/ttyS3" in console_tbl Console_Configuration_Ports[]

-          startup/bspstart.c: bsp_XAssertHandler(), printf() to
printk()

-          startup/linkcmds: 
RamBase =  0xfffc0000;

RamSize =  0x0003ffff;
HeapSize = 0x0;

StackSize = 0x2000;

MEMORY

{

  RAM : ORIGIN = 0xfffc0000, LENGTH = 0x0003ffff

}

SECTIONS

{

  .text 0xfffc0000:

...

  /* align bottom of 32k init stack at a 32k boundary */

  . = . + 0x1000;

  . = ALIGN( 0x1000 );

  stack.start = .;

  . = . + StackSize;

  . = . + StackSize;

  stack.end   = .;

  /*

   * Interrupt stack setup

   */

    IntrStack_start = ALIGN(0x10);

    . += StackSize;

    IntrStack_end = .;

...

 

Configured with :

../rtems/configure --target=powerpc-rtems4.11 --enable-rtemsbsp=virtex
--prefix=/home/me/code/bsp-install --disable-cxx --disable-networking

 

I tested several hello worlds.

 

The basic one:

//----------------------------------------------------------------------
---------------------------------------------

//----------------------------------------------------------------------
---------------------------------------------

/* forward declarations to avoid warnings */

rtems_task Init(rtems_task_argument argument);

 

rtems_task Init( rtems_task_argument ignored )

{

  printk( "\n\n*** HELLO WORLD TEST ***\t\t%s, %s\n", __DATE__, __TIME__
);

  printk( "Hello World\t\t\t\t%s, %s\n", __DATE__, __TIME__ );

 printk( "*** END OF HELLO WORLD TEST ***\t\t%s, %s\n", __DATE__,
__TIME__ );

  exit( 0 );

}

 

/* NOTICE: the clock driver is explicitly disabled */

#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER

#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER

#define CONFIGURE_MAXIMUM_TASKS            1

#define CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM

#define CONFIGURE_RTEMS_INIT_TASKS_TABLE

#define CONFIGURE_INIT

#include <rtems/confdefs.h>

------------------------------------------------------------------------
-------------------------------------------

Size:

   text       data        bss         dec        hex    filename

126392    1724      4004   132120   20418  rtems_libs.exe

------------------------------------------------------------------------
-------------------------------------------

 

To test the POSIX thread creation: 

//----------------------------------------------------------------------
---------------------------------------------

//----------------------------------------------------------------------
---------------------------------------------

void* dbg_thread(void *arg)

{

                printk( "POSIX: LOCAL dbg_thread()\t%s, %s\n", __DATE__,
__TIME__ );

                while(1);

                exit( 0 );

}

//----------------------------------------------------------------------
---------------------------------------------

rtems_task Init(rtems_task_argument ignored )

{

  printk( "\nClassic -- Hello World\t\t%s, %s\n", __DATE__, __TIME__ );

  rtems_task_delete( RTEMS_SELF );

}

//----------------------------------------------------------------------
---------------------------------------------

void *POSIX_Init( void *argument )

{

  pthread_t dbg;

 

  printk( "POSIX -- Hello World\t\t%s, %s\n", __DATE__, __TIME__ );

  pthread_create( &dbg, NULL, dbg_thread, NULL );

  sleep( 1 );

  while(1);

  exit( 0 );

}

//----------------------------------------------------------------------
---------------------------------------------

/* configuration information */

#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER

#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER

#define CONFIGURE_POSIX_INIT_THREAD_TABLE

#define CONFIGURE_RTEMS_INIT_TASKS_TABLE

#define CONFIGURE_MAXIMUM_TASKS
(1)

#define CONFIGURE_MAXIMUM_POSIX_THREADS                     (2)

#define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE
(CONFIGURE_MAXIMUM_POSIX_THREADS*1024)

#define CONFIGURE_INIT

#include <rtems/confdefs.h>

------------------------------------------------------------------------
-------------------------------------------

Size:

   text       data        bss         dec        hex    filename

141416    1796      3848   147060   23e74  rtems_libs.exe

------------------------------------------------------------------------
-------------------------------------------

 

These 2 examples worked and produced the output as expected over the
UART  defined as STDOUT_BASEADDRESS. Also the input (polled with
getchark ()) worked. 

 

> The PowerPC BSPs should provide this interface:
>
http://www.rtems.org/onlinedocs/doxygen/cpukit/html/group__rtems__interr
upt__extension.html
> In case this doesn't work with the virtex4 BSP, then we should fix
this.
 

I already tried it with rtems_interrupt_handler_install(), but it seems
to be missing in the libs:

undefined reference to `rtems_interrupt_handler_install' 

collect2: error: ld returned 1 exit status

 

virtex4 BSP: at the moment I use the virtex and not the virtex4 BSP
because I don't know how to get the UART stdio working. 

How do I set up the stdio and interrupt to STDOUT_BASEADDRESS? 

 

Ok, thank you very much again for your responses and help. I really
appreciate it. 

The next step of my evaluation process will be trying to get a lower
memory usage to move on with our tests. 

 

Kind regards

Stefan Gempeler

 

 

 

 

 

 

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20130603/d62d2775/attachment-0001.html>


More information about the users mailing list