Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
7e15c4a
Switch from desyrdl to peakrdl for sysrdl
mwishek Oct 26, 2025
860deae
CDC updates for CSRs and PeakRDL transition complete
mwishek Oct 27, 2025
3cf82bb
Resolve merge/rebase conflicts
mwishek Oct 27, 2025
ca022b9
Add read back of async FIFO read/write pointers
mwishek Oct 27, 2025
4923b1f
Fix fifo pointer read
mwishek Oct 27, 2025
ccd7b74
added the = '1' so implicit type casting from std_logic to boolean wo…
Abraxas3d Oct 27, 2025
5da15eb
added = '1' to rd_status_req_sync2 test in order to gresolve implicit…
Abraxas3d Oct 27, 2025
a0e1f6f
added /rdl/src/axi4lite_intf_pkg.vhd to the IP list in /pluto_msk/lib…
Abraxas3d Oct 27, 2025
b23e0f8
putting read_vhdl pkg_msk_top_regs.vhd up above, and making sure 2008…
Abraxas3d Oct 28, 2025
3558ba2
there was a name mismatch so I changed it to match like this: USE wor…
Abraxas3d Oct 28, 2025
bdac6a3
Remove rdl/vhdl folder and contents, revert USE library to work.msk_t…
mwishek Oct 28, 2025
a56c29b
added reg_utils.vhd to /library/msk_top_ip.tcl build script
Abraxas3d Oct 28, 2025
0550e64
removed desyrdl package from /library/msk_top_ip.tcl build script
Abraxas3d Oct 28, 2025
5266d12
changed path from rdl/vhdl/msk_top_regs/ to rdl/outputs/rtl
Abraxas3d Oct 28, 2025
e3c30b9
cast the wrong spell but fixed it to /rdl/outputs/rtl/msk_top_regs.vhd
Abraxas3d Oct 28, 2025
cfe0a80
vhdl2008 added to reg_utils.vhd to resolve errors
Abraxas3d Oct 28, 2025
d821407
vhdl2008 added to msk_top_regs.vhd. Should be the last one?
Abraxas3d Oct 28, 2025
86943dd
added cdc_resync.vhd pulse_detect.vhd and data_capture.vhd to add ip …
Abraxas3d Oct 28, 2025
dc22efd
Update regmap in README.md
mwishek Oct 29, 2025
e0dd889
rdl: move away from external registers to a write to capture model
mwishek Nov 4, 2025
fce224f
rdl: update descriptions for write-to-capture registers
mwishek Nov 4, 2025
eadbfcb
rdl: update register descriptions, add HTML output
mwishek Nov 6, 2025
a908758
sim: add readback of power register
mwishek Nov 6, 2025
0613fd1
Reset hdl submodule to match main
Abraxas3d Nov 7, 2025
169f9bd
merging edits from main to peakrdl, resolving conflicts to include th…
Abraxas3d Nov 7, 2025
9eb101e
Add XSim testbench support with PeakRDL compatibility
Abraxas3d Nov 8, 2025
6aeaa74
SYNC_TRANSFER_START is asking for a separate external sync signal, no…
Abraxas3d Nov 8, 2025
0cf8b61
rdl: register description improvements
mwishek Nov 8, 2025
a767c1c
rdl: output artifacts
mwishek Nov 8, 2025
5976835
resolved issue number 22 with comments to distinguish between signals…
Abraxas3d Nov 11, 2025
7d7a5f0
Merge branch 'peakrdl' of https://github.com/OpenResearchInstitute/pl…
Abraxas3d Nov 11, 2025
18ed769
Revert frame_sync_detector.vhd - initialization changes inadvertently…
Abraxas3d Nov 12, 2025
7948a30
Remove unnecessary signal initializations and fix missing counter resets
Abraxas3d Nov 12, 2025
ffc877c
Merge initialization cleanup from test-init-removal
Abraxas3d Nov 12, 2025
1c55316
Clean up signal initializations in AXIS components
Abraxas3d Nov 12, 2025
cfd64ea
rdl: add requested rx frame sync status register
mwishek Nov 13, 2025
19c15f1
rdl: update outputs
mwishek Nov 13, 2025
6174fd3
rdl: update frame sync status register descriptions.
mwishek Nov 14, 2025
628ca20
Improved reset of FIFO read and write pointers. Works in sim and hard…
Abraxas3d Nov 15, 2025
7708fd8
encoder and decoder tested in loopback and pass. encoder and decoder …
Abraxas3d Nov 18, 2025
e0ddf29
data now good in loopback - defeated tricky FIFO to encoder timing bug
Abraxas3d Nov 19, 2025
f9b7ab0
new encoder and decoder files added to the list in msk_top_ip.tcl
Abraxas3d Nov 19, 2025
eae5b60
added hard decision convolutional encoder and decoder
Abraxas3d Nov 20, 2025
8ba0705
hard decision Viterbit decoder installed and input data equals output…
Abraxas3d Nov 20, 2025
e4ce3c2
input matches output but firmware build seg faults. Please send help.
Abraxas3d Nov 21, 2025
af474e7
seg fault resolved. needs testing on full test bench on mymelody.
Abraxas3d Nov 23, 2025
dbc5a1f
end to end data corruption resolved. input equals output.
Abraxas3d Nov 25, 2025
184aa7d
works in simulation, comes under LUT limit for PLUTO, but doesn't rou…
Abraxas3d Nov 25, 2025
a563e0a
simulation looks good for byte level interleaver. byte vs bit now opt…
Abraxas3d Nov 25, 2025
2cc8fa5
simulation now working with yet again the count back from tlast metho…
Abraxas3d Nov 25, 2025
247bead
experiment to isolate encoder as source of lab hardware transmitter s…
Abraxas3d Nov 26, 2025
cd5f27c
decoder created a stall with no gaps between frames. this is a fix fo…
Abraxas3d Nov 27, 2025
44356f2
Change the encoder to deassert tvalid unconditionally after frame com…
Abraxas3d Nov 28, 2025
501c991
Revert "Change the encoder to deassert tvalid unconditionally after f…
Abraxas3d Nov 28, 2025
77336cb
Prevent Vivado from optimizing away data paths. I think synthesis was…
Abraxas3d Nov 28, 2025
e2a45a7
transmitter stall resolved. had 134 as loop limit when needed 268.
Abraxas3d Dec 1, 2025
edc5a7b
Add LibreSDR (XC7Z020/AD9363) support
Abraxas3d Dec 1, 2025
91bd716
Improve the LibreSDR build documentation and setup script. The .xsa f…
Abraxas3d Dec 2, 2025
f57ad15
Fix LibreSDR project paths for auto-build
Abraxas3d Dec 2, 2025
391a18a
Fix system_project.tcl path to adi_env.tcl
Abraxas3d Dec 2, 2025
f4a092e
Fix libre XSA path to TARGETlibre/libre.sdk/
Abraxas3d Dec 2, 2025
b41d0d1
Fix HDL build directory: clear TARGET to prevent TARGETlibre/ subdire…
Abraxas3d Dec 2, 2025
0a1cafe
Use env -u TARGET to fully unset TARGET variable for HDL sub-build
Abraxas3d Dec 2, 2025
e72efc8
Fix TARGET variable inheritance: add override to project Makefiles
Abraxas3d Dec 3, 2025
8d6ec6c
Rename TARGET to PLATFORM to avoid ADI project-xilinx.mk subdirectory…
Abraxas3d Dec 3, 2025
67a4b98
Use MAKEOVERRIDES= to prevent command-line variables from propagating…
Abraxas3d Dec 3, 2025
e8be811
Unset MAKEFLAGS to prevent variable inheritance to HDL sub-make
Abraxas3d Dec 3, 2025
0ae5453
Update README.md to give accurate instructions based on the minor wor…
Abraxas3d Dec 3, 2025
1451197
Make UBOOT_VERSION platform-aware using COMPLETE_NAME from .mk files
Abraxas3d Dec 4, 2025
544b8b7
Make UBOOT_VERSION platform-aware with commit hash: COMPLETE_NAME + V…
Abraxas3d Dec 4, 2025
c9728e4
Fix sdimg target for libre: use build/fsbl.elf instead of ori/bitstream/
Abraxas3d Dec 4, 2025
51d2c3f
Keep intermediate files in sdimg for debugging
Abraxas3d Dec 4, 2025
27593e0
Fix MAKEFLAGS for all platforms and keep sdimg intermediate files
Abraxas3d Dec 4, 2025
c6b05d2
Fix LibreSDR pin constraints and Makefile sdimg dependencies
Abraxas3d Dec 5, 2025
e251ae9
fixed constraints for receiver
Abraxas3d Dec 6, 2025
a3c6a40
libre.its updated for build workflow. might not need this.
Abraxas3d Dec 6, 2025
d3a87ad
updated build instructions in setup_libre.sh
Abraxas3d Dec 6, 2025
9030600
library component was not being built because Makefile had wrong orde…
Abraxas3d Dec 6, 2025
b822164
DAC_DDS_DISABLE set to 1 to match Pluto and possibly solve tuning pro…
Abraxas3d Dec 6, 2025
ad2a6eb
re-enable DDS because we might need it for tuning
Abraxas3d Dec 6, 2025
eff798d
Update linux submodule: skip TX tuning for LibreSDR MSK
Abraxas3d Dec 7, 2025
cbcaa72
LibreSDR: Add SD boot support and fix serial port in uEnv.txt
Abraxas3d Dec 7, 2025
2dae4c4
LibreSDR: Skip TX tuning - MSK owns TX data path
Abraxas3d Dec 7, 2025
a38f3b9
Add KEEP_HIERARCHY and dont_touch to prevent Vivado optimization rot
Abraxas3d Dec 7, 2025
e2b074b
Upgrade frame sync detector from hard-decision Hamming distance to so…
Abraxas3d Dec 8, 2025
5a1696f
Update msk_demodulator: soft decision differential decode fix
Abraxas3d Dec 8, 2025
632235a
went ahead and added a missing output port for soft data from demodul…
Abraxas3d Dec 8, 2025
48ee3c0
Protect conv_encoder from synthesis optimization; update msk_demodulator
Abraxas3d Dec 8, 2025
797e06c
Update msk_demodulator: main now includes rx_data_soft with different…
Abraxas3d Dec 8, 2025
8a05b45
Merge branch 'main' into encoder-dev
Abraxas3d Dec 8, 2025
bb0d426
default dac-dmac CYCLIC in system_bd.tcl changed from 0 to 1 just in …
Abraxas3d Dec 8, 2025
d8db939
addressing HDL triggers yet again
Abraxas3d Dec 8, 2025
3dde9d1
project makefile DEPS updated for HDL changes triggering build
Abraxas3d Dec 8, 2025
f96bb4c
Stop tracking firmware/build artifacts
Abraxas3d Dec 8, 2025
1ab29d1
Ignore Vivado project artifacts
Abraxas3d Dec 8, 2025
503e7a2
correct clock rates in our copy of zynq-libre.dtsi
Abraxas3d Dec 12, 2025
62605d1
Update firmware/linux submodule to e14e351533f9 (v5.15-20952)
Abraxas3d Dec 12, 2025
8fbcf17
LVDS port progress: fixed AXIS DMA connections, TSAMPL=30.72MHz
Abraxas3d Dec 13, 2025
fb1ce90
Add BUFR clock divider for LibreSDR LVDS timing
Abraxas3d Dec 13, 2025
fc3be33
clock divider installed and transmitter samples synchronized across t…
Abraxas3d Dec 14, 2025
9421bde
ILA for transmit I and Q to investigate corrupted output spectrum on …
Abraxas3d Dec 14, 2025
5609ea8
Fix frame encoder/decoder for bit-level interleaving
Abraxas3d Dec 17, 2025
ea7cf39
Add soft-decision Viterbi decoder with 3-bit quantization
Abraxas3d Dec 17, 2025
99b6fd2
Add soft-decision Viterbi decoder with 3-bit quantization
Abraxas3d Dec 17, 2025
2d695f8
Integrate soft-decision decoder into receive path
Abraxas3d Dec 18, 2025
04f4348
Fix critical OUTPUT state variable range bug in ov_frame_encoder!
Abraxas3d Jan 2, 2026
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: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,11 @@ pluto.*/
pluto.xpr
component.xml

firmware/build/
projects/libre/libre.cache/
projects/libre/libre.gen/
projects/libre/libre.hw/
projects/libre/libre.ip_user_files/
projects/libre/libre.runs/
projects/libre/libre.srcs/
projects/libre/libre.xpr
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ The following ORI library components are used as submodules to this repository:
6. [power_detector](https://github.com/OpenResearchInstitute/power_detector)
7. [Exponential Moving Average Filter](https://github.com/OpenResearchInstitute/lowpass_ema)

## Building Pluto Firmware
In oder to build the FPGA bitstream, you first need to install Vivado. Recommended version is 2022.2. In this documentation and in the `Makefile`, the Vivado installation path is assumed to be `/opt/Xilinx/Vivado`. If it is in another directory, change the path in the steps below (for example, to `/tools/Xilinx/Vivado`) or create a symbolic link in `/opt` pointing to the actual installation directory. For example,
## Building
In order to build the FPGA bitstream, you first need to install Vivado. Recommended version is 2022.2. In this documentation and in the `Makefile`, the Vivado installation path is assumed to be `/opt/Xilinx/Vivado`. If it is in another directory, change the path in the steps below (for example, to `/tools/Xilinx/Vivado`) or create a symbolic link in `/opt` pointing to the actual installation directory. For example,
```
sudo ln -s /tools/Xilinx /opt/Xilinx
```
Expand Down Expand Up @@ -172,6 +172,8 @@ sys 39m46.236s
| 0x84 |lowpass_ema_alpha1| Exponential Moving Average Alpha |
| 0x88 |lowpass_ema_alpha2| Exponential Moving Average Alpha |
| 0x8C | rx_power | Receive Power |
| 0x90 |tx_async_fifo_rd_wr_ptr| Tx async FIFO read and write pointers |
| 0x94 |rx_async_fifo_rd_wr_ptr| Rx async FIFO read and write pointers |


See [MSK Top Regs](rdl/msk_top_regs.pdf) for detailed register definitions.
Expand Down
18 changes: 14 additions & 4 deletions docs/msk_math.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,12 @@ The four resulting values for the f1 mix are
cos(2𝝿f1t)*cos(2𝝿f1t) = 1/2 [ cos(2𝝿f1t - 2𝝿f1t) + cos(2𝝿f1t + 2𝝿f1t) ]
= 1/2 [ cos(0) + cos(4𝝿f1t) ]
= 1/2 [ 1 + cos(4𝝿f1t)]
= 1/2 + 1/2cos(2𝝿2f1t)

-cos(2𝝿f1t)*cos(2𝝿f1t) = -1/2 [ cos(2𝝿f1t - 2𝝿f1t) + cos(2𝝿f1t + 2𝝿f1t) ]
= -1/2 [ cos(0) + cos(4𝝿f1t) ]
= -1/2 [ 1 + cos(4𝝿f1t)]
= -1/2 - 1/2cos(2𝝿2f1t)

(both the previous results are a DC value and a sinusoid at 2*f1)

Expand Down Expand Up @@ -149,20 +151,28 @@ cos(2𝝿f1t)*sin(2𝝿f1t) = 1/2 [ sin(2𝝿f1t + 2𝝿f1t + theta) - sin(2𝝿
= 1/2 sin(4𝝿f1t + theta)


-cos(2𝝿f1t)*sin(2𝝿f1t) = -1/2 [ sin(2𝝿f1t + 2𝝿f1t) - sin(2𝝿f1t - 2𝝿f1t) ]
= -1/2 [ sin(4𝝿f1t) - sin(0) ]
= -1/2 sin(4𝝿f1t)
-cos(2𝝿f1t)*sin(2𝝿f1t) = -1/2 [ sin(2𝝿f1t + 2𝝿f1t + theta) - sin(2𝝿f1t - 2𝝿f1t + theta) ]
= -1/2 [ sin(2𝝿2f1t + theta) - sin(theta) ]
= -1/2 sin(2𝝿2f1t + theta)

again we only care about the DC component, which when the phases are aligned is 0. If the phases are not aligned the
sin(0) term becomes sin(Δφ) a constant.


cos(2𝝿f1t)*sin(2𝝿f1t) = 1/2 [ sin(2𝝿f2t + 2𝝿f1t) - sin(2𝝿f2t - 2𝝿f1t) ]
= 1/2 [ sin(2𝝿(f2+f1)t) - sin(2𝝿(f2-f1)t) ]
= 1/2 [ sin(2𝝿(f2+f1)t) - sin(2𝝿(f2-f1)t) ]


cos(2𝝿f1t)*sin(2𝝿f1t) = -1/2 [ sin(2𝝿f2t + 2𝝿f1t) - sin(2𝝿f2t - 2𝝿f1t) ]
= -1/2 [ sin(2𝝿(f2+f1)t) - sin(2𝝿(f2-f1)t) ]




error_instant = 1/2 sin(2𝝿2f1t + theta) * sign( 1/2 + 1/2cos(2𝝿2f1t))
= -1/2 sin(2𝝿2f1t + theta) * sign(-1/2 - 1/2cos(2𝝿2f1t))
= 1/2 sin(2𝝿2f1t + theta)

error = SUM_T(1/2 sin(2𝝿2f1t + theta)) = -cos(2𝝿2f1t + theta) + C


115 changes: 67 additions & 48 deletions firmware/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ VERSION=$(shell git describe --abbrev=4 --always --tags)
PATCH=$(shell cd ori && ./applypatch.sh )
$(shell git log --pretty=format:"%h - %ad : %s" > ori/board/pluto/overlay/root/fwhistory.txt)
#LATEST_TAG=$(shell git describe --abbrev=0 --tags)
UBOOT_VERSION=$(shell echo -n "PlutoSDR " && cd u-boot-xlnx && git describe --abbrev=0 --dirty --always --tags)
HAVE_VIVADO= $(shell bash -c "source $(VIVADO_SETTINGS) > /dev/null 2>&1 && vivado -version > /dev/null 2>&1 && echo 1 || echo 0")
#XSA_URL ?= http://github.com/maia-sdr/plutosdr-fw/releases/download/${LATEST_TAG}/system_top.xsa

Expand All @@ -43,25 +42,26 @@ ifneq (1, ${PATCH})
$(warning patch granted $(PATCH))
endif

TARGET ?= pluto
SUPPORTED_TARGETS:=pluto plutoplus e200
#XSA_FILE ?= ori/bitstream/${TARGET}/system_top.xsa
PLATFORM ?= pluto
SUPPORTED_TARGETS:=pluto plutoplus e200 libre
#XSA_FILE ?= ori/bitstream/${PLATFORM}/system_top.xsa

$(warning *** Building target $(TARGET),)
$(warning *** Building target $(PLATFORM),)

# Include target specific constants
include scripts/$(TARGET).mk
include scripts/$(PLATFORM).mk
UBOOT_VERSION=$(COMPLETE_NAME) $(VERSION)

ifeq (, $(shell which dfu-suffix))
$(warning "No dfu-utils in PATH consider doing: sudo apt-get install dfu-util")
TARGETS = build/pluto.frm build/boot.frm
TARGETS = build/$(PLATFORM).frm build/boot.frm
else
TARGETS = build/$(TARGET).dfu build/uboot-env.dfu build/pluto.frm build/boot.dfu build/boot.frm
TARGETS = build/$(PLATFORM).dfu build/uboot-env.dfu build/$(PLATFORM).frm build/boot.dfu build/boot.frm
endif

ifeq ($(findstring $(TARGET),$(SUPPORTED_TARGETS)),)
ifeq ($(findstring $(PLATFORM),$(SUPPORTED_TARGETS)),)
all:
@echo "Invalid `TARGET variable ; valid values are: pluto, sidekiqz2, plutoplus" &&
@echo "Invalid `PLATFORM variable ; valid values are: pluto, sidekiqz2, plutoplus" &&
exit 1
else
all: clean-build $(TARGETS) zip-all legal-info
Expand All @@ -85,8 +85,8 @@ build:
### u-boot ###

u-boot-xlnx/u-boot u-boot-xlnx/tools/mkimage: TOOLCHAIN
# $(TOOLS_PATH) make -C u-boot-xlnx ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) zynq_$(TARGET)_defconfig
$(TOOLS_PATH) make -C u-boot-xlnx ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) zynq_$(TARGET)_defconfig
# $(TOOLS_PATH) make -C u-boot-xlnx ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) zynq_$(PLATFORM)_defconfig
$(TOOLS_PATH) make -C u-boot-xlnx ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) zynq_$(PLATFORM)_defconfig
$(TOOLS_PATH) make -C u-boot-xlnx ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) UBOOTVERSION="$(UBOOT_VERSION)"

.PHONY: u-boot-xlnx/u-boot
Expand All @@ -103,10 +103,10 @@ build/uboot-env.bin: build/uboot-env.txt
### Linux ###

linux/arch/arm/boot/zImage: TOOLCHAIN
$(TOOLS_PATH) make -C linux -j $(NCORES) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) zynq_$(TARGET)_linux_defconfig zImage UIMAGE_LOADADDR=0x8000
$(TOOLS_PATH) make -C linux -j $(NCORES) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) zynq_$(TARGET)_linux_defconfig uImage UIMAGE_LOADADDR=0x8000
## $(TOOLS_PATH) make -C linux ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) defconfig zynq_$(TARGET)_defconfig
##$(TOOLS_PATH) make BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE=$(ABSOLUTE_PATH)/datv/configs/zynq_$(TARGET)datv_linux_defconfig -C linux -j $(NCORES) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) zImage UIMAGE_LOADADDR=0x8000
$(TOOLS_PATH) make -C linux -j $(NCORES) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) zynq_$(PLATFORM)_linux_defconfig zImage UIMAGE_LOADADDR=0x8000
$(TOOLS_PATH) make -C linux -j $(NCORES) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) zynq_$(PLATFORM)_linux_defconfig uImage UIMAGE_LOADADDR=0x8000
## $(TOOLS_PATH) make -C linux ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) defconfig zynq_$(PLATFORM)_defconfig
##$(TOOLS_PATH) make BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE=$(ABSOLUTE_PATH)/datv/configs/zynq_$(PLATFORM)datv_linux_defconfig -C linux -j $(NCORES) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) zImage UIMAGE_LOADADDR=0x8000

.PHONY: linux/arch/arm/boot/zImage
.PHONY: linux/arch/arm/boot/uImage
Expand Down Expand Up @@ -134,7 +134,7 @@ buildroot/output/images/rootfs.cpio.gz:
@echo device-fw $(VERSION) > $(BR2_EXTERNAL)/board/pluto/VERSIONS
@$(foreach dir,$(VSUBDIRS),echo $(dir) $(shell cd $(dir) && git describe --abbrev=4 --dirty --always --tags) >> $(BR2_EXTERNAL)/board/pluto/VERSIONS;)
make BR2_EXTERNAL=$(ABSOLUTE_PATH)/ori -C buildroot ARCH=arm zynq_pluto_ori_defconfig
## make -C buildroot ARCH=arm zynq_$(TARGET)_defconfig
## make -C buildroot ARCH=arm zynq_$(PLATFORM)_defconfig

ifneq (1, ${SKIP_LEGAL})
make -C buildroot legal-info
Expand All @@ -152,29 +152,39 @@ build/rootfs.cpio.gz: buildroot/output/images/rootfs.cpio.gz | build
make -C buildroot BUSYBOX_CONFIG_FILE=$(BR2_EXTERNAL)/board/pluto/busybox-1.25.0.config all
cp $< $@

build/$(TARGET).itb: u-boot-xlnx/tools/mkimage build/zImage build/rootfs.cpio.gz $(TARGET_DTS_FILES) build/system_top.bit
u-boot-xlnx/tools/mkimage -f scripts/$(TARGET).its $@
build/$(PLATFORM).itb: u-boot-xlnx/tools/mkimage build/zImage build/rootfs.cpio.gz $(TARGET_DTS_FILES) build/system_top.bit
u-boot-xlnx/tools/mkimage -f scripts/$(PLATFORM).its $@

build/system_top.xsa: | build
# HDL source dependencies - rebuild if any VHDL or TCL changes
HDL_SRCS := $(wildcard ../src/*.vhd) \
$(wildcard ../projects/$(PLATFORM)/*.tcl) \
$(wildcard ../library/*.tcl) \
$(wildcard ../msk_demodulator/src/*.vhd)

build/system_top.xsa: $(HDL_SRCS) | build
ifneq ($(XSA_FILE),)
cp $(XSA_FILE) $@
else ifneq ($(XSA_URL),)
wget -T 3 -t 1 -N --directory-prefix build $(XSA_URL)
else ifeq (1, ${HAVE_VIVADO})
#bash -c "source $(VIVADO_SETTINGS) && make -C maia-sdr/maia-hdl/projects/$(TARGET) && cp maia-sdr/maia-hdl/projects/$(TARGET)/$(TARGET).sdk/system_top.xsa $@"
#unzip -l $@ | grep -q ps7_init || cp maia-sdr/maia-hdl/projects/$(TARGET)/$(TARGET).srcs/sources_1/bd/system/ip/system_sys_ps7_0/ps7_init* build/
ifeq ($(TARGET),pluto)
bash -c "source $(VIVADO_SETTINGS) && make -C ../projects/pluto && cp ../projects/pluto/pluto.sdk/system_top.xsa $@"
#bash -c "source $(VIVADO_SETTINGS) && make -C maia-sdr/maia-hdl/projects/$(PLATFORM) && cp maia-sdr/maia-hdl/projects/$(PLATFORM)/$(PLATFORM).sdk/system_top.xsa $@"
#unzip -l $@ | grep -q ps7_init || cp maia-sdr/maia-hdl/projects/$(PLATFORM)/$(PLATFORM).srcs/sources_1/bd/system/ip/system_sys_ps7_0/ps7_init* build/
ifeq ($(PLATFORM),pluto)
bash -c "source $(VIVADO_SETTINGS) && cd ../projects/pluto && unset MAKEFLAGS && /usr/bin/make && cd ../../firmware && cp ../projects/pluto/pluto.sdk/system_top.xsa $@"
unzip -l $@ | grep -q ps7_init || cp ../projects/pluto/pluto.srcs/sources_1/bd/system/ip/system_sys_ps7_0/ps7_init* build/
endif
ifeq ($(TARGET),plutoplus)
bash -c "source $(VIVADO_SETTINGS) && make -C ../hdl/projects/pluto-ori-plus && cp ../hdl/projects/pluto-ori-plus/pluto.sdk/system_top.xsa $@"
ifeq ($(PLATFORM),plutoplus)
bash -c "source $(VIVADO_SETTINGS) && cd ../hdl/projects/pluto-ori-plus && unset MAKEFLAGS && /usr/bin/make && cd ../../../firmware && cp ../hdl/projects/pluto-ori-plus/pluto.sdk/system_top.xsa $@"
unzip -l $@ | grep -q ps7_init || cp ../hdl/projects/pluto-ori-plus/pluto.srcs/sources_1/bd/system/ip/system_sys_ps7_0/ps7_init* build/
endif
ifeq ($(TARGET),e200)
bash -c "source $(VIVADO_SETTINGS) && make -C ../hdl/projects/pluto-ori-e200 && cp ../hdl/projects/pluto-ori-e200/e200.sdk/system_top.xsa $@"
ifeq ($(PLATFORM),e200)
bash -c "source $(VIVADO_SETTINGS) && cd ../hdl/projects/pluto-ori-e200 && unset MAKEFLAGS && /usr/bin/make && cd ../../../firmware && cp ../hdl/projects/pluto-ori-e200/e200.sdk/system_top.xsa $@"
unzip -l $@ | grep -q ps7_init || cp ../hdl/projects/pluto-ori-e200/e200.srcs/sources_1/bd/system/ip/system_sys_ps7_0/ps7_init* build/
endif
ifeq ($(PLATFORM),libre)
bash -c "source $(VIVADO_SETTINGS) && make -C ../library && cd ../projects/libre && unset MAKEFLAGS && /usr/bin/make && cp libre.sdk/system_top.xsa ../../firmware/$@"
unzip -l $@ | grep -q ps7_init || cp ../projects/libre/libre.srcs/sources_1/bd/system/ip/system_sys_ps7_0/ps7_init* build/
endif
#bash -c "source $(VIVADO_SETTINGS) && make -C ../hdl/projects/pluto-ori-plus"
endif

Expand All @@ -184,6 +194,8 @@ build/fsbl.elf build/system_top.bit : build/system_top.xsa
rm -Rf build/sdk
ifeq (1, ${HAVE_VIVADO})
bash -c "source $(VIVADO_SETTINGS) && xsct scripts/create_fsbl_project.tcl"
cp build/sdk/fsbl/Release/fsbl.elf build/fsbl.elf
unzip -o build/system_top.xsa system_top.bit -d build
else
unzip -o build/system_top.xsa system_top.bit -d build
endif
Expand All @@ -194,12 +206,12 @@ ifeq (1, ${HAVE_VIVADO})
cp build/sdk/fsbl/Release/fsbl.elf build/fsbl.elf
bash -c "source $(VIVADO_SETTINGS) && bootgen -image build/boot.bif -w -o $@"
else
cp ori/bitstream/$(TARGET)/fsbl.elf build/fsbl.elf
cp ori/bitstream/$(PLATFORM)/fsbl.elf build/fsbl.elf
bash -c "bootgen -image build/boot.bif -w -o $@"
endif
### MSD update firmware file ###

build/pluto.frm: build/$(TARGET).itb
build/$(PLATFORM).frm: build/$(PLATFORM).itb
md5sum $< | cut -d ' ' -f 1 > $@.md5
cat $< $@.md5 > $@

Expand All @@ -213,39 +225,46 @@ build/%.dfu: build/%.bin
dfu-suffix -a $<.tmp -v $(DEVICE_VID) -p $(DEVICE_PID)
mv $<.tmp $@

build/$(TARGET).dfu: build/$(TARGET).itb
build/$(PLATFORM).dfu: build/$(PLATFORM).itb
cp $< $<.tmp
dfu-suffix -a $<.tmp -v $(DEVICE_VID) -p $(DEVICE_PID)
mv $<.tmp $@

SDIMGDIR = build/sdimg
sdimg: build | build/rootfs.cpio.gz
sdimg: build build/fsbl.elf build/system_top.bit build/u-boot.elf build/zynq-libre.dtb build/uboot-env.txt | build/rootfs.cpio.gz
mkdir -p $(SDIMGDIR)
cp ori/bitstream/$(TARGET)/fsbl.elf $(SDIMGDIR)/fsbl.elf
if [ "$(PLATFORM)" = "libre" ]; then cp build/fsbl.elf $(SDIMGDIR)/fsbl.elf; else cp ori/bitstream/$(PLATFORM)/fsbl.elf $(SDIMGDIR)/fsbl.elf; fi
cp build/system_top.bit $(SDIMGDIR)/system_top.bit
cp build/u-boot.elf $(SDIMGDIR)/u-boot.elf
cp linux/arch/arm/boot/uImage $(SDIMGDIR)/uImage

ifeq ($(TARGET),pluto)
ifeq ($(PLATFORM),pluto)
cp build/zynq-pluto-sdr.dtb $(SDIMGDIR)/devicetree.dtb
endif
ifeq ($(TARGET),plutoplus)
ifeq ($(PLATFORM),plutoplus)
cp build/zynq-plutoplus-maiasdr.dtb $(SDIMGDIR)/devicetree.dtb
endif
ifeq ($(TARGET),e200)
ifeq ($(PLATFORM),e200)
cp build/zynq-e200.dtb $(SDIMGDIR)/devicetree.dtb
endif
ifeq ($(PLATFORM),libre)
cp build/zynq-libre.dtb $(SDIMGDIR)/devicetree.dtb
endif
cp build/uboot-env.txt $(SDIMGDIR)/uEnv.txt
@if [ "$(PLATFORM)" = "libre" ]; then \
echo 'sdboot=if mmcinfo; then run uenvboot; echo Copying Linux from SD to RAM... && load mmc 0 $${fit_load_address} $${kernel_image} && load mmc 0 $${devicetree_load_address} $${devicetree_image} && load mmc 0 $${ramdisk_load_address} $${ramdisk_image} && bootm $${fit_load_address} $${ramdisk_load_address} $${devicetree_load_address}; fi' >> $(SDIMGDIR)/uEnv.txt; \
sed -i 's/serial@e0001000/serial@e0000000/g' $(SDIMGDIR)/uEnv.txt; \
fi
cp build/rootfs.cpio.gz $(SDIMGDIR)/ramdisk.image.gz
mkimage -A arm -T ramdisk -C gzip -d $(SDIMGDIR)/ramdisk.image.gz $(SDIMGDIR)/uramdisk.image.gz
touch $(SDIMGDIR)/boot.bif
echo "img : {[bootloader] $(SDIMGDIR)/fsbl.elf $(SDIMGDIR)/system_top.bit $(SDIMGDIR)/u-boot.elf}" > $(SDIMGDIR)/boot.bif
bootgen -image $(SDIMGDIR)/boot.bif -w -o i $(SDIMGDIR)/BOOT.bin
rm $(SDIMGDIR)/fsbl.elf
rm $(SDIMGDIR)/system_top.bit
rm $(SDIMGDIR)/u-boot.elf
rm $(SDIMGDIR)/ramdisk.image.gz
rm $(SDIMGDIR)/boot.bif
#rm $(SDIMGDIR)/fsbl.elf
#rm $(SDIMGDIR)/system_top.bit
#rm $(SDIMGDIR)/u-boot.elf
#rm $(SDIMGDIR)/ramdisk.image.gz
#rm $(SDIMGDIR)/boot.bif


clean-build:
Expand All @@ -262,8 +281,8 @@ clean:
zip-all: $(TARGETS)
mkdir -p Release && cd build && zip -r ../Release/$(ZIP_ARCHIVE_PREFIX)-fw-$(VERSION).zip *.dfu *.frm

dfu-$(TARGET): build/$(TARGET).dfu
dfu-util -D build/$(TARGET).dfu -a firmware.dfu
dfu-$(PLATFORM): build/$(PLATFORM).dfu
dfu-util -D build/$(PLATFORM).dfu -a firmware.dfu
dfu-util -e

dfu-sf-uboot: build/boot.dfu build/uboot-env.dfu
Expand All @@ -272,17 +291,17 @@ dfu-sf-uboot: build/boot.dfu build/uboot-env.dfu
dfu-util -D build/uboot-env.dfu -a uboot-env.dfu
dfu-util -e

dfu-all: build/$(TARGET).dfu build/boot.dfu build/uboot-env.dfu
dfu-all: build/$(PLATFORM).dfu build/boot.dfu build/uboot-env.dfu
echo "Erasing u-boot be careful - Press Return to continue... " && read key && \
dfu-util -D build/$(TARGET).dfu -a firmware.dfu && \
dfu-util -D build/$(PLATFORM).dfu -a firmware.dfu && \
dfu-util -D build/boot.dfu -a boot.dfu && \
dfu-util -D build/uboot-env.dfu -a uboot-env.dfu
dfu-util -e

dfu-ram: build/$(TARGET).dfu
sshpass -p analog ssh root@$(TARGET) '/usr/sbin/device_reboot ram;'
dfu-ram: build/$(PLATFORM).dfu
sshpass -p analog ssh root@$(PLATFORM) '/usr/sbin/device_reboot ram;'
sleep 7
dfu-util -D build/$(TARGET).dfu -a firmware.dfu
dfu-util -D build/$(PLATFORM).dfu -a firmware.dfu
dfu-util -e

jtag-bootstrap: build/u-boot.elf build/ps7_init.tcl build/system_top.bit scripts/run.tcl scripts/run-xsdb.tcl
Expand Down
6 changes: 3 additions & 3 deletions firmware/ori/board/pluto/VERSIONS
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
device-fw b340
device-fw e2a4
buildroot 2022.02.3-adi-5712-gf70f4a
linux adi-xilinx-2020.1-175882-ge14e351
u-boot-xlnx v0.20-PlutoSDR-25-g90401c
linux v5.15-20952-ge14e351
u-boot-xlnx v0.20-PlutoSDR-25-g90401c-dirty
Loading