Commit Graph
4395 Commits
Author SHA1 Message Date
Joel Sherrill ae6718eca4 bfin/include/rtems/score/cpuimpl.h: Address unused parameter warning 2023-08-21 11:40:20 -05:00
Sebastian Huber ffec9f96fc arm: Fix cache support for ARM926EJ-S
The ARM926EJ-S is an ARMv5T architecture processor and lacks some
features of ARMv6 processors such as the ARM1176JZF-S.

Close #4940.
2023-08-10 08:34:34 +02:00
Sebastian Huber 6293fc4fd5 score: Assert scheduler index validity
Update #4844.
2023-07-28 17:13:14 +02:00
Sebastian Huber 3ba43da922 score: Move <rtems/score/gcov.h>
Move <rtems/score/gcov.h> to <rtems/test-gcov.h>.  These functions do
not belong to an super core service.
2023-07-28 11:58:32 +02:00
Sebastian Huber 527af2b7f2 score: Move formatted I/O functions
These functions do not belong to an super core service.
2023-07-28 11:58:32 +02:00
Sebastian Huber 233c21a232 score: Add files to Doxygen groups
Update #3707.
2023-07-26 07:18:29 +02:00
Sebastian Huber f8d4f16da6 score: Add workaround for GCC bug
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108658

This GCC bug leads to an incomplete code coverage status.

Update #4932.
2023-07-25 08:04:08 +02:00
Sebastian Huber c8cae1d82d score: Move _IO_Relax() to new <rtems/dev/io.h>
This function is not a super core service.
2023-07-24 17:51:48 +02:00
Karel Gardas 0e4e9dd421 score/arm: improve printed exception information for Cortex-Mx CPUs
Sponsored-By:	Precidata
2023-07-14 12:38:14 +02:00
Sebastian Huber 3e0314e8be bsps/sparc: Remove BSP_POWER_DOWN_AT_FATAL_HALT
Remove the BSP_POWER_DOWN_AT_FATAL_HALT BSP option.  Applications should
do the customization of the system termination with an initial fatal
extension.
2023-07-14 12:21:33 +02:00
Joel Sherrill 6264b14804 Revert accidentally committed "Remove unused _IO_Relax"
Sebastian has agreed to move this out of score. I should have
removed this patch from my tree but accidentally committed it
with another patch.
2023-07-03 10:32:53 -05:00
Joel Sherrill e49e8daf3d Remove unused _IO_Relax
The only use was in a test.
2023-07-03 10:11:58 -05:00
Sebastian Huber 0613593148 score: Remove CPU port specific cpuatomic.h
All CPU ports used the same <rtems/score/cpustdatomic.h> header file to
provide the atomic operations.  Remove the header file indirection.
2023-06-12 07:46:23 +02:00
Joel Sherrill 63415655e3 score/src/pheap*: Remove unreferenced methods
* _Protected_heap_Get_block_size
  * _Protected_heap_Iterate
  * _Protected_heap_Resize_block

Closes #4909.
2023-05-26 10:12:51 -05:00
Sebastian Huber bdb4bc436f arm: Use RTEMS_XCONCAT()
Prefer macros with a proper namespace.
2023-05-26 06:56:11 +02:00
Sebastian Huber 991919da3b arm: Improve Doxygen file comments 2023-05-26 06:56:11 +02:00
Sebastian Huber bcef89f236 Update company name
The embedded brains GmbH & Co. KG is the legal successor of embedded
brains GmbH.
2023-05-20 11:05:26 +02:00
Tian Ye e06152b82d bsps/aarch64: Fix 128bit q register print bug 2023-05-16 08:41:29 -05:00
Joel Sherrill 3f4454b686 _TOD_Adjust method is unused. Remove it.
Use of this method was likely eliminated during the rework to use
FreeBSD bintime/sbintime.

Close #4905.
2023-05-16 08:40:51 -05:00
Karel Gardas 1590df5f9a bsps/amd64: increase CPU alignment to 16
AMD64 requires SSE support which operates on 128bit data values.
2023-04-29 20:41:23 +02:00
Sebastian Huber 863b26ee3a score: Avoid cyclic header file dependencies
There was a cyclic dependency: For RTEMS_STATIC_ANALYSIS we needed
basedefs.h in assert.h. For RTEMS_UNREACHABLE() we needed _Assert() from
assert.h in basedefs.h.

Fix this by introducing _Debug_Unreachable() in basedefs.h.

Add RTEMS_FUNCTION_NAME to basedefs.h and use it in basedefs.h and
assert.h.

Close #4900.
2023-04-25 08:25:33 +02:00
Karel Gardas 139bc390b5 score/arm: enhance ARMV7M MPU setup with capability to set control register
Due to API change, the patch also fixes affected BSPs and uses
value provided by MPU CTRL spec option there.

Sponsored-By:	Precidata
2023-03-16 15:40:22 +01:00
Sebastian Huber d0dd98cca0 sparc: Add header files to Doxygen group 2023-03-15 16:01:06 +01:00
Sebastian Huber d5c386ff99 pps: Round to closest integer in pps_event()
The comment above bintime2timespec() says:

  When converting between timestamps on parallel timescales of differing
  resolutions it is historical and scientific practice to round down.

However, the delta_nsec value is a time difference and not a timestamp.  Also
the rounding errors accumulate in the frequency accumulator, see hardpps().
So, rounding to the closest integer is probably slightly better.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/604
2023-03-07 07:30:44 +01:00
Sebastian Huber d9f5345df6 pps: Simplify the nsec calculation in pps_event()
Let A be the current calculation of the frequency accumulator (pps_fcount)
update in pps_event()

  scale = (uint64_t)1 << 63;
  scale /= captc->tc_frequency;
  scale *= 2;
  bt.sec = 0;
  bt.frac = 0;
  bintime_addx(&bt, scale * tcount);
  bintime2timespec(&bt, &ts);
  hardpps(tsp, ts.tv_nsec + 1000000000 * ts.tv_sec);

and hardpps(..., delta_nsec):

  u_nsec = delta_nsec;
  if (u_nsec > (NANOSECOND >> 1))
          u_nsec -= NANOSECOND;
  else if (u_nsec < -(NANOSECOND >> 1))
          u_nsec += NANOSECOND;
  pps_fcount += u_nsec;

This change introduces a new calculation which is slightly simpler and more
straight forward.  Name it B.

Consider the following sample values with a tcount of 2000000100 and a
tc_frequency of 2000000000 (2GHz).

For A, the scale is 9223372036.  Then scale * tcount is 18446744994337203600
which is larger than UINT64_MAX (= 18446744073709551615).  The result is
920627651984 == 18446744994337203600 % UINT64_MAX.  Since all operands are
unsigned the result is well defined through modulo arithmetic.  The result of
bintime2timespec(&bt, &ts) is 49.  This is equal to the correct result
1000000049 % NANOSECOND.

In hardpps(), both conditional statements are not executed and pps_fcount is
incremented by 49.

For the new calculation B, we have 1000000000 * tcount is 2000000100000000000
which is less than UINT64_MAX. This yields after the division with tc_frequency
the correct result of 1000000050 for delta_nsec.

In hardpps(), the first conditional statement is executed and pps_fcount is
incremented by 50.

This shows that both methods yield roughly the same results.  However, method B
is easier to understand and requires fewer conditional statements.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/604
2023-03-07 07:30:44 +01:00
Sebastian Huber 3cda5ad953 pps: Directly assign the timestamps in pps_event()
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/604
2023-03-07 07:30:44 +01:00
Sebastian Huber 6730543457 pps: Move pcount assignment in pps_event()
Move the pseq increment.  This makes it possible to reuse registers earlier.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/604
2023-03-07 07:30:44 +01:00
Sebastian Huber 2a30bbf852 pps: Simplify capture and event processing
Use local variables for the captured timehand and timecounter in pps_event().
This fixes a potential issue in the nsec preparation for hardpps().  Here the
timecounter was accessed through the captured timehand after the generation was
checked.

Make a snapshot of the relevent timehand values early in pps_event().  Check
the timehand generation only once during the capture and event processing.  Use
atomic_thread_fence_acq() similar to the other readers.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/604
2023-03-07 07:30:44 +01:00
Sebastian Huber 069275f5fa pps: Load timecounter once in pps_capture()
This ensures that the timecounter and the tc_get_timecount handler belong
together.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/604
2023-03-07 07:30:44 +01:00
Mateusz Guzik bb06cdab42 ntptime: ansify
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-03-07 07:30:44 +01:00
Sebastian Huber aff6af106d Clarify hardpps() parameter name and comment
Since 32c203577a5e by phk in 1999 (Make even more of the PPSAPI
implementations generic), the "nsec" parameter of hardpps() is a time
difference and no longer a time point.  Change the name to "delta_nsec"
and adjust the comment.

Remove comment about a clock tick adjustment which is no longer in the code.

Pull Request: https://github.com/freebsd/freebsd-src/pull/640
Reviewed by: imp
2023-03-07 07:30:44 +01:00
Mitchell Horne 2bac3364d2 set_cputicker: use a bool
The third argument to this function indicates whether the supplied
ticker is fixed or variable, i.e. requiring calibration. Give this
argument a type and name that better conveys this purpose.

Reviewed by:	kib, markj
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D35459
2023-03-07 07:30:44 +01:00
firk 0c36cb6101 kern_tc.c/cputick2usec()
(which is used to calculate cputime from cpu ticks) has some imprecision and,
worse, huge timestep (about 20 minutes on 4GHz CPU) near 53.4 days of elapsed
time.

kern_time.c/cputick2timespec() (it is used for clock_gettime() for
querying process or thread consumed cpu time) Uses cputick2usec()
and then needlessly converting usec to nsec, obviously losing
precision even with fixed cputick2usec().

kern_time.c/kern_clock_getres() uses some weird (anyway wrong)
formula for getting cputick resolution.

PR:		262215
Reviewed by:	gnn
Differential Revision:	https://reviews.freebsd.org/D34558
2023-03-07 07:29:58 +01:00
Sebastian Huber 22d845d5b7 score: Replace goto with a break
The goto label was directly after the loop, so we can replace the goto
with a break.

Close #4847.
2023-02-10 16:14:11 +01:00
Sebastian Huber 453939753b score: Help static analysis in thread init
Add an assert to _Thread_Initialize_scheduler_and_wait_nodes() which may
help a static analyzer.  Use a do/while loop since we have at least one
scheduler.

Update #4832.
2023-01-28 17:58:20 +01:00
Sebastian Huber 48f693a97e score: Remove unused return value
Several SMP message processing functions returned a value.  This value
was always unused.

Close #4822.
2023-01-24 16:53:03 +01:00
Sebastian Huber 9ecb73f368 score: Clarify code block
Do not use a chained assignment for code clarity.

Close #4818.
2023-01-24 08:23:44 +01:00
Sebastian Huber 4f274b6925 powerpc: Increase MAS0 ESEL width
For example, the QorIQ T4240 has more than 16 TLB1 entries.
2023-01-23 09:56:52 +01:00
Sebastian Huber f8cb1f483d arm: Enable thread ID register for ARMv6
Close #4759.
2023-01-03 09:01:46 +01:00
Daniel Cederman 9384ac2d65 cpukit: Change license to BSD-2 for files with Gaisler copyright
This patch changes the license to BSD-2 for all source files where the
copyright is held by Aeroflex Gaisler, Cobham Gaisler, or Gaisler Research.
Some files also includes copyright right statements from OAR and/or
embedded Brains in addition to Gaisler.

Updates #3053.
2022-11-14 11:00:58 +01:00
Sebastian Huber 8f6dd3ca1f arm: Fix Armv7-M TLS support
Set the thread ID register in the CPU context.

Update #3835.
Close #4753.
2022-11-10 11:10:46 +01:00
Sebastian Huber 4a46161b3f riscv: Simplify _CPU_ISR_Set_level()
Where CPU_ENABLE_ROBUST_THREAD_DISPATCH == TRUE, the only supported interrupt
level allowed to set is 0 (interrupts enabled).  This constraint is enforced by
the API level functions which return an error status for other interrupt
levels.
2022-11-09 16:54:02 +01:00
Sebastian Huber 3a38a0173b riscv: Remove superfluous init/fini functions 2022-11-09 16:54:02 +01:00
Kinsey Moore 080dc5d873 cpukit/aarch64: Emulate FPSR for FENV traps
The AArch64 TRM specifies that when FPCR is set to trap floating point
exceptions, the FPSR exception bits are not set. This ensures that FPSR
is updated as FENV expects even if floating point exception traps are
enabled.
2022-11-09 08:14:11 -06:00
Sebastian Huber e9a69c5744 riscv: Move functions to avoid build issues
The _RISCV_Map_cpu_index_to_hardid() and _RISCV_Map_hardid_to_cpu_index()
functions must be available to all riscv BSPs.
2022-10-14 10:52:52 +02:00
Sebastian Huber a1f23c2879 powerpc: Conditionally provide Context_Control_fp
This avoids a pedantic warning about a zero size Context_Control_fp.
2022-10-14 10:48:23 +02:00
Sebastian Huber 985aaac0ab powerpc: Fix 'noreturn' function does return 2022-10-14 10:48:23 +02:00
Sebastian Huber 64fbeaa0d1 score: INTERNAL_ERROR_IDLE_THREAD_STACK_TOO_SMALL
Ensure that the IDLE storage allocator did allocate a suffiently large area.

Update #3835.
Update #4524.
2022-10-14 10:48:23 +02:00
Sebastian Huber 45ee958552 config: Add CONFIGURE_IDLE_TASK_STORAGE_SIZE
By default, allocate the IDLE task storage areas from the RTEMS Workspace.
This avoids having to estimate the thread-local storage size in the default
configuration.

Add the application configuration option CONFIGURE_IDLE_TASK_STORAGE_SIZE to
request a static allocation of the task storage area for IDLE tasks.

Update #3835.
Update #4524.
2022-10-14 10:48:23 +02:00
Sebastian Huber 1ab93ba480 score: INTERNAL_ERROR_IDLE_THREAD_CREATE_FAILED
Add the INTERNAL_ERROR_IDLE_THREAD_CREATE_FAILED fatal error in case the
creation of an idle thread fails.  This may happen due to a failing create
extension provided by the application.
2022-10-14 10:48:22 +02:00