diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index 338b29eb7..aa3abd968 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -10,6 +10,7 @@ ], "defines": [ "PLATFORM_BBB", + "PLATFORM_BB64", "PLATFORM_PI" ], "compilerPath": "/usr/bin/g++", diff --git a/src/boot/FPPINIT.cpp b/src/boot/FPPINIT.cpp index 90628f001..177ca31ce 100644 --- a/src/boot/FPPINIT.cpp +++ b/src/boot/FPPINIT.cpp @@ -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); } diff --git a/src/boot/FPPRTC.cpp b/src/boot/FPPRTC.cpp index 2e252f633..7500cdab4 100644 --- a/src/boot/FPPRTC.cpp +++ b/src/boot/FPPRTC.cpp @@ -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; @@ -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"); @@ -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()); diff --git a/src/channeloutput/BBBSerial.cpp b/src/channeloutput/BBBSerial.cpp index dd79e3b56..6d659a051 100644 --- a/src/channeloutput/BBBSerial.cpp +++ b/src/channeloutput/BBBSerial.cpp @@ -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(); diff --git a/src/channeloutput/ChannelOutputSetup.cpp b/src/channeloutput/ChannelOutputSetup.cpp index 7bdb375ef..5d554e5b6 100644 --- a/src/channeloutput/ChannelOutputSetup.cpp +++ b/src/channeloutput/ChannelOutputSetup.cpp @@ -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", diff --git a/src/channeloutput/GenericSPI.cpp b/src/channeloutput/GenericSPI.cpp index 940499223..37da1665f 100644 --- a/src/channeloutput/GenericSPI.cpp +++ b/src/channeloutput/GenericSPI.cpp @@ -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 diff --git a/src/fppd.cpp b/src/fppd.cpp index 4b4332128..c43c7bbbb 100644 --- a/src/fppd.cpp +++ b/src/fppd.cpp @@ -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) @@ -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) diff --git a/src/fseq/FSEQFile.cpp b/src/fseq/FSEQFile.cpp index 4274cac07..758c1899f 100644 --- a/src/fseq/FSEQFile.cpp +++ b/src/fseq/FSEQFile.cpp @@ -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" diff --git a/src/makefiles/libfpp-co-FalconV5Support.mk b/src/makefiles/libfpp-co-FalconV5Support.mk index a0709a277..6846c4612 100644 --- a/src/makefiles/libfpp-co-FalconV5Support.mk +++ b/src/makefiles/libfpp-co-FalconV5Support.mk @@ -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 $@ diff --git a/src/makefiles/platform/bb.mk b/src/makefiles/platform/bb.mk index 994af68cd..29be56013 100644 --- a/src/makefiles/platform/bb.mk +++ b/src/makefiles/platform/bb.mk @@ -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 @@ -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 diff --git a/src/mediaoutput/mediaoutput.cpp b/src/mediaoutput/mediaoutput.cpp index ecf224c34..72e9638d8 100644 --- a/src/mediaoutput/mediaoutput.cpp +++ b/src/mediaoutput/mediaoutput.cpp @@ -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) { diff --git a/src/non-gpl/BBB48String/BBB48String.cpp b/src/non-gpl/BBB48String/BBB48String.cpp index 94df7f0b1..390e1cdd6 100644 --- a/src/non-gpl/BBB48String/BBB48String.cpp +++ b/src/non-gpl/BBB48String/BBB48String.cpp @@ -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; diff --git a/src/non-gpl/CapeUtils/CapeUtils.cpp b/src/non-gpl/CapeUtils/CapeUtils.cpp index 41e113f58..4bc198495 100644 --- a/src/non-gpl/CapeUtils/CapeUtils.cpp +++ b/src/non-gpl/CapeUtils/CapeUtils.cpp @@ -52,7 +52,7 @@ #include #endif -#ifdef PLATFORM_BBB +#if defined(PLATFORM_BBB) || defined(PLATFORM_BB64) #define I2C_DEV 2 #elif defined(PLATFORM_PI) #define I2C_DEV 1 @@ -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"; @@ -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 @@ -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"; diff --git a/src/non-gpl/FalconV5Support/FalconV5Support.cpp b/src/non-gpl/FalconV5Support/FalconV5Support.cpp index 4f7755816..d8b5bf575 100644 --- a/src/non-gpl/FalconV5Support/FalconV5Support.cpp +++ b/src/non-gpl/FalconV5Support/FalconV5Support.cpp @@ -22,12 +22,10 @@ #include "channeloutput/serialutil.h" #include "util/GPIOUtils.h" -#ifdef PLATFORM_BBB #include "util/BBBPruUtils.h" #include "util/BBBUtils.h" #include #include -#endif extern "C" { bool encodeFalconV5Packet(const Json::Value& description, uint8_t* packet); @@ -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); diff --git a/src/non-gpl/FalconV5Support/libFalconV5.so.aarch64.zst b/src/non-gpl/FalconV5Support/libFalconV5.so.aarch64.zst new file mode 100755 index 000000000..90761dde7 Binary files /dev/null and b/src/non-gpl/FalconV5Support/libFalconV5.so.aarch64.zst differ diff --git a/src/playlist/PlaylistEntryMedia.cpp b/src/playlist/PlaylistEntryMedia.cpp index acdb47301..a9c9c3dca 100644 --- a/src/playlist/PlaylistEntryMedia.cpp +++ b/src/playlist/PlaylistEntryMedia.cpp @@ -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); diff --git a/src/sensors/Sensors.cpp b/src/sensors/Sensors.cpp index 2b88543be..9057a8317 100644 --- a/src/sensors/Sensors.cpp +++ b/src/sensors/Sensors.cpp @@ -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