![]() There are other ways to get a high level language going. You’ll also need to provide at least some bootstrap C library, although you may be able to repurpose a lot of the standard library after you get the compiler working. You’ll need to define your ABI (Application Binary Interface basically how memory is organized and arguments passed). Keep in mind, there’s more to doing a gcc port than just the C compiler. I’ve seen people port some of the “ small C” variants to a different CPU, although since they aren’t standard C, that is only of limited use. Although the vbcc compiler isn’t frequently updated, the documentation of its backend looks very good and it appears to be one of the easier compilers to port. There is a portable C compiler, PCC, that is quite venerable. It uses iburg to do code generation, and that tool might be useful with some other retargeting projects, as well. The lcc compiler started out as a book in 1995. The llvm project has clang which you might find slightly easier to port, although it is still not what I would consider trivial. Then you’ll probably also want to port gdb, which is also non-trivial (see the video below). ![]() There’s a very good slide show overview, very out of date official documentation, and some guy’s master’s thesis. However, be prepared to read a lot of source code and experiment, too. If you want to tackle it, there are several documents of interest. However, building these is fairly complex and uses a Lisp-like notation that isn’t always intuitive. There are only three things you have to create to produce a cross compiler: The worst news is there is only a limited amount of documentation and a lot of it is very out of date. The bad news is that it is fairly difficult to do a port. The good news is that gcc is made to be portable as long as your architecture fits some predefined notions (for example, at least 32 bit integers and a flat address space). There’s good news, bad news, and worse news. Of course, your first thought will be to port gcc, which is a great C and C++ compiler (among other things). I have my own variation on this, AXASM, and I’ll talk about it more in the near future.Īssembly language is fine, but you really want a high level language. Assuming your processor doesn’t look too strange and you don’t mind conventional assembler conventions about labels and symbols, you might consider TDASM or TASM. There are quite a few options for portable assemblers. This is about midway between stealing and building from scratch. If so, what do you do? You could try porting infrastructure. Or you could be like me and just want a computer that models the way you think better than any commercial alternative. Perhaps you have an idea about how to minimize processor stalls. ![]() Maybe you want to experiment with strange instruction set architectures. In general, though, the appeal to developing your own CPU is to make it your own. Of course, sometimes, people just want to emulate an old machine, and that can be fun too. What good is a clone CPU? Presumably, the designer wants to use that particular processor, but wants to integrate it with other items to produce a system on a chip. But that means your CPU has to be compatible with some other available CPU (like OpenSparc or OpenRisc) and what fun is that? Still, the Internet is full of clone CPUs that work this way. The easiest way to get infrastructure is to steal it. Unless you have a lot of free time on your hands or a big team, you are going to have to consider how to hack some shortcuts. A debugger? What about an operating system?Įach one of those things is a pretty serious project all by itself (on top of the project of making a fairly capable CPU). Assembly language coding gets tedious after a while, so maybe you want a C compiler (or some other language). If you are working on a big machine, you might even want a linker. Machine code is error prone so, you really need an assembler. In extreme cases, custom CPUs don’t have any infrastructure and you program them in straight machine code. Many custom CPUs, for example, don’t run interactive operating systems (or any operating system, for that matter). Although you might be more productive than I am, you probably need a certain amount of sleep, and so you may want to consider if you can really get it all done in a reasonable time. That’s a big enough job that I haven’t done it. I suppose the holy grail would be to bootstrap your custom CPU into a full-blown Linux system. Not to trivialize the attempt, but the real problem isn’t the CPU. I’ve done several CPUs over the years, and there’s no shortage of other custom CPUs out there ranging from pretty serious attempts to computers made out of discrete chips to computers made with relays. You want to build your own CPU? That’s great fun, but you might find it isn’t as hard as you think.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |