Skip to content
Open
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
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
miniSProg
=========
![image](https://github.com/vgegok/miniSProg/blob/vgegok/Screenshot/Screenshot.png)

GUI programmer for miniSpartan6+ development board

Expand Down Expand Up @@ -37,4 +38,4 @@ user.
- When compiling xc3sprog you might get "fatal error: ftdi.h: No such file or directory"
Make sure you have (libftdi 0.x) installed, some new Linux distributions have
moved to (libftdi 1.x) if that is the case with your distribution then fix the
source code of xc3sprog to use the new library instead.
source code of xc3sprog to use the new library instead.
Binary file added Screenshot/Screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bscan/bscan_spi_s6lx25_ftg256.bit
Binary file not shown.
Binary file added bscan/bscan_spi_s6lx9_ftg256.bit
Binary file not shown.
114 changes: 92 additions & 22 deletions miniSProg/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ MainWindow::MainWindow(QWidget *parent) :
if (xc3sprog_file.exists() && xc3sprog_file.isFile()) {
ui->lineEdit_xc3sprog->setText(xc3sprog_file.canonicalFilePath());
}

ui->toolBtnBscan->setEnabled(false);
ui->lineEdit_bscanfile->setEnabled(false);
ui->checkBoxRbt->setEnabled(false);
ui->checkBoxRbt->setText("Reboot is defalt");
}

MainWindow::~MainWindow()
Expand Down Expand Up @@ -77,20 +82,20 @@ void MainWindow::procError(QProcess::ProcessError procError)
ui->textEdit->append(proc->errorString());

switch (procError) {
case QProcess::FailedToStart:
case QProcess::FailedToStart:
ui->textEdit->append(tr("Failed to start"));
break;
case QProcess::Crashed:
case QProcess::Crashed:
ui->textEdit->append(tr("Crashed"));
break;
case QProcess::Timedout:
ui->textEdit->append(tr("Timedout"));
break;
case QProcess::UnknownError:
ui->textEdit->append(tr("Unknown Error"));
default:
default:
ui->textEdit->append(tr("REALLY! Unknown Error"));
}
}

setDefaultConsoleColor();
}
Expand All @@ -100,18 +105,18 @@ void MainWindow::procExited(int exitCode, QProcess::ExitStatus exitStatus)
ui->textEdit->append("Done.");
//ui->textEdit->append(QString::number(exitCode));

// if ( myProcess->exitStatus() == 0)
// {
// qDebug () << "Program ran successfully";
// }
// if ( myProcess->exitStatus() == 2)
// {
// qDebug () << "Customized message";
// }
// if ( myProcess->exitStatus() == 3)
// {
// qDebug () << "Another text warning message";
// }
// if ( myProcess->exitStatus() == 0)
// {
// qDebug () << "Program ran successfully";
// }
// if ( myProcess->exitStatus() == 2)
// {
// qDebug () << "Customized message";
// }
// if ( myProcess->exitStatus() == 3)
// {
// qDebug () << "Another text warning message";
// }

}

Expand Down Expand Up @@ -142,6 +147,12 @@ void MainWindow::on_toolBtnBit_clicked()
ui->lineEdit_bitfile->setText(bitfile_path);
}

void MainWindow::on_toolBtnBscan_clicked()
{
QString bscanfile_path = QFileDialog::getOpenFileName(this, tr("Select the Bscan file"),"./",tr("bit Files (*.bit)"));
ui->lineEdit_bscanfile->setText(bscanfile_path);
}

void MainWindow::on_checkBox_details_stateChanged(int status)
{
// status 0 => Hide, 2 => Show
Expand All @@ -155,6 +166,23 @@ void MainWindow::on_checkBox_details_stateChanged(int status)
}
}

void MainWindow::on_pushButton_Reboot_clicked()
{
if (ui->lineEdit_xc3sprog->text().isEmpty()) {
ui->textEdit->setTextColor(Qt::red);
ui->textEdit->append(tr("ERROR: Select the xc3sprog path first."));
setDefaultConsoleColor();
} else {
QString program = ui->lineEdit_xc3sprog->text();
QStringList arguments_reboot;
arguments_reboot.append("-c");
arguments_reboot.append("ftdi");
arguments_reboot.append("-R");
proc->start(program,arguments_reboot);
}

}

void MainWindow::on_pushButton_Program_clicked()
{
if (ui->lineEdit_xc3sprog->text().isEmpty()) {
Expand All @@ -167,11 +195,33 @@ void MainWindow::on_pushButton_Program_clicked()
setDefaultConsoleColor();
} else {
QString program = ui->lineEdit_xc3sprog->text();
QStringList arguments;
arguments.append("-c");
arguments.append("ftdi");
arguments.append(ui->lineEdit_bitfile->text());
proc->start(program, arguments);
QStringList arguments_load;
QStringList arguments_prog;
QStringList arguments_reboot;
arguments_load.append("-c");
arguments_load.append("ftdi");
if(ui->radioBtnLoader->isChecked()){
arguments_load.append(ui->lineEdit_bitfile->text());
}else{
arguments_load.append(ui->lineEdit_bscanfile->text());
}
proc->start(program, arguments_load);
proc->waitForFinished();
if(ui->radioBtnProg->isChecked()){
arguments_prog.append("-c");
arguments_prog.append("ftdi");
arguments_prog.append("-I");
arguments_prog.append(ui->lineEdit_bitfile->text());
ui->textEdit->append("Program Done, FPGA Will Reboot!\n");
proc->start(program,arguments_prog);
proc->waitForFinished();
if(ui->checkBoxRbt->isChecked()){
arguments_reboot.append("-c");
arguments_reboot.append("ftdi");
arguments_reboot.append("-R");
proc->start(program,arguments_reboot);
}
}
}
}

Expand All @@ -183,6 +233,26 @@ void MainWindow::on_actionAbout_triggered()
"the FPGA board miniSpartan6+.<br><br>"
"Source code: <a href='https://github.com/fduraibi/miniSProg'>https://github.com/fduraibi/miniSProg</a><br>"
"Developed by: Fahad Alduraibi<br>"
"v1.0");
"Updated by: Vgegok<br>"
"v2.0 2021.02.19");
QMessageBox::about(this, myTitle, myBody);
}



void MainWindow::on_radioBtnLoader_clicked()
{
ui->toolBtnBscan->setEnabled(false);
ui->lineEdit_bscanfile->setEnabled(false);
ui->checkBoxRbt->setEnabled(false);
ui->checkBoxRbt->setText("Reboot is defalt");

}

void MainWindow::on_radioBtnProg_clicked()
{
ui->toolBtnBscan->setEnabled(true);
ui->lineEdit_bscanfile->setEnabled(true);
ui->checkBoxRbt->setEnabled(true);
ui->checkBoxRbt->setText("Reboot when finshed");
}
6 changes: 6 additions & 0 deletions miniSProg/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,19 @@ private slots:

void on_toolBtnProg_clicked();
void on_toolBtnBit_clicked();
void on_toolBtnBscan_clicked();

void on_checkBox_details_stateChanged(int status);

void on_pushButton_Reboot_clicked();
void on_pushButton_Program_clicked();

void on_actionAbout_triggered();

void on_radioBtnLoader_clicked();

void on_radioBtnProg_clicked();

private:
Ui::MainWindow *ui;
QProcess * proc;
Expand Down
113 changes: 96 additions & 17 deletions miniSProg/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>495</width>
<height>373</height>
<width>512</width>
<height>513</height>
</rect>
</property>
<property name="sizePolicy">
Expand All @@ -25,6 +25,41 @@
</property>
<widget class="QWidget" name="centralWidget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QFrame" name="frame_3">
<property name="enabled">
<bool>true</bool>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QRadioButton" name="radioBtnLoader">
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="text">
<string>Loader to RAM</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioBtnProg">
<property name="text">
<string>Program to SPI Flash</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QFrame" name="frame">
<property name="sizePolicy">
Expand Down Expand Up @@ -69,19 +104,6 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>.bit file</string>
</property>
<property name="textFormat">
<enum>Qt::AutoText</enum>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineEdit_bitfile"/>
</item>
Expand All @@ -102,6 +124,46 @@
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QToolButton" name="toolBtnBscan">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>.bit file</string>
</property>
<property name="textFormat">
<enum>Qt::AutoText</enum>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEdit_bscanfile">
<property name="enabled">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>.bit Bscan file</string>
</property>
<property name="textFormat">
<enum>Qt::AutoText</enum>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
Expand Down Expand Up @@ -189,6 +251,23 @@ QCheckBox::indicator:checked {
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxRbt">
<property name="text">
<string>Reboot when finshed</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_Reboot">
<property name="text">
<string>Reboot</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_Program">
<property name="sizePolicy">
Expand Down Expand Up @@ -246,8 +325,8 @@ QCheckBox::indicator:checked {
<rect>
<x>0</x>
<y>0</y>
<width>495</width>
<height>20</height>
<width>512</width>
<height>19</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
Expand Down