RFC: Separate Header for Some Porting Methods

Sebastian Huber sebastian.huber at embedded-brains.de
Tue May 18 05:42:48 UTC 2021


On 18/05/2021 00:12, Joel Sherrill wrote:
> 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?

Maybe we should add a <rtems/score/cpucontext.h> which just defines the 
structures and corresponding defines, for example:

#define CPU_HARDWARE_FP                  TRUE
#define CPU_SOFTWARE_FP                  FALSE

We could add the prototypes to <rtems/score/context.h> and remove the 
_Context namespace.

> 
> 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.

Yes, this makes sense.

> 
> 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?

We could also add a <rtems/score/cpuisrlevel.h> for the interrupt 
enable/disable related support.

-- 
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber at 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/


More information about the devel mailing list