Advertisement

Programming a microcontroller

Started by November 10, 2014 07:48 AM
4 comments, last by LennyLen 10 years, 2 months ago

Hello. I know the title of the topic seems in other category than games but a game is what I want to do for learning porpuse.

I want to program the bare metal of an raspberry Pi while I try to make a simple "3d game" for learning porpuses. A simple game means a spining cube textured that will change direction while I press buttons on the keyboard. I'm very intersted in knowing how a CPU and a GPU works at a low level. And I want to program the whole framework that will covert the 3D coords of the cube in final pixel for the monitor (like a software renderer). I know C++ and some ASM and I worked with shaders and custom model loaders. So I have some quesions:

1. Am I realistic? I never programmed a microcontroller and I want to know if making an extremely simple OS that will run the render code is posible.

2. Can I acces the GPU directly with ASM and there are know limitation if I dont use the driver?

3. Is it posible to program the bare metal of the CPU and GPU with C ?

4. Will it worth the trouble ? Im intersted in gamedev on PC mostly but I always had the curiosity how hardware works at a low level so I can program the GPU and CPU better no matter in what arhitecture.

Thanks.

Just out of curiosity: why would you choose the raspberry Pi for that? its CPU/GPU is extremly weak. Not saying it is impossible, just saying that you are fighting an uphill struggle here that baring a good reason to do so sounds like your are just looking for a challenge...

In my short messing around with my rPi I had troubles getting the browser to run at anything but glacial speed. Granted, we are talking about a linux browser not optimized for the rPi, still, if it struggles with badly optimized code while trying to render simple websites, it will most probably struggle with anything 3D even with the best optimized code.

Advertisement

I'm intersted in programming something easy to understand and I dont expect extraordinary results in graphics. I just want to learn how hardware works when I run a code on a CPU or on a GPU since everything I learned so far was only on a abstract level. For example I worked with C++ code and shaders but I never knew why the code runs slower or faster in some cases. In the future if I'll be able to program for larger arhitectures and more powerfull CPU and GPU it will be easier to study the hardware capability of the components and make optimised programs. At least thats what I think.

Your ideas are not so bad, learning how things work.

But you do not need to let a renderer run on a bare CPU without OS. To lern to access hardware directly have a look into the linux kernel source.

Everything else can be run in userspace.

And accessing the GPU directly is, AFAIK, impossible because these things are someway a secret of the GPU companies.

And accessing the GPU directly is, AFAIK, impossible because these things are someway a secret of the GPU companies.

And that is why things like mantle are such a big deal in the space of PC games. "Closer to the metal" AFAIK is the best you will get....

@ Azzaleus: ah, I get it. To be clear, I did not wanted to paint the rPi in a bad light. It is a fine little machine, as long as you are aware what you are getting (and are not trying to use it as a cheap linux desktop...).

I am not 100% sure if the rPi really is that much easier to understand than other low power devices, but it is without doubt among the cheapest, and one of the few that were built for people to actually tinker with them.

There are now some other products, some pretty promising chinese systems-on-a-chip that upgrade on the rPi by using quadcore CPUs and much more powerful GPUs, prices are in the 100$ range though. I cannot think of the name at the momen....

And then there is the new Intel board, no idea if this is out yet, and it is also much more expensive than the rPi.

Still, if you looking for a small system-on-a-chip for tinkerers with more oomph, and are ready to put in a little bit additonal cash, there are options now.

I bought one of these the other day. It still hasn't arrived yet, but I'm looking forward to tinkering around with it at a low level. And at $60 (plus the cost of an Arduino), it's not super expensive.

This topic is closed to new replies.

Advertisement