WSL + clang
scan-buildを使いたかったため、WSLでclangを試す。
install
sudo apt install clang
使う
clang hoge.cxx
scan-build
yumの履歴確認
yum history list all Loaded plugins: fastestmirror, langpacks, nvidia ID | Login user | Date and time | Action(s) | Altered ------------------------------------------------------------------------------- 123 | <suima> | 2020-11-30 16:36 | Update | 8 EE 122 | <suima> | 2020-11-04 14:41 | Install | 3 EE 121 | <suima> | 2020-09-18 22:57 | Install | 1 ...
listでは具体的に、何のパッケージに対して実施したのか分からない。 詳しく調べる場合は、listで表示されたIDを指定する。
yum history info 122 Loaded plugins: fastestmirror, langpacks, nvidia Transaction ID : 122 Begin time : Mon Nov 30 18:07:48 2020 Begin rpmdb : 2677:399d9b70b360ff5ba5820fe2e460d2507721d078 End time : 18:07:49 2020 (1 seconds) End rpmdb : 2678:83f5429072dd7967ec6b67bc463d7e6c1a35fe14 User : suima <suima> Return-Code : Success Command Line : install systemd-devel.i686 Transaction performed with: Installed rpm-4.11.3-40.el7.x86_64 @base Installed yum-3.4.3-163.el7.centos.noarch @base Installed yum-metadata-parser-1.1.4-10.el7.x86_64 @anaconda Installed yum-plugin-fastestmirror-1.1.31-52.el7.noarch @base Packages Altered: Install systemd-devel-219-78.el7_9.2.i686 @updates history info
WSL から nios2-download すると出るエラー: .elf.srec not found
wsl
から nios2-download
で書き込みを行おうとすると .elf.sre
のファイルがないと怒られる。
nios2-download -c 1 ./hoge.elf -g hoge.elf.srec not found
空っぽの hoge.elf.srec
を作ってやると解決する。
touch hoge.elf.srec nios2-download -c 1 ./hoge.elf -g Using cable "USB-Blaster [1-2]", device 1, instance 0x00 Pausing target processor: OK Initializing CPU cache (if present) OK Downloaded 345KB in 1.6s (215.6KB/s) Verified OK Starting processor at address 0x00000238 nios2-terminal: connected to hardware target using JTAG UART on cable nios2-terminal: "USB-Blaster [1-2]", device 1, instance 0 nios2-terminal: (Use the IDE stop button or Ctrl-C to terminate) ...
Linux で USB Blaster を認識させる
ドライバーの準備
/etc/udev/rules.d/51-altera-usb-blaster.rules
に新しい udev ルールを作成する。
/etc/udev/rules.d/51-altera-usb-blaster.rules SUBSYSTEM=="usb", ATTR{idVendor}=="09fb", ATTR{idProduct}=="6001", MODE="0666" SUBSYSTEM=="usb", ATTR{idVendor}=="09fb", ATTR{idProduct}=="6002", MODE="0666" SUBSYSTEM=="usb", ATTR{idVendor}=="09fb", ATTR{idProduct}=="6003", MODE="0666" SUBSYSTEM=="usb", ATTR{idVendor}=="09fb", ATTR{idProduct}=="6010", MODE="0666" SUBSYSTEM=="usb", ATTR{idVendor}=="09fb", ATTR{idProduct}=="6810", MODE="0666"
udevのルールを記述したら、いったんJTAGを抜いてファイルをリロードする。
sudo udevadm control --reload
jtagconfig
で認識されているか確認する。認識されているれば完了。
jtagconfig 1) USB-Blaster [1-2] Unable to read device chain - JTAG chain broken 2) USB-BlasterII [1-1] 02E660DD 10AX115H(1|2|3|4|4E3)/.. 020A40DD 5M(1270ZF324|2210Z)/EPM2210
なにやらJtag Chainがおかしい。
lsusb
で確認する。 Altera Blaster
が USB Blaster
、 Altera
が USB Blaster II
だ。
lsusb Bus 001 Device 006: ID 09fb:6001 Altera Blaster Bus 001 Device 005: ID 8087:0aaa Intel Corp. Bus 001 Device 002: ID 09fb:6010 Altera
libudev 32bitのインストール
jtagconfig
で Unable to read device chain - JTAG chain broken
というエラーが起きる場合は
- 接続不良
libudev
の 32bit パッケージが足りてない
が考えられる。接続を確認してもエラーが出たので、後者のライブラリをインストールする。
rpm
rpmの 場合は、以下のURLから適当なパッケージを選んでインストールする。
例えばCent OS 8なら systemd-devel-239-31.el8_2.2.i686.rpm
を入れる。
sudo yum install http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/systemd-devel-239-31.el8_2.2.i686.rpm
jtagconfig で確認
jtagd
を再起動させ、udevを再ロードする。
sudo killall -9 jtagd jtagd jtagconfig 1) USB-Blaster [1-2] 02E660DD 10AX115H(1|2|3|4|4E3)/.. 2) USB-BlasterII [1-1] 02E660DD 10AX115H(1|2|3|4|4E3)/.. 020A40DD 5M(1270ZF324|2210Z)/EPM2210
USB-Blaster I,II の両方が確認できた。
使ってて認識しなくなったとき
JTAGケーブルを抜く
sudo killall -9 jtagd sudo udevadm control --reload jtagd
JTAGケーブルを挿して jtagconfig
で確かめる。
Kerass で AttributeError: 'str' object has no attribute 'decode' が出た
Kerasで保存したモデルをロードする際に
AttributeError: 'str' object has no attribute 'decode'
というエラーが出た.
KerasとTesorflowのバージョンの組み合わせだけでなく h5py
も変更したら直った.
pip install h5py==2.10.0
KerasとTensorflowのバージョンは以下の通り.
keras: 2.2.4
tensorflow-1.14.0
バージョンは適宜更新する必要があり?
Wireshark + Cent君
Ethのフレームを確認するのに使ったのでメモ.
環境
Install
今回は最新版が欲しいわけじゃないので,公式パッケージから持ってくる.
sudo sudo yum install wireshark-gnome # インストールの情報...略
グループの追加
sudo usermod -a -G wireshark suima id suima uid=1006(suima) gid=1006(suima) groups=1006(suima),10(wheel), xxx(wireshark)
再ログインするとユーザーグループが反映されて, Interface が選択できるようになる.
VScode: warning: agent returned different signature type ssh-rsa (expected rsa-sha2-512)
VScodeでSSH接続ができなくなっていた
Windows Updateで何かが変わったらしく,SSH Agentが無効になってしまった.VScodeから会社サーバやgithub等のサービスへ接続できなくなった.
Get-Process : Cannot find a process with the name "ssh-agent".`
SSH Agentを有効にする
Power Shellを管理者権限で起動し,以下のコマンドを実行する. Remote Development Tips and Tricks を参考にした.
Set-Service ssh-agent -StartupType Automatic
Start-Service ssh-agent
Get-Service ssh-agent
Power Shell でインストールしたsshが使えない
SSH Agentを有効にしたが,次のようなエラーが発生して失敗してしまった.
warning: agent returned different signature type ssh-rsa (expected rsa-sha2-512)
Open SSH のアンインストール
C:\Windows\System32\OpenSSH
にインストールされているOpenSSHをアンインストールする.
Get-Service -Name ssh-agent | Stop-Service
sc.exe delete ssh-agent
Remove-WindowsCapability -Online -Name "OpenSSH.Client~~~~0.0.1.0" Remove-WindowsCapability -Online -Name "OpenSSH.Server~~~~0.0.1.0"
Open SSH のインストール
Chocolatey を使ってOpen SSHをインストールする.Chocolateyが使えない場合,PowerShell/openssj-portableから直接ダウンロード&ビルド&インストールできる.
choco install openssh --package-parameters="/SSHAgentFeature"
VScodeのRemote.SSH:Pathを変更
C:\Program Files\OpenSSH-Win64\ssh.exe
これで繋がるようになった.
Quartus: コマンドからファームウェアのサンプルプロジェクトを作成
Quartus でコマンドからファームウェアのサンプルプロジェクトを作成
使用可能なサンプルプロジェクトの一覧を調べる.
nios2-swexample-create --list
Quartus 20.2では以下のサンプルが用意されていた.
blank_project web_server memtest_small simple_socket_server memtest count_binary hello_world_small hello_alt_main board_diag hello_world float2_performance float2_gcc float2_functionality hello_ucosii
例: Hello World (NO OS)
Nios II が動いているか確かめる.sopcinfoのパスは適宜変更する.
nios2-swexample-create --sopc-file=$(path to system.sopcinfo) --type=hello_world --elf-name=app.elf --app-dir=app --bsp-dir=bsp
例: Hello World (MicroC/OS-II)
Nios II + ucos ii を動かす.
nios2-swexample-create --sopc-file=$(path to system.sopcinfo) --type=hello_ucosii --elf-name=app.elf --app-dir=app --bsp-dir=bsp
wslのデフォルトシェルをzshに変更する
chsh で変更する
zsh を install する.
sudo apt install zsh
chsh で変更する.
chsh -s $(which zsh)
oh my zsh を導入する場合
- ohmyzsh/ohmyzsh を使う.
Method | Command |
---|---|
curl | sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" |
wget | sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" |
fetch | sh -c "$(fetch -o - https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" |
awesomeでtagごとに背景
awesomeでtagごとに背景変えたかったのでメモ。
強引な気がするけど一応動いてる
-- {{{ Tag Wallpapers for s = 1, screen.count() do tags[s] = awful.tag(tags.name, s, tags.layout) for t = 1, 9 do tags[s][t]:add_signal("property::selected", function (tag) if not tag.selected then return end wallpaper_cmd = "awsetbg /home/user/Pictures/wallpaper" .. t .. ".png" awful.util.spawn(wallpaper_cmd) end) end end ---}}}