1*4882a593SmuzhiyunBeagleV 2*4882a593Smuzhiyun======= 3*4882a593Smuzhiyun 4*4882a593SmuzhiyunBeagleV is a low-cost RISC-V 64-bit based platform, powered by a 5*4882a593SmuzhiyunStarfive JH7100 processor. The current defconfig in Buildroot has been 6*4882a593Smuzhiyuntested with the JH7100 chip used on the beta version of the BeagleV 7*4882a593Smuzhiyunboard. 8*4882a593Smuzhiyun 9*4882a593SmuzhiyunHow to build 10*4882a593Smuzhiyun============ 11*4882a593Smuzhiyun 12*4882a593Smuzhiyun$ make beaglev_defconfig 13*4882a593Smuzhiyun$ make 14*4882a593Smuzhiyun 15*4882a593SmuzhiyunBuild results 16*4882a593Smuzhiyun============= 17*4882a593Smuzhiyun 18*4882a593SmuzhiyunAfter building, output/images contains: 19*4882a593Smuzhiyun 20*4882a593Smuzhiyun+ bootloader-BEAGLEV-buildroot.bin.out 21*4882a593Smuzhiyun+ ddrinit-2133-buildroot.bin.out 22*4882a593Smuzhiyun+ Image 23*4882a593Smuzhiyun+ fw_payload.bin 24*4882a593Smuzhiyun+ fw_payload.bin.out 25*4882a593Smuzhiyun+ fw_payload.elf 26*4882a593Smuzhiyun+ rootfs.ext2 27*4882a593Smuzhiyun+ rootfs.ext4 28*4882a593Smuzhiyun+ sdcard.img 29*4882a593Smuzhiyun+ u-boot.bin 30*4882a593Smuzhiyun 31*4882a593SmuzhiyunThe four important files are: 32*4882a593Smuzhiyun 33*4882a593Smuzhiyun - bootloader-BEAGLEV-buildroot.bin.out, the first stage bootloader 34*4882a593Smuzhiyun 35*4882a593Smuzhiyun - ddrinit-2133-buildroot.bin.out, the DDR initialization firmware 36*4882a593Smuzhiyun 37*4882a593Smuzhiyun - fw_payload.bin.out, which is the bootloader image, containing 38*4882a593Smuzhiyun both OpenSBI and U-Boot. 39*4882a593Smuzhiyun 40*4882a593Smuzhiyun - sdcard.img, the SD card image, which contains the root filesystem, 41*4882a593Smuzhiyun kernel image and Device Tree. 42*4882a593Smuzhiyun 43*4882a593SmuzhiyunFlashing the SD card image 44*4882a593Smuzhiyun========================== 45*4882a593Smuzhiyun 46*4882a593Smuzhiyun$ sudo dd if=output/images/sdcard.img of=/dev/sdX 47*4882a593Smuzhiyun 48*4882a593SmuzhiyunPreparing the board 49*4882a593Smuzhiyun=================== 50*4882a593Smuzhiyun 51*4882a593SmuzhiyunConnect the Beagle-V fan to the 5V supply (pin 2 or 4 of the GPIO 52*4882a593Smuzhiyunconnector) and GND (pin 6 of the GPIO connector). 53*4882a593Smuzhiyun 54*4882a593SmuzhiyunConnect a TTL UART cable to pin 8 (TX), 10 (RX) and 14 (GND). 55*4882a593Smuzhiyun 56*4882a593SmuzhiyunInsert your SD card. 57*4882a593Smuzhiyun 58*4882a593SmuzhiyunPower-up the board using an USB-C cable. 59*4882a593Smuzhiyun 60*4882a593SmuzhiyunFlashing OpenSBI/U-Boot 61*4882a593Smuzhiyun======================= 62*4882a593Smuzhiyun 63*4882a593SmuzhiyunThe bootloader pre-flashed on the Beagle-V has a non-working 64*4882a593Smuzhiyunfdt_addr_r environment variable value, so it won't work 65*4882a593Smuzhiyunas-is. Reflashing the bootloader with the bootloader image produced by 66*4882a593SmuzhiyunBuildroot is necessary. 67*4882a593Smuzhiyun 68*4882a593SmuzhiyunWhen the board starts up, a pre-loader shows a count down of 2 69*4882a593Smuzhiyunseconds, interrupt by pressing any key. You should reach a menu like 70*4882a593Smuzhiyunthis: 71*4882a593Smuzhiyun 72*4882a593Smuzhiyun--------8<---------- 73*4882a593Smuzhiyun 74*4882a593Smuzhiyunbootloader version:210209-4547a8d 75*4882a593Smuzhiyunddr 0x00000000, 1M test 76*4882a593Smuzhiyunddr 0x00100000, 2M test 77*4882a593SmuzhiyunDDR clk 2133M,Version: 210302-5aea32f 78*4882a593Smuzhiyun0 79*4882a593Smuzhiyun*************************************************** 80*4882a593Smuzhiyun*************** FLASH PROGRAMMING ***************** 81*4882a593Smuzhiyun*************************************************** 82*4882a593Smuzhiyun 83*4882a593Smuzhiyun0:update uboot 84*4882a593Smuzhiyun1:quit 85*4882a593Smuzhiyunselect the function: 86*4882a593Smuzhiyun 87*4882a593Smuzhiyun--------8<---------- 88*4882a593Smuzhiyun 89*4882a593SmuzhiyunPress 0 and Enter. You will now see "C" characters being 90*4882a593Smuzhiyundisplayed. Ask your serial port communication program to send 91*4882a593Smuzhiyunfw_payload.bin.out using the Xmodem protocol. 92*4882a593Smuzhiyun 93*4882a593SmuzhiyunAfter reflashing is complete, restart the board, it will automatically 94*4882a593Smuzhiyunstart the system from the SD card, and reach the login prompt. 95*4882a593Smuzhiyun 96*4882a593SmuzhiyunFlashing low-level bootloaders 97*4882a593Smuzhiyun============================== 98*4882a593Smuzhiyun 99*4882a593SmuzhiyunThe BeagleV comes pre-flashed with functional low-level bootloaders 100*4882a593Smuzhiyun(called "secondboot" and "ddrinit"). Re-flashing them is not necessary 101*4882a593Smuzhiyunto use this Buildroot defconfig. However, for the sake of 102*4882a593Smuzhiyuncompleteness, Buildroot builds and provides those low-level bootloader 103*4882a593Smuzhiyunimages. 104*4882a593Smuzhiyun 105*4882a593SmuzhiyunYou can flash them as follows: 106*4882a593Smuzhiyun 107*4882a593Smuzhiyun - In the same "pre-loader" menu as the one used above, instead of 108*4882a593Smuzhiyun entering 0 or 1, enter the magic "root@s5t" string. This enters the 109*4882a593Smuzhiyun "expert" features. 110*4882a593Smuzhiyun 111*4882a593Smuzhiyun - Then, press 0 and send over X-modem the 112*4882a593Smuzhiyun bootloader-BEAGLEV-buildroot.bin.out file. 113*4882a593Smuzhiyun 114*4882a593Smuzhiyun - Then, press 1 and send over X-modem the 115*4882a593Smuzhiyun ddrinit-2133-buildroot.bin.out. 116*4882a593Smuzhiyun 117*4882a593SmuzhiyunNote that the reflashing mechanism itself relies on those low-level 118*4882a593Smuzhiyunbootloaders, so if you flash non-working versions, you'll have to go 119*4882a593Smuzhiyunthrough a recovery process. This requires wiring up to a separate 120*4882a593Smuzhiyundebug UART, which pins are located near the HDMI connector. See 121*4882a593Smuzhiyunhttps://wiki.seeedstudio.com/BeagleV-Update-bootloader-ddr-init-boot-uboot-Recover-bootloader/ 122*4882a593Smuzhiyunsection "Recover the bootloader" for more details. The instructions 123*4882a593Smuzhiyunmake use of a jh7100-recover tool, which Buildroot has built as part 124*4882a593Smuzhiyunof this defconfig: it is available as output/host/bin/jh7100-recover. 125