From 69322f86de2cf802a4b8b33e9bc8c0d8b9110788 Mon Sep 17 00:00:00 2001 From: narimiran Date: Tue, 8 Dec 2020 11:32:38 +0100 Subject: [PATCH] backport devel's compiler/platform.nim --- compiler/platform.nim | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/compiler/platform.nim b/compiler/platform.nim index cfe3e1f486..714946315b 100644 --- a/compiler/platform.nim +++ b/compiler/platform.nim @@ -22,7 +22,7 @@ type osNone, osDos, osWindows, osOs2, osLinux, osMorphos, osSkyos, osSolaris, osIrix, osNetbsd, osFreebsd, osOpenbsd, osDragonfly, osAix, osPalmos, osQnx, osAmiga, osAtari, osNetware, osMacos, osMacosx, osIos, osHaiku, osAndroid, osVxWorks - osGenode, osJS, osNimVM, osStandalone, osNintendoSwitch + osGenode, osJS, osNimVM, osStandalone, osNintendoSwitch, osFreeRTOS, osAny type TInfoOSProp* = enum @@ -177,15 +177,23 @@ const objExt: ".o", newLine: "\x0A", pathSep: ":", dirSep: "/", scriptExt: ".sh", curDir: ".", exeExt: ".elf", extSep: ".", props: {ospNeedsPIC, ospPosix}), + (name: "FreeRTOS", parDir: "..", dllFrmt: "lib$1.so", altDirSep: "/", + objExt: ".o", newLine: "\x0A", pathSep: ":", dirSep: "/", + scriptExt: ".sh", curDir: ".", exeExt: "", extSep: ".", + props: {ospPosix}), + (name: "Any", parDir: "..", dllFrmt: "lib$1.so", altDirSep: "/", + objExt: ".o", newLine: "\x0A", pathSep: ":", dirSep: "/", + scriptExt: ".sh", curDir: ".", exeExt: "", extSep: ".", + props: {}), ] type TSystemCPU* = enum # Also add CPU for in initialization section and # alias conditionals to condsyms (end of module). cpuNone, cpuI386, cpuM68k, cpuAlpha, cpuPowerpc, cpuPowerpc64, - cpuPowerpc64el, cpuSparc, cpuVm, cpuIa64, cpuAmd64, cpuMips, cpuMipsel, - cpuArm, cpuArm64, cpuJS, cpuNimVM, cpuAVR, cpuMSP430, cpuSparc64, - cpuMips64, cpuMips64el, cpuRiscV64, cpuWasm32 + cpuPowerpc64el, cpuSparc, cpuVm, cpuHppa, cpuIa64, cpuAmd64, cpuMips, + cpuMipsel, cpuArm, cpuArm64, cpuJS, cpuNimVM, cpuAVR, cpuMSP430, + cpuSparc64, cpuMips64, cpuMips64el, cpuRiscV32, cpuRiscV64, cpuEsp, cpuWasm32 type TEndian* = enum @@ -204,6 +212,7 @@ const (name: "powerpc64el", intSize: 64, endian: littleEndian, floatSize: 64,bit: 64), (name: "sparc", intSize: 32, endian: bigEndian, floatSize: 64, bit: 32), (name: "vm", intSize: 32, endian: littleEndian, floatSize: 64, bit: 32), + (name: "hppa", intSize: 32, endian: bigEndian, floatSize: 64, bit: 32), (name: "ia64", intSize: 64, endian: littleEndian, floatSize: 64, bit: 64), (name: "amd64", intSize: 64, endian: littleEndian, floatSize: 64, bit: 64), (name: "mips", intSize: 32, endian: bigEndian, floatSize: 64, bit: 32), @@ -217,7 +226,9 @@ const (name: "sparc64", intSize: 64, endian: bigEndian, floatSize: 64, bit: 64), (name: "mips64", intSize: 64, endian: bigEndian, floatSize: 64, bit: 64), (name: "mips64el", intSize: 64, endian: littleEndian, floatSize: 64, bit: 64), + (name: "riscv32", intSize: 32, endian: littleEndian, floatSize: 64, bit: 32), (name: "riscv64", intSize: 64, endian: littleEndian, floatSize: 64, bit: 64), + (name: "esp", intSize: 32, endian: littleEndian, floatSize: 64, bit: 32), (name: "wasm32", intSize: 32, endian: littleEndian, floatSize: 64, bit: 32)] type @@ -241,23 +252,23 @@ proc setTarget*(t: var Target; o: TSystemOS, c: TSystemCPU) = t.tnl = OS[o].newLine proc nameToOS*(name: string): TSystemOS = - for i in succ(osNone) .. high(TSystemOS): + for i in succ(osNone)..high(TSystemOS): if cmpIgnoreStyle(name, OS[i].name) == 0: return i result = osNone proc listOSnames*(): seq[string] = - for i in succ(osNone) .. high(TSystemOS): + for i in succ(osNone)..high(TSystemOS): result.add OS[i].name proc nameToCPU*(name: string): TSystemCPU = - for i in succ(cpuNone) .. high(TSystemCPU): + for i in succ(cpuNone)..high(TSystemCPU): if cmpIgnoreStyle(name, CPU[i].name) == 0: return i result = cpuNone proc listCPUnames*(): seq[string] = - for i in succ(cpuNone) .. high(TSystemCPU): + for i in succ(cpuNone)..high(TSystemCPU): result.add CPU[i].name proc setTargetFromSystem*(t: var Target) =