Commit Graph
38330 Commits
Author SHA1 Message Date
Sebastian Huber 2b050c1951 bsps/microblaze: Fix the benchmark timer
The timer is loaded with a value derived from the clock frequency and
the tick interval, but the read used the literal reload value of one
BSP variant and the frequency of the build time option.  On a variant
with another frequency every read returned the same wrong value and
tmck never finished.

Record the reload value and the frequency used by the initialization.

Update #5699.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-21 09:01:19 +10:00
Sebastian Huber 6532ddc955 bsps/microblaze: Do not translate the newline
rtems_putc() emits the carriage return before the newline, so the
console driver must not do it again.  Every line left the UART as
CR CR LF.  The test runner strips one CR and the parser of the test
output anchors five expressions at the end of the line, which the
remaining CR prevented from matching.  The parser stopped at the sixth
line of the report, so no test case of a report based test was ever
recorded and 42 tests were judged incomplete.

Update #5699.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-21 09:01:19 +10:00
Sebastian Huber 43d18c66fe bsps/shared/acpi: Allow use before the subsystem
AcpiInitializeTables() runs from bsp_start(), long before there is a
heap for AcpiInitializeSubsystem() to create the mutex objects from.
The handle of a predefined mutex is a null pointer until then, so every
table which the table manager installs early reported that it could not
acquire the table mutex and then that it could not release it.

Treat a null handle as done rather than as a bad parameter.  There is a
single thread of execution at that point and nothing to serialize.

The errors were not visible so far because the ACPICA output goes to the
standard output, whose buffer is discarded at the end of a test run.
Routing it to printk() makes them appear, 19001 lines in one suite run.

Close #5705.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-21 09:00:39 +10:00
Sebastian Huber e19acd2a68 cpukit/libdl: Fix the RISC-V relocations
The RISC-V backend had four defects, each of which alone prevented a
module from loading.

R_RISCV_RELAX, the four thread local storage types and the two
ULEB128 types had no case and failed the load.  The addend of the
relocation was never applied.  Relocations against a section symbol
were skipped, which left the C++ unwind tables unrelocated.

R_RISCV_PCREL_LO12_I and R_RISCV_PCREL_LO12_S used the symbol of
their own record.  The psABI defines this symbol as a label on the
AUIPC instruction and the value as the low twelve bits of the value
computed by the paired R_RISCV_PCREL_HI20.  Take the value from the
paired relocation and defer it if that one is not yet applied.

Close #5707.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:59:08 -05:00
Sebastian Huber 70d9de174e cpukit/score/cpu/riscv: Add relocation types
Add R_RISCV_IRELATIVE, R_RISCV_PLT32, R_RISCV_SET_ULEB128 and
R_RISCV_SUB_ULEB128 of the RISC-V psABI.  The dynamic loader needs the
last two to process objects produced by recent tool chains.

Update #5707.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:59:08 -05:00
Sebastian Huber d0545d272c testsuites/validation: Take the interrupted stack
ScoreIsrValIsr checks that the context which an interrupt during the
multitasking start interrupted ran on the stack of the thread which was
running.  A wrapper of the interrupt dispatch of the architecture takes
the address of that stack, and there is one for six architectures only.
Everywhere else the address stays zero, the check cannot pass, and it
reports nothing but a line number, which says neither that the
architecture is unsupported nor what was expected.

Add the wrapper for mips, i386 and x86_64, and say in the check what a
zero address means, so that the next port is told why it fails rather
than left to find out.

The frame which the mips dispatch receives is built on the stack of the
interrupted context, so the address of the frame is an address within
that stack.  Its stack pointer member is not used.  Only the path which
the debugger stub takes fills it, and the interrupt path leaves it zero.

The two x86 ports keep the frame base of the interrupted context in the
frame pointer register and may then switch to the interrupt stack, so
the wrapper has to take the value before the compiler establishes a
frame of its own.  A register variable does not do that, because the
compiler emits its prologue first and the wrapper then reads its own
frame.  They get the same treatment as sparc, which has the problem for
the same reason.

Close #5712.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:56:47 -05:00
Sebastian Huber ccc830b004 cpukit/score/cpu/moxie: Validate the context
The two routines were empty, so the validation task of spcontext01 spun
in a loop which checked nothing.

The frame pointer stays out of the pattern, since the return
instruction of this architecture unwinds through it.

Close #5701.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:55:30 -05:00
Sebastian Huber e848c24981 bsps/moxie/moxiesim: Exclude the failing tests
The BSP has neither a clock driver nor interrupt support.  Its clock is
the idle thread, which calls rtems_clock_tick() in a loop, so time only
advances while the system is idle.  The CPU port leaves the interrupt
disable, enable and level routines empty.  Fifty three tests fail as a
result or for reasons of their own, thread local storage among them.

Exclude them with the reason recorded, so that the results of this BSP
show what the target can do rather than a list nobody reads.  The run
reports no regression afterwards.

Update #5701.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:55:30 -05:00
Sebastian Huber cf5c60a725 bsps/moxie/moxiesim: Exit the simulator on reset
The BSP used the reset loop, so the simulator never stopped.  Every
test ran to completion and then spun until the test runner killed it.
The output was lost, because the standard output of the simulator is
buffered and is flushed by the exit of its process.

The simulator stops if the application issues the exit system call.
Use it and pass a status which tells a successful run from a fatal
error.

Update #5701.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:55:30 -05:00
Sebastian Huber db08506d40 bsps/x86_64/amd64: Add a PVH boot entry
The BSP is booted by the FreeBSD loader, which hands over in long
mode.  Qemu cannot load such an image with -kernel.  It supports the
x86/HVM direct boot ABI instead, which selects its entry through a
note of the ELF file and enters in 32 bit protected mode.

Add the note and an entry which builds the identity mapping, switches
to long mode and enables the floating point unit, then joins the
existing start code.  Qemu does not provide the location of the ACPI
tables on this path, so search for them if the boot information has
none.

This makes every test executable bootable by a plain Qemu command
line.  A boot image would have to be built for each of the roughly
700 executables otherwise, which needs tools outside the tool chain
and costs seconds per test.

Close #5694.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:50:50 -05:00
Sebastian Huber 8008d814b0 bsps/i386/pc386: Be quiet at startup
The four fatal validation suites open their test report at
RTEMS_SYSINIT_BSP_EARLY, so the report spans the whole system
initialization and every line the BSP prints during it lands inside the
report and breaks its hash.

Seven messages did, and each of them announces a normal outcome: no
video mode was requested, the interrupt controller has an ELCR, the PCI
BIOS interface works, the legacy UART ports exist, the machine has no
PCI to PCI bridge, and the console is the one which the command line
asked for.  The messages for a failure stay.

The last one read the in service and the interrupt request register of
the 8259A and printed both when they disagreed about the line being
unmasked.  A line which requests service and is not yet in service is
the normal state of a device with work pending, so it fired on the
clock and the console at every boot.

bootverbose is what a FreeBSD driver consults when the user asks for a
verbose boot.  The copy here defined it as one.

Close #5698.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:47:07 -05:00
Sebastian Huber b8b572abb0 bsps/i386/pc386: Drop stale expected failures
The five tests pass on this BSP.

Update #5698.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:47:07 -05:00
Sebastian Huber 051b8400e5 bsps/i386/pc386: Print before the console driver
The BSP selects the port of printk() from the boot command line in
bsp_start().  Until then BSPPrintkPort is the VGA console, so a board
without a monitor loses everything printed before it, and a system
which terminates in an early system initialization item prints nothing
at all.  Nothing of the console driver helps there: it builds its port
tables with a memory allocation, and every function of the libchip
drivers indexes them, so a build with BSP_ENABLE_VGA disabled
dereferenced a null table pointer.

Resolve a minor number through the statically defined ports while the
tables do not exist yet and drive the port of the boot console directly
with a polled write in that window.  It keeps the settings of the
firmware, since programming it needs the same tables.

USE_COM1_AS_CONSOLE selects COM1 as the console and the printk port
from reset.  The README of the BSP documents that option and nothing
implemented it.

Update #5698.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:47:07 -05:00
Sebastian Huber ef6f279569 bsps/microblaze: Add petalogix_s3adsp1800 BSP
Upstream Qemu has a petalogix-s3adsp1800 machine.  Its UART, interrupt
controller and timer are the peripherals the microblaze_fpga family
drives, so the family needs only a new variant to run on it.  The
existing kcu105_qemu variant needs the microblaze-fdt-plnx machine of
the Xilinx fork.

The peripheral addresses are taken from the machine definition in
hw/microblaze/petalogix_s3adsp1800_mmu.c of Qemu.

Close #5700.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:45:25 -05:00
Sebastian Huber 91401c423f bsps/microblaze: Fix build without FDT
The two parameters of try_get_prop_from_device_tree() are unused if
BSP_MICROBLAZE_FPGA_USE_FDT is not defined.  Both existing BSP
variants define it, so this path was never compiled.

Update #5700.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:45:25 -05:00
Sebastian Huber c7cfd1db3a build: Mark dl06 expected-fail for all BSPs
The test fails because rtems-ld and the RAP format have no TLS
support.  That is a property of the linker and not of a BSP, so the
test fails wherever libdl is built.  Four BSPs stated it individually
through a link to tst-xfail-dl06 while every other BSP reported a
failure.

Move the state into the general test states and drop the item.

Close #5715.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:43:42 -05:00
Sebastian Huber 4ea45303f6 cpukit/score/cpu/x86_64: Validate the context
The two routines were empty, so the validation task of spcontext01 spun
in a loop which checked nothing.

The floating point context of this port is the control word of the x87
unit and the control and status register of the SSE unit.  Only their
rounding mode carries the pattern, so that no exception is unmasked and
the precision does not change.

Close #5692.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:42:07 -05:00
Sebastian Huber 148ee1ed77 bsps/x86_64/amd64: Implement the vector operations
rtems_interrupt_vector_is_enabled() and rtems_interrupt_clear() returned
RTEMS_UNSATISFIED for every vector, while enable and disable claimed
success without doing anything, and the attributes said nothing about
either.  ts-validation-intr reported 1664 failed steps.

The three vectors which are left are delivered by the Local APIC.  Only
the local vector table entry of the timer has a mask bit, so it is the
only one which can be enabled and disabled.  The interprocessor and
software vectors are delivered by a write to the interrupt command
register and nothing masks them, so they are always enabled and the
attributes say that they cannot be disabled.

ts-validation-intr now has no failed step.

Update #5692.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:42:07 -05:00
Sebastian Huber 7989b9773a bsps/x86_64/amd64: Deliver the CPU exceptions
The BSP installed the interrupt prologue of the interrupt manager on all
of the vectors, so a processor exception was dispatched as an interrupt
with no handler and ended as a spurious interrupt.  A divide by zero in
ts-unit-no-clock-0 terminated the run and spfatal26 got no exception at
all.  The prologue is also wrong for the ten vectors on which the
processor pushes an error code, since the frame it assumes has none.

Give the vectors below the first Local APIC vector their own prologues.
They build a CPU_Exception_frame, pushing a zero error code where the
processor pushes none, and terminate with RTEMS_FATAL_SOURCE_EXCEPTION
and the frame, which is what a fatal handler expects.

Those vectors are no longer vectors of the interrupt manager, so the BSP
gets its own bsp_interrupt_is_valid_vector().  This also removes the
places where the interrupt manager operations had to answer for a vector
which the processor raises.

Update #5692.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:42:07 -05:00
Sebastian Huber ce6e17faea cpukit/score/cpu/x86_64: Add the exception frame
The port carried the CPU_Exception_frame of the no_cpu port, a processor
state register with one integer and one floating point register, and an
empty _CPU_Exception_frame_print().  Nothing could report what a
processor exception was.

Describe the frame which the exception prologues of a BSP build: the
general purpose registers, the vector, the error code and the five
members the processor pushes.  Print it.

Update #5692.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:42:07 -05:00
Sebastian Huber 10824efa89 cpukit/score/cpu/x86_64: Use the ud2 instruction
_CPU_Instruction_illegal() emitted a ".word 0".  The two zero bytes are
the encoding of an add instruction on x86, so nothing was raised and the
caller ran on.  spfatal26 asserted right behind the call.

Use the undefined instruction, which is the architected way to raise the
invalid opcode exception.

Update #5692.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:42:07 -05:00
Sebastian Huber 4f1d616340 bsps/x86_64/amd64: Implement tm27 support
The BSP used the default of <rtems/tm27-default.h>, where
Cause_tm27_intr() does nothing.  Every test which calls CallWithinISR()
waited forever for an interrupt which was never raised, which stopped
five test suites.

Use the software interrupt of the BSP.  Lower_tm27_intr() only has to
enable the interrupts, because the dispatch acknowledges the interrupt
before the handler runs.

Update #5692.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:42:07 -05:00
Sebastian Huber d2974ebefc bsps/x86_64/amd64: Add a software interrupt
The BSP had no interrupt which software can raise, so
rtems_interrupt_raise() was unsatisfied for every vector and there was
no vector available for tm27.

Add BSP_VECTOR_SOFTWARE with its own interrupt descriptor and prologue
and implement the raise, raise on, and pending status of the interrupt
controller with the Local APIC.  A vector is raised by an interprocessor
interrupt to self, which is maskable and stays in the interrupt request
register until the interrupts are enabled.  The Local APIC clears the
request when the processor acknowledges it, so the interrupt cannot be
cleared by software.

Update #5692.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:42:07 -05:00
Sebastian Huber d3b7547610 bsps/x86_64: Correct the vector count
BSP_IRQ_VECTOR_NUMBER is the number of vectors for which the BSP
provides an interrupt descriptor and a prologue.  The vector count was
one higher, so the highest vector passed the validity check of the
interrupt manager while its descriptor was never installed.  Raising it
did nothing and installing a handler for it could never be reached.

Update #5692.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:42:07 -05:00
Sebastian Huber f1adacb1ed bsps/x86_64/amd64: Acknowledge in the dispatch
Each interrupt handler of this BSP acknowledged the interrupt at the
Local APIC itself.  A handler which does not do it leaves the in service
bit set, so the processor priority stays at the level of the vector and
no further interrupt of that priority is ever delivered.  A shared
vector would acknowledge twice.

Acknowledge once in amd64_dispatch_isr() instead, before the handlers
run.  All interrupt sources of this BSP are edge triggered, so an early
acknowledge does not raise the request again, and it lets a handler
which enables interrupts take a nested interrupt of the same vector.

The vectors below the first Local APIC vector are raised by the
processor itself and must not be acknowledged.

Update #5692.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:42:07 -05:00
Sebastian Huber 8e0a5b6939 testsuites/sptests/sp20: Flush the report
The test prints through a stream and ends with fsync(), which makes the
console driver write out what it holds but does not move the buffer of
the stream into the driver first.  Where the standard output is line
buffered nothing is pending and the test passes.  On x86_64/amd64 it is
fully buffered, because the first output happens before there is a file
descriptor to inspect, so the last 721 bytes of the report never left
the buffer.  The test ran to the end and was reported as a failure for
want of its end of test line.

Close #5710.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:40:16 -05:00
Sebastian Huber c347dd177e testsuites/validation: Bound the ISR wait
CallWithinISR() raises an interrupt with Cause_tm27_intr() and then
waits for the handler to run.  The wait was an unbounded busy loop.

Not every BSP can raise an interrupt in software.  moxie, or1k and
x86_64 use the default of <rtems/tm27-default.h>, where
Cause_tm27_intr() does nothing, and the microblaze definition is empty
as well.  The wait spins forever there, so the test case never ends and
takes every later case of the test suite with it.  The unit test suite
produced no result at all on six of the eleven simulators of the
programme for this reason.

Give up after ten million iterations and fail the test case.  The
interrupt arrives a few instructions after it was raised, so the bound
is far out of the way where the mechanism works.  Do the check only
when the bound is reached, because an assertion in the loop would
record ten million test steps.

The unit test suite reports eight test cases and one failure now
instead of hanging, and the failure names Cause_tm27_intr().

Update #5710.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:40:16 -05:00
Sebastian Huber 453e920f88 testsuites/unit: Record fewer rbtree checks
The random operations part of the red-black tree test verifies the tree
after every single operation and the number of operations is cubic in
the tree size, so the check runs 495132 times.  Each one was recorded as
a test step, which is 99.95 percent of the steps of the whole unit test
suite.

Use a quiet check.  It still counts a failure and still reports the line
it happened on, so nothing is lost.  The suite reports 3100 steps
instead of 495367.

This does not make the suite faster.  The time is in the verification
walk itself, which is intended, and the run time on arm, riscv and sparc
is unchanged.

Update #5710.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:40:16 -05:00
Sebastian Huber 4db6143bd2 testsuites/sptests: Bound the timecounter error
The job runs for a number of clock ticks, so the measured duration is
quantised to the tick period.  The test required the difference from the
nominal one second to stay below a millisecond, which can only hold
where the clock tick is shorter than that.  With the default tick of ten
milliseconds it passes by luck.

It failed on the mips simulator.  Allow one clock tick and a millisecond
for the granularity of the loop which observes the stop condition.

Update #5710.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:40:16 -05:00
Sebastian Huber 262b9756c7 testsuites/sptests/sp69: Widen the time window
The wall time since the last period was required to be at least the
nominal 600 milliseconds and at most ten milliseconds more.  The lower
bound had no slack at all, although the measured interval is the sum of
a sleep which is quantised to the clock tick and a busy period which
ends when enough processor time was consumed.  Neither lands exactly on
the nominal value.

On the arm simulator the measurement came out 47 microseconds short and
the test failed about one run in three.  The processor time of the same
status is already checked with ten percent in both directions.

Allow the same ten milliseconds below the nominal value which the upper
bound allows above it.

Update #5710.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:40:16 -05:00
Sebastian Huber 823215560a testsuites/psxtests/psxclock: Add a tolerance
The test computed the number of clock ticks a sleep should consume and
required the measured count to match exactly.  It cannot.  The tick
counter is sampled before the sleep is entered, so a tick which elapses
in between is not part of the measured interval, and how much of the
first tick is left when the sleep starts is not under the control of the
test either.

The measured count came out one too low on i386, mips, moxie and x86_64,
where the emulated system is slow enough to hit the window every time.

Accept one tick in each direction.  A sleep which returns far too early
or far too late still fails.  The test passes on all eleven simulators
of the programme now instead of seven.

Update #5710.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 17:40:16 -05:00
Sebastian Huber 998f33a14f score: Recognize the clang analyzer
Define RTEMS_STATIC_ANALYSIS for the clang analyzer. For example, this
helps to reduce false positives related to dead branches.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 15:04:51 +00:00
Sebastian Huber 155de47f14 libtests/stringto01: Test the value range check
The test never gave a value outside the range of the value type but
inside the range of the conversion method type.  The range check of
rtems_string_to_int() and rtems_string_to_unsigned_int() had no
coverage.  The lower bound of that check had no coverage in any test.

Add a case for each bound.  The macros hold a value only where the
conversion method type is wider.  On a target where the two types have
the same width the test is unchanged.  Rename TEST_TOO_LARGE_FOR_UCHAR
to TEST_TOO_LARGE_FOR_TYPE, because every narrow type uses it.

Update #5708.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 03:24:52 +02:00
Sebastian Huber 6dca13d962 cpukit/libmisc: Remove the dead range checks
The string to integer template checked the range of the value in
every instantiation.  Six of the seven integer instantiations use a
conversion method whose type is not wider than the type of the value.
For those the two comparisons were constant and the code behind them
was dead.  Coverity reported this as CID 1700407 to CID 1700418.

Emit the range check only where the type of the conversion method is
wider than the type of the value.  Every instantiation which sets
STRING_TO_RESULT_TYPE gives the maximum of that type in
STRING_TO_RESULT_MAX.  The template compares the two maxima.  An
undefined macro drops the check without a diagnostic, so a missing
STRING_TO_RESULT_MAX is an error.

Behaviour is unchanged.  Where the two types have the same width, the
conversion method sets ERANGE.  The template already turns ERANGE into
RTEMS_INVALID_NUMBER.

Update #5708.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 03:21:55 +02:00
Shaunak Datar 3a1f6f9f60 bsps/aarch64/raspberrypi: Add sd card support
- Add the mmc node to the dts
- Regenerate rpi4b_dtb.c from the updated dts
2026-08-19 18:22:10 +00:00
Sebastian Huber 6f53982853 build: Fix the psxfenv01 test state
The tree wide expected-fail state of psxfenv01 carries no reason and
dates back to the commit which added the waf build system.  The test
passes on eight of the eleven architectures which run a full test suite
here, where the test runner reports it as an unexpected pass.

Drop the tree wide state.  State it once for the three architectures
which really fail.  On microblaze, moxie and or1k fesetenv() returns
-134, which is -ENOTSUP, because the C library declares the floating
point environment macros without implementing them.

Link the state from the microblaze and or1k architecture groups and from
the moxie BSP, so that it covers every BSP of those architectures rather
than the variants which run here.

Close #5711.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-19 13:18:07 -05:00
Sebastian Huber d92289d3fa build: Relink executables if a linkcmds changes
Some BSPs provide linker scripts which are generated during
`./waf configure`, for example the memory layout of
`spec/build/bsps/arm/fvp/linkcmds.yml`. The executable link tasks did not
depend on these generated files, so a reconfiguration which changed a linker
script did not trigger a relink of the test programs, leaving stale
executables.

Add the configuration files collected in env.cfg_files (which include the
generated linker scripts) as dependencies to all executable link tasks:

- the standard cprogram/cxxprogram links via process_start_files(),
- the custom link() task used by link_cc()/link_cxx(), and
- the gnatmake() task.

A change to any configuration file now relinks the executables.

Assisted-by: Claude:claude-opus-4-8 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-19 12:24:36 -05:00
Sebastian Huber 0788428d48 Revert "build: Add explicit dependencies"
This reverts commit 37163afc97.
2026-08-19 12:24:36 -05:00
Sebastian Huber 4564fe42dc build: Use compiler-generated deps for cc()/cxx()
The bld.cc() and bld.cxx() helper rules compiled sources through a raw
"rule=" command string.  The gccdeps.py plugin only wraps the asm, c,
and cxx task classes, so these rule-based tasks never had their
compiler-generated .d dependency files evaluated.  Header changes such
as a modified `cpukit/include/rtems/score/cpuopts.h` (for example after
toggling the RTEMS_SMP option) did not trigger a recompilation of the
affected objects, resulting in stale objects and linker errors.

Add c_explicit_target and cxx_explicit_target features, analogous to the
existing asm_explicit_target feature, which create genuine c and cxx
tasks with an explicit target node.  These tasks are wrapped by
gccdeps.py and thus honour the automatically generated dependency files.
Extra dependencies are attached as task dep_nodes to preserve the
build ordering for generated headers.

This makes the explicit cpuopts.h dependency workaround unnecessary.

Update #5482.

Assisted-by: Claude:claude-opus-4-8 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-19 12:24:36 -05:00
Sebastian Huber 1c8a6b8f60 bsps/x86_64/amd64: Add a timecounter
The timecounter of the BSP returned the clock tick counter, so the
uptime advanced once per clock tick and no time point inside a tick
could be expressed.  Tests which need a time source below the tick
resolution cannot work with it, among them the interrupt test
framework, which places its action a quarter of a tick before the tick
it wants the interrupt in.  spintrcritical08 ran into its iteration
limit for this reason.

Use the time stamp counter.  It is free running, so it needs no
interrupt to carry a period and a reader never sees it go backwards.
The local APIC timer offers the same resolution, but its count restarts
with every clock tick and the acknowledge of the tick happens before
the handlers run, so a reader between the restart and the tick handler
cannot tell whether a period has to be added.  Calibrate it in the PIT
window which already calibrates the APIC timer.

Close #5693.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-19 11:48:54 -05:00
Sebastian Huber f0acecec2a bsps/aarch64/a53: Enable the MMU and the caches
The BSP used the MMU stub, so the MMU stayed off and all memory was
Device-nGnRnE.  Unaligned accesses and DC ZVA are not permitted for
this memory type.  The memset() of the C library uses both, so
bsp_start_clear_bss() raised an alignment fault whenever the size of
the .bss section was not a multiple of 16 bytes.  That is the case for
almost every executable, so no test could run.

The memcpy() of the C library has the same problem.  It is latent
because bsp_start_copy_sections() skips a copy if the load address
equals the run address, which holds for this BSP.

Set up the translation table and enable the MMU and the caches before
the .bss section is cleared, like the other AArch64 BSPs do.

Close #5704.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-19 11:45:04 -05:00
Sebastian Huber 3503095458 bsps/m68k: Keep the exception frames
These linker command files collect the exception frames without KEEP(),
so --gc-sections removes the terminating zero word which crtend.o
contributes.  crtbegin.o gives __register_frame_info() the start of the
table, and the unwinder walks the entries until it finds a zero length.
It never finds one, walks past the end and reads whatever follows, so
every throw ends in a fatal exception.

Built for the three affected BSPs.  Without the change __FRAME_END__ is
absent from cdtest of each of them.  None of them runs on a simulator
here, so the link verifies the change and not a test run.

Close #5703.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-19 11:43:52 -05:00
Sebastian Huber 3e99343378 cpukit/libdl: Fix the RAP self-deadlocks
rtems_rap_load() and rtems_rap_unload() take the RAP lock and then call
rtems_rap_find(), which takes it again.  The lock is an ordinary
rtems_mutex, so the second acquisition is a self-deadlock and the system
terminates with INTERNAL_ERROR_THREAD_QUEUE_DEADLOCK.  The error paths
of both functions call rtems_rap_set_error(), which took the lock a
second time as well.

Add rtems_rap_find_unprotected() for callers which already hold the lock
and let rtems_rap_find() wrap it.  Drop the locking from
rtems_rap_set_error(), because all five of its call sites hold the lock
already.

This affected every call to rtems_rap_unload() and every call to
rtems_rap_load() which does not find the application already loaded.
The test dl14 exercises the failing load path and terminated the system
instead of reporting ENOMEM.

Close #5706.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-19 11:41:35 -05:00
Sebastian Huber 0462fa6b60 cpukit/libmisc: Align the device tree blob
A flattened device tree blob must start at an address which is a
multiple of eight, otherwise libfdt rejects it with FDT_ERR_ALIGNMENT.
The blob was allocated by rtems_malloc(), which provides the heap
alignment of the target.  That is four bytes on MicroBlaze, so no blob
could be loaded there at all.

Close #5708.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-19 11:40:04 -05:00
Sebastian Huber a2103e0ece cpukit/libmisc: Fix the string to integer overflow
The conversion method returns a type which can be wider than the type
of the value.  The result was stored in the type of the value before
the range was checked, so the check saw a truncated value.  On a 64
bit target rtems_string_to_int() returned success for a value outside
the range of an int.

Keep the result in the type of the conversion method and check its
range before it is narrowed.  Report every range error of the method
and not only the one which saturates to the limit.

Update #5708.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-19 11:40:04 -05:00
Sebastian Huber 4c864bd4ef cpukit/libdl: Fix unaligned MIPS relocation
rtems_rtl_elf_relocate_rel() read the addend of every relocation with an
aligned load before it knew the type.  R_MIPS_32 is the only data
relocation of this file and may target any byte offset, while every
other one targets an instruction and is aligned by construction.  The
processor takes an address error exception for an unaligned load, so
loading an object with such a relocation failed.

The .eh_frame of a C++ object has two of them, the personality routine
of the common information entry and the language specific data area of
the frame description entry.  Both sit behind a string and neither is
aligned, so dl05 could never load its module.

Use memcpy() for the read and for the R_MIPS_32 write.

Close #5714.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-19 11:36:14 -05:00
Sebastian Huber c0414b6f37 testsuites/libtests/dl14: Add the FP attribute
The init task loads a RAP application, which formats an error message
with vsnprintf() when the load fails.  On SPARC that uses the floating
point unit, so the system terminated with
INTERNAL_ERROR_ILLEGAL_USE_OF_FLOATING_POINT_UNIT.

Every other test of the libdl test suite gives its init task the
RTEMS_FLOATING_POINT attribute.  Do the same here.

Close #5716.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-19 11:35:49 -05:00
Sebastian Huber aa4eaaceed testsuites/fstests: Fix the tftpfs read loop
The read loop is bounded by a byte budget of type size_t.  Every test
passes SIZE_MAX to say that there is no budget.  Commit bd2055cf5a
cast the budget to ssize_t to silence a sign compare warning, which
turned SIZE_MAX into -1, so the loop condition was false right away
and read() was never called.

Cast the loop variable instead.  It is positive by the first operand
of the condition, so the cast preserves its value.

Close #5713.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-19 15:03:24 +00:00
Sebastian Huber 330abdc6a8 testsuites/libtests/ttest01: Quote the report
The test runs the test framework on itself, so its output contains a
report of a test suite which fails on purpose: 344 test cases, 1339 test
steps and 795 of them failing.  Every tool which reads the output of a
test executable takes that report for the report of this test and the
deliberate failures for failures of this test.

Quote the output of the self test with a prefix so that it is no longer
a report.  The prefix is added after the report hash is taken and after
the expected output is checked, so neither changes.

The test then has no report of its own and the begin and end of test
messages state its result, which is what it always meant.

Close #5709.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-19 13:29:54 +00:00
Sebastian Huber 32310c14ac testsuites/libtests: Fix the ttest01 expectations
The test compares the report of the test framework byte by byte
against expectations which contain the file and line of every check.
Commit 4d1604efb6 reformatted the test sources and moved the checks
without updating the expectations, so the test stopped at the first
difference.

Correct the line numbers, the stringified expressions and the hash of
the report.  The test case, check and failure counts are unchanged.

Update #5709.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-19 13:29:54 +00:00