-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Freestanding/Baremetal #187
Comments
Maybe try the mailing list? Cross-compilation should be possible, and the Lua(JIT) and LLVM runtime dependencies are optional. |
The On Thu, Jul 14, 2016 at 8:51 PM, Joshua Olson notifications@github.com
|
@zdevito thanks, I will try it out |
@zdevito I tried the following code but encounter some errors: local intel_x86_target = terralib.newtarget {
Triple = "i686-pc-none-elf";
-- CPU = ;
-- Features = "-ffreestanding ";
Ffreestanding = true;
}
terralib.saveobj("hello", {target = intel_x86_target}) Errors: src/terralib.lua:4296: expected terra globals or functions but found table
stack traceback:
[C]: in function 'error'
src/terralib.lua:4296: in function 'saveobj'
.../Development/Lua/hello.terra:8: in main chunk Also, can you pass arbitrary flags to the llvm from the terralib.newtarget() function? |
I'm doing an experiment with Terra code running of the (U)EFI environment and this works if I link with C and the GNU-EFI lib so, this works: terralib.includepath = terralib.includepath..";/usr/include/efi;/usr/include/efi/x86_64"
local C = terralib.includecstring [[
#include <efi.h>
#include <efilib.h>
]]
terra terra_main(str: &uint16)
C.Print(str)
end
terralib.saveobj('foo.o', {
terra_main=terra_main,
terra_add=add
}, {"-c", "-fno-stack-protector", "-fpic", "-fshort-wchar", "-mno-red-zone"})` https://github.com/xspager/hello_efi_from_terra/blob/master/foo.t#L19 I'm looking into rewriting all code in Terra and doing something useful. |
@Immortalin, try: local intel_x86_target = terralib.newtarget {
Triple = "i686-pc-none-elf";
-- CPU = ;
-- Features = "-ffreestanding ";
Ffreestanding = true;
}
terralib.saveobj("hello", "", {}, {}, intel_x86_target) You (may) need to pass the target to includecstring and includec, check: http://terralang.org/api.html#c-backwards-compatibility |
@xspager Are you still interested in this? If so you could try again on master? I'm trying to figure out which of the older issues are still relevant. |
Hi, since terra supports pointer arithmetic, can it be compiled freestanding? I am curious if it can be used for OS development .
The text was updated successfully, but these errors were encountered: