{"id":17244700,"url":"https://github.com/kost/fujprog","last_synced_at":"2025-04-14T04:09:42.659Z","repository":{"id":43091160,"uuid":"252994899","full_name":"kost/fujprog","owner":"kost","description":"FPGA ULX2/3 JTAG programmer","archived":false,"fork":false,"pushed_at":"2022-11-02T14:18:58.000Z","size":523,"stargazers_count":40,"open_issues_count":15,"forks_count":8,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-14T04:09:37.854Z","etag":null,"topics":["fpga","hardware","programming","ulx2s","ulx3s"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kost.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-04T12:46:51.000Z","updated_at":"2025-01-17T00:27:00.000Z","dependencies_parsed_at":"2023-01-20T21:18:50.649Z","dependency_job_id":null,"html_url":"https://github.com/kost/fujprog","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kost%2Ffujprog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kost%2Ffujprog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kost%2Ffujprog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kost%2Ffujprog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kost","download_url":"https://codeload.github.com/kost/fujprog/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248819403,"owners_count":21166477,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fpga","hardware","programming","ulx2s","ulx3s"],"created_at":"2024-10-15T06:27:06.509Z","updated_at":"2025-04-14T04:09:42.634Z","avatar_url":"https://github.com/kost.png","language":"C","readme":"[![Travis (.org)](https://img.shields.io/travis/kost/fujprog)](https://travis-ci.org/kost/fujprog \"Travis CI\")\n\n# ULX2S / ULX3S JTAG programmer\n\nThis is FPGA JTAG programmer for [ULX2/3S boards](https://radiona.org/ulx3s/). You need to have bitstream ready.\n\n## Usage\n\nFPGA ULX2S / ULX3S JTAG programmer command line options:\n\n```\nUsage: fujprog [option(s)] [bitstream_file]\n\n Valid options:\n  -p PORT\tSelect USB JTAG / UART PORT (default is 0)\n  -P TTY\tSelect TTY port (valid only with -t or -a)\n  -T TYPE\tSelect TYPE of input (svf, img, bit or jed)\n  -i \t\tidentify and exit\n  -j TARGET\tSelect bitstream TARGET as SRAM (default) or FLASH\n  -f ADDR\tStart writing to SPI flash at ADDR, optional with -j flash\n  -s FILE\tConvert bitstream to SVF FILE and exit\n  -r\t\tReload FPGA configuration from FLASH\n  -t\t\tEnter terminal emulation mode after completing JTAG operations\n  -b SPEED\tSet baudrate to SPEED (300 to 3000000 bauds)\n  -e FILE\tSend and execute a f32c (MIPS/RISCV) binary FILE\n  -x SPEED\tSet binary transfer speed, optional with -e\n  -a FILE\tSend a raw FILE\n  -d \t\tdebug (verbose)\n  -D DELAY\tDelay transmission of each byte by DELAY ms\n  -V \t\tdisplay version and exit\n  -z \t\tForce action\n  -h \t\tThis help message\n  -l X\t\tDisplay messages in log fashion every \u003cX\u003e times\n  -S serial \tSelect FTDI by serial to support multiple boards\n  -q \t\tSuppress messages\n```\n\n## Example usage\n\nUpload bitstream:\n```\nfujprog bitstream.bit\n```\n\nUpload bitstream to flash:\n```\nfujprog -j flash bitstream.bit\n```\n\nUpload bitstream from curl:\n```\ncurl https://www.site.com/bitstream.bit | fujprog\n```\n\nUpload flash image from curl:\n```\ncurl https://www.site.com/bitstream.img | fujprog -T img -j flash\n```\n\n# Building\n\nIt is standard CMake procedure:\n\n```\nmkdir build\ncd build\ncmake ..\nmake\nmake install\n```\n\nYou can also pass optional parameters:\n\n```\ncmake -DBUILD_STATIC=ON -DLIBFTDISTATIC=/opt/libftdi/lib/libftdi.a -DLIBUSB0STATIC=/opt/libusb0/lib/libusb.a ..\nmake install/strip\n```\n\n### Linux requirements\n\n\nYou need following packages in order to build on Debian/Ubuntu systems:\n```\nsudo apt-get install libftdi1-dev libusb-dev cmake make build-essential\n```\n\n## MacOS X build\n\nYou need to install following dependencies (tested with homebrew):\n```\nbrew install libftdi libftdi0\n```\n\nAnd then it is standard build with `-DSTATICLIB=ON`:\n\n```\nmkdir build\ncd build\ncmake -DBUILD_STATICLIB=ON ..\nmake\nmake install/strip\n```\n\nNote that full static binary is not supported by Apple.\n\n## Windows build\n\nYou need to download ftdi dependency lib:\n```\nwget https://www.ftdichip.com/Drivers/CDM/CDM%20v2.12.28%20WHQL%20Certified.zip\n```\n\nThen you can just open folder inside Visual Studio and build Release versions.\n\n## Windows cross-compile\n\nYou need to download ftdi dependency lib:\n```\nwget https://www.ftdichip.com/Drivers/CDM/CDM%20v2.12.28%20WHQL%20Certified.zip\n```\n\nCross compiling is done using standard cmake toolchain file:\n```\nmkdir build\ncd build\ncmake -DCMAKE_TOOLCHAIN_FILE=`pwd`/../cmake/Toolchain-cross-mingw32.cmake ..\nmake\n```\n\n## FreeBSD build\n\nYou need to install dependencies:\n```\npkg install libftdi1 pkgconf git cmake\n```\n\nAnd then it is standard CMake procedure:\n```\nmkdir build\ncd build\ncmake ..\nmake\nmake install\n```\n\nIf you need static binary version, you need to perform following cmake command:\n```\ncmake -E env CFLAGS=\"-pthread\" cmake -DBUILD_STATIC=ON ..\n```\n\n# Windows Notes\n\nYou may need to disable windows security block\n\n![windows security block](/images/securityblock.png)\n\n## Windows Drivers\n\nThe JTAG features of this fujprog cannot be used concurrently with OpenOCD.\n\nIn order to use OpenOCD with the ULX3S, the `libusbK` dirvers are needed. One way of manually changing the drivers is to use [Zadig](https://zadig.akeo.ie/). The problem with using the `libusbK` drivers is that this fujprog will no longer work, as it needs the FTDI drivers.\n\n## Change ULX3S Driver to libusbK using Zadig\n\nThe ULX3S is using the FTDI drivers if it shows up in the Device Manager - Ports (COM \u0026 LPT)\n\n![ULX3S-as-FTDI-device](/images/ULX3S-as-FTDI-device.PNG)\n\nLaunch Zadig and click on `Options - List all Devices`.  Select the ULX3S device from the dropdown:\n\n![Zadig-FTDI-to-libusbK](/images/Zadig-FTDI-to-libusbK.PNG)\n\nPress the Replace Driver button and after a few moments you should see a message that the drivers were installed successfully:\n\n![Zadig-success](/images/Zadig-success.PNG)\n\nThe driver change typically works immediately and no reboot is needed.\n\n## Change ULX3S Driver to FTDI \n\nThe FTDI drivers should already be installed. If so, Windows will automatically use these drivers when a new ULXS3 is plugged in. If the FTDI Drivers are not installed, they can be downloaded from https://www.ftdichip.com/Drivers/D2XX.htm (the setup executable noted in the comments column may be the easiest way to install the drivers). \n\nThe ULX3S is using the libusbK drivers if it shows up in Device Manager - libusbK USB Devices. (typically when using OpenOCD)\n\n![ULX3S-as-libusbK-device](/images/ULX3S-as-libusbK-device.PNG)\n\nTo remove the libusbK drivers, right click on your ULX3S device in Device Manager and select `Uninstall Device`:\n\n![Uninstall-libusbK-device](/images/Uninstall-libusbK-device.PNG)\n\nThen click the Uninstall button (don't check the box unless you want to actually uninstall the drivers from Windows and then reinstall the drivers later; we are only uninstalling the device):\n\n![Uninstall-libusbK-device-step2](/images/Uninstall-libusbK-device-step2.PNG)\n\nAfter clicking the Uninstall button, `Device Manager` may flicker a bit, but no message is typically shown. If the device was removed it will no longer be visible. If there are no other libusbK devices, then then entire `libusbK USB Devices` container will also be gone.\n\nTo complete the process of installing the FDTI drivers: Unplug the ULX3S, wait 30 seconds and plug it back in. Windows should automatically use the FTDI drivers and a new COM port will appear in `Device Manager - Ports (COM \u0026 LPT)` as shown above.\n\n# Troubleshooting\n\n##  WINDOWS\n\nMost issues come from windows platform. In some cases\nfujprog doesn't work. Sometimes it is just a matter of dynamic\nlinking (DLL file \"ftd2xx.dll\" or \"ftd2xx64.dll\", easiest is\njust to copy this file from FTDI D2XX CDM driver to the same\ndirectory where fujprog.exe is)\n\nOn VoIFS there is strange problem related with fujprog.exe\ncompiled with mingw. fujprog.exe, if started from \"wrong\" directory\ndoesn't work. When started from \"wrong\" directory, fujprog.exe\nwill exit without printing any error or any other message while\nit should print help/usage message shown on top of this page.\nPossible cause of this problem is that \"ftd2xx64.dll\" (for win64)\nis found copied to System32 directory under name \"ftd2xx.dll\" (for win32).\n\nPossible solution would be to remove all ftd2xx copies and copy\nfujprog.exe and dll to another directory and try again.\n\n## LINUX\n\nHere we have much better success, fujprog is statically linked and\ndoesn't depend on any other file. Most issues come from user permissions\nso fujprog should be either run as root or the user should be given\npermissions to access USB and serial device, that's usually done\neasily with some udev rule:\n\n    # /etc/udev/rules.d/80-fpga-ulx3s.rules\n    # this is for usb-serial tty device\n    SUBSYSTEM==\"tty\", ATTRS{idVendor}==\"0403\", ATTRS{idProduct}==\"6015\", \\\n      MODE=\"664\", GROUP=\"dialout\"\n    # this is for fujprog libusb access\n    ATTRS{idVendor}==\"0403\", ATTRS{idProduct}==\"6015\", \\\n      GROUP=\"dialout\", MODE=\"666\"\n\n## APPLE\n\nMake sure that FTDI driver is not loaded. For example:\n\n```\nsudo kextstat | grep -i ftdi\n```\n\nShould not return com.FTDI.driver.FTDIUSBSerialDriver when ulx3s is connected to USB port like this:\n\n```\n195 0 0xffffff7f85521000 0x7000 0x7000 com.FTDI.driver.FTDIUSBSerialDriver (2.4.4)\n```\n\nIf does, try to run fujprog as root as it will try to automatically handle kexts. Also, you can temporarily remove them by running following commands:\n\n```\n/sbin/kextunload -bundle-id com.FTDI.driver.FTDIUSBSerialDriver\n/sbin/kextunload -bundle-id com.apple.driver.AppleUSBFTDI\n```\n\nFeel free to report any problems. If you have problems running released binary try to compile your own version.\n\n# Credits\n\nFujprog is based on ujprog originally authored by Marko Zec.\nContributions from EMARD, gojimmypi and kost.\n\nCopyright (C), 2008-2018 Marko Zec, University of Zagreb\n\nCopyright (c), 2014-2019 EMARD\n\nCopyright (c), 2020 kost\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkost%2Ffujprog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkost%2Ffujprog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkost%2Ffujprog/lists"}