{"id":22074440,"url":"https://github.com/shenki/linux-on-microwatt","last_synced_at":"2025-07-12T01:04:26.763Z","repository":{"id":139970764,"uuid":"500695075","full_name":"shenki/linux-on-microwatt","owner":"shenki","description":"Linux on Microwatt","archived":false,"fork":false,"pushed_at":"2022-06-07T05:20:32.000Z","size":8486,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-24T08:49:17.593Z","etag":null,"topics":["fpga","linux","microwatt","powerpc"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shenki.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-06-07T04:58:44.000Z","updated_at":"2023-01-02T02:48:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"9bbc844d-40bf-4cee-823c-fd45388ea1da","html_url":"https://github.com/shenki/linux-on-microwatt","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/shenki/linux-on-microwatt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shenki%2Flinux-on-microwatt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shenki%2Flinux-on-microwatt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shenki%2Flinux-on-microwatt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shenki%2Flinux-on-microwatt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shenki","download_url":"https://codeload.github.com/shenki/linux-on-microwatt/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shenki%2Flinux-on-microwatt/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264922798,"owners_count":23683693,"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","linux","microwatt","powerpc"],"created_at":"2024-11-30T21:43:14.285Z","updated_at":"2025-07-12T01:04:26.727Z","avatar_url":"https://github.com/shenki.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Linux on Microwatt\n\n[Microwatt](https://github.com/antonblanchard/microwatt) is an open source\nPOWER ISA softcore written in VHDL 2008. It aims to be simple and easy to\nunderstand.\n\nMainline Linux supports Microwatt as of v5.14.\n\nThese instructions are for the Arty A7, which is the most common FPGA dev board\nused by Microwatt developers.\n\nThere are [other instructions](https://codeconstruct.com.au/docs/microwatt-orangecrab/)\nwritten by Matt from Code Construct for testing on the OrangeCrab.\n\nMicrowatt can also be built as part of a LiteX SoC. This configuration is not\nas well tested, and is not documented by these ininstructions.\n\n## Programming the board\n\nClone this repository and run the following steps, or use the instructions\nbelow to build your own artifacts.\n\n1. Program the flash\n\n   This operation will overwrite the contents of your flash.\n\n   For the Arty A7 A100T, set `FLASH_ADDRESS` to `0x400000` and pass `-f a100`.\n\n   For the Arty A7 A35T, set `FLASH_ADDRESS` to `0x300000` and pass `-f a35`.\n\n   For example:\n\n   ```\n   openocd/flash-arty -f a100 images/microwatt_0.bit\n   openocd/flash-arty -f a100 images/dtbImage.microwatt.elf -t bin -a 0x400000\n   ```\n\n2. Connect to the second USB TTY device exposed by the FPGA\n\n   ```\n   minicom -D /dev/ttyUSB1\n   ```\n\n   The gateware has firmware that will look at `FLASH_ADDRESS` and attempt to\n   parse an ELF there, loading it to the address specified in the ELF header\n   and jumping to it.\n\n## Building components from source\n\n### Synthesis on Xilinx FPGAs using Vivado\n\n1. Clone microwatt\n\n   ```\n   git clone https://github.com/antonblanchard/microwatt\n   ```\n\n2. Install Vivado WebPack\n\n   ```\n   source /opt/Xilinx/Vivado/2019.1/settings64.sh\n   ```\n\n3. Install FuseSoC\n\n   ```\n   pip3 install --user -U fusesoc\n   fusesoc init\n   fusesoc fetch uart16550\n   fusesoc library add microwatt /path/to/microwatt\n   ```\n\n4. Build gateware using FuseSoC\n\n   First configure FuseSoC as above.\n\n   Replace `arty_a7-100` with `arty_a7-35` if you have an Arty A7 35T.\n\n   ```\n   fusesoc run --build --target=arty_a7-100 microwatt --no_bram --memory_size=0\n   ```\n\n   The output is `build/microwatt_0/arty_a7-100-vivado/microwatt_0.bit`.\n\n### Software components\n\n### Use buildroot to create a userspace\n\n   A small change is required to glibc in order to support the VMX/AltiVec-less\n   Microwatt, as float128 support is mandiatory and for this in GCC requires\n   VSX/AltiVec. This change is included in Joel's buildroot fork, along with a\n   defconfig:\n\n   Note that this will also build the Linux kernel, so you do not need to build\n   it sparely.\n\n   ```\n   git clone -b microwatt https://github.com/shenki/buildroot\n   cd buildroot\n   make ppc64le_microwatt_defconfig\n   make\n   ```\n\n   The output is `output/images/rootfs.cpio`\n\n   The kernel is `output/images/dtbImage.microwatt.elf`, which embeds a copy of rootfs.cpio.\n\n\n### Build the Linux kernel\n\n   ```\n   git clone https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git\n   cd linux\n   make ARCH=powerpc microwatt_defconfig\n   make ARCH=powerpc CROSS_COMPILE=powerpc64le-linux-gnu- \\\n     CONFIG_INITRAMFS_SOURCE=/buildroot/output/images/rootfs.cpio -j`nproc`\n   ```\n\n   The output is `arch/powerpc/boot/dtbImage.microwatt.elf`.\n\n\n## Netbooting Linux\n\nInstead of flashing Linux to the SPI NOR, we can load it over the Ethernet\nconnection on the Arty.\n\nTo do this we use a fork of u-boot that supports Microwatt and the LiteEth\nperipheral. Follow the instructions above and instead of flashing Linux, flash\nu-boot.elf to the same location:\n\n```\n   openocd/flash-arty -f $ARTY images/u-boot -t bin -a $FLASH_ADDRESS\n```\n\n```\nTrying flash...\nCopy segment 0 (0x6a020 bytes) to 0xc000000\nBooting from DRAM at c000048\n\n\nU-Boot 2021.04-00924-gc55ea8aac3b6 (Nov 19 2021 - 10:27:41 +0800)\n\nCPU: Microwatt\nDRAM:  256 MiB\n```\n\nFrom here, serve the kernel over tftp:\n\n```\nsudo apt install python3-fbtftp\nsudo python3 /usr/share/doc/python3-fbtftp/examples/server.py --port 69\n```\n\n```\n=\u003e dhcp\n=\u003e setenv serverip 192.168.86.8\n=\u003e tftp dtbImage.microwatt.elf\n=\u003e bootelf\n```\n\n### Building u-boot\n\nTo build from source:\n\n```\ngit clone -b microwatt https://github.com/shenki/u-boot\ncd u-boot\nmake microwatt_arty_defconfig\nmake CROSS_COMPILE=powerpc64le-linux-gnu- -j`nproc`\n```\n\nThe output is `u-boot`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshenki%2Flinux-on-microwatt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshenki%2Flinux-on-microwatt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshenki%2Flinux-on-microwatt/lists"}