Blog

The head of the repository for rceapp/ now makes the experimental core version 2.0.

Changes

  • Tasks started with runTask from the shell now inherit the shell's definitions of the C stdio streams stdin, stdout and stderr. printf(), fprintf() et al. used from the child task now output to the telnet socket instead of to the in-memory syslog.
  • If you use the version of Logger() now in RCE::service it too will output to the telnet socket. Modules run with runTask no longer need to initialize the logging package.
  • New services in rce/service (namespace RCE::service):
    • EnumInfo. A template designed to make it easier to work with enumeration types. See rce/ppi/PortType.hh for an example of how to use it.
    • Logging service.
      • I've copied classes Logger, LoggerImpl and LogMessage from quarks.
      • You no longer need to initialize logging in modules run using runTask.
      • PtyLogger isn't copied, instead there is StderrLogger which is active by default.
      • Use class LoggingGuard to change the logging implementation or the severity threshold for a block of code.
    • Notepad. Each instance of Notepad tries to allocate one of the 16 notepad slots available under RTEMS; the class tracks which slots are in use. Each slot is a 32-bit value inside the task control block which therefore varies from task to task without the extra overhead of RTEMS task-variables.
    • Once. Runs an initialization function exactly once no matter how many tasks are competing for it.
    • Semaphore (Semaphore-new.hh). A re-implementation of the old Semaphore class.
    • SemaphoreGuard. Makes sure that a Semaphore is held only as long as the guard instance exists. Used to guarantee that a Semaphore is released when a block of code is exited in many places (throws, returns, gotos).
    • StringBuffer. Assembles a dynamically allocated C-string from smaller pieces, with formatting.
    • readAll(), writeAll() (rwall.hh). Used with devices like sockets which may exit from read() and write() without transferring all the data you asked them to (even when no error occurs).
    • Thread (Thread-new.hh). An abstract base class for managing tasks; you derive a class and implement the virtual function body(). New Threads inherit the C stdio streams from the creating task. If that task is also managed by Thread the new Thread can inherit the logging implementation and RTEMS priority as well. Class Thread uses a Notepad slot to keep a pointer to the Thread instance used to manage a task; the slot can be read with the static member function currentThread() even in code that is not in a Thread-derived class, e.g., library code. In your derived classes you can place extra data members which gives you thread-local storage without the overhead incurred by RTEMS' task variables. If your code fails to catch a C++ exception even at top level then the underlying RTEMS task is suspended.
SVN repository now on AFS

Yesterday we moved our SVN repository. There is a symbolic link at the old location pointing to the new. I've updated the Confluence page on the repository.

The e-mail from Jim:

Hi all,

Currently the SVN repo for the RCE is in /reg/g/npa/svnrepo on the main server
in the rack. This does not seem to be well backed up, so we are going to move
it to an AFS partition that Ric set up.

Your SVNROOT variable is currently: file:///reg/g/npa/svnrepo
The new location will be file:///afs/slac/g/cci/svnrepo

I plan on making this move after COB today (probably starting around 6:30) if
there are no objections.

--Jim

Core 1.6 tagged

I've just made the tags "core1.6" from the heads of release/, rce/, rceusr/, rceapp/ and quarks/.

Features of the new core:

  • Revamped and better documented rtems_configure_*.cc.
  • The core version and RTEMS object quotas are printed in the syslog just after a reboot.
  • The addCommand command in the shell allows you to add shell commands dynamically.
  • PGP init code can be called more than once; it will kill and restart existing service tasks.

The plain, optimized and debugging versions of the core all build and run.

I've copied the current head of rce/trunk to rce/branches/new-ppi-interface to create a branch for the code described here. The branch appears starting at revision 1313 of the repository. For now only the RCE project has such a branch but I may have to add it to other projects later on.

The new package ppi/ will contain the actual interface code. The logging service code from quarks will be moved into rce/service. The core-making code from rceapp/ will be moved to rce/core since the core will no longer be built in the same way as an application (see the JIRA issue PTC-13).

Third party code area for RCE project

I've set up an area on the lab1 system for third party code that we use for the RCE project. The directory /reg/g/rce/packages/ is set up like a /usr/local, and currently contains the following 3rd party packages:

  • rtems 4.9.2
    • Copied from /afs/slac/g/npa/package/rtems/4.9.2 so that we can actually see the source on the .6 subnet...
  • gdb 6.8
    • With RTEMS stub patch so we can use gdb over TCP with an RCE
  • libxml2 2.7.7
  • python 2.6.6
  • swig 2.0.1
  • QT 4.7.0
  • sip 4.11.1
  • PyQT 4.7.7
  • cfitsio 3.25.0
  • numpy 1.5.0
  • pyfits 2.3.1
  • ds9 9.6.2
    • ds9 is an astronomy package that reads and displays FITS image files

To use these:
setenv PATH /reg/g/rce/packages/bin:$PATH
setenv LD_LIBRARY_PATH /reg/g/rce/packages/lib:$LD_LIBRARY_PATH

Core 1.4 tagged

I've finally made a release of core 1.4 that be re-imported to CVS and
use at CERN. This fixes the bugs in the remove() code of System and Task, and
adds commands 'fsDump' and 'fsck' to the shell.

This is svn revision 1187.

There is a tag in SVN: ATLAS_20100622_core1.4 for packages release, rce, rceapp and
rceusr.

New package: io

This contains the functions readAll() and writeAll() which don't return until there's an I/O error or all the bytes you requested are transferred. Made PtyLogger use writeAll() for greater efficiency, slightly modifying the LoggerImpl interface.

Additions to package: concurrency

Added some RCE-specific components to the "concurrency" package. These include low-level synchronization primitives plus a CircularFifo template; the FIFO is actually implemented with the lock-free LlScFifo which uses lwarx/stwc for synchronization. There is also NoInterruptFifo which uses critical sections created by turning off interrupts; this is intended as an alternate means of implementing CircularFifo. Class InterruptGuard uses Initialization Is Resource Allocation (IIRA) to allow easy definition of blocks of code to be run with interrupts off, automatically turning them back on when the block is exited.

Additions to package: service

Added the TimerGuard template to the "service" package (also for RCE only). This uses IIRA to calculate the number of PowerPC time base ticks needed to execute a code block and passes the result to a user-specified object.

Coding examples for some of the above are in testCircularFifo.cc and testTiming.cc.

New PDF documentation

A new version of quarks.pdf is attached to the Petacache Documentation page in Confluence.

IR2 testing nodes are available

Nodes are available in IR2 for development of Petacache benchmarking. Their names are ir2farm{01..40}. See Benchmarking the Petacache for more info.

Head of repository is core 1.3

After adding the gdbStub code to the development core, I bumped the minor version number.

GDB stub support added

GDB stub support has been added to the RCE core for the petacache. See Debugging the DAT on an RCE for usage and requirements.

1 Comment  · 

There's a new version of sofi.pdf attached to the Petacache Documentation page in Confluence, reflecting recently checked-in changes.

Logging is thread-safe

quarks::service::Logger now takes a Semaphore during the call to LoggerImpl::send() so that log messages from different tasks don't get mixed together. Class LoggerImpl is much simplified in that all formatting, severity level filtering and synchronization are done elsewhere.

Checking the severity level threshold

Logger().aboveThreshold(severity-level) will return true if messages of level severity-level are being logged. This allows you to skip debug-printout code that's more complex than a simple series of logging calls.

Piecewise assembly of log messages.

Class quarks::service::LogMessage may be used to assemble a log message a piece at a time instead of all in one logging call. The accumulated message is sent when the LogMessage instance being used is destroyed. This may happen at the end of a statement (temporary instance) or at the end of a code block (named instance).

New way to initialize and shut down logging

In a module's main function construct an instance of quarks::service::InitLogging on the stack instead of calling Logging::initLogging() directly. When the function exits then logging will be gracefully shut down. An example of Resource Allocation Is Initialization (RAII).

New package: concurrency

These are tools and data structures used in aid of thread-safe programming. The first class added is CriticalSection, whose constructor takes a given Semaphore and whose destructor gives that semaphore, thereby creating a critical section that lasts as long as the instance does. Another example of RAII.

New package: datastructures

These are non-concurrent data structures. BitSet is a classic powerset defined in an unsigned int (32 bits). BitPq is a priority queue that returns in ascending order the bit positions of all the bits set in a Bitset.

New PDF documentation

A new version of quarks.pdf is attached to the Petacache Documentation page in Confluence.

Classes Logger and PtyLogger in namespace quarks::service are now available from quarks/trunk as of revision 1086 of the repository. PtyLogger is still a little delicate because it assumes that your telnet session is using /dev/pty0. This is normally true unless you start a new session while keeping /dev/pty0 open in your own code. The implementation may also not be thread-safe although the class code itself is reentrant.

Example logging to the telnet socket:

#include "quarks/service/Logger.hh"
#include "quarks/service/PtyLogger.hh"
using quarks::service::Logger;
using quarks::service::PtyLogger;

extern "C" void rce_appmain() {
  // Log to telnetd PTY, filter out severity less than Info.
  Logging::initLogging(Logger::Info, new PtyLogger());
  Logger().info("Hello");
  Logger().debug("Extra stuff"); // Filtered out.
}

The head of rceapp/trunk/core, starting at revision 1086, makes core.1.2.devel and core.1.2 prod.

The new core contains dprintf() and related functions needed for quarks::service::Logger and related classes. It also has a fix for a bug in long long RceSvc::time().