I've been in the process of developing a kernel in Nim. I've made a lot of progress and I'm planning to write a blog series about it. But when I came back to some of the basics, I'm not sure I quite understand the difference between --os:any and --os:standalone. The section on embedded systems in the compiler manual suggests to use the any target and the -d:useMalloc flag, which is what I did. I also provided implementations for malloc(), realloc(), and free().
My question is: what is os:standalone useful for? I couldn't find documentation about this target. All I know is that it requires the user to provide a panicoverride.nim module that implements panic() and rawoutput().
Sorry, follow up question. I noticed that if I put --os:any in a nim.cfg file, it doesn't take effect. It has to be passed on the command line to work.
Is this by design or something overlooked?
I think I found a reproducible scenario. It has to do with using a cross-compiler (e.g. mingw) and os:any together. I'm using mingw because I need to produce a PE32+ image, which is required by the UEFI spec for bootloaders.
--listCmd
cpu = amd64
os = any
mm = arc
threads = off
define = StandaloneHeapSize=10000
amd64.any.gcc.exe = "x86_64-w64-mingw32-gcc"
amd64.any.gcc.linkerexe = "x86_64-w64-mingw32-gcc"
If I compile an empty file using nim c empty.nim with this nim.cfg on my mac, I see it's using clang instead of x86_64-w64-mingw32-gcc, thus producing a mach-o image.
If I compile with nim c --os:any empty.nim, it correctly uses the x86_64-w64-mingw32-gcc compiler and produces a PE32+ image. So for some reason it's not picking up the amd64.any.gcc.* config when os = any is defined in nim.cfg.