Skip to content

how to build flash and use examples on linux

Benjamin Vernoux edited this page Nov 1, 2023 · 20 revisions

How to build flash and use examples on Linux with shell

Build the firmware source code for HydraUSB3(CH569W MCU)

Toolchain available and compatible:

Prerequisites

  • Tested on Ubuntu x64 22.04 LTS & 20.04 LTS(does not work on ArchLinux)
  • Download open source GCC RISC-V v12.2.0 from https://github.com/hydrausb3/riscv-none-elf-gcc-xpack/releases
    • Extract the archive and add the bin directory to your PATH
    • PATH=$PATH:~/xpack-riscv-none-elf-gcc-12.2.0-1/bin
  • Alternative closed source toolchain Download MRS_Toolchain_Linux_x64_V1.50.tar.xz
    • Extract the archive and install it like described in the README
    • Add the path to "RISC-V Embedded GCC" bin directory for MRS_Toolchain_Linux_x64_V1.50
      • PATH=$PATH:~/MRS_Toolchain_Linux_x64_V1.50/RISC-V\ Embedded\ GCC/bin
    • Alternatively you can download MounRiver_Studio_Community_Linux_x64_V120.tar.xz
      • Extract the archive and install it like described in the README
      • Add the path to "RISC-V Embedded GCC" bin directory for MounRiver_Studio_Community_Linux_x64_V120
        • PATH=$PATH:~/MounRiver_Studio_Community_Linux_x64_V120/MRS_Community/toolchain/RISC-V\ Embedded\ GCC/bin
  • Start a Terminal emulator
  • Prerequisites
    • Install git
      • sudo apt install git

Clone the hydrausb3_fw repository with git

cd ~
git clone --recursive https://github.com/hydrausb3/hydrausb3_fw.git
  • Change current directory to firmware example (here HydraUSB3_Blink_ULED)
    • cd ~/hydrausb3_fw/HydraUSB3_Blink_ULED
  • Clean and build the firmware example
    • make clean all
  • The flashable firmware with wch-ch56x-isp (*.bin) is available in ~/hydrausb3_fw/HydraUSB3_Blink_ULED/build/HydraUSB3_Blink_ULED.bin

Flash and use hydrausb3_fw example(s) with wch-ch56x-isp

See https://github.com/hydrausb3/hydrausb3_fw/wiki/Flash-and-use-hydrausb3_fw-example-on-Linux