# Toolchain and OpenOCD for HPMicro SoCs **Repository Path**: devinfanyang/hpmicro-toolchain-debugger ## Basic Information - **Project Name**: Toolchain and OpenOCD for HPMicro SoCs - **Description**: 本仓库提供先楫MCU开发需要用到的: - GCC 工具链 - OpenOCD - **Primary Language**: Unknown - **License**: GPL-3.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-05-13 - **Last Updated**: 2023-10-17 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # HPMicro Toolhcain and Debugger Tools ## 1. 简介 本仓库包含用于先楫MCU开发和调试需要的: - RISC-V GCC 工具链 - OpenOCD 调试器 ## 2. RISC-V GCC 工具链 ### 2.1 仓库信息 - 仓库链接:[RISC-V toolchain](https://github.com/riscv-collab/riscv-gnu-toolchain) - tag: 2023.04.29 ### 2.2 Linux 编译脚本 ```shell PREFIX=$HOME/riscv32-gnu-toolchain TARGET=riscv32-unknown-elf if [ -d $PREFIX ]; then rm -rf $PREFIX fi make clean ./configure --disable-shared --enable-static --with-abi=ilp32 --with-arch=rv32imac --enable-multilib --with-multilib-generator="rv32imac-ilp32--;rv32imafc-ilp32--;rv32imafc-ilp32f--;rv32imafdc-ilp32--;rv32imafdc-ilp32f--;rv32imafdc-ilp32d--" --prefix=${PREFIX} 'CFLAGS_FOR_TARGET=-Os -mstrict-align -mcmodel=medlow ' 'CXXFLAGS_FOR_TARGET=-Os -mstrict-align -mcmodel=medlow ' --target=$TARGET LDFLAGS="-static" --with-isa-spec=2.2 make -j8 # Strip strip -s `find $PREFIX/ -type f -executable` ``` ### 2.3 Windows 编译脚本 ```shell BUILD_HOST=x86_64-w64-mingw32 PREFIX=${HOME}/riscv32-gnu-toolchain-win TARGET=riscv32-unknown-elf export PATH=$PATH:${HOME}/riscv32-gnu-toolchain:${HOME}/riscv32-gnu-toolchain/bin MULTILIB_LIST="rv32imac-ilp32--;rv32imafc-ilp32--;rv32imafc-ilp32f--;rv32imafdc-ilp32--;rv32imafdc-ilp32f--;rv32imafdc-ilp32d--" cd gcc ./contrib/download_prerequisites cd .. ./configure --with-abi=ilp32 --with-arch=rv32imac --enable-multilib -with-multilib-generator=${MULTILIB_LIST} --with-host=${BUILD_HOST} --prefix=${PREFIX} --without-system-zlib 'CFLAGS_FOR_TARGET=-Os -mcmodel=medlow ' 'CXXFLAGS_FOR_TARGET=-Os -mcmodel=medlow ' --target=${TARGET} LDFLAGS="-static" --with-isa-spec=2.2 make clean make -j8 cd build-gdb-newlib make distclean ../riscv-gdb/configure --target=$TARGET --host=${BUILD_HOST} --prefix=${PREFIX} --disable-werror --with-expat=yes --enable-gdb --disable-gas --disable-binutils --disable-ld --disable-gold --disable-gprof --disable-shared --with-static-standard-libraries --disable-source-highlight LDFLAGS="-static" make -j8 make install cd $PREFIX # Strip unused symbols in toolchain binaries for i in `find . -name *.dll`; do x86_64-w64-mingw32-strip -s $i ; done for i in `find . -name *.exe`; do x86_64-w64-mingw32-strip -s $i ; done cd .. ``` ## 3. OpenOCD 调试工具 ### 3.1 Windows 版本 - Windows版本复制自先楫 `sdk_env_v1.1.0` ### 3.2 Linux 版本 - Linux 版本编译自[riscv-openocd](https://github.com/hpmicro/riscv-openocd)