nios2 gcc atomic builtins

Hill, Jeff johill at lanl.gov
Fri Jul 15 21:54:53 UTC 2016


Hello All,

Recently I noticed that with RTEMS, nios2 architecture, and gcc the c++ std :: shared_ptr is synchronized with an operating system mutex instead of with built-in gcc atomic operators based on a short duration interrupt lock. The mutex implementation  is of course much-slower for basic operations like compare-and-swap and or increment/decrement, and furthermore allocation of a mutex for every shared_ptr instance results in some considerable overhead.

I have observed some discussion concerning this issue in the link below, and I read elsewhere that a google code effort might be forming related to RTEMS atomic primitives.

https://gcc.gnu.org/ml/gcc/2016-04/msg00116.html

Furthermore, for sh architecture I notice that gcc/config/VxWorks.h has some snippets like this which might be relevant.

#define TARGET_OS_CPP_BUILTINS()	\
  do					\
    {					\
      builtin_define ("CPU=SH7000");	\
      VXWORKS_OS_CPP_BUILTINS ();	\
    }					\
  while (0)

So I have some questions.

1) What is the expected direction for atomic primitives on RTEMS? Will there be RTEMS implementations. Will use of the gcc compiler generated intrinsic functions conflict with the typical RTEMS implementation in the future?
2) Has this issue already been resolved for nios2, and if so is it possible to benefit in advance from some of the gcc configuration work?
3) If not, any suggestion for another architecture such as sh, and a gcc version,  to emulate would be helpful?

I haven't built from the latest gcc for a year or so perhaps I only need to download version X of GCC? Here is what I currently have installed.

nios2-rtems4.10-g++ --version
nios2-rtems4.10-g++ (GCC) 4.9.1 20140716 (RTEMS 4.10-RSB-5f0e38f3bfe1c49e59e188d7924d95e10f9d4b9d-1,gcc-4.9.1/newlib-1.18.1)

PS: I also have some work for an Altera tools auto-configuring BSP, prioritized ISR dispatch for the internal interrupt controller, Altera IP drivers including TSE Mac Ethernet, network attached thread-mode gdb stub (usable but a work in progress), exception back-trace messages etc that are in use here, that I would be happy to distribute, as  requested. We see a  max Ethernet  throughput of about 140 Mbps on the Stratix III based nios2 soft-core. 

Jeff


More information about the users mailing list