Skip to content

Commit

Permalink
Stub in a platform for the 64bit Beagles, get fppd compiling and running
Browse files Browse the repository at this point in the history
  • Loading branch information
dkulp committed Nov 16, 2024
1 parent a5e625e commit 493cc43
Show file tree
Hide file tree
Showing 17 changed files with 67 additions and 42 deletions.
1 change: 1 addition & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
],
"defines": [
"PLATFORM_BBB",
"PLATFORM_BB64",
"PLATFORM_PI"
],
"compilerPath": "/usr/bin/g++",
Expand Down
17 changes: 10 additions & 7 deletions src/boot/FPPINIT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,18 +327,21 @@ void configureBBB() {
}

// Beagle LEDS
std::string led;
if (getRawSetting("BBBLedPWR", led) && !led.empty()) {
if (led == "0") {
led = "0x00";
std::string pled;
if (getRawSetting("BBBLedPWR", pled) && !pled.empty()) {
if (pled == "0") {
pled = "0x00";
} else {
led = "0x38";
pled = "0x38";
}
exec("/usr/sbin/i2cset -f -y 0 0x24 0x0b 0x6e");
exec("/usr/sbin/i2cset -f -y 0 0x24 0x13 " + led);
exec("/usr/sbin/i2cset -f -y 0 0x24 0x13 " + pled);
exec("/usr/sbin/i2cset -f -y 0 0x24 0x0b 0x6e");
exec("/usr/sbin/i2cset -f -y 0 0x24 0x13 " + led);
exec("/usr/sbin/i2cset -f -y 0 0x24 0x13 " + pled);
}
#endif
#if defined(PLATFORM_BBB) || defined(PLATFORM_BB64)
std::string led;
if (getRawSetting("BBBLeds0", led) && !led.empty()) {
PutFileContents("/sys/class/leds/beaglebone:green:usr0/trigger", led);
}
Expand Down
11 changes: 9 additions & 2 deletions src/boot/FPPRTC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ static int getSettingInt() {
}

static int getBus() {
#ifdef PLATFORM_BBB
#if defined(PLATFORM_BBB) || defined(PLATFORM_BB64)
return 2;
#elif defined(PLATFORM_PI)
return 1;
Expand Down Expand Up @@ -174,6 +174,13 @@ static std::string getRTCDev() {
rtc = "/dev/rtc1";
}
}
#elif defined(PLATFORM_BB64)
if (FileExists("/sys/class/rtc/rtc1/name")) {
std::string drv = GetFileContents("/sys/class/rtc/rtc1/name");
if (!contains(drv, "rtc-ti-k3")) {
rtc = "/dev/rtc1";
}
}
#elif defined(PLATFORM_PI)
if (FileExists("/sys/class/rtc/rtc0/name")) {
std::string drv = GetFileContents("/sys/class/rtc/rtc0/name");
Expand Down Expand Up @@ -209,7 +216,7 @@ int main(int argc, char* argv[]) {
if (contains(ret, "Remote I/O error")) {
removeI2CDevice(dev, getBus());
} else {
#ifdef PLATFORM_BBB
#if defined(PLATFORM_BBB) || defined(PLATFORMBB64)
// set the built in rtc to the same time as read from the RTC
if (rtc != "/dev/rtc0") {
hwclock("-w", rtc.c_str());
Expand Down
6 changes: 1 addition & 5 deletions src/channeloutput/BBBSerial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,7 @@ int BBBSerialOutput::Init(Json::Value config) {
string pru_program = "/tmp/FalconSerial.out";

const char* mode = BBB_PRU ? "gpio" : "pruout";
if (BBB_PRU) {
args.push_back("-DRUNNING_ON_PRU1");
} else {
args.push_back("-DRUNNING_ON_PRU0");
}
args.push_back("-DRUNNING_ON_PRU" + std::to_string(BBB_PRU));

std::string verPostf = "";
std::string device = config["device"].asString();
Expand Down
2 changes: 1 addition & 1 deletion src/channeloutput/ChannelOutputSetup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ int InitializeChannelOutputs(void) {
"/co-other.json",
"/co-pixelStrings.json",
"/co-pwm.json",
#ifdef PLATFORM_BBB
#if defined(PLATFORM_BBB) || defined(PLATFORM_BB64)
"/co-bbbStrings.json",
#endif
"/channeloutputs.json",
Expand Down
4 changes: 4 additions & 0 deletions src/channeloutput/GenericSPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
//TODO need to confirm these
#define MIN_SPI_SPEED_HZ 1500
#define MAX_SPI_SPEED_HZ 48000000
#elif PLATFORM_BB64
//TODO need to confirm these
#define MIN_SPI_SPEED_HZ 32000
#define MAX_SPI_SPEED_HZ 125000000
#elif PLATFORM_ARMBIAN
#define MIN_SPI_SPEED_HZ 50000
#define MAX_SPI_SPEED_HZ 2500000
Expand Down
4 changes: 3 additions & 1 deletion src/fppd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@

#include "fppd.h"

#if defined(PLATFORM_BBB)
#if defined(PLATFORM_BBB) || defined(PLATFORM_BB64)
#include "util/BBBUtils.h"
#define PLAT_GPIO_CLASS BBBPinProvider
#elif defined(PLATFORM_PI)
Expand Down Expand Up @@ -332,6 +332,8 @@ static void handleCrash(int s) {
char sysType[] = "Armbian";
#elif defined(PLATFORM_BBB)
char sysType[] = "BBB";
#elif defined(PLATFORM_BB64)
char sysType[] = "BB64";
#elif defined(PLATFORM_PI)
char sysType[] = "Pi";
#elif defined(PLATFORM_OSX)
Expand Down
2 changes: 1 addition & 1 deletion src/fseq/FSEQFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ static void SetThreadName(const std::string& name) {
#define PLATFORM_UNKNOWN
#endif

#if defined(PLATFORM_PI) || defined(PLATFORM_BBB) || defined(PLATFORM_UNKNOWN) || defined(PLATFORM_DEBIAN) || defined(PLATFORM_FEDORA) || defined(PLATFORM_UBUNTU) || defined(PLATFORM_MINT)
#if defined(PLATFORM_PI) || defined(PLATFORM_BBB) || defined(PLATFORM_BB64) || defined(PLATFORM_UNKNOWN) || defined(PLATFORM_DEBIAN) || defined(PLATFORM_FEDORA) || defined(PLATFORM_UBUNTU) || defined(PLATFORM_MINT)
// for FPP, use FPP logging
#include "Warnings.h"
#include "log.h"
Expand Down
10 changes: 8 additions & 2 deletions src/makefiles/libfpp-co-FalconV5Support.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,14 @@ LIBS_fpp_FalconV5Support_so += -L. -lfpp -ljsoncpp -lFalconV5 -Wl,-rpath=$(SRCDI
TARGETS += libFalconV5.$(SHLIB_EXT) libfpp-FalconV5Support.$(SHLIB_EXT) non-gpl/FalconV5Support/FalconV5PRUListener_pru0.out
OBJECTS_ALL+=$(OBJECTS_fpp_FalconV5Support_so)

libFalconV5.$(SHLIB_EXT): non-gpl/FalconV5Support/libFalconV5.$(SHLIB_EXT).zst
zstd -fd non-gpl/FalconV5Support/libFalconV5.$(SHLIB_EXT).zst -o libFalconV5.$(SHLIB_EXT)
ifeq '$(ARMV)' 'aarch64'
ZEXT=.aarch64
else
ZEXT=
endif

libFalconV5.$(SHLIB_EXT): non-gpl/FalconV5Support/libFalconV5.$(SHLIB_EXT)$(ZEXT).zst
zstd -fd non-gpl/FalconV5Support/libFalconV5.$(SHLIB_EXT)$(ZEXT).zst -o libFalconV5.$(SHLIB_EXT)

libfpp-FalconV5Support.$(SHLIB_EXT): $(OBJECTS_fpp_FalconV5Support_so) libfpp.$(SHLIB_EXT) libFalconV5.$(SHLIB_EXT)
$(CCACHE) $(CC) -shared $(CFLAGS_$@) $(OBJECTS_fpp_FalconV5Support_so) $(LIBS_fpp_FalconV5Support_so) $(LDFLAGS) $(LDFLAGS_fpp_FalconV5Support_so) -o $@
Expand Down
14 changes: 9 additions & 5 deletions src/makefiles/platform/bb.mk
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# BeagleBone Black
ifeq '$(ARCH)' 'BeagleBone Black'

CFLAGS += \
-DPLATFORM_BBB

LIBS_GPIO_ADDITIONS=
OBJECTS_GPIO_ADDITIONS+=util/BBBUtils.o
LIBS_GPIO_ADDITIONS+=-lgpiod -lgpiodcxx
Expand All @@ -18,7 +15,14 @@ BUILD_FPPINIT=1
LDFLAGS=-lrt -lpthread
SHLIB_EXT=so

# Beagles are ALL armv7a processors with neon
CFLAGS+=-march=armv7-a+neon -mfloat-abi=hard -mfpu=neon
ARMV := $(shell uname -m 2> /dev/null)
$(shell echo "Building FPP on '$(ARMV)' architecture" 1>&2)

ifeq '$(ARMV)' 'aarch64'
CFLAGS+=-DPLATFORM_BB64
else
# All 32bit Beagles are armv7a processors with neon
CFLAGS+=-DPLATFORM_BBB -march=armv7-a+neon -mfloat-abi=hard -mfpu=neon
endif

endif
10 changes: 5 additions & 5 deletions src/mediaoutput/mediaoutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,11 +313,11 @@ int OpenMediaOutput(const std::string& filename) {
lock.lock();
std::string vOut = getSetting("VideoOutput");
if (vOut == "") {
#if !defined(PLATFORM_BBB)
vOut = "--HDMI--";
#else
vOut = "--Disabled--";
#endif
if (FileExists("/sys/class/drm/card0-HDMI-A-1/status") || FileExists("/sys/class/drm/card1-HDMI-A-1/status")) {
vOut = "--HDMI--";
} else {
vOut = "--Disabled--";
}
}
mediaOutput = CreateMediaOutput(tmpFile, vOut);
if (!mediaOutput) {
Expand Down
2 changes: 1 addition & 1 deletion src/non-gpl/BBB48String/BBB48String.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ void BBB48StringOutput::createOutputLengths(FrameData& d, const std::string& pfx
}

if (sizes.empty()) {
args.push_back("-DFIRST_CHECK=NO_PIXELS_CHECK");
args.emplace_back("-DFIRST_CHECK=NO_PIXELS_CHECK");
} else {
int sz = sizes.begin()->first;
std::string v = "-DFIRST_CHECK=CHECK_" + pfx;
Expand Down
10 changes: 8 additions & 2 deletions src/non-gpl/CapeUtils/CapeUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
#include <openssl/decoder.h>
#endif

#ifdef PLATFORM_BBB
#if defined(PLATFORM_BBB) || defined(PLATFORM_BB64)
#define I2C_DEV 2
#elif defined(PLATFORM_PI)
#define I2C_DEV 1
Expand Down Expand Up @@ -272,6 +272,9 @@ static uint8_t* get_file_contents(const std::string& path, int& len) {
#ifdef PLATFORM_PI
static const std::string PLATFORM_DIR = "pi";
const std::string& getPlatformCapeDir() { return PLATFORM_DIR; }
#elif defined(PLATFORM_BB64)
static const std::string PLATFORM_DIR = "bb64";
const std::string& getPlatformCapeDir() { return PLATFORM_DIR; }
#elif defined(PLATFORM_BBB)
static const std::string PLATFORM_DIR_BBB = "bbb";
static const std::string PLATFORM_DIR_PB = "pb";
Expand Down Expand Up @@ -359,6 +362,9 @@ static void processBootConfig(Json::Value& bootConfig) {
const std::string fileName = FPP_BOOT_DIR "/config.txt";
#elif defined(PLATFORM_BBB)
const std::string fileName = FPP_BOOT_DIR "/uEnv.txt";
#elif defined(PLATFORM_BB64)
// TODO - booting is VERY different on BB64
const std::string fileName;
#elif defined(PLATFORM_ARMBIAN)
const std::string fileName = FPP_BOOT_DIR "/armbianEnv.txt";
#else
Expand Down Expand Up @@ -1119,7 +1125,7 @@ class CapeInfo {
std::string mapV5Config(const std::string& orig) {
std::string stringsConfigFile = "";
std::string platformDir = "/opt/fpp/capes/" + getPlatformCapeDir();
#if defined(PLATFORM_BBB)
#if defined(PLATFORM_BBB) || defined(PLATFORM_BB64)
stringsConfigFile = "/home/fpp/media/config/co-bbbStrings.json";
#elif defined(PLATFORM_PI)
stringsConfigFile = "/home/fpp/media/config/co-pixelStrings.json";
Expand Down
4 changes: 0 additions & 4 deletions src/non-gpl/FalconV5Support/FalconV5Support.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@
#include "channeloutput/serialutil.h"
#include "util/GPIOUtils.h"

#ifdef PLATFORM_BBB
#include "util/BBBPruUtils.h"
#include "util/BBBUtils.h"
#include <sys/wait.h>
#include <arm_neon.h>
#endif

extern "C" {
bool encodeFalconV5Packet(const Json::Value& description, uint8_t* packet);
Expand All @@ -38,13 +36,11 @@ class FalconV5Listener {
public:
FalconV5Listener(const Json::Value& config) {
pin = config["pin"].asString();
#ifdef PLATFORM_BBB
const PinCapabilities& p = PinCapabilities::getPinByName(pin);
p.configPin("pruin");

const BBBPinCapabilities* pc = (const BBBPinCapabilities*)p.ptr();
offset = pc->pruPin;
#endif
}
~FalconV5Listener() {
const PinCapabilities& p = PinCapabilities::getPinByName(pin);
Expand Down
Binary file not shown.
10 changes: 5 additions & 5 deletions src/playlist/PlaylistEntryMedia.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,11 +336,11 @@ int PlaylistEntryMedia::OpenMediaOutput(void) {
vOut = getSetting("VideoOutput");
}
if (vOut == "") {
#if !defined(PLATFORM_BBB)
vOut = "--HDMI--";
#else
vOut = "--Disabled--";
#endif
if (FileExists("/sys/class/drm/card0-HDMI-A-1/status") || FileExists("/sys/class/drm/card1-HDMI-A-1/status")) {
vOut = "--HDMI--";
} else {
vOut = "--Disabled--";
}
}

m_mediaOutput = CreateMediaOutput(tmpFile, vOut);
Expand Down
2 changes: 1 addition & 1 deletion src/sensors/Sensors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

#include "Sensors.h"

#ifdef PLATFORM_BBB
#if defined(PLATFORM_BBB) || defined(PLATFORM_BB64)
#define I2C_DEV 2
#else
#define I2C_DEV 1
Expand Down

0 comments on commit 493cc43

Please sign in to comment.