Skip to content
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

how to use the compiler to build bare metal test binary for i80 #281

Open
ladmanj opened this issue Mar 25, 2023 · 2 comments
Open

how to use the compiler to build bare metal test binary for i80 #281

ladmanj opened this issue Mar 25, 2023 · 2 comments

Comments

@ladmanj
Copy link

ladmanj commented Mar 25, 2023

Hello @davidgiven and others

I would like to try this compiler to build test binary from C code to place it in ROM sitting at 0x0000 in i8080 system.
I would like to test the hardware, RAM, ports and so on.
Is it possible to place the code right at the reset vector from C function or inline assembly?

Thank you

@davidgiven
Copy link
Owner

Yes, but no...

So the thing is that with these platforms it's not really possible to separate the platform from the operating system. The 8080 backend, in particular, is expecting to run out of RAM and with RAM at 0x000, and the first thing it will do is to copy a bunch of helper routines into the reset vectors --- look at mach/i80/libem/rst.s. This obviously won't work on your system.

But what you can do is to define a new platform, configured for your system, with startup code which knows about your ROM layout, etc. To do this you'll want to copy plat/cpm. Most of the code in there is for the CP/M system call library and the emulator, neither of which you're using. You'll want a very basic set of system calls for console I/O --- look at plat/pc86/libsys for an example of this (that platform produces bootable PC floppies). It isn't a great deal of work but it is, unfortunately, work!

If you want to go ahead --- and you may not, it could well be more effort than is warranted given that you want to use this for testing --- I'd be happy to assist. That environment would probably be a useful thing to have support for in the compiler.

@ladmanj
Copy link
Author

ladmanj commented Mar 25, 2023

Thanks for the quick response.
Yes i want to go ahead, but I can't find any helpful documentation how to start with.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants