{"id":617,"date":"2019-08-16T16:02:56","date_gmt":"2019-08-16T07:02:56","guid":{"rendered":"https:\/\/pg-mana.net\/blog\/?p=617"},"modified":"2024-09-09T17:19:40","modified_gmt":"2024-09-09T08:19:40","slug":"sifive-hifive-1-rev-b","status":"publish","type":"post","link":"https:\/\/pg-mana.net\/blog\/sifive-hifive-1-rev-b\/","title":{"rendered":"SiFive HiFive 1 Rev B\u3067\u904a\u3093\u3060"},"content":{"rendered":"\n<p>\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30ad\u30e3\u30f3\u30d72019\u306b\u30c1\u30e5\u30fc\u30bf\u30fc\u3068\u3057\u3066\u53c2\u52a0\u3057\u3066\u3044\u308b\u3068\u304d\u306bhikalium\u5148\u751f\u304b\u3089HiFive1 RevB\u3068\u3044\u3046\u3082\u306e\u3092\u501f\u308a\u3066\u3001<a href=\"https:\/\/github.com\/PG-MANA\/RuscV\">https:\/\/github.com\/PG-MANA\/RuscV<\/a> (Rust\u3067\u66f8\u304b\u308c\u305fOS\u3082\u3069\u304d)\u3092\u8a66\u3057\u3066\u307f\u3088\u3046\u3068\u30d3\u30eb\u30c9\u3057\u305f\u306e\u3067\u8a18\u9332\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u307e\u305aHiFive1\u306fRISCV-32 IMAC\u306a\u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3\u306a\u306e\u3067\u3059\u304c\u3001RuscV\u306fRISCV-64 IMAC\u5411\u3051\u306b\u66f8\u3044\u3066\u3044\u305f\u306e\u3067(\u3068\u3044\u3046\u3088\u308a\u30c6\u30b9\u30c8\u3057\u3066\u3044\u305f\u306e\u3067)\u3001\u5927\u5e45\u306b\u66f8\u304d\u63db\u3048\u307e\u3057\u305f\u3002\u5730\u5473\u306b\u30e1\u30e2\u30ea\u914d\u7f6e\u3082HiFive1\u3068HiFive1 Rev B\u3067\u9055\u3046\u306e\u3067\u3064\u307e\u3065\u304d\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u307e\u305ariscv32-unknown-none.json\u3092\u4f5c\u6210\u3057\u3066\u4ee5\u4e0b\u306e\u5185\u5bb9\u306b\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n  \"abi-blacklist\": &#91;\n    \"cdecl\",\n    \"stdcall\",\n    \"fastcall\",\n    \"vectorcall\",\n    \"thiscall\",\n    \"aapcs\",\n    \"win64\",\n    \"sysv64\",\n    \"ptx-kernel\",\n    \"msp430-interrupt\",\n    \"x86-interrupt\",\n    \"amdgpu-kernel\"\n  ],\n  \"llvm-target\": \"riscv32-unknown-none\",\n  \"data-layout\": \"e-m:e-p:32:32-i64:64-n32-S128\",\n  \"linker-flavor\": \"gcc\",\n  \"cpu\": \"generic-rv32\",\n  \"target-endian\": \"little\",\n  \"target-pointer-width\": \"32\",\n  \"target-c-int-width\": \"32\",\n  \"arch\": \"riscv32\",\n  \"os\": \"none\",\n  \"features\": \"+m,+a\",\n  \"disable-redzone\": true,\n  \"panic-strategy\": \"abort\",\n  \"relocation-model\": \"static\",\n  \"atomic-cas\": true,\n  \"max-atomic-width\": \"32\"\n}\n<\/code><\/pre>\n\n\n\n<p>\u6b21\u306b\u30ea\u30f3\u30ab\u30b9\u30af\u30ea\u30d7\u30c8\u3092config\/riscv32\/hifive.ld\u3068\u3057\u3066<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>MEMORY {\n    rom : ORIGIN = 0x20010000, LENGTH = 0x6a120\n    ram : ORIGIN = 0x80000000, LENGTH = 0x4000\n}\n\nENTRY(_main)\n\nSECTIONS {\n    .boot_entry : {} &gt; rom\n    .text : {*(.text*)} &gt; rom\n    .rodata : {*(.rodata*)} &gt; rom\n    .bss : {*(.bss*)} &gt; ram\n} \n<\/code><\/pre>\n\n\n\n<p>\u3068\u3057\u3066\u304f\u3060\u3055\u3044\u3002(\u30b5\u30f3\u30d7\u30eb\u306a\u3069\u3092\u6f01\u3063\u3066\u9069\u5f53\u306b\u4f5c\u3063\u305f\u306e\u3067\u5b9f\u7528\u5316\u306e\u3068\u304d\u306f\u3082\u3063\u3068\u3061\u3083\u3093\u3068\u3057\u3066\u304f\u3060\u3055\u3044&#8230;)<\/p>\n\n\n\n<p>\u30c4\u30fc\u30eb\u30c1\u30a7\u30fc\u30f3\u306f\u30d3\u30eb\u30c9\u3057\u3066\u3082\u826f\u3044\u3067\u3059\u304c\u3001\u516c\u5f0f(<a href=\"https:\/\/www.sifive.com\/boards\">https:\/\/www.sifive.com\/boards<\/a>)\u304b\u3089Prebuilt RISC\u2011V GCC Toolchain\u3092\u6301\u3063\u3066\u304d\u3066\u304f\u3060\u3055\u3044\u3002(riscv64\u306e\u30d0\u30a4\u30ca\u30ea\u3060\u304criscv32\u3082\u6271\u3048\u308b\u307f\u305f\u3044)\u3002\u307e\u305fexport\u3067\u3082\u3057\u3066\u30d1\u30b9\u3092\u901a\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<p>Makefile\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#\u74b0\u5883\u8a2d\u5b9a\n##\u540d\u524d\nNAME = ruscv\n\n##\u30bf\u30fc\u30b2\u30c3\u30c8\nTARGET_ARCH = $(2)\nifeq ($(strip $(TARGET_ARCH)),)\n    TARGET_ARCH = riscv32\nendif\nRUST_TARGET = $(TARGET_ARCH)-unknown-none\n#RUST_TARGET_FILE_FOLDER = target-json\/ # https:\/\/github.com\/japaric\/xargo\/issues\/146\n\n##\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\nSRC = src\/\nMAKE_BASEDIR ?= $(shell pwd)\/\nMAKE_BINDIR = $(MAKE_BASEDIR)bin\/\nMAKE_IMGDIR = $(MAKE_BINDIR)img\/\nMAKE_TMPDIR = $(MAKE_BASEDIR)tmp\/\nMAKE_OBJDIR = $(MAKE_TMPDIR)obj\/\nMAKE_CONGIGDIR =  $(MAKE_BASEDIR)config\/$(TARGET_ARCH)\/\n\n##\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\nSTRIP= riscv64-unknown-elf-strip\n##\u2191\u5909\u66f4\nMKDIR = mkdir -p\nCP = cp -r\nRM = rm -rf\nLD = riscv64-unknown-elf-ld -n --gc-sections -Map $(MAKE_TMPDIR)$(NAME).map -nostartfiles -nodefaultlibs -m elf32lriscv -nostdlib -T $(MAKE_CONGIGDIR)hifive1.ld\nCARGO = cargo\nQEMU = qemu-system-riscv32 --nographic -machine sifive_e\n\n##\u30d3\u30eb\u30c9\u30d5\u30a1\u30a4\u30eb\nKERNELFILES = kernel.elf\nRUST_OBJ = target\/$(RUST_TARGET)\/release\/lib$(NAME).a\nBOOT_SYS_LIST = $(RUST_OBJ)\n\n#\u521d\u671f\u8a2d\u5b9a\nexport TARGET_ARCH\nexport MAKE_BINDIR\nexport MAKE_TMPDIR\nexport MAKE_OBJDIR\n\n\n#\u5404\u30b3\u30de\u30f3\u30c9\n##\u30c7\u30d5\u30a9\u30eb\u30c8\u52d5\u4f5c\ndefault:\n\t$(MAKE) kernel\n\t-$(STRIP) $(MAKE_BINDIR)*.elf #\u3067\u304d\u306a\u304f\u3066\u3082\u3044\u3044\n\n##\u521d\u671f\u5316\u52d5\u4f5c\ninit:\n\t-$(MKDIR) $(MAKE_BINDIR)\n\t-$(MKDIR) $(MAKE_TMPDIR)\n\t-$(MKDIR) $(MAKE_OBJDIR)\n\nclean:\n\t$(RM) $(MAKE_TMPDIR)\n\t$(CARGO) clean\n\nkernel:\n\t$(MAKE) init\n\t$(MAKE) $(KERNELFILES)\n\n#run:\n#\t$(MAKE) kernel\n#\t$(QEMU) -kernel bin\/kernel.elf\n\n# \u30d5\u30a1\u30a4\u30eb\u751f\u6210\u898f\u5247\nkernel.elf : $(BOOT_SYS_LIST)\n\t$(LD) -o $(MAKE_BINDIR)kernel.elf $(BOOT_SYS_LIST)\n\n$(RUST_OBJ) :  .FORCE\n\t$(CARGO) xbuild --release --target $(RUST_TARGET_FILE_FOLDER) $(RUST_TARGET)\n\n.FORCE:\n<\/code><\/pre>\n\n\n\n<p>\u305d\u3093\u306a\u308f\u3051\u3067make\u3059\u308b(make run\u306f\u52d5\u304d\u307e\u305b\u3093)\u3068kernel.elf\u304c\u3067\u304d\u308b\u306e\u3067<\/p>\n\n\n\n<p><strong><code>riscv64-unknown-elf-objcopy<\/code><\/strong><code> &nbsp;-O ihex kernel.elf kernel.hex<\/code><br>\u3068\u3059\u308b\u3068hex\u30d5\u30a1\u30a4\u30eb\u304c\u3067\u304d\u308b\u306e\u3067\u3001HiFive1\u3092USB\u63a5\u7d9a\u3057\u3066USB\u30e1\u30e2\u30ea\u3068\u3057\u3066\u8a8d\u8b58\u3055\u308c\u305f\u306e\u3061\u306bkernel.hex\u3092\u653e\u308a\u8fbc\u3080\u3068\u30d5\u30e9\u30c3\u30b7\u30e5\u3055\u308c\u3066\u518d\u8d77\u52d5\u3057\u307e\u3059\u3002<br>\u30ea\u30bb\u30c3\u30c8\u3068\u540c\u6642\u306bcu\u30b3\u30de\u30f3\u30c9\u306a\u3069\u3067USB\u30b7\u30ea\u30a2\u30eb\u901a\u4fe1\u3092\u3059\u308b\u3068\u300cHello, RISC-V!\u300d\u3068\u8868\u793a\u3055\u308c\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3082\u3068\u306eWelcome\u8868\u793a\u306b\u623b\u3059\u306b\u306f\u30b5\u30f3\u30d7\u30eb\u3092\u30d3\u30eb\u30c9\u3057\u306a\u3044\u3068\u3044\u3051\u306a\u3044\u306e\u3067\u3059\u304c\u3001\u30d3\u30eb\u30c9\u30c1\u30a7\u30fc\u30f3\u306f\u914d\u5e03\u3055\u308c\u3066\u308b\u30d0\u30a4\u30ca\u30ea\u3092\u5229\u7528\u3057\u3066nano.specs\u306e\u8a18\u8ff0\u3092\u524a\u9664\u3059\u308b\u306a\u308a\u3001\u8272\u3005\u624b\u9593\u304c\u5fc5\u8981\u3060\u3063\u305f\u306e\u3067\u6ce8\u610f\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u305b\u3063\u304b\u304f\u306a\u306e\u3067\u3001Welcome\u30b5\u30f3\u30d7\u30eb\u306e<br>HiFive1 RevB\u7528\u306eHex\u30d5\u30a1\u30a4\u30eb\u3092\u4e0a\u3052\u3066\u304a\u304d\u307e\u3059\u3002(Apache Licence 2.0)<br><a href=\"https:\/\/repo.taprix.org\/pg_mana\/riscv\/hifive1revb\/\">https:\/\/repo.taprix.org\/pg_mana\/riscv\/hifive1revb\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30ad\u30e3\u30f3\u30d72019\u306b\u30c1\u30e5\u30fc\u30bf\u30fc\u3068\u3057\u3066\u53c2\u52a0\u3057\u3066\u3044\u308b\u3068\u304d\u306bhikalium\u5148\u751f\u304b\u3089HiFive1 RevB\u3068\u3044\u3046\u3082\u306e\u3092\u501f\u308a\u3066\u3001https:\/\/github.com\/PG-MANA\/RuscV (Rust\u3067\u66f8\u304b\u308c\u305fO [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,5],"tags":[],"class_list":["post-617","post","type-post","status-publish","format-standard","hentry","category-seccamp","category-programming"],"_links":{"self":[{"href":"https:\/\/pg-mana.net\/blog\/wp-json\/wp\/v2\/posts\/617","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pg-mana.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pg-mana.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pg-mana.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pg-mana.net\/blog\/wp-json\/wp\/v2\/comments?post=617"}],"version-history":[{"count":0,"href":"https:\/\/pg-mana.net\/blog\/wp-json\/wp\/v2\/posts\/617\/revisions"}],"wp:attachment":[{"href":"https:\/\/pg-mana.net\/blog\/wp-json\/wp\/v2\/media?parent=617"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pg-mana.net\/blog\/wp-json\/wp\/v2\/categories?post=617"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pg-mana.net\/blog\/wp-json\/wp\/v2\/tags?post=617"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}