Skip to content

Commit

Permalink
-update makefile
Browse files Browse the repository at this point in the history
-update am-modulation WIP
  • Loading branch information
wodowiesel committed Dec 23, 2023
1 parent 87a2600 commit 6393709
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 36 deletions.
54 changes: 38 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ $(PFFLAGS)
##-DMODULE: This symbol tells the header files to give the appropriate definitions for a kernel module.

## Determine the hardware/software platform
LSCPU:=$(shell lscpu | grep "Model name" | awk '{print $$3}')
$(UNAME)
UNAME:=$(shell uname -m) ## processor: armv6l
$(UNAME)
KERNEL:=$(shell uname -a) ## kernel: Linux raspberrypi 4.19.97+ #1294 Thu Jan 30 13:10:54 GMT 2020 armv6l GNU/Linux
Expand All @@ -89,50 +91,70 @@ OSVERSION:=$(shell cat /etc/rpi-issue) ## os Date, http://github.com/RPi-Distro/
$(OSVERSION)
RPIVERSION:=$(shell cat /proc/device-tree/model) ## grab revision: | grep -a -o "Raspberry\sPi\sModel\s[A-Z]\sPlus" | grep -a -o "Rev\s[0-9].[0-9]" : Raspberry Pi Model B Plus Rev 1.2
$(RPIVERSION)
PIV:= $(shell expr $(RPIVERSION) | grep -a -o "Raspberry\sPi\sModel\s[A-Z]" | grep -o "[0-9]" = 4)
$(PIV)
PCPUI:=$(shell cat /proc/cpuinfo) ## cpuinfos my rev: 0010 -> 1.2 B+: | grep Revision | cut -c16-
$(PCPUI)

## Enable ARM-specific options only
## old/special pi versions
ifeq ($(UNAME), armv5)
PFLAGS=-march=native -mtune=native -mfloat-abi=soft -mfpu=vfp -ffast-math -DRPI
TARGET=RPI ## alternative1
PFLAGS=-march=native -mtune=native -mfloat-abi=soft -mfpu=vfp -ffast-math -DRPI
TARGET=RPI ## alternative1
endif

ifeq ($(UNAME), armv5l)
PFLAGS=-march=native -mtune=native -mfloat-abi=softfp -mfpu=vfp -ffast-math -DRASPBERRY
TARGET=RASPBERRY ## alternative2
PFLAGS=-march=native -mtune=native -mfloat-abi=softfp -mfpu=vfp -ffast-math -DRASPBERRY
TARGET=RASPBERRY ## alternative2
endif

ifeq ($(UNAME), armv6)
PFLAGS=-march=armv6 -mtune=arm1176jzf-s -mfloat-abi=softfp -mfpu=vfp -ffast-math -DRASPI0
TARGET=RASPI0 ## & Pi W
PFLAGS=-march=armv6 -mtune=arm1176jzf-s -mfloat-abi=softfp -mfpu=vfp -ffast-math -DRASPI0
TARGET=RASPI0 ## & Pi W
endif

ifeq ($(UNAME), armv6l)
PFLAGS=-march=armv6 -mtune=arm1176jzf-s -mfloat-abi=hard -mfpu=vfp -ffast-math -DRASPI1
TARGET=RASPI1
PFLAGS=-march=armv6 -mtune=arm1176jzf-s -mfloat-abi=hard -mfpu=vfp -ffast-math -DRASPI1
TARGET=RASPI1
endif

ifeq ($(UNAME), armv7l)
PFLAGS=-march=armv7-a -mtune=arm1176jzf-s -mfloat-abi=hard -mfpu=neon-vfpv4 -ffast-math -DRASPI2
TARGET=RASPI2
ifeq
PFLAGS=-march=armv7-a -mtune=arm1176jzf-s -mfloat-abi=hard -mfpu=neon-vfpv4 -ffast-math -DRASPI2
TARGET=RASPI2
else
PFLAGS=-march=armv7-a -mtune=arm1176jzf-s -mfloat-abi=hard -mfpu=vfp -ffast-math -DRASPI=4
TARGET = RASPI4L
endif

ifeq ($(UNAME), armv8l)
PFLAGS=-march=armv7-a -mtune=arm1176jzf-s -mfloat-abi=hard -mfpu=neon-vfpv4 -ffast-math -DRASPI3
TARGET=RASPI3
endif

ifeq ($(UNAME), armv8l)
PFLAGS=-march=armv7-a -mtune=arm1176jzf-s -mfloat-abi=hard -mfpu=neon-vfpv4 -ffast-math -DRASPI3
TARGET=RASPI3
PFLAGS=-march=armv7-a -mtune=arm1176jzf-s -mfloat-abi=hard -mfpu=neon-vfpv4 -ffast-math -DRASPI3
TARGET=RASPI4
endif

ifeq ($(UNAME), armv8l && $(PIV), 1)
PFLAGS=-march=armv8-a -mtune=cortex-a53 -mfloat-abi=hard -mfpu=neon-fp-armv8 -ffast-math -DRASPI4
TARGET=RASPI4
endif

ifeq ($(UNAME), armv8l && $(shell expr $(RPIVERSION) | grep -a -o "Raspberry\sPi\sModel\s[A-Z]" | grep -o "[0-9]" = 4), 1)
PFLAGS=-march=armv8-a -mtune=cortex-a53 -mfloat-abi=hard -mfpu=neon-fp-armv8 -ffast-math -DRASPI4
TARGET=RASPI4
ifeq ($(UNAME), aarch64)
ifeq ($(PCPUI), 14)
PFLAGS=-march=armv8-a -ffast-math -DRASPI=4A
TARGET=RASPI4A
else ifeq ($(LSCPU), Cortex-A72)
PFLAGS=-march=armv8-a -mtune=cortex-a72 -ffast-math -DRASPI=4C
TARGET=RASPI4C
endif

$(TARGET)
$(PFLAGS)

#@echo Compiling PiFunk
@echo "Compiling PiFunk"

## Generating objects in gcc specific order, -save-temps
## translated assembler/c-code
Expand Down
5 changes: 4 additions & 1 deletion __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ def main():
print ("Welcome to PiFunk lite!")

if __name__ == '__main__':
main()
try:
main()
except:
print("\nERROR\n")
10 changes: 5 additions & 5 deletions pifunklite.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ volatile unsigned (*allof7e); // shouuld be NULL in the begining
#define PWM_WRITES_PER_SAMPLE (10) //
#define PWM_CHANNEL_RANGE (32) //
#endif
// pi 0 zero & w
// pi0 zero & w
#ifdef RASPI0 //== 0
#define PERIPH_VIRT_BASE (0x20000000) // base=GPIO_offset dec: 2 virtual base
#define PERIPH_PHYS_BASE (0x7E000000) // dec: 2113929216
Expand All @@ -202,7 +202,7 @@ volatile unsigned (*allof7e); // shouuld be NULL in the begining
#define PWM_WRITES_PER_SAMPLE (10) //
#define PWM_CHANNEL_RANGE (32) //
#endif
// pi 1 - BCM2835 -> my version
// pi1 - BCM2835 -> my version
#ifdef RASPI1 // == 1
#define PERIPH_VIRT_BASE (0x20000000) // base=GPIO_offset dec: 2 virtual base
#define PERIPH_PHYS_BASE (0x7E000000) // dec: 2113929216
Expand All @@ -221,7 +221,7 @@ volatile unsigned (*allof7e); // shouuld be NULL in the begining
#define PWM_WRITES_PER_SAMPLE (10) //
#define PWM_CHANNEL_RANGE (32) //
#endif
// pi 2 - BCM2836/7
// pi2 - BCM2836/7
#ifdef RASPI2 //== 2
#define PERIPH_VIRT_BASE (0x3F000000) // dec: 1056964608
#define PERIPH_PHYS_BASE (0x7E000000) // dec: 2113929216
Expand Down Expand Up @@ -253,7 +253,7 @@ volatile unsigned (*allof7e); // shouuld be NULL in the begining
#define MEM_FLAG (0x04) // dec: 4
#define CURBLOCK (0x04) // dec: 4 memflag
#define OFF_VCLK (0x08) // dec: 2
#define CLOCK_BASE (19.2E6) //
#define CLOCK_BASE (19.2E6) //
#define XTAL_CLOCK (54.0E6) // = 54000000
#define PAGE_SIZE (1024) // 4096
#define DMA_CHANNEL (14) //
Expand All @@ -262,7 +262,7 @@ volatile unsigned (*allof7e); // shouuld be NULL in the begining
#define PWM_WRITES_PER_SAMPLE (10) //
#define PWM_CHANNEL_RANGE (32) //
#endif
// pi 4 - BCM2838
// pi4 - BCM2838
#ifdef RASPI4 //== 4
#define BCM2708_PERI_BASE (0xFE000000) // 4261412864
#define BCM2711_PERI_BASE (0x3F000000) // 1056964608, coprocessor!
Expand Down
34 changes: 20 additions & 14 deletions scripts/pifunklite.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,9 @@ def logger ():

##------------------------------------------------------------------------------
if __name__ == "__main__":
print ("\nStarting Program!\n")
(int (sys.argv [1])
print ("\nStarting Program!\n")
datetime.now().strftime("\n%d-%m-%Y, %H:%M:%S \n")
(int(sys.argv[1])

## run another py-script from shell-terminal (holds main script)
## selecting a individual band:
Expand All @@ -292,26 +293,27 @@ def logger ():

##------------------------------------------------------------------------------
## main program
__init__ ()
datetime.now().strftime("\n%d-%m-%Y, %H:%M:%S \n")
try:
__init__ ()

#print (datetime.datetime.now ())
#current_time = datetime.datetime.now ()
#str (datetime.now ())
#current_time.isoformat ()

## here a menu with switchcase
logger ()
csv_reader ()
logger ()
csv_reader ()

## if args not specified, else so to play
soundfile ()
frequency ()
sampler ()
channels ()
modulation ()
callsign ()
soundfile ()
frequency ()
sampler ()
channels ()
modulation ()
callsign ()

c_arg_parser ()
c_arg_parser ()

try:
## if all args are parsed so to transmission mode
Expand All @@ -328,7 +330,11 @@ def logger ():
except KeyboardInterrupt:
GPIO.cleanup() ## clean up GPIO on CTRL+C exit

GPIO.cleanup() ## clean up GPIO on normal exit
GPIO.cleanup() ## clean up GPIO on normal exit

except:
print("\nERROR\n")
pass
##------------------------------------------------------------------------------

## test-area
Expand Down

0 comments on commit 6393709

Please sign in to comment.