Falls mal ein ESP32, RP2040/Raspberry Pico, STM32 trotz der Möglichkeit der Übertaktung nicht ausreicht und der Schritt zum FPGA noch zu groß ist, könnte man einen großen Raspberry Pi ohne laufendes Linuxsystem, als Microcontroller verwenden. Da kein Linux läuft kann man die Ressourcen die sonst Linux benötigt auch noch verwenden.
Ein interessantes SDK für solche Bare Metal Programmierung ist Circle. Ich weiß nicht ob schon ein Projekt im Forum damit durchgezogen und dokumentiert wurde, deshalb hier nochmal die Erwähnung.

Die Programmierung mit dem SDK erfolgt in C oder C++, man setzt also über Assembler an und damit ist die Lernkurve so, daß auch Arduino-Boys und Girls damit schnell Erfolge erzielen können. Zudem gibt es schon sehr viel Democode dazu aus dem man lernen und kopieren kann: https://github.com/rsta2/circle/tree/master/sample
SAMPLES
01-gpiosimple [5] Simple GPIO usage, blinking Act LED
02-screenpixel [5] Setting pixels on screen
03-screentext [5] Writing text to screen, debug_hexdump() and assert usage
04-timer [5] Interrupt driven timer, exception handler demonstration
05-usbsimple [5] Displaying USB device descriptor of root hub
06-ethernet [5] Receiving broadcasts from Ethernet
07-usbstorage [5] Displaying partition table from master boot record (MBR)
08-usbkeyboard [PnP,5] Echoing typed characters to screen or SPI/I2C display, or keyboard raw mode
09-softserial [5] GPIO interrupt demonstration, serial interface via non-UART GPIO-pins
10-usbmouse [PnP] Little painting program with USB mouse support
11-gpioclock [5] Using GPIO clock 0 to generate a square wave signal and sampling this signal to display it
12-pwmsound [5] Using PWM device and DMA controller to playback a short sound sample
13-pwmoutput [5] Using PWM device to continously change the brightness of a connected LED
14-usbprinter [5] Printing some text lines on an USB printer (GDI printers do not work)
15-files [5] Root directory listing of a connected USB drive, writing and reading the file "circle.txt"
16-i2cping Transfering data blocks between two Raspberry Pis connected via I2C
17-fractal [5] Displaying a fractal image from a Mandelbrot set (may be build for single- or multi-core)
18-ntptime [PnP,5] Setting the system time from an Internet time (NTP) server, reducing boot time
19-tasks [5] Demonstrating the cooperative non-preemtive scheduler
20-tcpsimple [5] Simple TCP echo server
21-webserver [5] Simple HTTP webserver which controls the Act LED
23-spisimple [5] Transfers some data bytes to/from a SPI slave device. Dumps the received bytes.
24-hwrandom [5] Demonstrating the hardware random number generator.
25-spidma [5] Transfers some data bytes to/from a SPI slave device using DMA.
26-cpustress [5] Calculates fractal images to stress the CPU. Displays a SoC temperature chart.
27-usbgamepad [PnP,5] Displaying information about an attached USB gamepad and its current state.
28-touchscreen [5] Displaying events from the official Raspberry Pi or USB touch screens.
29-miniorgan [PnP,5] Mini organ instrument using PWM, HDMI, I2S or USB sound, (USB or serial) MIDI or USB keyboard.
30-gpiofiq Demonstrating FIQ-driven fast GPIO event capture and a tracing class.
31-webclient Fetching a RPi hardware revision list from a HTTP webserver and parsing it.
32-i2cshell [PnP,5] Command line tool for interactive communication with I2C devices.
33-syslog [5] Demonstrating how to send log messages to a syslog server using UDP.
34-sounddevices [5] Integrating multiple sound devices in one application
35-mqttclient [5] Demonstrating the MQTT client
36-softpwm Using the class CUserTimer to implement software PWM
37-showgamepad [PnP,5] Shows a stylised gamepad on screen and the state of an attached USB gamepad.
38-bootloader HTTP- and TFTP-based bootloader with Web front-end
39-umsdplugging [PnP,5] Plug in and remove USB flash drives, list directory
40-irqlatency [PnP] Displays the maximum measured IRQ latency
41-screenanimations [5] 2D graphical shapes demo on screen without flickering or on SPI/I2C display
42-soundinput [5] I2S or USB to PWM sound data converter and digital sound recorder
43-multiwindow [5] Demonstrating multiple non-overlapping windows on a screen (Multi-core only)
Samples marked with [PnP] are enabled for USB plug-and-play.
Samples marked with [5] are working on the Raspberry Pi 5.
Display More
Eine ansprechende SDK Dokumentation findet man auf https://circle-rpi.readthedocs.io/en/latest/
Und ein HowTo von anderer Seite zur SDK-Einrichtung kopiere ich mal mit rein in den Beitrag
Using Circle for Pi Bare Metal Programming
Apr 4, 2024
Circle is a C/C++ bare metal programming environment for the Raspberry Pi - i.e. it provides a bunch of libraries to make bare metal programming easier.
To get it building for the Pi 4, 64-bit follow these instructions.
Get the ARM GNU Toolchain
The latest ARM GNU toolchain is available here.
To install the toolchain for an x86_64 host and an AArch64 bare-metal target, using version 13.2.rel1:
cd ~/builds
wget "https://developer.arm.com/-/media/Files/…07019956E7122B5" -O arm-gnu-toolchain-13.2.rel1-x86_64-aarch64-none-elf.tar.xz
unxz arm-gnu-toolchain-13.2.rel1-x86_64-aarch64-none-elf.tar.xz
tar xf arm-gnu-toolchain-13.2.rel1-x86_64-aarch64-none-elf.tar
rm arm-gnu-toolchain-13.2.rel1-x86_64-aarch64-none-elf.tar
Build Circle Libraries
To build for the Raspberry Pi 4, 64-bit, with a UK keyboard mapping:
cd ~/builds
git clone https://github.com/rsta2/circle
cd circle
PATH=$PATH:~/builds/arm-gnu-toolchain-13.2.Rel1-x86_64-aarch64-none-elf/bin ./configure -r 4 -p aarch64-none-elf- --keymap UK
PATH=$PATH:~/builds/arm-gnu-toolchain-13.2.Rel1-x86_64-aarch64-none-elf/bin ./makeall
The libraries are output to ./lib.
Build Circle Samples
The samples are in ./sample. To build a sample, go to the sample’s directory and run make.
For example, to build 08-usbkeyboard:
cd sample/08-usbkeyboard
PATH=$PATH:~/builds/arm-gnu-toolchain-13.2.Rel1-x86_64-aarch64-none-elf/bin make
To run the Sample
You need an SD card with a FAT32 formatted first partition.
You can do create this via the command line, as follows, assuming you have an SD card at /dev/sdb (make sure you use the right device as this will wipe the filesystem!):
sudo apt install parted dosfstools
sudo wipefs --all --force /dev/sdb
sudo parted -s /dev/sdb mklabel msdos
sudo parted -s /dev/sdb mkpart primary fat32 1MiB 100%
sudo mkfs -t vfat /dev/sdb1
Now you need the following files on the SD card:
- start4.elf
- bcm2711-rpi-4-b.dtb
- kernel8.img
Get the first two from the Raspberry Pi Firmware repo. For example:
wget "https://github.com/raspberrypi/fi…boot/start4.elf" -O /tmp/start4.elf
wget "https://github.com/raspberrypi/fi…711-rpi-4-b.dtb" -O /tmp/bcm2711-rpi-4-b.dtb.elf
The last file you just built, and so it comes from the sample directory - it will be called kernel8-rpi4.img so you will need to rename.
For example to install all of these files on /dev/sdb1:
sudo mount /dev/sdb1 /mnt
sudo cp /tmp/start4.elf /mnt
sudo cp /tmp/bcm2711-rpi-4-b.dtb /mnt
sudo cp kernel8-rpi4.img /mnt/kernel8.img
sudo umount /mnt
Now put the SD card in the Pi and turn it on.
Building for the Zero
Get the AArch32 bare-metal target toolchain:
cd ~/builds
wget "https://developer.arm.com/-/media/Files/…96E6450E14A3E26" -O arm-gnu-toolchain-13.2.rel1-x86_64-arm-none-eabi.tar.xz
unxz arm-gnu-toolchain-13.2.rel1-x86_64-arm-none-eabi.tar.xz
tar xf arm-gnu-toolchain-13.2.rel1-x86_64-arm-none-eabi.tar
rm arm-gnu-toolchain-13.2.rel1-x86_64-arm-none-eabi.tar
Build the Circle libraries and sample:
cd ~/builds/circle
PATH=$PATH:~/builds/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin ./configure -f -r 1 -p arm-none-eabi- --keymap UK
PATH=$PATH:~/builds/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin ./makeall clean
PATH=$PATH:~/builds/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin ./makeall
cd sample/08-usbkeyboard
PATH=$PATH:~/builds/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin make clean
PATH=$PATH:~/builds/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin make
This gives a kernel.img file - install it on the SD card.
For the Raspberry Pi Zero you need a slightly different set of other files on the SD card: