RFC: Separate Header for Some Porting Methods

Joel Sherrill joel at rtems.org
Mon May 17 22:12:52 UTC 2021


Hi

In working on the Microblaze port, it occurred to me that the prototypes
for the context switch methods are always the same. The structures vary,
not the signatures. What do you all think of making a separate header that
can be included from various cpu.h files to avoid repeating them?

Similarly, swap u32 and u16 are often the duplicated generic ones. A single
header with those which ports can include if they use the generic
implementation would also reduce some bulk.

My rough calculation is that a shared header for CPU Context method
prototypes saves about 75 lines every time it is included which should
eliminate somewhere between 1300 and 1500 lines in the ports.

An alternative, slightly more aggressive,  approach be to prototype all the
port required methods in one file and then let every port include that. It
would eliminate even more. This would pick up _CPU_Initialize and a few
others like _CPU_Thread_Idle. Just by honoring some of the existing
conditionals.

Thoughts?

--joel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20210517/359af889/attachment.html>


More information about the devel mailing list