ChezScheme icon indicating copy to clipboard operation
ChezScheme copied to clipboard

How to run Chez Scheme on the bare metal?

Open guenchi opened this issue 6 years ago • 12 comments

I'm trying to build a Lisp Machine base on Chez Scheme.

Please give some advice...

thanks very much!

guenchi avatar Dec 06 '19 21:12 guenchi

What do you have in mind? Would you like to write code that emits machine code for a Lisp machine?

burgerrg avatar Dec 09 '19 16:12 burgerrg

I was also interested in getting chez to run on bare metal. Chez won't build for bare metal targets so, it requires workarounds. Probably the best way of getting it to build would be to use newlib and make the appropriate patches from there. It's a considered effort.

I think Dr. Burger's hint to write a compiler for your target instead of directly using chez would be better to look into. The problem is complicated and the solution may require it's own lisp and vm. Although, that doesn't answer the question of how to run chez on bare metal targets.

steven741 avatar Dec 09 '19 17:12 steven741

Here are my thoughts: (and implementations in progress).

  1. Write a preliminary system in assembly and C.
  2. Use C to implement the system functions needed by Chez. (This is exactly what I want to know here, like which functions...)
  3. Use existing machines to cross-compile Chez into the target code.
  4. Use Scheme to implement the remaining system functions.
  5. Optimize specific scheme basic functions. like car, cdr ... etc.

guenchi avatar Dec 09 '19 20:12 guenchi

One option is to create a new machine type in Chez Scheme. You will need to have a C compiler and run-time libraries for the C side of Chez Scheme. You'll need to write the assembler for your architecture in Scheme (see arm32.ss, ppc32.ss, x86.ss, and x86_64.ss). It's a significant undertaking.

burgerrg avatar Dec 09 '19 21:12 burgerrg

One option is to create a new machine type in Chez Scheme. You will need to have a C compiler and run-time libraries for the C side of Chez Scheme. You'll need to write the assembler for your architecture in Scheme (see arm32.ss, ppc32.ss, x86.ss, and x86_64.ss). It's a significant undertaking.

thanks :)

I think if the new system is compatible with Unix, maybe there is no need to change the Chez Scheme?

guenchi avatar Dec 10 '19 01:12 guenchi

It would certainly minimize the porting effort if the system is Posix-like and uses one of the already supported CPUs.

burgerrg avatar Dec 12 '19 20:12 burgerrg

I'm not trying to discourage anyone from using Chez Scheme, but if you truly want a scheme for bare-metal you should check out Loko (Bare Metal). It's designed to be entirely self hosting and has no dependencies on C libraries. It's also only amd64, so other targets will require significant work.

gwatt avatar Dec 12 '19 21:12 gwatt

It would certainly minimize the porting effort if the system is Posix-like and uses one of the already supported CPUs.

Ya, that was the plan.

guenchi avatar Dec 13 '19 23:12 guenchi

I'm not trying to discourage anyone from using Chez Scheme, but if you truly want a scheme for bare-metal you should check out Loko (Bare Metal). It's designed to be entirely self hosting and has no dependencies on C libraries. It's also only amd64, so other targets will require significant work.

It’s quite useful, thanks!

guenchi avatar Dec 13 '19 23:12 guenchi

Let me suggest also Samuel and Marc's experience report. Their paper and video should be up soon.

jasonhemann avatar Aug 31 '20 19:08 jasonhemann

Back in the day Flatt has MzScheme on “bare metal” using OSKit. Maybe OSKit is an option today too?

https://www.cs.utah.edu/flux/oskit/

fre. 6. dec. 2019 kl. 22.54 skrev guenchi [email protected]:

I'm trying to build a Lisp Machine base on Chez Scheme.

Please give some advice...

thanks very much!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/cisco/ChezScheme/issues/480?email_source=notifications&email_token=AADQXRNN4JXCTZLNTU7UERDQXLC2TA5CNFSM4JXCC652YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4H6YMXBQ, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADQXROXFYRBCQ4RAI6DB23QXLC2TANCNFSM4JXCC65Q .

-- -- Jens Axel Søgaard

soegaard avatar Aug 31 '20 20:08 soegaard

Let me suggest also Samuel and Marc's experience report. Their paper and video should be up soon.

that's very cool...

guenchi avatar Sep 10 '20 17:09 guenchi