peterlemon / raspberrypi Goto Github PK
View Code? Open in Web Editor NEWRaspberry Pi Bare Metal Assembly Programming
Raspberry Pi Bare Metal Assembly Programming
I've read that you are woring on SMP support for RPi2 for your fractal demo. So this issue is just to track your progress. :) Purely a wishlist issue.
When I try to play audio through the audio output on the pi the quality is much worse than other devices. I'm wondering is 14bit too low and is it running out of precision? If there are any other ways to make the audio sound clearer please state them also.
The resolution of the framebuffer seem to be hardcoded in various demos causing the (at least here) picture to be scaled up with tons of scaling artefacts. Makes text output rather hard to read and images look ugly.
You can query the native screen resolution and then request a framebuffer of the ideal size. This would greatly improve the visual quality of the demos and be educational too.
PS: great collection of demos
Hello,
I am working on an ARM emulator for a university project and I am trying to get the HelloWorld demo running on it. I think that I might have noticed a small error in the code:
imm32 r0,PERIPHERAL_BASE + MAIL_BASE
imm32 r1,FB_STRUCT
orr r1,MAIL_FB
str r1,[r0,MAIL_WRITE + MAIL_FB] ; Mail Box Write
The value of r1 is written to 0x2000b8a1, an unaligned address. Isn't it redundant to add MAIL_FB to r0 + MAIL_WRITE, the channel information already being encoded in the least significant bits of r1?
Hi, I have RPI2 and booted bare metal examples there, but now I'm trying to boot on RPI3 in any(x64, x86) mode. I have formated sd card with https://github.com/raspberrypi/firmware/tree/master/boot files and your kernel8.img HelloWorld example. There are only one blink of green light on RPI and red light other time. What's wrong with me and my RPI?
Hello Peter
Currently, I am writing a research study at the University of Applied Science HSR (Switzerland). I would like to present your CPU HelloWorld code for the RPI3 in this study and therefore wanted to ask you under which license you published your code.
Thanks for your reply and your efforts!
Best regards, David
In your 12bit 44100Hz stereo cpu demo the audio doesn't actually come out in both sides of the headphones. The headphones are perfectly functional in other devices it seems like this code doesn't actually give stereo output. Is there a way to make the code stereo?
Hi Peter,
This is an unbelievably valuable repository, first of all, I am extremely indebted to you for all of the hard work you have done putting it together.
I've been working on rpi 3 port of PiFox and I'm having problems with the sound. I discovered your sound demos, and decided to try one out to see if it played correctly for me on my rpi 3b.
I tested the Sound/PWM/12Bit/44100Hz/Stereo/CPU demo, and it played the sample perfectly, until it hit the end of the sample, after which several seconds of white noise are played, before the sample restarts. The white noise is very similar to the white noise I am experiencing in my PiFox port, so I suspect it is a similar issue. My thoughts are maybe this could be due to a firmware update, or possibly my rpi 3b has slightly different clock timings to the rpi 3 base model, or perhaps there is something else at play.
Do you happen to know if this demo should work with the latest firmware on a rpi 3, or is there any debug information I can get you that might hint at the cause of the white noise?
I'm happy to dump some system register values to UART etc if that helps with a diagnosis. Also if you'd like me to try out any of the other samples, or try explicitly the kernel7.img
vs kernel8.img
versions, I can do that. I can also make a recording, if that helps. :-)
Once again, many thanks for this amazing repository!
Kind regards,
Pete
I have tried to leverage multiple kernel.img and kernel7.img, but I always get a black screen. I read the forum post between you and rst hoping to see if I was missing anything, but I am stuck. Any help you can provide would be great. I am using the RP2 B. I leveraged your links to grab the latest firmware and my SD card is laid out as such...
start.elf
bootcode.bin
config.txt
kernel7.img
If I replace the kernel with one I did earlier by valvers for the LED Blink, it works just fine. I noticed someone else posted the same issue in the Forum, but I haven't seemed to fine a resolve.
Hi @PeterLemon! it took me many years to give this a try, but now that i am a more confident and experienced programmer, i got it running!
https://www.youtube.com/watch?v=S8icTC9zRAc
My only issue is it does not loop and then it freezes, whereas your example loops forever (desired behavior for me as well).
My process is here:
https://github.com/apkatsikas/pi-video
When i open my concat-ed lz file, it looks like this:
notably, mine shows only 1 element of 159, vs. your files 5. also of note, i only used 155 frames for this animation, so im not sure where the other 4 are coming from. i also noticed your starts with a few test frames, it looks like, whereas mine does not.
Other things to consider:
I could process my array differently like this https://github.com/apkatsikas/pi-video/blob/fc316f29794ba68453592231e06337367fa3cc68/process.py#L10
I could specify a different length, byte order or signed options https://github.com/apkatsikas/pi-video/blob/fc316f29794ba68453592231e06337367fa3cc68/process.py#L45
I could write bytes more like this https://github.com/apkatsikas/pi-video/blob/fc316f29794ba68453592231e06337367fa3cc68/process.py#L50
Peter,
I tried to build your CPU Hello world and I can't . Where do I find LIB\R_PI.INC?
Rich...
in lib, duh....
Hello Peter,
I have tried your demos on a Pi2 with great success and was now trying to do the same on a compute module. I assumed that once I format the emmc on the compute module then I can just copy the 4 files to it like I do with the Pi2 and power cycle once to load my kernel. Unfortunately, that does not seem to work. I am getting a rainbow screen meaning the kernel could not be found.
I am working with your basic hello world example. Is there something that I have to do differently for the compute module?
Best regards,
Szoshi
As you can see by the title this isn't an issue about your code at all. Recently I tried to rewrite your 14 bit 44100Hz Mono CPU code in C however I have run into an error somewhere because it doesn't work. I have been able to rule out unaligned memory access as the culprit however I'm sure there is still much I don't know I have posted my question to https://www.raspberrypi.org/forums/viewtopic.php?f=72&t=212930&sid=aeafdbf5f08d4d0563e61392c6cac157. Thank you if you can help!
Many of your examples make use of the TAGS channel of the mailbox interface. In particular, you set up the framebuffer in a FB_Init
loop. While this does work, this is not technically correct.
The issue is that you don't properly wait for a response from the VC to indicate it's finished processing the tags list (and thus written the response). This is why immediately reading the FB_POINTER
field yields zero, as the VC hasn't finished processing.
The correct mailbox usage is to write the structure address + channel to the mailbox, then enter a loop waiting for the MAIL_EMPTY
bit (bit 30) of the status register (offset 0x18) to be clear. Then, read from the read register (offset 0) to clear the mailbox. At this point, the VC has fully processed the tags list and written the response. This should eliminate the need for the FB_Init
loop.
Hi Peter,
First of all, thank you for this great collection of bare metal projects. I notice that in the audio subdirectory, different files are using different clock sources, and you label their frequency in comments. However, their values are different from what's listed here http://pinout.xyz/pinout/gpclk. Are these clock frequencies configurable?
The first frame renders just fine, but subsequent frames don't pick up changes to the vertices.
I've tried with both most recent firmware (commit 78c4983) and a year-old firmware (commit 046effa), and neither work. I've also tested with my own code based of yours, and it seems like any changes pre-rendering are picked up by the GPU, but not any changes in the middle of the loop.
Running on Raspberry Pi 2; display via HDMI.
Hello Guys,
I am trying out the Hello World demo on a RPi 2. I have an SD card (32 GB Samsung EVO Plus) formatted for FAT32 and I have copied 4 files to this card as suggested.
bootcode.bin
start.elf
kernel7.img (This image has been downloaded directly and not built locally)
config.txt
The screen shows just a rainbow pattern which it seems means that the Pi cannot load the kernel.
Am I doing something wrong? Any help would be appreciated.
Regards,
Shailesh
HI,
First of all, I appreciate your work and it make clear for me to how to use Pi3.
Can you add a small demo of bootloader that uses aarch64 ISA and load programs from serial port?
Currently all bootloader I found online is outdated with respect to PI3 B+ model.
Thank you!
Hi,
Was wondering how I can get a video file into this format you use, lz.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.