From 03be0764a1b1971455a3684579ae5fbccefeec38 Mon Sep 17 00:00:00 2001 From: mamborambo <36679886+mamborambo@users.noreply.github.com> Date: Thu, 22 Nov 2018 00:00:00 +0000 Subject: [PATCH 1/3] Clean Makefile Set c++ standard to c++11 --- src/Makefile | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/Makefile b/src/Makefile index 65a2c9c..c6132e0 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,21 +1,16 @@ - -all: librpitx - -CFLAGS = -Wall -O3 -Wno-unused-variable -LDFLAGS = -lm -lrt -lpthread -CCP = g++ -CC = gcc +CFLAGS = -Wall -O3 -Wno-unused-variable +CXXFLAGS = -std=c++11 -Wall -O3 -Wno-unused-variable +LDFLAGS = -lm -lrt -lpthread +CCP = c++ +CC = cc librpitx: librpitx.h gpio.h gpio.cpp dma.h dma.cpp mailbox.c raspberry_pi_revision.c fmdmasync.h fmdmasync.cpp ngfmdmasync.h ngfmdmasync.cpp dsp.h dsp.cpp iqdmasync.h iqdmasync.cpp serialdmasync.h serialdmasync.cpp phasedmasync.h phasedmasync.cpp fskburst.h fskburst.cpp $(CC) $(CFLAGS) -c -o mailbox.o mailbox.c $(CC) $(CFLAGS) -c -o raspberry_pi_revision.o raspberry_pi_revision.c - $(CCP) $(CFLAGS) -c dsp.cpp iqdmasync.cpp ngfmdmasync.cpp fmdmasync.cpp dma.cpp gpio.cpp serialdmasync.cpp phasedmasync.cpp amdmasync.h amdmasync.cpp fskburst.cpp + $(CCP) $(CXXFLAGS) -c dsp.cpp iqdmasync.cpp ngfmdmasync.cpp fmdmasync.cpp dma.cpp gpio.cpp serialdmasync.cpp phasedmasync.cpp amdmasync.h amdmasync.cpp fskburst.cpp $(AR) rc librpitx.a dsp.o iqdmasync.o ngfmdmasync.o fmdmasync.o dma.o gpio.o mailbox.o raspberry_pi_revision.o serialdmasync.o phasedmasync.o amdmasync.o fskburst.o +install: librpitx clean: - - rm -f *.o *.a - -#install: all - + rm -f *.o *.a From 0b586212b156b15e31fd38c5bc3427093d636cbe Mon Sep 17 00:00:00 2001 From: mamborambo <36679886+mamborambo@users.noreply.github.com> Date: Thu, 22 Nov 2018 00:00:00 +0000 Subject: [PATCH 2/3] Add missing includes Else compilation fails --- src/amdmasync.cpp | 1 + src/dsp.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/src/amdmasync.cpp b/src/amdmasync.cpp index ff4d76a..fc51c53 100644 --- a/src/amdmasync.cpp +++ b/src/amdmasync.cpp @@ -22,6 +22,7 @@ This program is free software: you can redistribute it and/or modify #include #include #include +#include amdmasync::amdmasync(uint64_t TuneFrequency,uint32_t SR,int Channel,uint32_t FifoSize):bufferdma(Channel,FifoSize,3,2) diff --git a/src/dsp.cpp b/src/dsp.cpp index 33f26f6..e6ff654 100644 --- a/src/dsp.cpp +++ b/src/dsp.cpp @@ -17,6 +17,7 @@ This program is free software: you can redistribute it and/or modify #include "dsp.h" +#include dsp::dsp() { From 5f716d78234dca18120a90f2f8ebe222718c197f Mon Sep 17 00:00:00 2001 From: mamborambo <36679886+mamborambo@users.noreply.github.com> Date: Thu, 22 Nov 2018 00:00:00 +0000 Subject: [PATCH 3/3] Fix warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gpio.cpp:119:39: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 3 has type ‘uint64_t {aka long unsigned int}’ [-Wformat=] mailbox.c:66:33: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] --- src/gpio.cpp | 2 +- src/mailbox.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gpio.cpp b/src/gpio.cpp index 7689acf..00160d6 100644 --- a/src/gpio.cpp +++ b/src/gpio.cpp @@ -116,7 +116,7 @@ uint64_t clkgpio::GetPllFrequency(int PllNo) Freq = XOSC_FREQUENCY * ((uint64_t)gpioreg[PLLH_CTRL] & 0x3ff) + XOSC_FREQUENCY * (uint64_t)gpioreg[PLLH_FRAC] / (1 << 20); break; } - fprintf(stderr, "Freq = %lld\n", Freq); + fprintf(stderr, "Freq = %lu\n", Freq); return Freq; } diff --git a/src/mailbox.c b/src/mailbox.c index 4ef05ca..e172615 100644 --- a/src/mailbox.c +++ b/src/mailbox.c @@ -63,7 +63,7 @@ void *mapmem(unsigned base, unsigned size) printf("base=0x%x, mem=%p\n", base, mem); #endif if (mem == MAP_FAILED) { - printf("mmap error %d\n", (int)mem); + printf("mmap error %p\n", mem); exit (-1); } close(mem_fd);