-
C Compiler working
08/22/2017 at 20:50 • 0 commentsToday, I compiled simple C program with vbbc and then ran it on MARK-II successfully. So I finally have C compiler for my CPU!
Of course, there are a lot of bugs and there is plenty of work left, but, it simply works!
Next goals are:
- Port some C standard library (newlib?)
- Write peripheral library
- Improve CPU architecture to get better performance
- Find as many bugs as can and eliminate them.
Code that I ran is really simple:
#define TIME 0x2FFFF static void delay(int time); static unsigned int* DDRA = 0x101; static unsigned int* PORTA = 0x100; int main(){ *DDRA = 0xFF; while(1){ *PORTA = 0xAA; delay(TIME); *PORTA = 0x55; delay(TIME); } return 0; } static void delay(int time){ unsigned int i; for(i = 0; i < time; i = i + 1); }
It is hello world with LED. And I had a lot of problems with it. I discovered few bugs in emitting comparison code, I found out that loader isn't working correctly, and I spent a lot of time before I noticed I accidentally swap DDRA and PORTA registers addresses.
There is also link to commit that add vbcc into my project repository at github.
-
Retargeting C compiler
08/14/2017 at 17:00 • 0 commentsI'm now working on retargeting C compiler. I can say, it is not easy job for me. I tried read something about LCC but LCC seem a bit hard to retarget, not so hard as GCC, but for example vbcc can be retarget more easily. So I started writing backend for vbcc.
I'm almost done and things like branching, arithmetic are working well, also global and static variables. But I got stuck at stack related parts, this mean calls to others functions, arguments passing, local variables and so on.
If somebody can share link where I can find information about how C Compilers are using stack I will be glad.
Also, it is not clear to me, how to deal with libraries. Have I write my own libraries to be ANSI C compatible? Or is OK to write just backend for vbcc and say "let there be an compiler"? For now I don't want any operating system for my CPU so I suppose, it should be OK to write just backend.
-
First release
07/18/2017 at 09:05 • 0 commentsToday, I released first release of MARK II. You can clone repository from my GitHub. This first version include:
- Fully working RISC CPU core with set of simple peripherals
- Fully working tools like Assembler, Emulator and so on
- Reference manual for whole SoC
Now I have some base point for next development. Things that I want to implement next are:
- Better UART with buffers
- Faster CPU core
- SDRAM driver
- Port of the LCC
I will be glad for any feedback.