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

Modifications for bare metal builds for Raspberry Pi with current circle-stdlib #1143

Closed
hpingel opened this issue Jul 31, 2020 · 15 comments
Closed

Comments

@hpingel
Copy link

hpingel commented Jul 31, 2020

Hi, thanks to the good work of @msx80 I was able to test the TIC-80 bare metal build of @msx80 on a Raspberry Pi 2. Because I couldn't find a current bare metal build (is there one somewhere?) I have then tried to compile it myself and was successful enough to get a 32bit bare metal kernel for Raspberry Pi 3 and 4.

For a successful compilation I had to change a bit of Makefile related stuff and also do some minor code changes.

I have used the latest GNU toolchain 9.2-2019.12 for aarch32 available at the moment and also the latest version of circle-stdlib v15 (containing Circle Step 42) together with the current state of the TIC-80 master branch.

The kernels are booting fine with video and sound via HDMI. The USB keyboard support is currently still broken in a way that I can only use half of the keys of my USB keyboard - I can use Cursor-Keys + Function keys but not normal letters. This issue can probably be fixed easily but I didn't look into it yet.

As a proof I will try to attach an archive with an SD card image to this github issue (the SD card image contains the carts provided by @msx80 in his SD card image). The SD card should boot fine with Raspberry Pi 3 and 4 but it has the keyboard issues. With the right USB gamepad it might still be usable to launch games.
experimental_tic80_bare_metal_builds.zip

Further work needs to be done. I want to clean up my changes and offer Pull Requests.

@msx80
Copy link
Contributor

msx80 commented Jul 31, 2020

good to hear that it works on RPi4! how are the performances?
the baremetal build was merged into TIC80 some time ago (info here) but i think it broke later due to new changes. I'm not sure if you used this one or my repository?

@hpingel
Copy link
Author

hpingel commented Jul 31, 2020

For building I used the master branch of nesbox/TIC-80 at git revision 946d910

(accidently closed this issue by tapping on smartphone screen...)

Performance has yet to be tested. My focus was on getting it to build within a Docker image for easier bare metal build workflow.

@hpingel hpingel closed this as completed Jul 31, 2020
@hpingel hpingel reopened this Jul 31, 2020
@hpingel
Copy link
Author

hpingel commented Aug 1, 2020

So the keyboard problem described in post 1 in this issue is a bit annoying to fix. I have now had a look a the n3ds keyboard handling but it seems that n3ds does not use the lib and can access tic_api_key and such where the bare metal PI can't. I also don't understand at the moment why we have to use the circle raw keyboard handler for bare metal pi.

I have attached a new zip archive to this posting with updated experimental kernels for Raspberry Pi 3+ 4 where the keyboard characters A-Z,0-9 are working now but if you press a key for a long time you get dozens of char repeats (very annoying). So it still is not really working well, but at least one can launch the surf mode and launch games.

tic80_bare_metal_build_with_insane_keyboard_repeat.zip

@hpingel
Copy link
Author

hpingel commented Aug 1, 2020

how are the performances?

So I ran the performance benchmarks now (I am not an expert on TIC-80 so I might have run it wrongly or I might have used an outdated version). Performance in "Secret Agents" game is much better compared to Pi 2 (obviously to be expected).

Results for Raspberry Pi 4 (2GB)
Results for Raspberry Pi 4 (2GB)

Results for Raspberry Pi 3A+
Results for Raspberry Pi 3A+

Results for Raspberry Pi 2B
Results for Raspberry Pi 2B

Results for Raspberry Pi Zero W V1.1
IMG_20200801_233236

@hpingel hpingel changed the title Modifications for bare metal builds for Raspberry Pi with current Circle stdlib Modifications for bare metal builds for Raspberry Pi with current circle-stdlib Aug 1, 2020
@hpingel
Copy link
Author

hpingel commented Aug 1, 2020

My current changes to make the Pi bare metal build work again are available here in the master branch: https://github.com/hpingel/TIC-80

@hpingel
Copy link
Author

hpingel commented Aug 2, 2020

@msx80 I think your file https://github.com/msx80/BareMetalTic80/blob/master/arm-gcc-toolchain.cmake is worth looking at again for me as I think my current version of CMakeLists.txt can still be streamlined/improved although it works for me.

@hpingel
Copy link
Author

hpingel commented Aug 3, 2020

I have prepared another SD card image with experimental bare metal builds. What's new?

  • This SD card image contains only the demo carts (I removed any third party games not to annoy any creator of games not having asked them before).
  • It contains four different Pi kernel images for Raspberry Pi 4, 3, 2, 1 + Zero.
  • It contains a new workaround for the keyboard key repeat problem. As long as the user doesn't press more than one alphanumeric keyboard key at once it should be acceptable to type at the moment. (This problem needs a proper solution and I need some advice to fix it.)
  • The kernels are compiled with the state of the master branch of my fork. hpingel@9857de3

Enjoy!

tic_80_experimental_bare_metal_pi_image_20200803.zip

@farvardin
Copy link
Contributor

That's great!

For the multiple key press, it often happens when you type fast, and in my case the keyboard is pretty hard to type, which make the problem even more present! What if you just add a slight delay after every input? It wouldn't be the best, but still better than hitting 2 keys together. Or maybe preventing any new repeat if 2 keys at hit together?

Bare metal TIC-80 is awesome because it really feels like a "real" hardware console!

@jmcerrejon
Copy link

Hi @hpingel . How could I compile it for Raspberry Pi OS 32 bits (no bare metal). I get a malloc issue and drive me crazy. Thks.

@farvardin
Copy link
Contributor

Hi @hpingel . How could I compile it for Raspberry Pi OS 32 bits (no bare metal). I get a malloc issue and drive me crazy. Thks.

@jmcerrejon As you stated it yourself, your issue has nothing to do with the bare metal version, so please have a look at this thread instead: #984 . And please post some extracts of your errors to get some help.
You can also get some more instructions there: #1017

I've succesfully compiled tic-80 on Raspberry pi a few days ago.

@hpingel
Copy link
Author

hpingel commented Aug 22, 2020

Hi, as @farvardin stated, this is only bare-metal build related stuff in here.

For TIC-80 a bare metal future depends on two things IMHO:

  • Somebody has to adapt it continuously so that it always builds the bare metal way.

  • Somebody has to provide the build infrastructure in a way that many people can compile it for bare metal target without in-depth knowledge of all the details. For this I think a Docker based build environment is the best approach. For the builds I provided in this issue I used my experimental Docker images to build TIC-80 four times for the different Pi generations.

I will try to work on both of these issues but would also like some help on the first one to speed things up. I will post updates here whenever my time permits to continue playing with this. Once my Docker based stuff has matured a bit I will probably put it on Github. And it’s only meant for bare metal builds.

@jmcerrejon
Copy link

jmcerrejon commented Aug 23, 2020

The problem was @hpingel I couldn't contact with you (complete your GitHub's profile!) and this was the first post I found concerning the Pi. I maintain a project called PiKISS to provide scripts to easily compile/install software on the Pi, and my idea is give support to this project. Thank you all for the suggestions and links. I'll try to compile. 😉

@hpingel
Copy link
Author

hpingel commented Aug 23, 2020

Why don't you open up a new ticket for your project and goals and describe your problem in detail? This is a ticket about bare metal without Linux underneath and it is a different world to Linux. At the moment you are hijacking this issue with your goals and I would like help on my goals in this ticket.

@jmcerrejon
Copy link

I did it. My last post was for explain you my situation. Nothing more, nothing less. Good luck!

@nesbox
Copy link
Owner

nesbox commented Nov 2, 2020

closing as dup of #912

@nesbox nesbox closed this as completed Nov 2, 2020
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

5 participants