From 257689792311843c32f83a48389a264c00d275a8 Mon Sep 17 00:00:00 2001 From: Matt Mascarenhas Date: Tue, 24 Apr 2018 20:37:33 +0100 Subject: [PATCH] Annotate riscy059 --- miotatsu/riscy/riscy/riscy059.hmml | 106 +++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 miotatsu/riscy/riscy/riscy059.hmml diff --git a/miotatsu/riscy/riscy/riscy059.hmml b/miotatsu/riscy/riscy/riscy059.hmml new file mode 100644 index 0000000..c831955 --- /dev/null +++ b/miotatsu/riscy/riscy/riscy059.hmml @@ -0,0 +1,106 @@ +[video member=miotatsu stream_platform=twitch project=riscy medium=research title="Playing with a Fedora chroot & Ion on the HiFive Unleashed" vod_platform=youtube id=AHH-KfjJn_s annotator=Miblo] +[0:13][Begin to recap and set the stage for the day][:speech] +[0:17][@riskyfive][\\o/] +[0:39][@riskyfive][Hmm, I can't see my own text] +[1:19][@riscyfive][Ah, any feedback on the podcast? Boring? Confusing?] +[4:28][Plug @riscyfive's podcast 'Why So Anemic'[ref + site="Twitter: @coredumppodcast" + page="Episode 1: Why So Anemic?" + url=https://twitter.com/coredumppodcast/status/985931647437672448]] +[4:42][@riskyfive][Well, I want(ed) to keep my mind open. If I had found out (or I later find out) that the OOP-style modeling was the best option then so be it. I just want to get at the truth, I don't have a camp] +[5:30][@riskyfive][People at DConf 2016 thought I was Italian, due to the way I talk] +[6:11][Determine to continue doing stuff with the HiFive Unleashed, [ref + site="SiFive Forums" + page="Is there a more complete system image for Unleashed board?" + url=https://forums.sifive.com/t/is-there-a-more-complete-system-image-for-unleashed-board/1146]] +[10:49][Explain the process of installing Fedora onto the HiFive Unleashed,[ref + site="Fedora Project Wiki" + page="Architectures/RISC-V" + url=https://fedoraproject.org/wiki/Architectures/RISC-V] noting the block size in Arch Linux's example dd invocation[ref + site="Arch Wiki" + page="USB flash installation media" + url=https://wiki.archlinux.org/index.php/USB_flash_installation_media#In_GNU.2FLinux]] +[15:42][@riskyfive][By the way, you probably don't have video on your RISC-V system. SiFive used an adapter FPGA board for their demo. I wanted to share with you and your viewers that you can buy the Nexys Video (the bigger one recommended for ~Bitwise) using an academic discount. I ordered one. We can then later collaborate to get HDMI output using one, or something like that. I can help you with that] +[17:02][Continue to explain the dd part of the installation process] +[17:44][@riskyfive][You can even add MP4 encoding in the FPGA itself. No need for OBS] +[18:38][Continue to explain the installation process] +[19:08][@riskyfive][You need more Patreons. I'll try to promote you[ref + site=Patreon + page="miotatsu is creating RISCY BUSINESS" + url=https://www.patreon.com/miotatsu][ref + site=Gumroad + page="RISCY BUSINESS: Programming a handmade tool-chain for RISC-V live on Twitch" + url=https://gumroad.com/riscy]] +[20:49][Finish up explaining the setup process, including building the Ion compiler from ~bitwise and having it run out of the box!] +[23:00][Don the antistatic wristband and plug in the HiFive Unleashed][:admin] +[24:03][@riskyfive][Where are you plugging the band?] +[25:03][@riskyfive][The "duct tape" method. Good engineering] +[25:23][Read 5.3. Knobs on the HiFive Unleashed[ref + site="SiFive Developers" + page="HiFive Unleashed Getting Started Guide" + url=https://www.sifive.com/documentation/boards/hifive-unleashed/hifive-unleashed-getting-started-guide/]] +[27:02][@riskyfive][I've worked with $5K boards at Siemens without grounding and they never exhibited problems. After that I never cared too much] +[28:47][@riskyfive][That actually was very surprising because I kept getting shocked due to the static discharges at that laboratory (when touching the server racks). But the hardware itself never complained] +[30:25][@riskyfive][No, there was a ground. But we were busy and lazy! Maybe that was the trick: I kept discharging myself unintentionally!] +[30:42][Plug in and power up the board][:admin] +[31:53][@riskyfive][Yeah, I pretty much only have grounded plugs in the kitchen] +[32:18][Connect to the HiFive Unleashed and setup the environment][:admin] +[36:45][@riskyfive][It seems the cool kids use tmux these days] +[37:09][Delete our test files related to ion][:admin] +[40:01][@riskyfive][Try: $ shopt | grep checkwinsize] +[41:05][Compile ion, :run generate_test.py, show the resulting Ion code in test3.ion, run ion on that file to produce test3.c] +[43:54][Point out that qemu[ref + site=QEMU + url=https://www.qemu.org/] may provide the closest means to follow along, without having to invest in a HiFive Unleashed][:speech] +[45:30][Try to :run ion on test2.ion and then gcc on the resulting test2.c file] +[46:54][Try to :run ion on test1.ion and then gcc on the resulting test1.c file, to see printouts and input totally working][:"input handling"] +[48:39][Read through test1.ion] +[51:45][:Run test1 to provide the first demo of Ion code compiled to and running on RISC-V] +[52:50][Note @Miblo's thought to use readelf while he wrote annotations for ~Bitwise][:speech] +[55:12][:Run objdump on test2] +[55:44][Determine to run objdump on hello][:speech] +[56:51][@riskyfive][I use readelf all the time for my empire RISC-V port] +[57:03][Continue to figure out how to unfreeze the screen][:admin] +[57:57][@riskyfive][Ctrl-q?] +[58:21][Note the annoyance of the XOFF ASCII character and screen's default keybinding for it][:rant] +[59:39][@riskyfive][Yeah, very annoying. Arguably it's just it not ignoring the ASCII characters (XON / XOFF) that you actually typed] +[1:00:30][Copy hello into the (Fedora) chroot environment][:admin] +[1:01:06][@riskyfive][Yeah, but when you type Ctrl-something it emits certain ASCII characters that are control characters, like stop transmitting (freeze)] +[1:03:35][:Run objdump on our elf64-littleriscv hello] +[1:04:50][Consider trying the hula RISC-V "Hello, world!" on our HiFive Unleashed[ref + site=GitHub + page="riscy-business / hula" + url=https://github.com/riscy-business/hula]] +[1:05:37][@riskyfive][That's just what the ASCII character 19 means: stop transmitting. And when you type Ctrl-s you type that character. The real question is, who thought it was a good idea to transmit control information in-band with the content. That is, if you cat a .txt file that contains that character you're screwed] +[1:07:14][@riskyfive][You see, it used to be that terminals had dedicated wires for control. But then $ happened] +[1:07:31][:Rant on screen having kept legacy baggage around] +[1:09:31][Continue to compare the objdump of hello with hula[ref + site=GitHub + page="riscy-business / hula" + url=https://github.com/riscy-business/hula]] +[1:10:02][@riskyfive][With dedicated wires you don't need in-band control characters] +[1:10:43][@riskyfive][No, there was a message missing in between] +[1:10:52][Compare hula's "write" code with the hello objdump] +[1:11:55][@riskyfive][The Ctrl-z was an example of how the shell has the same problem] +[1:13:11][Note that the hello objdump may not show scall] +[1:14:08][@riskyfive][I agree it's braindead. But just think this: the initial Ctrl-a just means that you want the sequence Ctrl-a q to pass as a Ctrl-q to the target process. It's not a list of Ctrl-a commands, it just a generic escape] +[1:14:34][@riskyfive][scall -> ecall] +[1:15:14][@riskyfive][It's the old name] +[1:15:16][Wonder if the objdump is not using system calls, and that it's a lot bigger than hula] +[1:16:19][@riskyfive][Notice: disassembly of XXX (not .text) section] +[1:16:42][Hunt for a7 in the objdump because that is where you put the syscall number in RISC-V] +[1:18:11][@riskyfive][You can do a readelf of the binary in your main system] +[1:18:27][Consult man readelf] +[1:19:25][:Run readelf -a hello] +[1:20:21][Read through the readelf of hello] +[1:21:40][@riskyfive][Maybe just try GDB with the binary?] +[1:22:13][Continue to read through the readelf of hello] +[1:22:31][@riskyfive][That's why you need the JTAG port] +[1:22:46][Return to the objdump of hello] +[1:23:42][@riskyfive][The system calls are probably wrapped in libc functions] +[1:23:55][Notice the mentions of "libc" in the hello objdump] +[1:24:49][@riskyfive][I think the ligc_start_main is just a red herring. Notice the offset is different between different __libc_start_main lines] +[1:25:58][Notice "libc_start_main" in the hello objdump] +[1:27:59][Consult the objdump of test1, to see that its symbols are correctly resolved] +[1:30:39][Call it a day][:speech] +[/video]