使用 Linux 內建的指令 hexdump 就可以將 *.bin 轉換成 *.mem
讓 verilog 的 $readmemh 直接讀取
範例:8051 的 program : test.bin 轉換成 test.mem
$ hexdump -e '"@%07.7_ax " 8/1 "%02x " "n"' test.bin > test.mem
使用 Linux 內建的指令 hexdump 就可以將 *.bin 轉換成 *.mem
讓 verilog 的 $readmemh 直接讀取
範例:8051 的 program : test.bin 轉換成 test.mem
$ hexdump -e '"@%07.7_ax " 8/1 "%02x " "n"' test.bin > test.mem
因工作上需要 hex2bin 的工具 又懶得自己寫
在網路上發現一個寫的還不錯的 hex2bin source code : hex2bin-1.0.9
其中包含了兩個程式 hex2bin and mot2bin
但使用時出現了錯誤的情形,
原來是 compile 時必須是 32-bit 架構,而我卻是在 64-bit Linux 下編譯的,
為了解決這問題,
首先安裝 32-bit gcc compiler
$ sudo zypper in libstdc++47-devel-32bit $ sudo zypper in gcc47-32bit
接下來修改 hex2bin 的 Makefile,在 gcc 後面加上 -m32 參數
重新編譯後即可正常使用!
在公司用 OpenSuSE 架設了一個 OpenVPN Server
做好之後,發現從家裡除了 VPN Server 之外
其他與 VPN Server 同一網段的機器都連不上
後來發現,原來還需要設定 NAT!
首先編輯 NAT 設定擋
$ vi /root/openvpn_nat.sh #! /bin/bash # 清除所有規則 iptables -F iptables -X iptables -Z iptables -t nat -F iptables -t nat -X iptables -t nat -Z iptables -t mangle -F iptables -t mangle -X iptables -t mangle -Z # 定義防火牆政策 iptables -P INPUT ACCEPT iptables -P OUTPUT ACCEPT iptables -P FORWARD ACCEPT iptables -t nat -P PREROUTING ACCEPT iptables -t nat -P POSTROUTING ACCEPT iptables -t nat -P OUTPUT ACCEPT # 讓 OpenVPN 能進去 LAN echo "1" > /proc/sys/net/ipv4/ip_forward iptables -t nat -A POSTROUTING -o eth0 -s 10.8.0.0/24 -j MASQUERADE
測試OK,其他的機器都可以連上了!
接下來更改設定擋,以後不需要在手動啟動了
$ vi /etc/init.d/boot.local # NAT for OpenVPN /root/openvpn_nat.sh
重新開機後,測試OK!
搞定,收工!
最近這幾次升級 OpenSuSE 時都遇到一些問題
不過還好都有順利解決
這次仍然使用 command line 的 方式
$ zypper modifyrepo --all --disable $ zypper addrepo --name "openSUSE-12.2-OSS" http://download.opensuse.org/distribution/12.2/repo/oss/ repo-12.2-oss $ zypper addrepo --name "openSUSE-12.2-Non-Oss" http://download.opensuse.org/distribution/12.2/repo/non-oss/ repo-12.2-non-oss $ zypper addrepo --refresh --name "openSUSE-12.2 Update-Oss" http://download.opensuse.org/update/12.2/ repo-12.2-update $ zypper addrepo --refresh --name "openSUSE-12.2-Update-Non-Oss" http://download.opensuse.org/update/12.2-non-oss/ repo-12.2-non-oss-update $ zypper dup --download "in-advance"
經過漫長下載與安裝後,重新開機…. 但是
居然 GRUB 開機失敗!
錯誤訊息:
.... Kernel (hd0,0)/grub2/core.img root=/dev/system/root resume=/dev/system/swap splash=silent quiet showopts vga=0x31a Error 15: File not found Press any key to continue...
似乎是從 GRUB 到 GRUB2 升級失敗?
後來發現 /grub2/core.img 這路徑不對,應該是 /grub2/i386-pc/core.img 才對
先進到 GRUB 將啟動參數路徑修改正確 press “e”
Kernel (hd0,0)/grub2/i386-pc/core.img root=/dev/system/root resume=/dev/system/swap splash=silent quiet showopts vga=0x31a
and than press “b” to boot:
結果,似乎只將 GRUB2 啟動,OpenSuSE 沒動靜??
只好 press “c” 進到命令列,手動啟動 OpenSuSE
> linux /boot/vmlinuz-...[press TAB] ro root=/dev/system/root > initrd /boot/initrd-...[press TAB] > boot
好耶,OpenSuSE 12.1 順利啟動!
立刻進到 YaST 看看 bootloader 的設定
發先仍是 GRUB
將他改成 GRUB2 ,儲存,重新開機後 OK 了!
最近常遇到 “License: Error, 0x3f2” 的問題,可是不知道什麼意思?
後來找到一些資料,留著參考先:
error info: 1 No “VENDOR_STRING=ES=XXXXXXXXXXXXXXXXXXXX" License: Error, 0x3e9, Contact customer support. Program will now exit. 2 ES length < 0×14 and ES length != 0x0F License: Error, 0x3ea, Contact customer support. Program will now exit. 3 “VENDOR_STRING=MAC=XXXXXXXXXXXXXXX" length error License: Error, 0x3eb, Contact customer support. Program will now exit. 4 “VENDOR_STRING=ES=XXXXXXXXXXXXXXXXXXXX" ES mismatch License: Error, 0x3ec, Contact customer support. Program will now exit. 5 count=uncounted or count=0 License: Error, 0x3ed, Contact customer support. Program will now exit. 6 No SERVER line (License server = null string) License: Error, 0x3ee, Contact customer support. Program will now exit. 7 FEATURE HOSTID type error License: Error, 0x3ef, Contact customer support. Program will now exit. 8 lc_isadmin error License: Error, 0x3f0, Contact customer support. Program will now exit. 9 SERVER HOSTID type error License: Error, 0x3f1, Contact customer support. Program will now exit. 0A FEATURE desktop_main exists, but its version > 5.300000000000000 License: Error, 0x3f2, Contact customer support. Program will now exit. 0B FEATURE desktop_main doesn’t exist, and some fields in the feature line are wrong License: Error, 0x3f3, Contact customer support. Program will now exit. 0C expiration date = permanent or (expiration date – today) > 0x2dc License: Error, 0x3f4, Contact customer support. Program will now exit. 0D, 0E, 0F expiration date format error License: Error, 0x3f5, 0x3f6, 0x3f7 Contact customer support. Program will now exit.
7/10 訂購,7/12 就收到,真是迅速(廣州到台灣)
接下來要來研究研究如何改裝