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

Build for 32-bit armhf #1

Merged
merged 2 commits into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ jobs:


build_wheels:
name: Wheels on ${{ matrix.os }}${{ matrix.extra }}
name: Wheels on ${{ matrix.os }} ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
arch_linux: ["aarch64"]
arch: ["aarch64", "armv7l"]
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -57,7 +57,7 @@ jobs:

- uses: pypa/[email protected]
env:
CIBW_ARCHS_LINUX: ${{ matrix.arch_linux }}
CIBW_ARCHS_LINUX: ${{ matrix.arch }}
CIBW_BUILD: "cp311-manylinux* cp312-manylinux* cp313-manylinux*"
CIBW_MANYLINUX_AARCH64_IMAGE: "manylinux_2_28"
- name: Verify clean directory
Expand All @@ -67,7 +67,7 @@ jobs:
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheel-${{ matrix.os }}${{ matrix.artifact-extra }}
name: wheel-${{ matrix.os }}${{ matrix.arch }}
path: wheelhouse/*.whl
compression-level: 0
if-no-files-found: error
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
[submodule "src/utils"]
path = src/utils
url = https://github.com/raspberrypi/utils
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

ext_modules = [
Pybind11Extension("adafruit_raspberry_pi5_neopixel_write",
["src/main.cpp", "src/utils/piolib/piolib.c", "src/utils/piolib/pio_rp1.c"],
["src/main.cpp", "src/piolib.c", "src/pio_rp1.c"],
define_macros = [('VERSION_INFO', __version__)],
include_dirs = ['./src/utils/piolib/include'],
include_dirs = ['./src/include'],
# use this setting when debugging
#extra_compile_args = ["-g3", "-Og"],
),
Expand Down
29 changes: 29 additions & 0 deletions src/README_piolib.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# piolib

PIOlib/libPIO is a user-space API to the rp1-pio driver, which gives access to the PIO hardware of RP1. It takes the form of a clone of the PICO SDK PIO API, where most of the methods are implemented as RPC calls to RP1. This allows existing PIO code to be run without (much) alteration, but runs into problems when it relies on the PIO state machine and the support code being closely coupled.

To build piolib:
1. cmake . (or create a build subdirectory and cmake ..)
2. make

If `ls -l /dev/pio0` reports that the file is not found, you may need to update your Pi 5 firmware to one with PIO support and make sure that you are running a suitably recent kernel.
If `ls -l /dev/pio0` reports that the file is owned by `root` and group `root`, you should add the following to /etc/udev/rules/99-com.rules:
```
SUBSYSTEM=="*-pio", GROUP="gpio", MODE="0660"
```

Examples:

* piotest:
This is the normal WS2812 example LED PIO code, but using DMA to send the data. The optional parameter is the GPIO number to drive; the defailt is 2.
* piopwm:
The PWM example, unmodified except for dynamic SM allocation and a command line parameter to choose the GPIO. The optional parameter is the GPIO number to drive; the default is 4.
* piows2812:
The ws2812 example, unmodified except for dynamic SM allocation and a command line parameter to choose the GPIO. The optional parameter is the GPIO number to drive; the defailt is 2.
* rp1sm:
Show the state of the hardware for a particular SM. The parameter is the number of the state machine to inspect.
* dpi_interlace:
Nick's interlaced sync fixer. More of an example than something actually usable right now - it may eventually be built into a kernel driver. Run with "-n" or "--ntsc" to enable NTSC timing (it's PAL by default=)

Known issues:
* Blocking operations block the whole RP1 firmware interface until they complete.
24 changes: 24 additions & 0 deletions src/include/hardware/clocks.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2024 Raspberry Pi Ltd.
* All rights reserved.
*/

#ifndef _HARDWARE_CLOCKS_H
#define _HARDWARE_CLOCKS_H

enum clock_index {
clk_gpout0 = 0, ///< GPIO Muxing 0
clk_gpout1, ///< GPIO Muxing 1
clk_gpout2, ///< GPIO Muxing 2
clk_gpout3, ///< GPIO Muxing 3
clk_ref, ///< Watchdog and timers reference clock
clk_sys, ///< Processors, bus fabric, memory, memory mapped registers
clk_peri, ///< Peripheral clock for UART and SPI
clk_usb, ///< USB clock
clk_adc, ///< ADC clock
clk_rtc, ///< Real time clock
CLK_COUNT
};

#endif
65 changes: 65 additions & 0 deletions src/include/hardware/gpio.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2024 Raspberry Pi Ltd.
* All rights reserved.
*/
#ifndef _HARDWARE_GPIO_H
#define _HARDWARE_GPIO_H

#include "pio_platform.h"

#ifndef PARAM_ASSERTIONS_ENABLED_GPIO
#define PARAM_ASSERTIONS_ENABLED_GPIO 0
#endif

#define NUM_BANK0_GPIOS 32

enum gpio_function {
GPIO_FUNC_XIP = 0,
GPIO_FUNC_SPI = 1,
GPIO_FUNC_UART = 2,
GPIO_FUNC_I2C = 3,
GPIO_FUNC_PWM = 4,
GPIO_FUNC_SIO = 5,
GPIO_FUNC_PIO0 = 6,
GPIO_FUNC_PIO1 = 7,
GPIO_FUNC_GPCK = 8,
GPIO_FUNC_USB = 9,
GPIO_FUNC_NULL = 0x1f,
};

#define GPIO_OUT 1
#define GPIO_IN 0

enum gpio_irq_level {
GPIO_IRQ_LEVEL_LOW = 0x1u,
GPIO_IRQ_LEVEL_HIGH = 0x2u,
GPIO_IRQ_EDGE_FALL = 0x4u,
GPIO_IRQ_EDGE_RISE = 0x8u,
};

enum gpio_override {
GPIO_OVERRIDE_NORMAL =
0, ///< peripheral signal selected via \ref gpio_set_function
GPIO_OVERRIDE_INVERT =
1, ///< invert peripheral signal selected via \ref gpio_set_function
GPIO_OVERRIDE_LOW = 2, ///< drive low/disable output
GPIO_OVERRIDE_HIGH = 3, ///< drive high/enable output
};
enum gpio_slew_rate {
GPIO_SLEW_RATE_SLOW = 0, ///< Slew rate limiting enabled
GPIO_SLEW_RATE_FAST = 1 ///< Slew rate limiting disabled
};

enum gpio_drive_strength {
GPIO_DRIVE_STRENGTH_2MA = 0, ///< 2 mA nominal drive strength
GPIO_DRIVE_STRENGTH_4MA = 1, ///< 4 mA nominal drive strength
GPIO_DRIVE_STRENGTH_8MA = 2, ///< 8 mA nominal drive strength
GPIO_DRIVE_STRENGTH_12MA = 3 ///< 12 mA nominal drive strength
};

static inline void check_gpio_param(__unused uint gpio) {
invalid_params_if(GPIO, gpio >= NUM_BANK0_GPIOS);
}

#endif
11 changes: 11 additions & 0 deletions src/include/hardware/pio.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2024 Raspberry Pi Ltd.
* All rights reserved.
*/
#ifndef _HARDWARE_PIO_H
#define _HARDWARE_PIO_H

#include "piolib.h"

#endif
Loading
Loading