Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unified fpga folders #2001

Merged
merged 5 commits into from
Jul 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 1 addition & 11 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,7 @@ tools/mfd_aes_brute/mfd_aes_brute
tools/mfd_aes_brute/mfd_multi_brute
tools/mfd_aes_brute/brute_key

fpga/*
!fpga/tests
!fpga/fpga_lf.bit
!fpga/fpga_hf.bit
!fpga/*.v
!fpga/Makefile
!fpga/fpga.ucf
!fpga/xst_lf.scr
!fpga/xst_hf.scr
!fpga/go.bat
!fpga/sim.tcl
fpga/__build*

# offcial dumps folder
dumps/*
Expand Down
3 changes: 0 additions & 3 deletions armsrc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,6 @@ endif
# Generic standalone Mode injection of source code
include Standalone/Makefile.inc

#the FPGA bitstream files. Note: order matters!
FPGA_BITSTREAMS = fpga_lf.bit fpga_hf.bit fpga_felica.bit fpga_hf_15.bit

#the lz4 source files required for decompressing the fpga config at run time
SRC_LZ4 = lz4.c
#additional defines required to compile lz4
Expand Down
20 changes: 13 additions & 7 deletions armsrc/fpgaloader.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,16 +404,22 @@ static int bitparse_find_section(int bitstream_version, char section_name, uint3
/* Four byte length field */
current_length += get_from_fpga_stream(bitstream_version, compressed_fpga_stream, output_buffer) << 24;
current_length += get_from_fpga_stream(bitstream_version, compressed_fpga_stream, output_buffer) << 16;
numbytes += 2;
default: /* Fall through, two byte length field */
current_length += get_from_fpga_stream(bitstream_version, compressed_fpga_stream, output_buffer) << 8;
current_length += get_from_fpga_stream(bitstream_version, compressed_fpga_stream, output_buffer) << 0;
numbytes += 4;
if (current_length > 300*1024) {
/* section e should never exceed about 300KB, if the length is too big limit it but still send the bitstream just in case */
current_length = 300*1024;
}
break;
default: /* Two byte length field */
current_length += get_from_fpga_stream(bitstream_version, compressed_fpga_stream, output_buffer) << 8;
current_length += get_from_fpga_stream(bitstream_version, compressed_fpga_stream, output_buffer) << 0;
numbytes += 2;
}

if (current_name != 'e' && current_length > 255) {
/* Maybe a parse error */
break;
if (current_length > 64) {
/* if text field is too long, keep it but truncate it */
current_length = 64;
}
}

if (current_name == section_name) {
Expand Down
2 changes: 1 addition & 1 deletion common_arm/Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ OBJDIR = obj
INCLUDE = -I../include -I../common_arm -I../common_fpga -I../common -I.

# Also search prerequisites in the common directory (for usb.c), the fpga directory (for fpga.bit), and the lz4 directory
VPATH = . ../common_arm ../common ../common/crapto1 ../common/mbedtls ../common/lz4 ../fpga-$(PLATFORM_FPGA) ../armsrc/Standalone
VPATH = . ../common_arm ../common ../common/crapto1 ../common/mbedtls ../common/lz4 ../fpga ../armsrc/Standalone

INCLUDES = ../include/proxmark3_arm.h ../include/at91sam7s512.h ../include/config_gpio.h ../include/pm3_cmd.h

Expand Down
9 changes: 9 additions & 0 deletions common_arm/Makefile.hal
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,26 @@ PLTNAME = Unknown Platform
PLATFORM_FPGA = fpga-undefined

ifeq ($(PLATFORM),PM3RDV4)
# FPGA bitstream files, the order matters!
FPGA_BITSTREAMS = fpga_pm3_lf.bit fpga_pm3_hf.bit fpga_pm3_felica.bit fpga_pm3_hf_15.bit
PLATFORM_DEFS = -DWITH_SMARTCARD -DWITH_FLASH -DRDV4
PLTNAME = Proxmark3 RDV4
PLATFORM_FPGA = xc2s30
RDV4 = yes
else ifeq ($(PLATFORM),PM3OTHER)
$(warning PLATFORM=PM3OTHER is deprecated, please use PLATFORM=PM3GENERIC)
# FPGA bitstream files, the order matters!
FPGA_BITSTREAMS = fpga_pm3_lf.bit fpga_pm3_hf.bit fpga_pm3_felica.bit fpga_pm3_hf_15.bit
PLTNAME = Proxmark3 generic target
PLATFORM_FPGA = xc2s30
else ifeq ($(PLATFORM),PM3GENERIC)
# FPGA bitstream files, the order matters!
FPGA_BITSTREAMS = fpga_pm3_lf.bit fpga_pm3_hf.bit fpga_pm3_felica.bit fpga_pm3_hf_15.bit
PLTNAME = Proxmark3 generic target
PLATFORM_FPGA = xc2s30
else ifeq ($(PLATFORM),PM3ICOPYX)
# FPGA bitstream files, the order matters - only hf has a bitstream, the other 3 files are 0 bytes
FPGA_BITSTREAMS = fpga_icopyx_lf.bit fpga_icopyx_hf.bit fpga_icopyx_felica.bit fpga_icopyx_hf_15.bit
PLATFORM_DEFS = -DWITH_FLASH -DICOPYX -DXC3
PLTNAME = iCopy-X with XC3S100E
PLATFORM_FPGA = xc3s100e
Expand Down Expand Up @@ -246,6 +254,7 @@ export PLATFORM_DEFS
export PLATFORM_DEFS_INFO
export PLATFORM_DEFS_INFO_STANDALONE
export PLATFORM_CHANGED
export FPGA_BITSTREAMS

$(info ===================================================================)
$(info Version info: $(shell tools/mkversion.sh --short 2>/dev/null || ../tools/mkversion.sh --short 2>/dev/null))
Expand Down
60 changes: 0 additions & 60 deletions fpga-xc2s30/Makefile

This file was deleted.

54 changes: 0 additions & 54 deletions fpga-xc2s30/fpga.ucf

This file was deleted.

Binary file removed fpga-xc2s30/fpga_felica.bit
Binary file not shown.
Loading
Loading