Yu-Ti Kuo
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # 第六階段 準備Litex 環境 ## Install Litex ✅ https://github.com/enjoy-digital/litex/wiki/Installation ``` bash mkdir litex cd litex ``` ### UV https://docs.astral.sh/uv/getting-started/installation/ ```bash uv venv --seed source .venv/bin/activate ``` ### venv ```bash sudo apt install python3-venv python3 -m venv .litex . .litex/bin/activate ``` ```bash ./litex_setup.py --init --install git clone https://github.com/litex-hub/linux-on-litex-vexriscv.git ``` https://www.scala-sbt.org/1.x/docs/Installing-sbt-on-Linux.html#Installing+sbt+on+Linux ``` sudo apt install curl # Please Use These curl -s "https://get.sdkman.io" | bash sdk install java $(sdk list java | grep -o "\b8\.[0-9]*\.[0-9]*\-tem" | head -1) sdk install sbt ``` ## FPGA BitStream Build ✅ https://github.com/enjoy-digital/litex/wiki/Installation ``` ERROR: Could not detect Ninja v1.8.2 or newer ``` ``` pip3 install ninja ``` ## Simulation ✅ plase install Verilator on the git https://verilator.org/guide/latest/install.html ```bash= litex_sim --cpu-type=vexriscv litex_sim --cpu-type=vexriscv_smp ``` ### Linux Boot ✅ https://github.com/litex-hub/linux-on-litex-vexriscv/tree/master 1. Install the dtc tool ```bash= sudo apt-get install device-tree-compiler ``` 2. Create the dts & dtb file. (Use Sim.py) ``` cd litex git clone https://github.com/litex-hub/linux-on-litex-vexriscv.git cd linux-on-litex-vexriscv ./sim.py ``` 3. Generating the Linux binaries use the buildroot. ```bash cd litex git clone http://github.com/buildroot/buildroot cd buildroot make BR2_EXTERNAL=../linux-on-litex-vexriscv/buildroot/ litex_vexriscv_defconfig make ``` 4. Run the Sim.py Again. ``` cd litex cd linux-on-litex-vexriscv ./sim.py ``` 5. You just need wait an hour........ (took 1h 23m 54.1s on AMD RX7800X3D) ``` Warning: missing file ~/litex/linux-on-litex-vexriscv/buildroot/../images/rv32.dtb ``` 1. what is dtb https://breezetemple.github.io/2018/11/20/linux-dtb-and-boot/ https://stackoverflow.com/questions/21670967/how-to-compile-dts-linux-device-tree-source-files-to-dtb 2. Check the dts file ![image](https://hackmd.io/_uploads/BksefxKy1e.png) https://github.com/litex-hub/linux-on-litex-vexriscv/blob/69545456c5ccfbc88973107d64c1b7097c9f4c9b/sim.py#L137 ```bash= cd linux-on-litex-vexriscv/ ./sim.py ``` 4.AttributeError: 'str' object has no attribute 'removesuffix' ![image](https://hackmd.io/_uploads/B1izmeFyJg.png) ![image](https://hackmd.io/_uploads/rJEIQltk1g.png) upgrage the Ububtu to 22.04 , supported Python 3.9 6.Timescale missing on this module as other modules have it (IEEE 1800-2017 3.14.2.2) https://github.com/litex-hub/linux-on-litex-vexriscv/issues/314 https://verilator.org/guide/latest/install.html#git-install 7. Runing https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html https://verilator.org/guide/latest/simulating.html https://verilator.org/guide/latest/verilating.html ![image](https://hackmd.io/_uploads/rJnFsBa1ke.png) took 1h 23m 54.1s ## digilent_arty https://github.com/litex-hub/litex-boards https://www.controlpaths.com/2022/01/17/building-soc-litex/ #### arty a7 100t https://gist.github.com/ibndias/6f44d1d55251324f5b873436ad290ab3 #### arty a7 35t https://www.controlpaths.com/2022/03/28/running-linux-on-a-litex-soc/ https://jia.je/hardware/2023/04/19/litex-digilent-arty-a7/ https://www.taterli.com/9418 > It tooks (5m 37.5s) > ```bash= ./digilent_arty.py --build ``` ## OpenOCD Install ``` $ sudo apt install libtool automake pkg-config libusb-1.0-0-dev jimsh libjim-dev $ git clone https://github.com/ntfreak/openocd.git $ cd openocd $ ./bootstrap $ ./configure --enable-ftdi $ make $ sudo make install ``` ## digilent_arty Modify to Embedfire ✅ https://github.com/enjoy-digital/litex/wiki/LiteX-for-Hardware-Engineers/ ## Git Clone the litex-boards ✅ 1. Git Clone 2. litex_boars install ### Enviroments please use the ubuntu 22.04.5 https://ftp.ubuntu-tw.org/mirror/ubuntu-releases/22.04.5/ copy openocd/contrib/60-openocd.rules to /etc/udev/rules.d/ use `groups` check the user is in plugdev sudo udevadm control --reload-rules && sudo udevadm trigger add groups `sudo adduser $USER dialout` rename usb device https://www.rigacci.org/wiki/doku.php/doc/appunti/linux/sa/renaming_usb_devices `sudo nano /etc/udev/rules.d/10-local.rules` `ACTION=="add", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", SYMLINK+="usbSerial"` `sudo udevadm control --reload-rules && sudo udevadm trigger` remove brltty (CH340 USBTTY) ```sudo apt purge brltty``` ### TODO (Wiil Add new Target to Here) ``` cd litex source .venv/bin/activate cd linux-on-litex-vexriscv ``` - [x] litex_boards - [x] platform - [x] boards - [x] Try Build : `python3 -m litex_boards.targets.embedfire_rise_pro --uart-baudrate=921600 --cpu-type=vexriscv_smp --cpu-variant=linux --build` - [x] Try Load : `python3 -m litex_boards.targets.embedfire_rise_pro --load` - [x] Try Flash: `python3 -m litex_boards.targets.embedfire_rise_pro --flash` - [x] litex_term - [x] ch340g : Use dmesg to check the is there any btltty ? - [x] ch340g : Use the latest Kernel form `sudo apt install linux-image-6.5.0-45-generic` - [x] LED Blink - [x] Build - [x] Load By OpenOCD - [x] Load By Vivado - [x] FPGA Example - [x] GPIO - [x] Buzzer (PWM) - [ ] EEPROM - [ ] Eth - [ ] HDMI Output - [ ] HDMI Input - [x] SD Card : `python3 -m litex_boards.targets.embedfire_rise_pro --uart-baudrate=921600 --cpu-type=vexriscv_smp --cpu-variant=linux --with-sdcard --build` - [ ] linux-on-litex-vexriscv - [x] Change the Dictionary : `cd linux-on-litex-vexriscv` - [x] Start the litex_term : `litex_term --speed=921600 --images=images/boot.json /dev/usbSerial` or `/dev/ttyUSB2` (You can use udev to rename the serial adpater) - [x] You must see the `litex>`, then key `serialboot` - [x] litex-bios - [x] LED Test - [x] SDRAM Test - [x] FPGA bit stream build (Linux) - [x] normal `./make.py --board embedfire_rise_pro --uart-baudrate 921600 --build` (need the dtb dts file) - [x] add jtagbone `./make.py --board embedfire_rise_pro --uart-baudrate 921600 --build` - [x] Image Build 1. `cd buildroocd t` 2. `make BR2_EXTERNAL=../linux-on-litex-vexriscv/buildroot/ litex_vexriscv_defconfig` 3. `make` - [x] OpenSBI - [x] [Host Bridge to control litex](/D1JJ8UEcSjyadWoKkrtQJw) - [x] uartbone - [x] `python3 -m litex_boards.targets.embedfire_rise_pro --uart-baudrate=921600 --uart-name=crossover --with-uartbone --cpu-type=vexriscv_smp --cpu-variant=linux --build --flash --load` - [x] `litex_server --uart --uart-port=/dev/usbSerial --uart-baudrate=921600` - [x] `litex_term crossover` - [x] jtagbone - [x] `python3 -m litex_boards.targets.embedfire_rise_pro --uart-baudrate=921600 --with-jtagbone --cpu-type=vexriscv_smp --cpu-variant=linux --build --load` - [x] `litex_server --jtag --jtag-config openocd_xc7_ft2232.cfg` - [x] `litex_cli --ident` - [x] [Use litexsope to debug soc](/MCYi6TdES6eTDcA36-TQZA) - [x] `litescope_cli -v main_leds 1` - [x] Learn https://github.com/enjoy-digital/litex/wiki/LiteX-for-Hardware-Engineers - [ ] [Use jtag to debug linux soc](/mpdEzmu6SiSPkY1yKgbweg) - [ ] Why libgpio set is not working ? - [x] Linux Boot - [x] litex_term - [x] SDCard - [ ] GPIO : [Use GPIO in Linux](/5p40uQkWQ6KPU-oRpCyppA) - [x] libgpio get - [ ] libgpio set - [ ] PWM : [Use PWM in Linux](/bYimwwfmSfmmfWddPb-bIw) ### Change to use PYZ update litex_boards ``` litex$ ./litex_setup.py --instal ``` build bitstream ``` python3 -m litex_boards.targets.tul_pynq_z2 --uart-baudrate=921600 --cpu-type=vexriscv_smp --cpu-variant=linux --build ``` load to fpga ``` python3 -m litex_boards.targets.tul_pynq_z2 --uart-baudrate=921600 --cpu-type=vexriscv_smp --cpu-variant=linux --load ```

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully