Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
C

circle

> 编程语言
Open source

A C++ bare metal environment for Raspberry Pi with USB (32 and 64 bit)

2.3K stars0 likes0 views
WebsiteGitHub

About

A C++ bare metal environment for Raspberry Pi with USB (32 and 64 bit)

Circle

Overview

Circle is a C++ bare metal programming environment for the Raspberry Pi. It should be usable on most existing models (see "Support Status" below). Circle provides several ready-tested C++ classes and add-on libraries, which can be used to control different hardware features of the Raspberry Pi. Together with Circle there are delivered several sample programs, which demonstrate the use of its classes. Circle can be used to create 32-bit or 64-bit bare metal applications.

Circle includes bigger (optional) third-party C-libraries for specific purposes in addon/ now. This is the reason why GitHub rates the project as a C-language-project. The main Circle libraries are written in C++ using classes instead. That's why it is called a C++ programming environment.

The 51st Step

This release offers a significantly improved implementation of the TCP/IP network stack. It supports TCP congestion control according to RFC 5681 with Fast Retransmit and Fast Recovery. Also the unnecessary copying of frames and data in the stack is largely prevented. This improves throughput very much, especially when a Raspberry Pi with 100 MBps Ethernet is connected to a Gigabit network.

The socket API is nearly unchanged, but the new MSG_MORE flag can be specified, when calling CSocket::Send() on TCP sockets, which prevents the immediate delivery of received data on the receiver side, when more data follows. CSocket::Bind() can be called with port 0 to bind to an ephemeral port, which can be requested using CSocket::GetOwnPort(). CSocket::SendTo() without preceding Bind() or Connect() is allowed too, which automatically assigns an ephemeral port.

Circle supports the extended C++ standard library support (LLVM libc++ port) in the circle-stdlib project in several ways (e.g. with the new STDLIB_SUPPORT=4 level).

The recommended toolchain to build Circle applications is now based on GCC 15.2.Rel1. See the link in the Build section! Circle is built with -std=c++17 by default now. There are options for selecting C++14 (previous default) and C++20 for the configure tool, beside the new --kernel-max-size, --clang and --kasan options. Enter ./configure --help for more info!

The recommended firmware has been updated in boot/.

More new features:

  • A CDevice instance can have property strings for vendor, product, serial number and function (e.g. the USB interface) now. These strings are assigned for all USB- and for NVMe devices, and can be used to distinguish devices of the same class. CDeviceNameService::ListDevices() can show these properties.
  • The system option USE_GPIO_MANAGER_FIQ has been added. When an application needs multiple FIQ-triggered GPIO interrupt pins, the class CGPIOPinFIQ cannot be used. It is also not possible to use CGPIOPinFIQ together with the class CGPIOManager to handle more GPIO pins with IRQ. Now one can define this option to enable CGPIOManager and all GPIO pins, which use an interrupt, to use the FIQ to reduce GPIO interrupt latency. The GPIO interrupt handler will run at FIQ_LEVEL then.
  • CGPIOClock::StartRate() can use fractional dividers on Raspberry 1-4. Before only integer dividers were supported. Now automatically a fractional divider will be used with MASH 1, if necessary.
  • The class CPipe (an unidirectional inter-process communication channel using a FIFO) and the methods CMutex::TryAcquire() and CSemaphore::DownWithTimeout() have been added to the scheduler library. CSemaphore objects can have the initial count of zero now. test/pipe demonstrates CPipe.
  • Sound devices allow writing and reading samples in the SoundFormatFloat32 now. Samples must be of the data type float in the range [-1.0 .. 1.0] in this case. sample/34-sounddevices and test/sound-controller can be configured to use this.
  • The class CPWMSoundBaseDevice supports the M/S PWM mode, which is also the default now. This should lead to a better audio quality and suppresses hum, when the PWM signal is delivered via the GPIO header.
  • The class CEMMCDevice in addon/SDCard supports external SDIO breakout boards at GPIO22-27 now as device "emmc2" and "SD2:" in FatFs. This does work with the EMMC host only (not with USE_SDHOST). On the Raspberry Pi 4 and CM4 the class can be instantiated twice with different device selector parameter specified to the constructor.
  • A CSSD1309Display graphics-mode driver for the SSD1309 128x64 OLED display controller (I2C and SPI) has been added to addon/display.
  • A CMCP23017 driver for the MCP23017 16-bit I2C GPIO expander has been added to the addon/gpio.
  • The MPU-6050 driver in addon/sensor has been extended and returns a scaled acceleration and gyroscope output now. The acceleration and gyroscope range and digital low-pass filter bandwidth can be configured. The sample adds a graphics mode.
  • The serial bootloader images are much smaller now and are able to load kernel images of up to about 8 MB.

A number of fixes have been applied:

  • CGPIOClock::Stop() was operating on the wrong clock. This caused a stop of the UART clock, when GPIOClock2 was started.
  • CMachineInfo::GetClockRate() now favors the firmware function GET_CLOCK_RATE_MEASURED over GET_CLOCK_RATE, which reported a wrong Core clock rate, when CCPUThrottle was used. The reported value is rounded to the closest MHz value.
  • The cmdline.txt option wm8960tune= has been added as a workaround. Add the given value to the fractional (K) part of PLL1 input/output frequency ratio (treated as 24-digit binary number) of the WM8960 Codec to suppress clicks/pops (range -10000 to 10000, default 0).
  • There have been multiple issues with the handling of TCP FIN packets, which were leading to a delayed termination of connections.
  • There was a problem found in the scheduler using KASan, which was accessing a task object after deleting it.

Features

Only the features with a "x" or other info are currently supported on the Raspberry Pi 5.

Circle supports the following features:

Group Features Raspberry Pi 5
C++ build environment AArch32 and AArch64 support AArch64 only
Basic library functions (e.g. new and delete) x
Enables all CPU caches using the MMU x
Interrupt support (IRQ and FIQ) IRQ only
Multi-core support (Raspberry Pi 2, 3 and 4) x
Cooperative non-preemptive scheduler x
CPU clock rate management x
Clang/LLVM support (experimental) x
Debug support Kernel logging to screen, UART and/or syslog server x
C-assertions with stack trace x
Hardware exception handler with stack trace x
GDB support using rpi_stub (Raspberry Pi 2 and 3)
Serial bootloader (by David Welch) included x
Software profiling support (single-core) x
QEMU support
Kernel Address Sanitizer support x
SoC devices GPIO pins (with interrupt, Act LED) and clocks x
Frame buffer (screen driver with escape sequences) limited
UART(s) (Polling and interrupt driver) x
System timer (with kernel timers) x
Platform DMA controller DMA40 only
RP1 platform DMA controller (Raspberry Pi 5 only) x
EMMC SD card interface driver x
SDHOST SD card interface driver (Raspberry Pi 1-3)
PWM output (2 channels) 4 channels
PWM sound output (on headphone jack) with adapter
I2C master(s) and slave masters only
SPI0 master (Polling and DMA driver) x
SPI1 auxiliary master (Polling)
SPI3-6 masters of Raspberry Pi 4 (Polling) SPI1-3 and 5
SMI master
I2S sound output and input x
HDMI sound output (without VCHIQ) x
Hardware random number generator x
Watchdog device x
Official Raspberry Pi touch screen (v1 only)
VCHIQ interface and audio service drivers
BCM54213PE Gigabit Ethernet NIC of Raspberry Pi 4
MACB / GEM Gigabit Ethernet NIC of Raspberry Pi 5 x
Wireless LAN access x
Driver for XPT2046-based touch screens x
NVMe SSD driver for Raspberry Pi 5 (experimental) x
USB Host controller interface (HCI) drivers x
Standard hub driver (USB 2.0 only) x
HID class device drivers (keyboard, mouse, gamepad) x
Driver for on-board Ethernet device (SMSC951x)
Driver for on-board Ethernet device (LAN7800)
Driver for CDC Ethernet devices (RTL815x, QEMU)
Driver for USB mass storage devices (bulk only) x
Driver for USB floppy disk devices (experimental) x
Driver for USB audio streaming devices (RPi 4 only) x
Drivers for different USB serial devices x
Audio class MIDI input support x
Touchscreen driver (digitizer mode) x

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Cbare-metalc-plus-plusraspberry-pitcp-ip

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言