Commit Graph
38535 Commits
Author SHA1 Message Date
Sebastian Huber 26a73bcdec score: Flatten the red-black tree node
The red-black tree node held its links and its color in a nested
member.  The nesting came from the entry macro of the header which the
previous commit removed.  It served no purpose, and each access had to
name the nested member.

Move the links and the color into the node.  Change the prefix of the
fields from rbe_ of the entry to rbn_ of the node.  The Linux API
wrapper <linux/rbtree.h> renames the Linux fields with
"#define rb_left rbn_left" and "#define rb_right rbn_right".  Other
Linux compatibility layers such as the linuxkpi of FreeBSD define
rb_left and rb_right as object-like macros.  The prefix rbn_ is no
Linux name, so these macros leave the fields alone.

The tests sprbtree01 and ts-unit-no-clock-0 passed on the boards of
eight targets.

  Target                    Processor
  aarch64/zynqmp_apu        Cortex-A53
  LS1046A                   Cortex-A72
  arm/zynqmp_rpu_lock_step  Cortex-R5F
  arm/samrh71_flexram       Cortex-M7
  arm/xilinx_zynq_zc702     Cortex-A9
  riscv/mpfs_e51            E51
  riscv/mpfs_u54            U54
  sparc/gr740               LEON4

Update #5804.

Assisted-by: Claude:claude-opus-5-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-10-14 15:20:12 +11:00
Sebastian Huber 9485932096 score: Translate the red-black tree macros
The red-black tree of the score used <rtems/score/bsd-tree.h>, an import
of the FreeBSD <sys/tree.h> of 2020.  FreeBSD replaced this red-black
tree by a rank-balanced tree, so the header has no upstream any more.
The macros of the header generated the functions of the tree.  Most of
the header, such as the splay tree, served no code of RTEMS.

Translate each macro which the score uses into a static inline function
of <rtems/score/rbtree.h> or <rtems/score/rbtreeimpl.h>.  Each field of
a node gets a getter and a setter.  The body of each generated function
moves into the function which called it.  Each statement of a macro maps
to one statement of the translation.  Remove the header with its unused
parts and keep its copyright in each file which receives its code.  The
node keeps its layout and its field names, and the colors keep their
names.

The test sptree01 checked that the RTEMS_ prefixed macros of the header
did not clash with the macros of <sys/tree.h>.  It ran no check at
runtime.  Remove the test with the header.

The tests sprbtree01 and ts-unit-no-clock-0 passed on the boards of
eight targets.

  Target                    Processor
  aarch64/zynqmp_apu        Cortex-A53
  LS1046A                   Cortex-A72
  arm/zynqmp_rpu_lock_step  Cortex-R5F
  arm/samrh71_flexram       Cortex-M7
  arm/xilinx_zynq_zc702     Cortex-A9
  riscv/mpfs_e51            E51
  riscv/mpfs_u54            U54
  sparc/gr740               LEON4

Update #5804.

Assisted-by: Claude:claude-opus-5-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-10-14 15:20:12 +11:00
Sebastian Huber 8a2c53690c validation: Measure the red-black tree runtime
The thread queues and the watchdogs order their elements in red-black
trees.  No test measured the runtime of the tree operations.

Add a runtime measurement test for the insert, the extract, the
minimum, the successor and the replace.  The tree sizes cover the
special paths of one to three nodes and grow by a factor of about 2.6
up to 233 nodes.  One operation takes 30 ns to 250 ns on the boards,
and the counter of some boards has a step of 10 ns or more.  One sample
therefore covers the operation in each of 16 trees of the same shape.

Update #5804.

Assisted-by: Claude:claude-opus-5-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-10-14 15:20:12 +11:00
Joel Sherrill d3ad021269 xilinx-zynqmp/start/bspstart.c: Disable 64-bit PCIe addresses for ilp32
The recently added code to add memory mappings for PCIe uses addresses
that are 64-bits. These do not work on ilp32. Since ilp32 is scheduled
for removal after 7.1 is released, disable the code doing the mapping.
If someone wants PCIe, use ilp64.
2026-10-13 15:22:34 -05:00
Vijay Banerjee 6acc6402b7 powerpc/mvme3100: Use generic IRQ support
Replace the legacy irq with generic irq
2026-10-12 16:45:40 +11:00
Avi Weiss 34856b7c0a score: watchdogimpl.h minor doxygen + comment fixes
Correct reversed and incorrect comments + doxygen.
2026-10-10 11:43:59 +03:00
Avi Weiss f5c89ae0f6 score: replace magic number with nanoseconds-per-second constant
Replace the hardcoded 1000000000 in the watchdog sbintime
conversion with the existing WATCHDOG_NANOSECONDS_PER_SECOND

No functional change.
2026-10-10 11:30:01 +03:00
Samuel Price acb78c0c8c libfs/rfs: Reject max-held-bufs=0 instead of dereferencing NULL
This is where the fix came from.  GCC's -fanalyzer reports:

  rtems-rfs-buffer.c:274:24: warning: dereference of NULL 'buffer'
                             [CWE-476] [-Wanalyzer-null-dereference]

Mounting RFS with max-held-bufs=0 dereferences a NULL pointer on the first
buffer release.

rtems_rfs_buffer_handle_release evicts a held buffer when

  (fs->release_count + fs->release_modified_count) >= fs->max_held_buffers

taking it from fs->release when release_count is the larger and from
fs->release_modified otherwise, then doing buffer->user = (void*)0 at
rtems-rfs-buffer.c:274 with no NULL test.  rtems_chain_get_unprotected
returns NULL for an empty chain by design.

For max_held_buffers >= 1 the guard implies one of the counts is non-zero
and the branch selects the queue holding it, so the result is never NULL.
At zero the guard is 0 >= 0, true on the first release with both queues
still empty; 0 > 0 is false so the else branch runs; the count underflows
from zero; and the NULL reaches :274.

The value is a mount option and nothing range checked it: the parser used
strtoul straight into the local and rtems_rfs_fs_open assigned it
unchecked.  Zero held buffers is not a meaningful configuration, so reject
it where it is parsed.

It mounts with max-held-bufs=0 and requires EINVAL, and with
max-held-bufs=1, which must succeed: the guard is >=, so at one the first
release sees 0 >= 1 and evicts nothing, which puts the boundary exactly
where the arithmetic says it is.

Also removes a stray printf("options=%s") from the option parsing loop.
It is debug output left in the mount path, so every RFS mount printed a
line per option to the console.  It is in the function this commit already
changes, and it was polluting the test output above.

Signed-off-by: Samuel Price <thesamprice@gmail.com>
Assisted-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-10-08 18:08:38 -05:00
Shivam Deolankar df48df8b78 bsps/i386: Update and format comments and other files.
Formatting changes in README and comments for other files
for i386/pc386 after running mdformat.
2026-10-08 17:33:01 -05:00
Shivam Deolankar b758d1ad73 bsps/i386: Standardize APIC definitions across x86 BSPs
Move common APIC register definitions to a shared
bsps/include/bsp/apic.h header and keep architecture
specific definitions in respective BSP headers,
aviudubg cross BSP dependencies.

Standardize LAPIC register access in pc386 to use array
indexing and LAPIC_REGISTER_* definitions. Rename
architecture-specific symbols to BSP-neutral names and
standardize APIC base access.

Fixes #5516
2026-10-08 17:33:01 -05:00
Sebastian Huber 97cf8529cb rtems: Fix the counter conversion overflows
The 64-bit product of the counter ticks and the scaler overflowed.
rtems_counter_ticks_to_sbintime() returned a wrong value for more than
2 s.  rtems_counter_ticks_to_nanoseconds() returned a wrong value for
more than 4.29 s, where the product overflowed and the cast to 32 bits
truncated the result.  The test framework measures durations with
rtems_counter_ticks_to_sbintime().  On a 25 MHz counter, the
performance test suite reported 107 s for a run of 731 s.

Compute the 96-bit product from two 32-bit by 32-bit products.  The
result is the same as before for each value which did not overflow.
Return the nanoseconds with 64 bits.

The test spcpucounter01 checked the conversions at one second alone.
Check them at three seconds and at the maximum counter ticks.

Close #5806.

Assisted-by: Claude:claude-opus-5-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-10-08 17:23:52 -05:00
Sebastian Huber 1cfb8b0e11 bsps/aarch64: Fix the cache size functions
The cache size functions returned 16 times the size of each cache
level.  They added the offset of four to the line size field of
CCSIDR_EL1 twice.  Level zero wrote the reserved level field seven
into CSSELR_EL1, so the result depended on the core.  For a unified
level, the instruction cache size selected a cache which does not
exist.  The performance measurement framework sizes its chunk with
level zero.  It dirtied 64 MiB instead of 4 MiB per sample on the
LS1046A.

Add the offset once.  Map level zero to the level of coherency.  Select
the data, the instruction or the unified cache of a level by the cache
type in CLIDR_EL1.

The validation test called the cache size directives and checked no
value.  Check that level zero is at least as large as each level.
Where the architecture provides cache geometry registers, compare each
level with the size which the registers specify.

Close #5805.

Assisted-by: Claude:claude-opus-5-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-10-08 08:15:53 +02:00
Catalin Miron 6745aab2fa bsps: fix stm32f4 bsp usart
made it work with simple console driver
2026-10-07 08:19:33 -05:00
Shivam Deolankar b3a3b372fa aarch64/xilinx-zynqmp: Use FDT to define PCIe memory mappings
Move the PCIe initialization logic to a helper function and derive
the PCIe address ranges from the device tree when a PCIe node is
present. If the node is not available, fall back to the previous
static PCIe MMU mappings to preserve existing BSP behaviour.

This removes the ZYNQMP_MMU_PCIE_ENABLE option and avoids hardcoded
PCIe mappings while maintaining compatibility with existing users.

Fixes #5510
2026-10-06 23:13:50 +00:00
Joel Sherrill 0797ef2415 gen5200/grp.yml: Rename opticecub.yml to opticecube.yml
This file was named incorrectly based on the name of the BSP.
2026-10-06 23:08:07 +00:00
Matteo Concas 0524f1668a tests/fdt01: Compare struct members
Comparing memory areas could lead to failed `memcmp()` calls if the
padding contained non-zero data.
2026-10-01 11:29:47 +00:00
Yang Zhang 32595811b3 cpukit/libdl: Preserve bit 31 of a PREL31 place
R_ARM_PREL31 writes the relocated value to bits 30:0 of the place.
Bit 31 has a separate meaning and must retain its original value.

Replace the misleading sign_extend31() helper with prel31_field(). The new
helper masks the relocation result to 31 bits and combines it with bit 31
from the original place.

Closes #5225.
2026-10-01 02:54:15 +00:00
Sebastian Huber 45c48e13e7 validation: Test the extended interrupt line
No test checked the dispatch of the controller line of the extended
interrupt as a standard controller line.  On the GR765, no bus line of
the reset map goes to this controller line.

Map a free bus line to the controller line of the extended interrupt
where the BSP uses an interrupt map.  Raise it and check the dispatch
of its interrupt handler.

Assisted-by: Claude:claude-opus-5-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-30 09:53:11 -05:00
Sebastian Huber eb59229e10 validation: Test the IPI vector fatal errors
No test triggered the fatal errors of leon3_check_ipi_vector().  With
the interrupt map, the default configuration cannot trigger them.

Add the two test suites which the fatal error specifications generate.
Each defines LEON3_mp_irq.  With the interrupt map, it selects a bus
line which no driver uses and maps that bus line before the BSP reads
the interrupt map.  Without the interrupt map, it selects an invalid
vector or an extended controller line.

Assisted-by: Claude:claude-opus-5-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-30 09:53:11 -05:00
Sebastian Huber 6a40bdc24a validation: Test invalid interrupt map entries
No test checked that a bus line whose map entry is zero is associated
with no interrupt vector.

Add the test case which the specification of invalid interrupt map
entries generates.  Build it in the BSP validation test suite of the
GR740 and the GR765, which use the interrupt map.

Assisted-by: Claude:claude-opus-5-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-30 09:53:11 -05:00
Sebastian Huber b5e4339f26 validation: Test leon3_irqmap_set()
leon3_irqmap_set() is new, and no test checked it.

Add the test case which the specification of leon3_irqmap_set()
generates.  Build it beside the test cases of the other interrupt map
functions.

Assisted-by: Claude:claude-opus-5-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-30 09:53:11 -05:00
Sebastian Huber 61356df602 validation: Test leon3_ext_irq_init()
No test checked what leon3_ext_irq_init() writes to the interrupt
controller and to the interrupt map copy.

Add the test case which the specification of leon3_ext_irq_init()
generates.  Build it beside the test case of leon3_irqmap_get().

Assisted-by: Claude:claude-opus-5-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-30 09:53:11 -05:00
Sebastian Huber e20b4a612f validation: Test leon3_irqmap_get()
The validation test suite checked no LEON3 interrupt map function.

Add the test case which the specification of leon3_irqmap_get()
generates.  Build it in the BSP validation test suite of the GR712RC,
the GR740 and the GR765.

Assisted-by: Claude:claude-opus-5-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-30 09:53:11 -05:00
Sebastian Huber 5ceb38813e bsps/leon3: Add a map test bus line to <tm27.h>
A test of the interrupt map changes the map entry of a bus line.  The
GR740 has an unassigned bus line, and the GR765 has none.  The test
needs a bus line which no driver uses on each chip.

Define TM27_IRQMAP_BUS_LINE by the bus line count.  Use the unassigned
bus line 13 on the GR740.  Use the eFPGA bus line 19 on the GR765,
which the plug and play information does not report.

Assisted-by: Claude:claude-opus-5-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-30 09:53:11 -05:00
Sebastian Huber 1c871c4d9c bsps/leon3: Add leon3_irqmap_set()
The BSP read the interrupt map once during initialization.  An
application could not change the controller line of a bus line.  It
could not move a device off a controller line which the reset map
shares.

Add leon3_irqmap_set().  It writes the map register and the copy under
the interrupt support mutex and the interrupt controller lock.  It
refuses the change while a handler is installed on the current
controller line of the bus line.  That handler would no longer see the
interrupt.

Assisted-by: Claude:claude-opus-5-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-30 09:53:11 -05:00
Sebastian Huber a7a701b67c bsps/leon3: Send the IPI on bus line 0
The BSP sent the inter-processor interrupt on bus line 14 and followed
the interrupt map.  The GR765 reset map maps bus line 14 to controller
line 1, which the DMA controllers use.  The GR765 keeps the controller
lines 13 and 14 free after reset.  No peripheral drives bus line 0.

Add the option LEON3_IPI_BUS_LINE for the initial value of
LEON3_mp_irq.  It is 0 for the GR740 and the GR765, and 14 otherwise.
With a map, map bus line 0 in the copy to the controller line defined
by the new option LEON3_IPI_CONTROLLER_LINE, which is 14 by default.
Accept vector 0 where its map entry is not zero.  Let the shared memory
driver force the controller line of LEON3_mp_irq.

Assisted-by: Claude:claude-opus-5-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-30 09:53:11 -05:00
Sebastian Huber 795abe60c4 bsps/leon3: Map an enabled vector once
bsp_interrupt_vector_enable() and bsp_interrupt_set_affinity() mapped
the bus line to its controller line.  They passed the result to
leon3_interrupt_vector_enable(), which mapped it a second time.  The
GR765 reset map maps bus line 14 to controller line 1.  A bus line
remapped to controller line 14 therefore unmasked controller line 1.

Map the vector once, in the callers of leon3_interrupt_vector_enable().

Assisted-by: Claude:claude-opus-5-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-30 09:53:11 -05:00
Sebastian Huber 50b6b73dda bsps/leon3: Document the interrupt controller init
The documentation of leon3_ext_irq_init() stated only that the function
initializes the interrupt controller.  It did not state what a caller
can rely on.

Document the state which the function establishes for the boot
processor and for the interrupt map copy.  State that the parameter
references the first interrupt controller.

Assisted-by: Claude:claude-opus-5-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-30 09:53:11 -05:00
Sebastian Huber 653c701745 bsps/leon3: Read the map of the given controller
leon3_ext_irq_init() took the register block of the interrupt
controller as a parameter.  It read the interrupt map through
LEON3_IrqCtrl_Regs instead and every other register through the
parameter.

Read the interrupt map through the parameter.

Assisted-by: Claude:claude-opus-5-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-30 09:53:11 -05:00
Sebastian Huber b65353df6e bsps/leon3: Check that the IPI vector is valid
leon3_check_ipi_vector() took the status of
bsp_interrupt_get_attributes() as the validity of the IPI vector.  The
function returns RTEMS_SUCCESSFUL for every vector.  An IPI bus line
which the interrupt map connected to no controller line passed the
check.
Both failures of the check reported LEON3_FATAL_IPI_INITIALIZATION, so
the fatal code did not tell them apart.

Check the vector with bsp_interrupt_is_valid_vector() before the
attributes are read.  Replace the fatal code with
LEON3_FATAL_INVALID_IPI_VECTOR for an invalid vector and with
LEON3_FATAL_CANNOT_RAISE_IPI for a vector which cannot be raised on a
processor.

Assisted-by: Claude:claude-opus-5-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-30 09:53:11 -05:00
Sebastian Huber 7f15ce2f0a bsps/leon3: Map a valid vector without a check
bsp_interrupt_set_affinity() requires a valid vector.
rtems_interrupt_set_affinity() and rtems_interrupt_get_affinity()
check the vector before they call the BSP.  The leon3 affinity functions
checked the bus line a second time.  The RTEMS_UNSATISFIED return of
that check could not happen.

Use the unchecked map lookup in both functions.  Assert the valid
vector and the affinity pointer in both, as the other interrupt
functions of the file do.  State the valid vector as a requirement of
bsp_interrupt_get_affinity(), as bsp_interrupt_set_affinity() states
it.

Assisted-by: Claude:claude-opus-5-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-30 09:53:11 -05:00
Sebastian Huber c9206587ac bsps/leon3: Size the interrupt map per chip
The BSP assumed 64 bus lines for every chip with an interrupt map.  The
GR740 has 32 bus lines in eight map registers.  The BSP read the
undefined offsets 0x320 to 0x33C, and vector 32 passed as valid, so
ts-validation-intr failed on the GR740.  The GR765 has 64 bus lines.

A map field is eight bits wide.  A field value above 31 indexed past
the dispatch table of 32 entries and made the bit shifts undefined.

Replace the option LEON3_IRQAMP_IRQMAP by LEON3_IRQMAP_BUS_LINE_COUNT,
which is 32 for the GR740 and 64 for the GR765.  With an interrupt map,
an interrupt vector is a bus line.  The vector count is then the bus
line count, and the dispatch table keeps one entry for each controller
line.  Bound each map entry by the dispatch table, so that a hardware
fault cannot index past it.

The description of LEON3_IRQAMP_EXTENDED_INTERRUPT named an interrupt
line and did not say which kind.  Call it a controller line, the term
which the other options use.

The extended interrupt raise test took a vector for its controller
line.  It raised 1U << vector for vectors up to the count, which is
undefined from 32 on.  Its specification item did not exist.
Regenerate the test from the new item.  It raises the mapped controller
line of each vector which maps to an extended controller line.  It
checks that it exercised each extended controller line.

Close #5786.

Assisted-by: Claude:claude-opus-5-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-30 09:53:11 -05:00
Sebastian Huber 3840a7bc54 bsps/leon3: Offer leon3_irqmap_get() on every BSP
<bsp/irq.h> and <bsp/irqimpl.h> both declared LEON3_IrqCtrl_Mapping.
leon3_irqmap_get() was declared in <bsp/irqimpl.h> and defined only
where the BSP uses the interrupt map.  An application for a BSP without
the interrupt map could not call it.  The function wrote through its
pointer parameter without a check.  Its documentation did not follow
the style of the API directives and stated no constraints.

Make leon3_irqmap_get() part of the API of every BSP of the family.
Where the BSP uses no interrupt map, it reports the controller line of
the same number.  It returns RTEMS_INVALID_ADDRESS for a NULL pointer
first, as the API directives do.  For an invalid bus line, it stores
UINT32_MAX, so that a caller which ignores the status reads no
indeterminate value.  Document it in the style of the API directives,
with a parameter name which says that it holds a controller line.

Assisted-by: Claude:claude-opus-5-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-30 09:53:11 -05:00
Yang Zhang b943263291 bsps/arm/beagle: Fix GPIO output clear bug
AM335X_GPIO_CLEARDATAOUT and AM335X_GPIO_SETDATAOUT are write-1-to-clear
and write-1-to-set registers. Reading either register returns the current
GPIO_DATAOUT state.

Using mmio_set() performed a read-modify-write on these registers. For
CLEARDATAOUT, this wrote 1s for all currently active output pins, causing
all set pins in the bank to be unintentionally cleared whenever any single
pin was cleared.

Fix this by using mmio_write() instead of mmio_set() to write only the
target pin mask directly without reading back the current output state.

Fixes #5235.
2026-09-30 06:54:42 +00:00
Abdullah Wasiq c2e236c817 cpukit/rtems: Add directive and testsuite
Add testsuite along with directive.

Closes https://gitlab.rtems.org/rtems/rtos/rtems/-/work_items/5651
2026-09-29 17:37:22 -05:00
Sebastian Huber c0ccc65b4d psxtests/psx09: Use a scheduler which exists
The test asked for the scheduler of processor 1.  A uniprocessor
configuration owns processor 0 alone.
rtems_scheduler_ident_by_processor() therefore returned
RTEMS_INVALID_NAME and the test ended with a failed assertion.

Ask for the scheduler of the last processor of the configuration.  The
directive under test refuses a scheduler change of a sporadic server
thread whatever the scheduler is.

Closes #5788.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-29 14:53:55 +02:00
Sebastian Huber 0e1a26fc0a score: Inhibit a scheduler change without SMP
The POSIX sporadic server takes the real priority node of a thread out
of the priority aggregation while the thread runs at the low priority.
_Scheduler_Set() extracts that node without a check.  It skips the
extract where a scheduler change inhibitor is present, and only an SMP
build had one.  A uniprocessor build with the POSIX API therefore
extracted a node which sits in no tree.  A debug build ended psx09 with
a failed assertion in _RBTree_Extract() and a release build broke the
priority aggregation of the thread.

The sporadic server is a property of the POSIX API alone.  Enable the
scheduler change inhibitors wherever the POSIX API is enabled.
rtems_task_set_scheduler() then returns RTEMS_RESOURCE_IN_USE for a
sporadic server thread at both priorities, as it does in an SMP build.

Closes #5745.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-29 14:53:50 +02:00
Sharvin Neve 338bab40ec score: Fix TOD_LATEST_YEAR and watchdog overflow beyond 2400
rtems_clock_set() accepted years up to TOD_LATEST_YEAR defined as 4095.
However, realtime watchdogs represent timestamps using 34 bits for
seconds since the UNIX Epoch (WATCHDOG_MAX_SECONDS), which wraps around
year 2514. Setting CLOCK_REALTIME beyond year 2514 breaks every subsequent
tick: in debug builds _Watchdog_Ticks_from_timespec() asserts that the
timestamp is not far future, while in release builds the realtime watchdog
collection is tickled with wrapped values.

As discussed in the Year 4000 (Y4K) problem topic on the RTEMS forum,
extending the calendar to year 4095 is prevented by this 34-bit watchdog
seconds limit.

Furthermore, _TOD_Validate() checked year bounds while
_TOD_Is_valid_new_time_of_day() checked seconds against
TOD_SECONDS_1970_THROUGH_2400, leaving a boundary mismatch between
rtems_clock_set() and POSIX clock_settime().

Bound TOD_LATEST_YEAR to 2400 and align TOD_SECONDS_1970_THROUGH_2400
as an exclusive upper limit in _TOD_Is_valid_new_time_of_day(). Both
rtems_clock_set() and clock_settime() now consistently accept times up
to 2400-12-31T23:59:59.999999999Z and reject later values, leaving over
113 years of system uptime headroom before watchdog overflow. Synchronize
documentation and update psxclock, spclock_err02, and clock validation
test suites accordingly.

Closes #5749.
2026-09-29 03:34:07 +00:00
Samuel Price 75adf35e31 termios: Sort B28800 into the baud table's ascending order
rtems_termios_baud_table listed B28800 after B38400, but
rtems_termios_set_best_baud() scans forward to the first entry at or
above the request and so assumes ascending order.  The two rates around
the out-of-place row came back wrong: 28800 returned B19200, and 40000
returned B28800.

Move the row between B19200 and B38400.  Nothing else depends on the
order: rtems_termios_baud_to_index() is a self-contained switch and the
num/baud conversions search by value.  test_set_best_baud() had skipped
every extension rate, which is the region where the table was out of
order, so add 28800, 38400 and 40000.

Signed-off-by: Samuel Price <thesamprice@gmail.com>
Assisted-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-09-28 13:48:42 +00:00
Matteo Concas 0e7b526837 bsps/sparc: Add GR765 BSP 2026-09-28 09:48:59 +02:00
Aaron Nyholm 51dd2cc3ad dev/io/iodev.c: Fix lock held while waiting on event
iodev lock is now released when waiting on an event. This
allows other IOCTL calls to be made while a thread is waiting
on an event.
2026-09-28 02:02:56 +00:00
Matteo Concas e9d427c097 bsps/griscv: Use proper IRQ(A)MP member names
Closes #5784
2026-09-25 09:30:49 +02:00
shuhua hua 124690270d shell: flashdev: close fds on allocation failure 2026-09-25 02:05:33 +00:00
Matteo Concas 05bab5136d grlib/ambapp: Use correct member offset
On 64-bit platforms, `struct ambapp_dev` is 36 bytes which get padded to 40
bytes.
In that scenario, substracting the size of the struct to get the address of the
parent struct yields incorrect results.

We instead use `RTEMS_CONTAINER_OF()` which will always give the correct parent
no matter the padding.
2026-09-24 05:37:03 +00:00
Matteo Concas 212057c72e drvmgr: Fix driver manager linking issues
This would lead to a `LEON3_FATAL_CLOCK_INITIALIZATION` as no PnP scan was run
and no timer was found in the process.
2026-09-22 17:56:34 +02:00
Matteo Concas a93897b428 drvmgr: Add DRVMGR prefix to list macros
This could cause conflicts when used with other libraries
2026-09-22 11:47:24 +02:00
Sebastian Huber 62598e8db1 bsps/mips: Build the libdl tests of three BSPs
The hurricane, rbtx4925 and rbtx4938 BSPs excluded dl01 to dl13.  The
exclusion dates from 2015 and answers a link failure of dl01.  The
build of that era passed the compiler flags to rtems-syms as a string
and let the tool call the compiler.  The string lost -EL, so the tool
built a big endian object for a little endian target and the link
rejected it.

The waf build runs rtems-syms with -S, which writes a C source file,
and compiles that file itself with the flags of the BSP.  The flag
cannot get lost.

Drop the exclusion of the three BSPs.  Twelve tests return, because
dl13 belongs to arm.  The other users of the item keep it.

No simulator runs these three BSPs, so the link is the only evidence
available.  The link is what the report named.

Update #2279.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-21 20:02:55 -05:00
Sebastian Huber ced6d1fa36 testsuites/validation: Check the MIPS registers
Nothing checked that the context switch, interrupt processing and the
exception resume of the MIPS port keep the register sets which the ABI
requires.  Three defects of the port reached the test suite unseen.
The interrupt return dropped the status register.  The exception path
saved a floating point data register in place of the control register.
The exception resume left the call-saved registers as the fatal error
chain left them.

Add three test cases from the specification items
spec/score/cpu/mips/val/context, spec/score/cpu/mips/val/interrupt and
spec/score/cpu/mips/val/resume.  Each case loads a distinct pattern
into every register of its set, runs the operation and takes a trap.
The frame of that trap reports what the operation left behind.  So no
register under test carries the address of the store-out.

The cases join ts-validation-no-clock-0.  That suite needs no clock
driver, and the interrupt case raises the software interrupt of the
processor through the TM27 support.

Update #5754.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-21 20:02:55 -05:00
Sebastian Huber ea80e1d7ba cpukit/score/cpu/mips: Save fcr31 through cfc1
The exception path of _ISR_Handler() read the control and status
register of coprocessor 1 with mfc1 and wrote it back with mtc1.
Those instructions address a floating point data register.  cfc1 and
ctc1 address a control register.

So the save put the bits of $f31 into the frame at R_FCSR, over the
value which the prologue stored there.  The restore put the slot into
$f31 and destroyed that register.  The same pair used C1_REVISION,
which is $f0 and which holds the identity of the unit rather than
state of a context.

Drop both accesses.  The prologue stores the register through the
two-read idiom of the port and the exit restores it with ctc1, so the
exception path needs neither.  Nothing fills R_FEIR, because no MIPS32
processor carries that register.

Update #5769.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-21 20:02:55 -05:00
Sebastian Huber a29441c5f6 cpukit/score/cpu/mips: Add the exception resume
The port had no _CPU_Exception_resume().  A fatal error extension
which inspects an exception frame could not continue the interrupted
context.  Every exception therefore ended the system.

The chain which reaches such an extension ends in a fatal error.  No
function of that chain returns, so no function of it puts a call-saved
register back.  _Terminate() also clears the interrupt enable before
it calls the extensions.  The frame is the only source of s0 to s7 and
of the interrupt level.

Add the routine.  It restores the registers which the interrupted
context owns and continues at the exception program counter of the
frame.  The header comment of the file names the registers which it
leaves out and the reason for each.

Update #5754.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-21 20:02:55 -05:00