There are two ways to automate the programmer tool:
1. TCL scripting via Radiant TCL console
2. Batch/Bash/Shell scripting using command-line/powershell (Windows) or terminal (Linux)
For TCL scripting: search for the "Programmer Tcl Commands" section in the Radiant Help
For CMD/Terminal scripting: search for the "Running Programmer from the Command Line" section in the Radiant Help.
The first and most important part is creating the *.xcf file. The *.xcf file is the configuration file in which you set up the operation and the location of your programming file (ex. bitstream).
Here is a detailed instructions on how to create an XCF file:
1. Open Radiant Programmer and create a new blank project or you can directly scan the attached board on your PC/Laptop
2. Set the Device, Operation, and Programming File to be used.
3. Save the programmer settings as xcf file by clicking File > Save Project/Save Project as.
4. Once the *.xcf file is saved, you can now use it as input to your TCL script.
Here are some example scripts:
A. TCL scripting for Windows/LinuxOption 1:
1. Open Windows CMD or Linux Terminal
2. Invoke Radiant Stand Alone TCL console first then use the "source" command to execute the script.
For Windows example: C:/lscc/radiant/2023.2/bin/nt64/pnaminc.exe <tcl file path>
For Linux example: /home/jomar/lscc/radiant/2023.2/bin/lin64/pnmainc <tcl file path>
my_script.tcl======================
pgr_project C:/Users/jmanguba/Cases/Scripting/test.xcf
pgr_program set -cable usb2 -portaddress FTUSB-0
pgr_program run
======================
Option 2:
1. Directly start the standalone Radiant TCL console included in the Radiant Software Package
In Windows: C:/lscc/radiant/2023.2/bin/nt64/pnmainc.exe
In Linux: /home/jomar/lscc/radiant/2023.2/bin/lin64/pnmainc
2. After invoking the standalone Radiant console, type "source <tcl file path>" to invoke your script
B. Batch/Bash/Shell Scripting for Windows/Linux
If the customer would like to use batch/bash/shell scripting, they can also refer to below examples:
Windows Batch======================
@echo off
:: Change the variables according to your file paths
:: Radiant Programmer executable path
set Radiant_pgrcmd=C:\lscc\radiant\2023.2\programmer\bin\nt64
:: xcf file path
set xcf_file=C:\Users\jmanguba\Desktop\Script\test.xcf
:: log file
set pgr_log=C:\Users\jmanguba\Desktop\Script\programmer.log
REM Start
:: Begin Programming
cd %Radiant_pgrcmd%
pgrcmd.exe -infile %xcf_file% -logfile %pgr_log%
if %ERRORLEVEL% EQU 0 (
echo,
echo ############################
echo ## Sucessfully Programmed ##
echo ############################
pause
) else (
echo Exit Status %errorlevel%
exit /b %errorlevel%
pause
)
REM End
======================
Linux Bash======================
#!/bin/bash
#Setup the environment for running programmer on Linux
export bindir=/home/jomar/lscc/radiant/2023.2/bin/lin64
source $bindir/radiant_env
set FOUNDRY=/home/jomar/lscc/radiant/2023.2/ispfpga
#Running Programmer
#Change the directory for your xcf and log file
pgrcmd -infile /home/jomar/programmer/test.xcf -logfile /home/jomar/programmer/test.log
======================
Windows Bash
======================
#Setup the environment for running programmer on Windows
set PATH=C:/lscc/radiant/2023.2/programmer/bin/nt64
set FOUNDRY=C:/lscc/radiant/2023.2/ispfpga
pgrcmd -infile C:/Users/jmanguba/Desktop/test.xcf -logfile C:/Users/jmanguba/Desktop/test.log
======================
Note: To understand more about how to set up the environment for Linux/Windows, search for "Setting Up the Environment to Run Command Line" in Radiant Help.