Re: GCC version for RTEMS 6?
On 4/5/2022 3:54 pm, Sebastian Huber wrote: > On 04/05/2022 02:14, Chris Johns wrote: >> On 3/5/2022 4:56 pm, Sebastian Huber wrote: >>> Hello, >>> >>> I added a back port of the gcov-tool merge-stream patches to GCC 12. You >>> find >>> some background information here: >>> >>> https://gcc.gnu.org/onlinedocs/gcc/Freestanding-Environments.html#Freestanding-Environments >>> >>> >>> A back port to GCC 10 would be quite difficult since the gcov file handling >>> changed significantly between GCC 10 and 12. >>> >>> There is some work in progress to support MC/DC code coverage in gcov: >>> >>> https://gcc.gnu.org/pipermail/gcc-patches/2022-March/592065.html >>> >>> Back porting this to GCC 12 would be probably feasible. >>> >>> It would be nice if we could make the gcov support available for RTEMS 6, >>> but >>> this is only possible with an update to GCC 12. Are there any objections to >>> update the RSB to use the upcoming GCC 12 release for RTEMS 6? >> >> Are there any posted test results? > > I did only local test runs on simulators so far. Did you post the results? It helps having tested results :) >> How do I build gcc12 with rtems6 and test? I am working on a large complex >> C++ >> framework with rtems6/gcc10 and it is working well and is stable. If there >> is a >> way I can test what I am working on with gcc12 to determine if there are any >> regressions that would help me decide. > > I updated the RTEMS 7 tools to use the GCC 12 release branch with a gcov back > port. You can test GCC 12 with a local patch for RTEMS 6: > > diff --git a/rtems/config/6/rtems-default.bset > b/rtems/config/6/rtems-default.bset > index 731c9d8..381f916 100644 > --- a/rtems/config/6/rtems-default.bset > +++ b/rtems/config/6/rtems-default.bset > @@ -15,5 +15,5 @@ devel/gmp-6.2.1 > tools/rtems-gdb-11.2 > > tools/rtems-binutils-2.38 > -tools/rtems-gcc-10-newlib-head > +tools/rtems-gcc-head-newlib-head > tools/rtems-tools-6 Ah ok and thanks. I will take a look and report back. It will take a couple of days for me to work through this. It would be nice to be able to handle this without changing anything. Chris ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: GCC version for RTEMS 6?
On 04/05/2022 09:11, Chris Johns wrote: I updated the RTEMS 7 tools to use the GCC 12 release branch with a gcov back port. You can test GCC 12 with a local patch for RTEMS 6: diff --git a/rtems/config/6/rtems-default.bset b/rtems/config/6/rtems-default.bset index 731c9d8..381f916 100644 --- a/rtems/config/6/rtems-default.bset +++ b/rtems/config/6/rtems-default.bset @@ -15,5 +15,5 @@ devel/gmp-6.2.1 tools/rtems-gdb-11.2 tools/rtems-binutils-2.38 -tools/rtems-gcc-10-newlib-head +tools/rtems-gcc-head-newlib-head tools/rtems-tools-6 Ah ok and thanks. I will take a look and report back. It will take a couple of days for me to work through this. Ok, thanks. It would be nice to be able to handle this without changing anything. I can commit this change if it helps. -- embedded brains GmbH Herr Sebastian HUBER Dornierstr. 4 82178 Puchheim Germany email: sebastian.hu...@embedded-brains.de phone: +49-89-18 94 741 - 16 fax: +49-89-18 94 741 - 08 Registergericht: Amtsgericht München Registernummer: HRB 157899 Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler Unsere Datenschutzerklärung finden Sie hier: https://embedded-brains.de/datenschutzerklaerung/ ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH v3 00/11] ENABLE PPS API in RTEMS6
This is the 3rd version of the patches for enabling the PPS API in RTEMS6. It contains the changes suggested by Sebastian from yesterday (03/05/2022). Gabriel Moyano (11): kern_ntptime.c: Disable freebsd features kern_ntptime.c: Add lmax() qmin() definitions kern_tc.c: Add atomic dependencies required by the PPS API kern_tc.c: Replace FREEBSD event mechanism by adding pointers to function timecounter.h: Rename tc_getfrequency() to _Timecounter_Get_frequency() kern_tc.c: Add definitions required by PPS API kern_tc.c: Enable PPS API support kern_ntptime.c: Add define in order to remove warning timepps.h: PPS_SYNC defined by default timecounter.h: Add _Timecounter_Discipline() testsuites/sptests: Add sppps01 test cpukit/include/rtems/score/timecounter.h | 25 cpukit/include/sys/timepps.h | 32 cpukit/include/sys/timetc.h | 3 + cpukit/score/src/kern_ntptime.c | 19 +-- cpukit/score/src/kern_tc.c| 54 ++- spec/build/testsuites/sptests/grp.yml | 2 + spec/build/testsuites/sptests/sppps01.yml | 19 +++ testsuites/sptests/sppps01/init.c | 173 ++ 8 files changed, 312 insertions(+), 15 deletions(-) create mode 100644 spec/build/testsuites/sptests/sppps01.yml create mode 100644 testsuites/sptests/sppps01/init.c -- 2.25.1 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH v3 02/11] kern_ntptime.c: Add lmax() qmin() definitions
--- cpukit/score/src/kern_ntptime.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cpukit/score/src/kern_ntptime.c b/cpukit/score/src/kern_ntptime.c index 610386833c..da6b425064 100644 --- a/cpukit/score/src/kern_ntptime.c +++ b/cpukit/score/src/kern_ntptime.c @@ -71,6 +71,8 @@ __FBSDID("$FreeBSD$"); #definentp_update_second _Timecounter_NTP_update_second #definetime_uptime _Timecounter_Time_uptime struct thread; +static __inline long lmax(long a, long b) { return (a > b ? a : b); } +static __inline quad_t qmin(quad_t a, quad_t b) { return (a < b ? a : b); } #endif /* __rtems__ */ #ifndef __rtems__ -- 2.25.1 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH v3 01/11] kern_ntptime.c: Disable freebsd features
--- cpukit/score/src/kern_ntptime.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cpukit/score/src/kern_ntptime.c b/cpukit/score/src/kern_ntptime.c index cb39133408..610386833c 100644 --- a/cpukit/score/src/kern_ntptime.c +++ b/cpukit/score/src/kern_ntptime.c @@ -73,9 +73,11 @@ __FBSDID("$FreeBSD$"); struct thread; #endif /* __rtems__ */ +#ifndef __rtems__ #ifdef PPS_SYNC FEATURE(pps_sync, "Support usage of external PPS signal by kernel PLL"); #endif +#endif /* __rtems__ */ /* * Single-precision macros for 64-bit machines @@ -374,7 +376,6 @@ SYSCTL_NODE(_kern, OID_AUTO, ntp_pll, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, SYSCTL_PROC(_kern_ntp_pll, OID_AUTO, gettime, CTLTYPE_OPAQUE | CTLFLAG_RD | CTLFLAG_MPSAFE, 0, sizeof(struct ntptimeval) , ntp_sysctl, "S,ntptimeval", ""); -#endif /* __rtems__ */ #ifdef PPS_SYNC SYSCTL_INT(_kern_ntp_pll, OID_AUTO, pps_shiftmax, CTLFLAG_RW, @@ -391,6 +392,7 @@ SYSCTL_S64(_kern_ntp_pll, OID_AUTO, time_freq, CTLFLAG_RD | CTLFLAG_MPSAFE, &time_freq, 0, "Frequency offset (ns/sec)"); #endif +#endif /* __rtems__ */ /* * ntp_adjtime() - NTP daemon application interface -- 2.25.1 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH v3 03/11] kern_tc.c: Add atomic dependencies required by the PPS API
--- cpukit/include/sys/timepps.h | 7 +++ cpukit/score/src/kern_tc.c | 7 +++ 2 files changed, 14 insertions(+) diff --git a/cpukit/include/sys/timepps.h b/cpukit/include/sys/timepps.h index 01212f0b43..5703381ffa 100644 --- a/cpukit/include/sys/timepps.h +++ b/cpukit/include/sys/timepps.h @@ -24,12 +24,19 @@ #include #include #include +#ifdef __rtems__ +#include +#endif /* __rtems__ */ #define PPS_API_VERS_1 1 typedef int pps_handle_t; +#ifndef __rtems__ typedef unsigned pps_seq_t; +#else /* __rtems__ */ +typedef Atomic_Uintpps_seq_t; +#endif /* __rtems__ */ typedef struct ntp_fp { unsigned intintegral; diff --git a/cpukit/score/src/kern_tc.c b/cpukit/score/src/kern_tc.c index e57da2c0ca..f7d0a0b4ba 100644 --- a/cpukit/score/src/kern_tc.c +++ b/cpukit/score/src/kern_tc.c @@ -114,6 +114,13 @@ atomic_thread_fence_rel(void) _Atomic_Fence(ATOMIC_ORDER_RELEASE); } +static inline u_int +atomic_load_int(Atomic_Uint *i) +{ + + return (_Atomic_Load_uint(i, ATOMIC_ORDER_RELAXED)); +} + static inline u_int atomic_load_acq_int(Atomic_Uint *i) { -- 2.25.1 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH v3 04/11] kern_tc.c: Replace FREEBSD event mechanism by adding pointers to function
--- cpukit/include/sys/timepps.h | 21 cpukit/score/src/kern_tc.c | 38 2 files changed, 59 insertions(+) diff --git a/cpukit/include/sys/timepps.h b/cpukit/include/sys/timepps.h index 5703381ffa..b734c6f841 100644 --- a/cpukit/include/sys/timepps.h +++ b/cpukit/include/sys/timepps.h @@ -164,6 +164,27 @@ struct pps_state { int ppscap; struct timecounter *ppstc; unsignedppscount[3]; +#ifdef __rtems__ +/** + * @brief Wait for an event. + * + * Called internally when time_pps_fetch() is used. + * It is initialized with an empty function by default. + * + * @param pps is the pointer to the object. + * + * @param timeout + * + * @return 0 if no error otherwise a negative value. + */ +int (*wait)(struct pps_state *pps, struct timespec timeout); +/** + * @brief Wakeup the tasks waiting for an event. + * + * @param pps is the pointer to the object. + */ +void (*wakeup)(struct pps_state *pps); +#endif /* __rtems__ */ /* * The following fields are valid if the driver calls pps_init_abi(). */ diff --git a/cpukit/score/src/kern_tc.c b/cpukit/score/src/kern_tc.c index f7d0a0b4ba..6ca408e4ab 100644 --- a/cpukit/score/src/kern_tc.c +++ b/cpukit/score/src/kern_tc.c @@ -1917,9 +1917,15 @@ abi_aware(struct pps_state *pps, int vers) static int pps_fetch(struct pps_fetch_args *fapi, struct pps_state *pps) { +#ifndef __rtems__ int err, timo; +#else /* __rtems__ */ + int err; +#endif /* __rtems__ */ pps_seq_t aseq, cseq; +#ifndef __rtems__ struct timeval tv; +#endif /* __rtems__ */ if (fapi->tsformat && fapi->tsformat != PPS_TSFMT_TSPEC) return (EINVAL); @@ -1932,6 +1938,7 @@ pps_fetch(struct pps_fetch_args *fapi, struct pps_state *pps) * sleep a long time. */ if (fapi->timeout.tv_sec || fapi->timeout.tv_nsec) { +#ifndef __rtems__ if (fapi->timeout.tv_sec == -1) timo = 0x7fff; else { @@ -1939,10 +1946,12 @@ pps_fetch(struct pps_fetch_args *fapi, struct pps_state *pps) tv.tv_usec = fapi->timeout.tv_nsec / 1000; timo = tvtohz(&tv); } +#endif /* __rtems__ */ aseq = atomic_load_int(&pps->ppsinfo.assert_sequence); cseq = atomic_load_int(&pps->ppsinfo.clear_sequence); while (aseq == atomic_load_int(&pps->ppsinfo.assert_sequence) && cseq == atomic_load_int(&pps->ppsinfo.clear_sequence)) { +#ifndef __rtems__ if (abi_aware(pps, 1) && pps->driver_mtx != NULL) { if (pps->flags & PPSFLAG_MTX_SPIN) { err = msleep_spin(pps, pps->driver_mtx, @@ -1954,6 +1963,10 @@ pps_fetch(struct pps_fetch_args *fapi, struct pps_state *pps) } else { err = tsleep(pps, PCATCH, "ppsfch", timo); } +#else /* __rtems__ */ +_Assert(pps->wait != NULL); +err = (*pps->wait)(pps, fapi->timeout); +#endif /* __rtems__ */ if (err == EWOULDBLOCK) { if (fapi->timeout.tv_sec == -1) { continue; @@ -2058,9 +2071,29 @@ pps_ioctl(u_long cmd, caddr_t data, struct pps_state *pps) } } +#ifdef __rtems__ +static int +default_wait(struct pps_state *pps, struct timespec timeout) +{ +(void) pps; +(void) timeout; + +return 0; +} + +static void +default_wakeup(struct pps_state *pps) +{ +(void) pps; +} +#endif /* __rtems__ */ void pps_init(struct pps_state *pps) { +#ifdef __rtems__ +pps->wait = default_wait; +pps->wakeup = default_wakeup; +#endif /* __rtems__ */ pps->ppscap |= PPS_TSFMT_TSPEC | PPS_CANWAIT; if (pps->ppscap & PPS_CAPTUREASSERT) pps->ppscap |= PPS_OFFSETASSERT; @@ -2227,7 +2260,12 @@ pps_event(struct pps_state *pps, int event) #endif /* Wakeup anyone sleeping in pps_fetch(). */ +#ifndef __rtems__ wakeup(pps); +#else /* __rtems__ */ +_Assert(pps->wakeup != NULL); +(*pps->wakeup)(pps); +#endif /* __rtems__ */ } #else /* __rtems__ */ /* FIXME: https://devel.rtems.org/ticket/2349 */ -- 2.25.1 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH v3 06/11] kern_tc.c: Add definitions required by PPS API
--- cpukit/score/src/kern_tc.c | 5 + 1 file changed, 5 insertions(+) diff --git a/cpukit/score/src/kern_tc.c b/cpukit/score/src/kern_tc.c index 133a6ea5e0..64a11bae20 100644 --- a/cpukit/score/src/kern_tc.c +++ b/cpukit/score/src/kern_tc.c @@ -56,6 +56,11 @@ #definetimecounter _Timecounter #definetime_second _Timecounter_Time_second #definetime_uptime _Timecounter_Time_uptime + +#define ENOIOCTL EINVAL +#include +#define KASSERT(exp, arg) _Assert(exp) + #include #include #include -- 2.25.1 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH v3 05/11] timecounter.h: Rename tc_getfrequency() to _Timecounter_Get_frequency()
--- cpukit/include/rtems/score/timecounter.h | 8 cpukit/include/sys/timetc.h | 3 +++ cpukit/score/src/kern_tc.c | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/cpukit/include/rtems/score/timecounter.h b/cpukit/include/rtems/score/timecounter.h index 1ecfc02085..fdade06128 100644 --- a/cpukit/include/rtems/score/timecounter.h +++ b/cpukit/include/rtems/score/timecounter.h @@ -292,6 +292,14 @@ void _Timecounter_Set_NTP_update_second( */ void _Timecounter_NTP_update_second(int64_t *adjustment, time_t *newsec); +/** + * @brief Get the frequency in Hz of the current timecounter at some time point + * during the call. + * + * @return the frequency in Hz. + */ +uint64_t _Timecounter_Get_frequency(void); + /** @} */ #ifdef __cplusplus diff --git a/cpukit/include/sys/timetc.h b/cpukit/include/sys/timetc.h index 5cdfdfe9b3..7cc3284b4d 100644 --- a/cpukit/include/sys/timetc.h +++ b/cpukit/include/sys/timetc.h @@ -36,6 +36,7 @@ struct vdso_timehands32; typedef u_int timecounter_get_t(struct timecounter *); #else /* __rtems__ */ typedef uint32_t timecounter_get_t(struct timecounter *); +#define tc_getfrequency _Timecounter_Get_frequency #endif /* __rtems__ */ typedef void timecounter_pps_t(struct timecounter *); typedef uint32_t timecounter_fill_vdso_timehands_t(struct vdso_timehands *, @@ -94,7 +95,9 @@ extern int tc_min_ticktock_freq; /* * required to handle counter wraps. */ +#ifndef __rtems__ u_int64_t tc_getfrequency(void); +#endif /* __rtems__ */ void tc_init(struct timecounter *tc); void tc_setclock(struct timespec *ts); void tc_ticktock(int cnt); diff --git a/cpukit/score/src/kern_tc.c b/cpukit/score/src/kern_tc.c index 6ca408e4ab..133a6ea5e0 100644 --- a/cpukit/score/src/kern_tc.c +++ b/cpukit/score/src/kern_tc.c @@ -1513,7 +1513,6 @@ unlock: #endif /* __rtems__ */ } -#ifndef __rtems__ /* Report the frequency of the current timecounter. */ uint64_t tc_getfrequency(void) @@ -1522,6 +1521,7 @@ tc_getfrequency(void) return (timehands->th_counter->tc_frequency); } +#ifndef __rtems__ static bool sleeping_on_old_rtc(struct thread *td) { -- 2.25.1 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH v3 07/11] kern_tc.c: Enable PPS API support
--- cpukit/score/src/kern_tc.c | 4 1 file changed, 4 deletions(-) diff --git a/cpukit/score/src/kern_tc.c b/cpukit/score/src/kern_tc.c index 64a11bae20..0bad76c329 100644 --- a/cpukit/score/src/kern_tc.c +++ b/cpukit/score/src/kern_tc.c @@ -1903,7 +1903,6 @@ SYSCTL_PROC(_kern_timecounter, OID_AUTO, choice, "Timecounter hardware detected"); #endif /* __rtems__ */ -#ifndef __rtems__ /* * RFC 2783 PPS-API implementation. */ @@ -2272,9 +2271,6 @@ pps_event(struct pps_state *pps, int event) (*pps->wakeup)(pps); #endif /* __rtems__ */ } -#else /* __rtems__ */ -/* FIXME: https://devel.rtems.org/ticket/2349 */ -#endif /* __rtems__ */ /* * Timecounters need to be updated every so often to prevent the hardware -- 2.25.1 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH v3 08/11] kern_ntptime.c: Add define in order to remove warning
--- cpukit/score/src/kern_ntptime.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cpukit/score/src/kern_ntptime.c b/cpukit/score/src/kern_ntptime.c index da6b425064..c1b4013e9b 100644 --- a/cpukit/score/src/kern_ntptime.c +++ b/cpukit/score/src/kern_ntptime.c @@ -58,6 +58,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef __rtems__ +#define_KERNEL +#endif /* __rtems__ */ #include #ifndef __rtems__ #include -- 2.25.1 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH v3 10/11] timecounter.h: Add _Timecounter_Discipline()
--- cpukit/include/rtems/score/timecounter.h | 17 + cpukit/include/sys/timepps.h | 3 +++ 2 files changed, 20 insertions(+) diff --git a/cpukit/include/rtems/score/timecounter.h b/cpukit/include/rtems/score/timecounter.h index fdade06128..95e0839cff 100644 --- a/cpukit/include/rtems/score/timecounter.h +++ b/cpukit/include/rtems/score/timecounter.h @@ -300,6 +300,23 @@ void _Timecounter_NTP_update_second(int64_t *adjustment, time_t *newsec); */ uint64_t _Timecounter_Get_frequency(void); +/** + * @brief Updates the timecounter frequency adjustment used by + * _Timecounter_Set_NTP_update_second(). + * + * This function is part of the time synchronization using a PPS + * (Pulse Per Second) signal. + * + * When an event (a rising or falling edge of the PPS signal) occurs, the + * functions pps_capture() and pps_event() are executed. Only if the kernel + * consumer is configured to be PPS_KC_HARDPPS, the timecounter is disciplined. + * + * @param[in] tsp is the time at PPS event + * + * @param[i] nsec is the time in nanoseconds from the last PPS event + */ +void _Timecounter_Discipline(struct timespec *tsp, long nsec); + /** @} */ #ifdef __cplusplus diff --git a/cpukit/include/sys/timepps.h b/cpukit/include/sys/timepps.h index 56c1cc43ca..0eb4246a39 100644 --- a/cpukit/include/sys/timepps.h +++ b/cpukit/include/sys/timepps.h @@ -27,6 +27,7 @@ #ifdef __rtems__ #include #define PPS_SYNC +#define hardpps _Timecounter_Discipline #endif /* __rtems__ */ #define PPS_API_VERS_1 1 @@ -200,7 +201,9 @@ void pps_event(struct pps_state *pps, int event); void pps_init(struct pps_state *pps); void pps_init_abi(struct pps_state *pps); int pps_ioctl(unsigned long cmd, caddr_t data, struct pps_state *pps); +#ifndef __rtems__ void hardpps(struct timespec *tsp, long nsec); +#endif /* __rtems__ */ #else /* !_KERNEL */ -- 2.25.1 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH v3 09/11] timepps.h: PPS_SYNC defined by default
--- cpukit/include/sys/timepps.h| 1 + cpukit/score/src/kern_ntptime.c | 10 -- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/cpukit/include/sys/timepps.h b/cpukit/include/sys/timepps.h index b734c6f841..56c1cc43ca 100644 --- a/cpukit/include/sys/timepps.h +++ b/cpukit/include/sys/timepps.h @@ -26,6 +26,7 @@ #include #ifdef __rtems__ #include +#define PPS_SYNC #endif /* __rtems__ */ #define PPS_API_VERS_1 1 diff --git a/cpukit/score/src/kern_ntptime.c b/cpukit/score/src/kern_ntptime.c index c1b4013e9b..8a16702736 100644 --- a/cpukit/score/src/kern_ntptime.c +++ b/cpukit/score/src/kern_ntptime.c @@ -538,16 +538,6 @@ kern_ntp_adjtime(struct thread *td, struct timex *ntv, int *retvalp) ntv->jitcnt = pps_jitcnt; ntv->stbcnt = pps_stbcnt; #endif /* PPS_SYNC */ -#ifdef __rtems__ - ntv->ppsfreq = 0; - ntv->jitter = 0; - ntv->shift = 0; - ntv->stabil = 0; - ntv->jitcnt = 0; - ntv->calcnt = 0; - ntv->errcnt = 0; - ntv->stbcnt = 0; -#endif /* __rtems__ */ retval = ntp_is_time_error(time_status) ? TIME_ERROR : time_state; NTP_UNLOCK(); -- 2.25.1 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH v3 11/11] testsuites/sptests: Add sppps01 test
--- spec/build/testsuites/sptests/grp.yml | 2 + spec/build/testsuites/sptests/sppps01.yml | 19 +++ testsuites/sptests/sppps01/init.c | 173 ++ 3 files changed, 194 insertions(+) create mode 100644 spec/build/testsuites/sptests/sppps01.yml create mode 100644 testsuites/sptests/sppps01/init.c diff --git a/spec/build/testsuites/sptests/grp.yml b/spec/build/testsuites/sptests/grp.yml index a69a4d20f7..3264ba5450 100644 --- a/spec/build/testsuites/sptests/grp.yml +++ b/spec/build/testsuites/sptests/grp.yml @@ -349,6 +349,8 @@ links: uid: sppercpudata01 - role: build-dependency uid: spporterr01 +- role: build-dependency + uid: sppps01 - role: build-dependency uid: spprintk - role: build-dependency diff --git a/spec/build/testsuites/sptests/sppps01.yml b/spec/build/testsuites/sptests/sppps01.yml new file mode 100644 index 00..55770eceb9 --- /dev/null +++ b/spec/build/testsuites/sptests/sppps01.yml @@ -0,0 +1,19 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +build-type: test-program +cflags: [] +copyrights: +- Copyright (C) 2022 German Aerospace Center (DLR) +cppflags: [] +cxxflags: [] +enabled-by: true +features: c cprogram +includes: [] +ldflags: [] +links: [] +source: +- testsuites/sptests/sppps01/init.c +stlib: [] +target: testsuites/sptests/sppps01.exe +type: build +use-after: [] +use-before: [] diff --git a/testsuites/sptests/sppps01/init.c b/testsuites/sptests/sppps01/init.c new file mode 100644 index 00..a4159bf6a9 --- /dev/null +++ b/testsuites/sptests/sppps01/init.c @@ -0,0 +1,173 @@ +/* + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (C) 2022 German Aerospace Center (DLR) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include +#define _KERNEL +#include + +const char rtems_test_name[] = "SPPPS 1"; + +#define PPS_EVENT RTEMS_EVENT_0 +#define TASK_WAITING RTEMS_EVENT_1 +#define PPS_EVENT_RECEIVED RTEMS_EVENT_2 + +struct test_pps_device { + struct pps_state pps; + rtems_id task_waiting; +}; + +typedef struct { + rtems_id main_task; + struct test_pps_device *pps_dev; +} test_context; + +static void wakeup(struct pps_state *pps) +{ + struct test_pps_device *pps_dev; + + pps_dev = RTEMS_CONTAINER_OF( pps, struct test_pps_device, pps ); + if (pps_dev->task_waiting != RTEMS_INVALID_ID) +rtems_event_send( pps_dev->task_waiting, PPS_EVENT ); +} + +static int wait(struct pps_state *pps, struct timespec timeout) +{ + rtems_status_code sc; + rtems_event_set out; + uint32_t timeoutticks; + struct test_pps_device *pps_dev; + + pps_dev = RTEMS_CONTAINER_OF( pps, struct test_pps_device, pps ); + pps_dev->task_waiting = rtems_task_self(); + + timeoutticks = rtems_timespec_to_ticks(&timeout); + sc = rtems_event_receive( PPS_EVENT, RTEMS_DEFAULT_OPTIONS, timeoutticks, &out ); + return rtems_status_code_to_errno(sc); +} + +static void pps_task(rtems_task_argument arg) +{ + int status; + rtems_status_code sc; + struct pps_fetch_args fetch; + test_context *ctx; + + ctx = (test_context *) arg; + + fetch.tsformat = PPS_TSFMT_TSPEC; + fetch.timeout.tv_sec = 1; + fetch.timeout.tv_nsec = 0; + + sc = rtems_event_send( ctx->main_task, TASK_WAITING ); + T_rsc_success( sc ); + status = pps_ioctl( PPS_IOC_FETCH, (caddr_t)&fetch, &ctx->pps_dev->pps ); + T_eq_int( status, 0 ); + sc = rtems_event_send( ctx->main_task, PPS_EVENT_RECEIVED ); + T_rsc_success( sc ); + + rtems_task_delete(rtems_task_self()); +} + +T_TEST_CASE( PPS ) +{ + int status; + rtems_status_code sc; + struct test_pps_device pps_dev; + struct pps_kcbind_args kcbind; + test_context ctx; +
Re: GCC version for RTEMS 6?
On 4/5/2022 8:57 pm, Sebastian Huber wrote: > On 04/05/2022 09:11, Chris Johns wrote: >>> I updated the RTEMS 7 tools to use the GCC 12 release branch with a gcov >>> back >>> port. You can test GCC 12 with a local patch for RTEMS 6: >>> >>> diff --git a/rtems/config/6/rtems-default.bset >>> b/rtems/config/6/rtems-default.bset >>> index 731c9d8..381f916 100644 >>> --- a/rtems/config/6/rtems-default.bset >>> +++ b/rtems/config/6/rtems-default.bset >>> @@ -15,5 +15,5 @@ devel/gmp-6.2.1 >>> tools/rtems-gdb-11.2 >>> >>> tools/rtems-binutils-2.38 >>> -tools/rtems-gcc-10-newlib-head >>> +tools/rtems-gcc-head-newlib-head >>> tools/rtems-tools-6 >> Ah ok and thanks. I will take a look and report back. It will take a couple >> of >> days for me to work through this. > > Ok, thanks. > >> >> It would be nice to be able to handle this without changing anything. > > I can commit this change if it helps. This assumes it is ok and I prefer we get posted test results before such a change. Until we have this we need to wait until we all each do a level of testing we are happy with. A solution that lets us test would steam line this. I think this is a use case where something added to the RSB may be required to make this easier. For example logic in a bset file would be nice. Chris ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: GCC version for RTEMS 6?
On 5/5/2022 9:32 am, Chris Johns wrote: > I think this is a use case where something added to the RSB may be required to > make this easier. For example logic in a bset file would be nice. https://devel.rtems.org/ticket/4646 Chris ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH] sb/setbuilder: Control buildsets using the --with-* command line option
From: Chris Johns - Expand macros in buildset file names - Add support to buildsets for `%defineifnot` - Update 6 and 7 to support command line build overrides Closes #4646 --- rtems/config/6/rtems-default.bset | 23 +- rtems/config/7/rtems-default.bset | 26 - rtems/config/tools/rtems-default-tools.bset | 15 source-builder/sb/setbuilder.py | 22 +++-- 4 files changed, 57 insertions(+), 29 deletions(-) create mode 100644 rtems/config/tools/rtems-default-tools.bset diff --git a/rtems/config/6/rtems-default.bset b/rtems/config/6/rtems-default.bset index 731c9d8..cee9091 100644 --- a/rtems/config/6/rtems-default.bset +++ b/rtems/config/6/rtems-default.bset @@ -4,16 +4,17 @@ %include 6/rtems-base.bset # -# Build gdb first to raise the Python install error as early as possible. -# GDB needs expat so it needs to be built before. +# Default RTEMS build. Override on the command line to the +# the RSB. For example to test the latest version of gcc use: # +# --with-rtems-gcc=tools/rtems-gcc-head-newlib-head +# +%defineifnot with_rtems_dtc devel/dtc-1.6.1-1 +%defineifnot with_rtems_expatdevel/expat-2.4.8-1 +%defineifnot with_rtems_gmp devel/gmp-6.2.1 +%defineifnot with_rtems_gdb tools/rtems-gdb-11.2 +%defineifnot with_rtems_binutils tools/rtems-binutils-2.38 +%defineifnot with_rtems_gcc tools/rtems-gcc-10-newlib-head +%defineifnot with_rtems_toolstools/rtems-tools-6 -devel/dtc-1.6.1-1 - -devel/expat-2.4.8-1 -devel/gmp-6.2.1 -tools/rtems-gdb-11.2 - -tools/rtems-binutils-2.38 -tools/rtems-gcc-10-newlib-head -tools/rtems-tools-6 +tools/rtems-default-tools.bset diff --git a/rtems/config/7/rtems-default.bset b/rtems/config/7/rtems-default.bset index e94cf21..0a8fcac 100644 --- a/rtems/config/7/rtems-default.bset +++ b/rtems/config/7/rtems-default.bset @@ -1,16 +1,20 @@ +# +# Default tools configuration. +# %include 7/rtems-base.bset # -# Build gdb first to raise the Python install error as early as possible. -# GDB needs expat so it needs to be built before. +# Default RTEMS build. Override on the command line to the +# the RSB. For example to test the latest version of gcc use: # +# --with-rtems-gcc=tools/rtems-gcc-head-newlib-head +# +%defineifnot with_rtems_dtc devel/dtc-1.6.1-1 +%defineifnot with_rtems_expatdevel/expat-2.4.8-1 +%defineifnot with_rtems_gmp devel/gmp-6.2.1 +%defineifnot with_rtems_gdb tools/rtems-gdb-head +%defineifnot with_rtems_binutils tools/rtems-binutils-head +%defineifnot with_rtems_gcc tools/rtems-gcc-head-newlib-head +%defineifnot with_rtems_toolstools/rtems-tools-6 -devel/dtc-1.6.1-1 - -devel/expat-2.4.8-1 -devel/gmp-6.2.1 -tools/rtems-gdb-head - -tools/rtems-binutils-head -tools/rtems-gcc-head-newlib-head -tools/rtems-tools-6 +tools/rtems-default-tools.bset diff --git a/rtems/config/tools/rtems-default-tools.bset b/rtems/config/tools/rtems-default-tools.bset new file mode 100644 index 000..7d273cf --- /dev/null +++ b/rtems/config/tools/rtems-default-tools.bset @@ -0,0 +1,15 @@ +# +# Default tools build +# + +# +# Build gdb first to raise the Python install error as early as +# possible. GDB needs expat so it needs to be built before gdb. +# +%{with_rtems_dtc} +%{with_rtems_expat} +%{with_rtems_gmp} +%{with_rtems_gdb} +%{with_rtems_binutils} +%{with_rtems_gcc} +%{with_rtems_tools} diff --git a/source-builder/sb/setbuilder.py b/source-builder/sb/setbuilder.py index 63392fe..4d6ca81 100644 --- a/source-builder/sb/setbuilder.py +++ b/source-builder/sb/setbuilder.py @@ -284,6 +284,7 @@ class buildset: line = line[1:b] return line.strip() +bset = macro_expand(self.macros, bset) bsetname = bset if not path.exists(bsetname): @@ -315,15 +316,22 @@ class buildset: if ls[0][-1] == ':' and ls[0][:-1] == 'package': self.bset_pkg = ls[1].strip() self.macros['package'] = self.bset_pkg -elif ls[0][0] == '%': +elif ls[0][0] == '%' and (len(ls[0]) > 1 and ls[0][1] != '{'): def err(msg): raise error.general('%s:%d: %s' % (self.bset, lc, msg)) -if ls[0] == '%define': +if ls[0] == '%define' or ls[0] == '%defineifnot' : +name = ls[1].strip() +value = None if len(ls) > 2: -self.macros.define(ls[1].strip(), - ' '.join([f.strip() for f in ls[2:]])) -else: -self.macros.define(ls[1].strip()) +value = ' '.join([f.strip() for f in ls[2:]]) +if ls[0] == '%defineifnot': +if self.macros.defined(name): +name =