platforms icon indicating copy to clipboard operation
platforms copied to clipboard

Define a value for "no OS"?

Open UlrichEckhardt opened this issue 3 years ago • 1 comments

Hello!

I'm working on embedded code which does not run with any OS underneath (on "bare metal"). My initial thought was to specifiy "OS=none" or something like that. What do you think of adding such a constant?

One issue I see is that it looks like it is not really a constraint, rather the opposite thereof. On the other hand, bare metal means direct access to device registers and similar things that the OS prevents normally. Interestingly, compiling an OS kernel itself would be one example of a program that requires this.

Thoughts? Ideas? Concerns?

Uli

UlrichEckhardt avatar May 03 '22 08:05 UlrichEckhardt

This needs some thought to find a real compelling use case. For the most part, a select would pick up none in //conditions:default. I also have a hunch that people compiling an OS might actually define the target os as their OS. Imagine the Mach kernel being used in MacOS or vanilla Mach.

aiuto avatar Aug 22 '22 17:08 aiuto

Looks like this already exists! https://github.com/bazelbuild/platforms/blob/3fbc687756043fb58a407c2ea8c944bc2fe1d922/os/BUILD#L52-L55

cpsauer avatar Dec 03 '22 06:12 cpsauer

Not sure why I missed this, thanks to @cpsauer for pointing this out. I think it might have been that I was using an older version of Bazel, because the company I worked for had this contstraint.

Anyway, no need to keep this open.

UlrichEckhardt avatar Jan 23 '23 11:01 UlrichEckhardt