RosettaCodeData/Lang/RISC-V-Assembly/00-LANG.txt

76 lines
2.4 KiB
Plaintext

{{language|RISC-V Assembly}}[https://riscv.org Risc-V] is an open source hardware instruction set architecture based on the principle of a '''R'''educed '''I'''nstruction '''S'''et '''C'''omputer. The project was started by the university of California, Berkeley in 2010. This site refers to the Risc-V assembly language. ([https://en.wikipedia.org/wiki/RISC-V#Software Wikipedia page]), Website: [https://riscv.org https://riscv.org].
'''Riscv on raspberry pico 2'''
A pico2 with the chip rp2335 contains 2 cores hazard3 with risc v assembly
it is possible to programm assembly riscv with the sdk C++ and a compiler riscv32-unknown-elf-as.exe
It is also possible to programm without SDK but it is necessary to write functions for init
the clocks and to communicate for usb connexion.
install under Windows11 (or see documentation raspberry py pico SDK) :
Create main folder (ex : \pico2)
install SDK C++ (see instructions in raspberry pi pico2 SDK documentation)
install toolchaine under \Pico2\tools\bin from
https://github.com/raspberrypi/pico-sdk-tools/releases/download/v2.0.0-2/riscv-toolchain-14-x64-win.zip
Create work folder (ex : \pico2\hello)
Create file CMakeLists.txt (see instructions in raspberry pi pico2 SDK documentation)
Create program hello.s with a editor
Copy a file pico_sdk_import.cmake from \pico2\pico-sdk\external
Create a folder build under \pico2\hello
Go to this folder
Compile program with :
cmake -DPICO_PLATFORM=rp2350-riscv -DPICO_TOOLCHAIN_PATH=E:\Pico2\tools\bin -G "NMake Makefiles" ..
and
nmake
copy the file .uf2 to raspberry pico2 (see documentation raspberry pi pico2)
Start serial connexion on host (ex: putty on windows11)
Example CMakeLists.txt :
cmake_minimum_required(VERSION 3.13)
include(pico_sdk_import.cmake)
project(hello C CXX ASM)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
pico_sdk_init()
add_executable(hello
hello.s # pgm source assembly riscv
)
target_link_libraries(hello pico_stdlib)
pico_enable_stdio_usb(hello 1)
pico_enable_stdio_uart(hello 0)
pico_add_extra_outputs(hello)
see source program on hello world rosetta code
cmake -DPython3_EXECUTABLE=C:\Users\Vincent\AppData\Local\Microsoft\WindowsApps\python3.10.exe -DPICO_PLATFORM=rp2350-riscv -DPICO_TOOLCHAIN_PATH=E:\Pico2\tools\bin -DPICO_SDK_PATH=..\..\..\pico-sdk -G "NMake Makefiles" ..
[[Category:Assembler language]]
[[Category:Assembly]]