<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Embedded &#8211; richliu&#039;s blog</title>
	<atom:link href="https://blog.richliu.com/category/computer/hardware/embedded/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.richliu.com</link>
	<description>Linux, 工作, 生活, 家人</description>
	<lastBuildDate>Sun, 21 Sep 2025 07:29:00 +0000</lastBuildDate>
	<language>zh-TW</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.6.2</generator>
	<item>
		<title>Running Risc-V Linux on Lattice Versa ECP5 EVB</title>
		<link>https://blog.richliu.com/2025/09/21/6411/running-risc-v-linux-on-lattice-versa-ecp5-evb/</link>
					<comments>https://blog.richliu.com/2025/09/21/6411/running-risc-v-linux-on-lattice-versa-ecp5-evb/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Sun, 21 Sep 2025 06:50:27 +0000</pubDate>
				<category><![CDATA[Embedded]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[IC Design]]></category>
		<category><![CDATA[RiscV]]></category>
		<category><![CDATA[ECP5]]></category>
		<category><![CDATA[FPGA]]></category>
		<category><![CDATA[Linux-on-lite-vexriscv]]></category>
		<category><![CDATA[LiteX]]></category>
		<guid isPermaLink="false">https://blog.richliu.com/?p=6411</guid>

					<description><![CDATA[<p>大部份的環境都要用上一篇(Build Risc-V on Ubuntu Linux)相同的環境，但是其實還有更 [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2025/09/21/6411/running-risc-v-linux-on-lattice-versa-ecp5-evb/">Running Risc-V Linux on Lattice Versa ECP5 EVB</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>大部份的環境都要用上一篇(<a href="https://blog.richliu.com/2025/08/27/6391/build-risc-v-on-ubuntu-linux/">Build Risc-V on Ubuntu Linux</a>)相同的環境，但是其實還有更多的問題，中間也踩了不少地雷，還好都不算難解的問題</p>



<div class="wp-block-rank-math-toc-block" id="rank-math-toc"><h2>Table of Contents</h2><nav><ul><li><a href="#lattice-versa-evb-board-晶片型號不同">Lattice Versa EVB Board 晶片型號不同</a></li><li><a href="#連接上-evb-board">連接上 EVB Board</a></li><li><a href="#燒錄-bitstream-到板子上">燒錄 bitstream 到板子上</a></li><li><a href="#設定-udev">設定 udev</a></li></ul></nav></div>



<span id="more-6411"></span>



<h3 class="wp-block-heading" id="lattice-versa-evb-board-晶片型號不同">Lattice Versa EVB Board 晶片型號不同</h3>



<p>這個是最主要的問題，因為文件並不會提到這件事，都會用 versa_ecp5 帶過，但是實際上 versa_ecp5 是使用 LFE5UM5G-85F 的晶片，晶片比較新，邏輯閘數也比較多。一般市面上賣的 versa_ecp5 是 LFE5UM5G-45F，一片約在一萬元左右。<br />我從淘寶看到一塊比較便宜的 LFE5UM5G-45F ，結果買回來後是 LFE5UM-45F ，沒有 5G。查詢網路上的資料，大概只差在 SEDERS 最高頻可以到 5G ，還有速度比較快。</p>



<p>但是 LiteX default versa_ecp5 是預設用 LFE5UM5G-85F ，在燒錄時就會失敗，ID 不一樣</p>



<p>此時我們就要重編一次 Linux-on-litex-vexriscv ，加上 device 的參數，這樣就可以了</p>



<pre class="wp-block-code"><code>./make.py --device LFE5UM --board=versa_ecp5 --cpu-count=1 --build</code></pre>



<p>編出來的 bitstream 和 fpga hardware 不同的錯誤訊息，可以看到 hardware id 不一樣</p>



<pre class="wp-block-preformatted">$ openFPGALoader -b ecp5_evn versa_ecp5.bit<br />empty<br />Jtag frequency : requested 6.00MHz    -&gt; real 6.00MHz<br />Open file: DONE<br />b3bdffff<br />Parse file: DONE<br />mismatch between target's idcode and bitstream idcode<br />        bitstream has <strong>0x81112043 </strong>hardware requires <strong>0x01112043</strong><br />Error: Failed to program FPGA: std::exception</pre>



<h3 class="wp-block-heading" id="連接上-evb-board">連接上 EVB Board </h3>



<p>EVB Board 應該支援 ethernet load ，但是我還沒試出來，就當 TBD 吧，看設定檔內 ethernet 是可以用的</p>



<p>EVB Board 上的 FT2232H 支援 JTAG 和 Serial Port ，Linux kernel 的 image 可以從 serial port load，不過速度好慢啊</p>



<p>我之前用 Diamond programmer 要燒錄編出來的 bitstream file ，但是因為 id mismatch 的關係所以燒不上去，所以我最後是找了一台乾淨的 Linux 直接接 EVB Board 的 USB （要注意，這塊版子的 USB Port 是 mini-USB ，如果沒附線要有支援 mini-USB 的線），就這樣找到最後才發現根本型號不一樣，所以這篇就不會提到 Diamond programmer</p>



<p>記得接上之前要將 FTDI 的J50跳線改成下圖這樣，要跳過 iSPclock </p>



<p>（原文 <strong>Note</strong>: If you are using a Versa board, you will need to change J50 to bypass the iSPclock. Re-arrange the jumpers to connect pins 1-2 and 3-5 (leaving one jumper spare). See p19 of the Versa Board user guide.）</p>



<figure class="wp-block-image size-full"><img fetchpriority="high" decoding="async" width="699" height="627" src="https://blog.richliu.com/wp-content/uploads/2025/09/image.png" alt="" class="wp-image-6412" srcset="https://blog.richliu.com/wp-content/uploads/2025/09/image.png 699w, https://blog.richliu.com/wp-content/uploads/2025/09/image-600x538.png 600w" sizes="(max-width: 699px) 100vw, 699px" /></figure>



<p>接上去之後，上電之後，Linux 下會出現 /dev/ttyUSB0 是 JTAG 的介面，/dev/ttyUSB1 是 serial port 的介面</p>



<p>在另一個視窗先執行 litex_term（記得在 venv 環境下執行）</p>



<pre class="wp-block-code"><code>litex_term --images=images/boot.json /dev/ttyUSB1</code></pre>



<h3 class="wp-block-heading" id="燒錄-bitstream-到板子上">燒錄 bitstream 到板子上</h3>



<p>最後一步就是燒錄上去了，我是用 OpenFPGAloader ，以下是安裝步驟</p>



<pre class="wp-block-code"><code>sudo apt install -y  libftdi1-dev

cd /nvme/cpu
git clone https://github.com/trabucayre/openFPGALoader
cd openFPGALoader
mkdir -p build
cd build
cmake ../
make -j `nproc`
sudo make install </code></pre>



<p>然後到 linux-on-litex-vexriscv 下用 OpenFPGAloader 暫時 load bitstream 上去，這速度很快，這樣就不用燒上去了</p>



<pre class="wp-block-code"><code>cd /nvme/cpu/linux-on-litex-vexriscv/build/versa_ecp5/gateware
$ openFPGALoader -b ecp5_evn versa_ecp5.bit
empty
Jtag frequency : requested 6.00MHz    -&gt; real 6.00MHz
Open file: DONE
b3bdffff
Parse file: DONE
Enable configuration: DONE
SRAM erase: DONE
Loading: &#91;==================================================] 100.00%
Done
Disable configuration: DONE</code></pre>



<p>如果順利，可以在剛剛執行 litex_term 上看到 load image 訊息<br />如果用的是上一篇文章內提到的先下載好 RiscV 的 Linux image 和 rootfs ，就可以看到 Linux boot 了</p>



<figure class="wp-block-image size-full"><img decoding="async" width="943" height="927" src="https://blog.richliu.com/wp-content/uploads/2025/09/image-1.png" alt="" class="wp-image-6413" srcset="https://blog.richliu.com/wp-content/uploads/2025/09/image-1.png 943w, https://blog.richliu.com/wp-content/uploads/2025/09/image-1-600x590.png 600w, https://blog.richliu.com/wp-content/uploads/2025/09/image-1-768x755.png 768w, https://blog.richliu.com/wp-content/uploads/2025/09/image-1-88x88.png 88w, https://blog.richliu.com/wp-content/uploads/2025/09/image-1-816x802.png 816w" sizes="(max-width: 943px) 100vw, 943px" /></figure>



<p>這年代可以自己編一顆 CPU 跑起來也真的是很有趣</p>



<figure class="wp-block-image size-full"><img decoding="async" width="1353" height="927" src="https://blog.richliu.com/wp-content/uploads/2025/09/image-2.png" alt="" class="wp-image-6414" srcset="https://blog.richliu.com/wp-content/uploads/2025/09/image-2.png 1353w, https://blog.richliu.com/wp-content/uploads/2025/09/image-2-600x411.png 600w, https://blog.richliu.com/wp-content/uploads/2025/09/image-2-768x526.png 768w, https://blog.richliu.com/wp-content/uploads/2025/09/image-2-816x559.png 816w" sizes="(max-width: 1353px) 100vw, 1353px" /></figure>



<p>以下未完成，待續</p>



<h3 class="wp-block-heading" id="設定-udev">設定 udev</h3>



<p>這塊版子看起來要設定過 udev 才能被 LiteX 抓到，首先新增檔案 /etc/udev/rules.d/99-ftdi.rules<br />內容如下，記得 GROUP=換成 Linux login 帳號</p>



<pre class="wp-block-preformatted">SUBSYSTEMS=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", MODE="0660", GROUP="使用者名稱"</pre>



<p>然後執行以下命令之後再重新上電即可</p>



<pre class="wp-block-code"><code>sudo udevadm control --reload-rules
sudo udevadm trigger</code></pre>



<p>這個命令也可以像 OpenFPGAloader 一樣將 bitstream load 到 FPGA 上</p>



<pre class="wp-block-code"><code>./make.py --device LFE5UM --board=versa_ecp5 --cpu-count=1 --load </code></pre>



<p>45F Gate count 夠放二顆 CPU ，所以可以跑 SMP</p>



<pre class="wp-block-code"><code>./make.py --device LFE5UM --board=versa_ecp5 --cpu-count=2 --build
./make.py --device LFE5UM --board=versa_ecp5 --cpu-count=2 --load </code></pre>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1299" height="1033" src="https://blog.richliu.com/wp-content/uploads/2025/09/image-3.png" alt="" class="wp-image-6418" srcset="https://blog.richliu.com/wp-content/uploads/2025/09/image-3.png 1299w, https://blog.richliu.com/wp-content/uploads/2025/09/image-3-600x477.png 600w, https://blog.richliu.com/wp-content/uploads/2025/09/image-3-768x611.png 768w, https://blog.richliu.com/wp-content/uploads/2025/09/image-3-816x649.png 816w" sizes="(max-width: 1299px) 100vw, 1299px" /></figure>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2025/09/21/6411/running-risc-v-linux-on-lattice-versa-ecp5-evb/">Running Risc-V Linux on Lattice Versa ECP5 EVB</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.richliu.com/2025/09/21/6411/running-risc-v-linux-on-lattice-versa-ecp5-evb/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Raspberry Pi Pico W + PicoOLED 2.23 + Arduino 顯示天氣預報降雨機率和空污指數</title>
		<link>https://blog.richliu.com/2023/01/15/5079/raspberry-pi-pico-w-picooled-2-23-arduino-%e9%a1%af%e7%a4%ba%e5%a4%a9%e6%b0%a3%e9%a0%90%e5%a0%b1%e9%99%8d%e9%9b%a8%e6%a9%9f%e7%8e%87%e5%92%8c%e7%a9%ba%e6%b1%a1%e6%8c%87%e6%95%b8/</link>
					<comments>https://blog.richliu.com/2023/01/15/5079/raspberry-pi-pico-w-picooled-2-23-arduino-%e9%a1%af%e7%a4%ba%e5%a4%a9%e6%b0%a3%e9%a0%90%e5%a0%b1%e9%99%8d%e9%9b%a8%e6%a9%9f%e7%8e%87%e5%92%8c%e7%a9%ba%e6%b1%a1%e6%8c%87%e6%95%b8/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Sun, 15 Jan 2023 10:12:54 +0000</pubDate>
				<category><![CDATA[Computer/Technical]]></category>
		<category><![CDATA[ARM]]></category>
		<category><![CDATA[Embedded]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Json]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[Raspberry Pi Pico]]></category>
		<guid isPermaLink="false">https://blog.richliu.com/?p=5079</guid>

					<description><![CDATA[<p>有時候人生就是不能亂買東西，一步錯步步錯，然後就弄了這個出來，當然不是圖中大螢幕的屋內屋外溫濕度狀況，而是左上 [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2023/01/15/5079/raspberry-pi-pico-w-picooled-2-23-arduino-%e9%a1%af%e7%a4%ba%e5%a4%a9%e6%b0%a3%e9%a0%90%e5%a0%b1%e9%99%8d%e9%9b%a8%e6%a9%9f%e7%8e%87%e5%92%8c%e7%a9%ba%e6%b1%a1%e6%8c%87%e6%95%b8/">Raspberry Pi Pico W + PicoOLED 2.23 + Arduino 顯示天氣預報降雨機率和空污指數</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div class="wp-block-image">
<figure class="alignright size-full is-resized"><img loading="lazy" decoding="async" src="https://blog.richliu.com/wp-content/uploads/2023/01/image.png" alt="" class="wp-image-5080" width="360" height="269" srcset="https://blog.richliu.com/wp-content/uploads/2023/01/image.png 1460w, https://blog.richliu.com/wp-content/uploads/2023/01/image-600x450.png 600w, https://blog.richliu.com/wp-content/uploads/2023/01/image-768x575.png 768w" sizes="(max-width: 360px) 100vw, 360px" /></figure></div>


<p>有時候人生就是不能亂買東西，一步錯步步錯，然後就弄了這個出來，當然不是圖中大螢幕的屋內屋外溫濕度狀況，而是左上角小小的溫度預測<br /><br />至於怎麼來的，一切都要從邪惡的阿媽爽60元免運說起，因為60元免運，有時候就會將有些小東西放到購物車內，因為有時候即使加了稅金，從美亞（美國亞馬遜Amazon）網站買東西還比淘寶買便宜，更不要說很多東西只有美亞有，這時候小東西湊60元免運頗方便的<br /><br />原來是我有二張 Arduino 的板子，本來也只是接來做溫度偵測，也沒有什麼用，想說接個小螢幕顯示一下天氣預報，但是這東西又不是很必要，就想想而已，就隨便找了一個看起來順眼的 SPI LCD 和 OLED （想說比較省電）就放到購物車了，上個月美國很多東西都特價，兩雙鞋子才 30 元美金，這塊 OLED 好像也才 15 上下，就被拿來湊運費了，沒想到我手上並沒有東西可以接</p>



<span id="more-5079"></span>



<h2 class="wp-block-heading">Waveshare 2.23 inch OLED</h2>



<figure class="wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex">
<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="609" height="293" data-id="5081" src="https://blog.richliu.com/wp-content/uploads/2023/01/image-1.png" alt="" class="wp-image-5081" srcset="https://blog.richliu.com/wp-content/uploads/2023/01/image-1.png 609w, https://blog.richliu.com/wp-content/uploads/2023/01/image-1-600x289.png 600w" sizes="(max-width: 609px) 100vw, 609px" /></figure>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="609" height="312" data-id="5082" src="https://blog.richliu.com/wp-content/uploads/2023/01/image-2.png" alt="" class="wp-image-5082" srcset="https://blog.richliu.com/wp-content/uploads/2023/01/image-2.png 609w, https://blog.richliu.com/wp-content/uploads/2023/01/image-2-600x307.png 600w" sizes="(max-width: 609px) 100vw, 609px" /></figure>
</figure>



<p>這片是 <a href="https://www.amazon.com/Waveshare-2-23inch-Raspberry-Interface-Operating/dp/B094K2G8K5?th=1" target="_blank" rel="noreferrer noopener">Waveshare Pico OLED 2.23</a> 是一片 2.23 吋的 OLED 螢幕，內建 SSD1305 driver ，可以用 SPI/I2C bus 驅動<br />最大的優勢是，他可以和 Raspberry Pi Pico 的接頭整合在一起</p>



<p>不過我買來之後就傻眼了，因為我以為只是 SPI 螢幕，但是沒有 Raspberry Pi Pico 啊～（謎之音，藉口，明明可以外接）所以本來想接 Arduino 的，只好就買了一片 Raspberry Pi Pico W ，Raspberry Pi Pico W 是有 WiFi 的版本，我想說都要買了，買有 WiFi 的比較方便<br /><br />如果有去 Amazon 網站上會有一行字提到，事後來看可能是地雷<br />The built-in controller used in this OLED is SSD1305, <strong>which has 132 × 64 bit SRAM, supports a maximum 132 × 64 pixels screen, supports SPI/I2C/8bit 8080 parallel port. The solution of this screen is 128 × 32 pixels, so the internal SRAM is not fully used</strong>. This module uses four-wire SPI and I2C interfaces, with good compatibility and high transmission speed.<br /><br />至少以目前看到的資料，只有他的 demo code 可以用，其他沒找到有人成功使它完全正常工作的範例</p>



<h2 class="wp-block-heading">系統架構</h2>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" src="https://blog.richliu.com/wp-content/uploads/2023/01/image-3.png" alt="" class="wp-image-5083" width="633" height="327" srcset="https://blog.richliu.com/wp-content/uploads/2023/01/image-3.png 1317w, https://blog.richliu.com/wp-content/uploads/2023/01/image-3-600x310.png 600w, https://blog.richliu.com/wp-content/uploads/2023/01/image-3-768x397.png 768w" sizes="(max-width: 633px) 100vw, 633px" /></figure>



<p>架構如上，不過為什麼要多一個中介 Server 呢？因為在 PC 上改 code 還是簡單速度快，Arduino 的開發環境很怪， compile 很慢，而整個開發驗證流程太長，我也沒要商業化，當然是選自己好用的為主<br />中間互丟就用 udp 就好，簡單速度快還沒有什麼多有的沒有的事情，畢竟一組 packet 也不會超過 1K</p>



<h2 class="wp-block-heading">Raspberry Pi Pico W</h2>



<p><a href="https://shop.playrobot.com/products/raspberry-pi-pico-w" target="_blank" rel="noreferrer noopener">Raspberry Pi Pico W</a> 是 RP2040 (ARM Cortex M0+ 雙核處理器) 的 CPU + Infineon CYW43439 WiFi 和藍牙，其他就看看規格吧，Raspberry Pi Pico 預設的開發環境是 <a href="https://micropython.org/download/rp2-pico-w/" target="_blank" rel="noreferrer noopener">MicroPython</a> ，用的是 <a href="https://thonny.org/" target="_blank" rel="noreferrer noopener">Thonny </a>這個 IDE<br />另外一個就是使用 <a href="https://www.arduino.cc/en/software" target="_blank" rel="noreferrer noopener">Arduino</a> 加上 <a href="https://github.com/earlephilhower/arduino-pico" target="_blank" rel="noreferrer noopener">arduino-pico</a> 套件<br />我最後是選了 Arduino + Pico SDK 套件，好吧，我也忘了當初是因為什麼會用 Arduino 這個組合的，大概是 Arduino 之前寫過，比較熟悉吧</p>



<p>對了，在跑 Arduino raspberry Pi pico 的 sample code 時，不要選 Fade 或是點 LED 這種網路上常見的 sample code ，因為 Raspberry Pi pico 的 LED 是放在 WiFi 那邊，不是 GPIO 直出，所以只是要驗證可不可以用，example code 請選 teampterature 就好</p>



<h2 class="wp-block-heading">Arduino </h2>



<p>其實 Arduino 的使用還算方便，但是我想到的組合會踏到一個一般人的地雷，ArduinoJson 要使用 C++，但是因為不是用到很複雜的功能，所以抄一抄還可以<br /><br />Arduino 要設定 Additional Boards Manager URLs ，請按照<a href="https://github.com/earlephilhower/arduino-pico" target="_blank" rel="noreferrer noopener">arduino-pico</a>  的說明文件，加上 <a href="https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json" target="_blank" rel="noopener">https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json</a></p>



<p>在安裝的過程中，Windows 所有的 driver 都請同意安裝，否則可能會有奇怪的問題</p>



<p>Tool -&gt; manager Libraries 請安裝 ArduinoJson 和 U8g2 Library</p>



<h2 class="wp-block-heading">Python Server </h2>



<p>抓取資料的部份主要是參考之前的作品<a href="https://blog.richliu.com/2019/10/17/4192/python-%E5%8F%96%E5%BE%97-pm2-5-%E5%92%8C%E5%A4%A9%E6%B0%A3%E8%B3%87%E8%A8%8A/" target="_blank" rel="noreferrer noopener"> Python 取得 PM2.5 和天氣資訊</a>，不過都過了這麼久了，有些部份不一樣，例如文內的 PM2.5 就變 pm2.5</p>



<p>預測天氣部份就使用氣象局的資料，氣象局有針對各縣市鄉鎮的未來二天預報資料，找到你自己要的鄉鎮，再取出資料即可，以新北市來說是 F-D0047-069</p>



<h3 class="wp-block-heading">天氣預測資料</h3>



<p>以下是抓出未來 18 小時共六筆的溫度預測和未來 18 小時三筆的降雨預測資料</p>



<pre class="wp-block-preformatted"> res = "https://opendata.cwb.gov.tw/fileapi/v1/opendataapi/F-D0047-069?Authorization=[請填入你的KEY]D&amp;format=JSON"

        while True:
            try:
                with urllib.request.urlopen(res) as url:
                    data = url.read()
            except urllib.error.URLError as e:
                self.LOG.error(e)
                return -1
            try:
                my_object = json.loads(data.decode('utf-8'))
            except:
                self.LOG.error("Json Error")
                return -1

            item = my_object['cwbopendata']['dataset']['locations']['location']

            for i in range(len(item)):
                if item[i]['locationName'] == "鶯歌區":
                    for j in range(len(item[i]['weatherElement'])):
                        if item[i]['weatherElement'][j]['elementName'] == "T":
                            weather_time_value = item[i]['weatherElement'][j]['time']
                            # 抓出每一個時間和溫度
                            for k in range(len(weather_time_value)):
                                weather_date = weather_time_value[k]['dataTime']
                                data_time = datetime.strptime(weather_date, '%Y-%m-%dT%H:%M:%S%z')
                                clock_string = data_time.strftime('%H')
                                tw_weather.w_data["temp"][clock_string] = weather_time_value[k]['elementValue']['value']
                                self.LOG.debug("now is %s temp is %s" % (clock_string, weather_time_value[k]['elementValue']['value']))
                                # 每三小時一筆，取 18 小時的數據
                                if k >= 5:
                                    break
                        # PoP6h 六小時降雨機率
                        if item[i]['weatherElement'][j]['elementName'] == "PoP6h":
                            weather_rain_value = item[i]['weatherElement'][j]['time']
                            # 抓出每一個時間和溫度
                            for k in range(len(weather_rain_value)):
                                weather_date = weather_rain_value[k]['startTime']
                                data_time = datetime.strptime(weather_date, '%Y-%m-%dT%H:%M:%S%z')
                                clock_string = data_time.strftime('%H')
                                tw_weather.w_data["rain"][clock_string] = weather_rain_value[k]['elementValue']['value']
                                self.LOG.debug("now is %s rain is %s" % (clock_string, weather_rain_value[k]['elementValue']['value']))
                                # 每六小時一筆，取 24 小時的數據
                                if k >= 3:
                                    break</pre>



<h3 class="wp-block-heading">UDP Server</h3>



<p>UDP server 就很簡單，收到資料就將 json 資料丟出去就好，因為資料量少應該不會出問題吧<br /></p>



<pre class="wp-block-preformatted">    def udp_server(self):
        sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        sock.bind(("0.0.0.0", 9999))

        self.LOG.info("Server IP address: %s", socket.gethostbyname(socket.gethostname()))

        while True:
            data, addr = sock.recvfrom(1024)

            json_send_data = json.dumps(self.serve_data)
            sock.sendto(json_send_data.encode(), addr)
</pre>



<h2 class="wp-block-heading">Arduino Sample Code </h2>



<p>Arduino 其實對開發者很友善，安裝 Pico W 套件的時候內有大量的 Sample code ，WiFi 部份就照抄 Sample code 就可以了，這部份不是很大的問題　</p>



<h3 class="wp-block-heading">UDP Client </h3>



<p>不知道大家是不是都不寫 UDP Client ，網路上大部份的範例都是拿 Arduino 當 server 用，而且 WiFiUdp 和 EthernetUDP 也有一點差別，我自己的做法如下<br />Udp.beginPacket 就可以直接送 packet 出去，送出去之後等待二秒收資料就好，不是很好的做法但是我人懶，不想弄異步傳輸，可以用就好</p>



<pre class="wp-block-preformatted">const char* serverip = "10.0.0.1";
const uint16_t serverport = 9999;
const uint16_t localport = 9999;

void setup(void) {
    Udp.begin(localport);
}

void loop(void){
  Udp.beginPacket(serverip, serverport);
  Udp.write("Hello");
  Udp.endPacket();

  delay(2000);

  int packetSize = Udp.parsePacket();
  if (packetSize){
    Udp.read(packetBuffer, UDP_TX_PACKET_MAX_SIZE);
    packetBuffer[packetSize] = 0;

    // The packet is coming from the remote server
    Serial.println("Received packet from: ");
    Serial.println(Udp.remoteIP());
    Serial.println("Packet is: ");
    Serial.println(packetBuffer);
}</pre>



<h2 class="wp-block-heading">ArduinoJson Sample Code</h2>



<p>說實在這個用的時候不知道取出 Json 的資料要會一點 C++ ，雖然我也已經不太懂 C++，不過這東西沒有很難，照抄就好，當初會不會不用 Json 比較好？我不知道，不過用用看嘛，我是記得看到已經到很多版了，應該頗多人用，這樣就不用太害怕要自己修 code <br /><br />但是開發過程中，在這邊碰到當機的問題找了好久，才知道 Arduino 如果程式寫到會當掉，那就要使用 Bootsel 更新，要不然就會一直卡在當機那邊，要不然一直以為是 host 的 driver 爛了<br /><br />以下是 Sample code </p>



<pre class="wp-block-preformatted">// 網路上的範例 200 太小，以我大概 150 byte 還是要設大一點，要不然也有 DynamicJsonDocument 可以用
StaticJsonDocument&lt;500&gt; doc;

    // decode json format 
    DeserializationError error = deserializeJson(doc, packetBuffer);
    if (error) {
        Serial.println("Deserialization failed: " + String(error.c_str()));
        return;
    }
    JsonObject temp = doc["temp"];

    sprintf(buffer,"TEMP: ");
    for (JsonPair kv : temp) {
      sprintf(buffer + strlen(buffer), "%s:%s ", kv.key().c_str(), kv.value().as&lt;const char*&gt;());
      count++;
      if(count &gt; 2){
        Serial.println(buffer);
        oled_show_generalmsg(5,y,buffer,0);

        sprintf(buffer,"TEMP: ");
        y = y+ 8;
        count = 0;
      }
    }
    // Raining chance
    temp = doc["rain"];
    sprintf(buffer,"R: ");
    count = 0; 
    for (JsonPair kv : temp) {
      sprintf(buffer + strlen(buffer), "%s:%s%% ", kv.key().c_str(), kv.value().as&lt;const char*&gt;());
      count++;
      // only show 3 records here 
      if (count &gt; 2)
        break; 
    }
    Serial.println(buffer);
    oled_show_generalmsg(5,y,buffer,0);
    y=y+8;

    int pm25 = atoi(doc["pm2.5"]);
    int pm10 = atoi(doc["pm10"]);

    const char *level; 
    if ( pm25 &lt;15 || pm10 &lt; 50 ){
      level = "Good"; 
    } else if ( (pm25 &gt;= 15 &amp;&amp; pm25 &lt;35) || (pm10 &gt;= 50 &amp;&amp; pm10 &lt; 100)){
      level = "Medium";
    } else if ( (pm25 &gt;= 35 &amp;&amp; pm25 &lt;54) || (pm10 &gt;= 100 &amp;&amp; pm10 &lt; 254)){
      level = "Bad";
    }else{
      level = "SBad";
    }
    
    sprintf(buffer , "PM2.5:%d PM10:%d Lv:%s", pm25, pm10, level);
    Serial.println(buffer);
    oled_show_generalmsg(5,y,buffer,0);</pre>



<h2 class="wp-block-heading">u8g2 display Library</h2>



<p>這個是 Waveshare Pico OLED 2.23 唯一可以用的 Library ，可能其他 Library 也可以用，但是我沒找到<br />我試過一些 ssd1305 和 ssd1306 的 library ，像 Adafruit ssd1306 SPI 就可以驅動，可以顯示，但是沒辦法正確顯示<br /><br />u8g2 只可以顯示，但是在邊界的地方會出問題（請見本文第一張圖最右邊的白色部份），本人並沒有要做產品不想幫廠商 debug 這種事，小小小缺點就眼不見為淨就好<br /><br />放個 sample code 就好了<br />u8g2 可以選字體還不錯，也有人教如何顯示<a href="https://atceiling.blogspot.com/2020/12/arduino103-u8g2.html" target="_blank" rel="noreferrer noopener">中文</a>，不過我沒用到中文就不想試了，對了128&#215;32真是太小了，顯示好擠，還是要買大一點的好，最好是 320&#215;240 <s>還要有觸控</s></p>



<p>oled_show_generalmsg 是我拿來秀字體用的，但是因為要避開這塊面版的問題，都要 offset 5 pixels （應該有其他解決方案，但是大部份正常我就懶得試了）<br />顯示字串的部份上面那一塊有 sample code ，下面就不放了</p>



<pre class="wp-block-preformatted">U8G2_SSD1305_128X32_NONAME_F_4W_SW_SPI  u8g2(U8G2_R0, /* clock=*/ 10, /* data=*/ 11, /* cs=*/ 9, /* dc=*/ 8, /* reset=*/ 12);

void oled_show_generalmsg(int x,int y, const char *msg, int clearbuffer=1){
    if (clearbuffer == 1)
        u8g2.clearBuffer();
    u8g2.setFont(u8g2_font_5x8_tr );
    
    u8g2.drawStr(x,y,msg);
    u8g2.sendBuffer();
}

void setup(void) {
  pinMode(9, OUTPUT);
  digitalWrite(9, 0);	// default output in I2C mode for the SSD1306 test shield: set the i2c adr to 0

  u8g2.begin();
}</pre>



<h2 class="wp-block-heading">Python Server on Docker</h2>



<p>最後當然要將 python server 放到 docker 上面去，以下是幾個步驟</p>



<p>產生 Dockerfile </p>



<pre class="wp-block-preformatted"># Use an official Python runtime as the base image
FROM python:3.9

# Set the working directory
WORKDIR /app

# Copy the requirements file
COPY requirements.txt .

# Install the required libraries
RUN /usr/local/bin/python -m pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt

# Copy the Python script
COPY weather.py .

# Run the script
CMD ["python", "weather.py"]
</pre>



<p>產生 requirement.txt</p>



<pre class="wp-block-preformatted">urllib3
jsonschema
</pre>



<p>產生 docker image，這個如果程式有改動就要再執行一次</p>



<p>docker build -f Dockerfile -t weatherdaemon .</p>



<p>執行 docker ，udp 的 portforwarding 和 tcp 稍稍不一樣，加上 timezome 讓 script debug 顯示的時間更正確</p>



<pre class="wp-block-preformatted">docker run -v /usr/share/zoneinfo/Asia/Taipei:/etc/localtime -p 8888:8888/udp weatherdaemon
# Daemon mode
# docker run -d -v /usr/share/zoneinfo/Asia/Taipei:/etc/localtime -p 8888:8888/udp weatherdaemon</pre>



<h2 class="wp-block-heading">功耗</h2>



<p>大功告成，組合測試，都是 embedded system 一定要測一下功耗的啊<br />大略都在 0.54W 左右，算還可以吧</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="2560" height="1728" src="https://blog.richliu.com/wp-content/uploads/2023/01/IMG_20230115_015554-scaled.jpg" alt="" class="wp-image-5086" srcset="https://blog.richliu.com/wp-content/uploads/2023/01/IMG_20230115_015554-scaled.jpg 2560w, https://blog.richliu.com/wp-content/uploads/2023/01/IMG_20230115_015554-600x405.jpg 600w, https://blog.richliu.com/wp-content/uploads/2023/01/IMG_20230115_015554-768x518.jpg 768w, https://blog.richliu.com/wp-content/uploads/2023/01/IMG_20230115_015554-1536x1037.jpg 1536w, https://blog.richliu.com/wp-content/uploads/2023/01/IMG_20230115_015554-2048x1382.jpg 2048w" sizes="(max-width: 2560px) 100vw, 2560px" /></figure>



<p><br />當然一定要拿一顆 186550 來當行動電源的，這樣就可以到處放了<br />約略可以顯示 16 小時，算可以了吧，這個耗電量應該還是要插電比較好</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="2560" height="1728" src="https://blog.richliu.com/wp-content/uploads/2023/01/IMG_20230115_091630-scaled.jpg" alt="" class="wp-image-5087" srcset="https://blog.richliu.com/wp-content/uploads/2023/01/IMG_20230115_091630-scaled.jpg 2560w, https://blog.richliu.com/wp-content/uploads/2023/01/IMG_20230115_091630-600x405.jpg 600w, https://blog.richliu.com/wp-content/uploads/2023/01/IMG_20230115_091630-768x518.jpg 768w, https://blog.richliu.com/wp-content/uploads/2023/01/IMG_20230115_091630-1536x1037.jpg 1536w, https://blog.richliu.com/wp-content/uploads/2023/01/IMG_20230115_091630-2048x1382.jpg 2048w" sizes="(max-width: 2560px) 100vw, 2560px" /></figure>



<h2 class="wp-block-heading">ChatGPT</h2>



<p>為什麼會有這個，應該不是很意外吧？<br />這次因為都不是很熟悉的東西，所以很多事情都問 ChatGPT 拿答案<br /><br />簡單的心得是，比 Google 好用，但是問題很多<br /><br />原因是因為 Google 會給很多文章，但是這些文章不見得是你要的，或是寫很長一串重點找半天</p>



<p>ChatGPT 總是可以直擊問題給出答案，然後有些問題會很容易翻車，像是</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1114" height="759" src="https://blog.richliu.com/wp-content/uploads/2023/01/image-4.png" alt="" class="wp-image-5088" srcset="https://blog.richliu.com/wp-content/uploads/2023/01/image-4.png 1114w, https://blog.richliu.com/wp-content/uploads/2023/01/image-4-600x409.png 600w, https://blog.richliu.com/wp-content/uploads/2023/01/image-4-768x523.png 768w" sizes="(max-width: 1114px) 100vw, 1114px" /><figcaption>無法分辨那個才是 package</figcaption></figure>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1003" height="787" src="https://blog.richliu.com/wp-content/uploads/2023/01/image-5.png" alt="" class="wp-image-5089" srcset="https://blog.richliu.com/wp-content/uploads/2023/01/image-5.png 1003w, https://blog.richliu.com/wp-content/uploads/2023/01/image-5-600x471.png 600w, https://blog.richliu.com/wp-content/uploads/2023/01/image-5-768x603.png 768w" sizes="(max-width: 1003px) 100vw, 1003px" /><figcaption>給了錯的參數</figcaption></figure>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1210" height="701" src="https://blog.richliu.com/wp-content/uploads/2023/01/image-6.png" alt="" class="wp-image-5090" srcset="https://blog.richliu.com/wp-content/uploads/2023/01/image-6.png 1210w, https://blog.richliu.com/wp-content/uploads/2023/01/image-6-600x348.png 600w, https://blog.richliu.com/wp-content/uploads/2023/01/image-6-768x445.png 768w" sizes="(max-width: 1210px) 100vw, 1210px" /><figcaption>但是還是可以糾正回來</figcaption></figure>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="971" height="654" src="https://blog.richliu.com/wp-content/uploads/2023/01/image-7.png" alt="" class="wp-image-5091" srcset="https://blog.richliu.com/wp-content/uploads/2023/01/image-7.png 971w, https://blog.richliu.com/wp-content/uploads/2023/01/image-7-600x404.png 600w, https://blog.richliu.com/wp-content/uploads/2023/01/image-7-768x517.png 768w" sizes="(max-width: 971px) 100vw, 971px" /><figcaption>那個 as&lt;char *&gt;()) 是錯的，要改用 as&lt;const char *&gt;()) 才對</figcaption></figure>



<p>如果是初學者，又沒有排除故障能力，那麼直接用 chatgpt 就會翻車，不過如果是已經懂得怎麼排除問題，又有一定基礎，使用 chatgpt 可以加速很多開發時的工作</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1162" height="819" src="https://blog.richliu.com/wp-content/uploads/2023/01/image-8.png" alt="" class="wp-image-5092" srcset="https://blog.richliu.com/wp-content/uploads/2023/01/image-8.png 1162w, https://blog.richliu.com/wp-content/uploads/2023/01/image-8-600x423.png 600w, https://blog.richliu.com/wp-content/uploads/2023/01/image-8-768x541.png 768w" sizes="(max-width: 1162px) 100vw, 1162px" /><figcaption>幫忙修改程式碼，加上忽略的部份</figcaption></figure>



<p>總之，這東西如果價格不貴，我會付費使用，而且是常駐在系統上，它能大幅增進我的能力，尤其是現在少寫 code 了，很多東西都忘得差不多了</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2023/01/15/5079/raspberry-pi-pico-w-picooled-2-23-arduino-%e9%a1%af%e7%a4%ba%e5%a4%a9%e6%b0%a3%e9%a0%90%e5%a0%b1%e9%99%8d%e9%9b%a8%e6%a9%9f%e7%8e%87%e5%92%8c%e7%a9%ba%e6%b1%a1%e6%8c%87%e6%95%b8/">Raspberry Pi Pico W + PicoOLED 2.23 + Arduino 顯示天氣預報降雨機率和空污指數</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.richliu.com/2023/01/15/5079/raspberry-pi-pico-w-picooled-2-23-arduino-%e9%a1%af%e7%a4%ba%e5%a4%a9%e6%b0%a3%e9%a0%90%e5%a0%b1%e9%99%8d%e9%9b%a8%e6%a9%9f%e7%8e%87%e5%92%8c%e7%a9%ba%e6%b1%a1%e6%8c%87%e6%95%b8/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Ampere Altra Mt. Jade OpenBMC and EDKII build guide on ARM64 platform</title>
		<link>https://blog.richliu.com/2022/06/23/4601/ampere-altra-mt-jade-openbmc-build-guide-on-arm64-platform/</link>
					<comments>https://blog.richliu.com/2022/06/23/4601/ampere-altra-mt-jade-openbmc-build-guide-on-arm64-platform/#comments</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Thu, 23 Jun 2022 05:31:55 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[ARM]]></category>
		<category><![CDATA[Computer/Technical]]></category>
		<category><![CDATA[Embedded]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Altra]]></category>
		<category><![CDATA[Ampere Computing]]></category>
		<category><![CDATA[arm64]]></category>
		<category><![CDATA[EDKII]]></category>
		<category><![CDATA[OpenBMC]]></category>
		<guid isPermaLink="false">https://blog.richliu.com/?p=4601</guid>

					<description><![CDATA[<p>Ampere announce Altra CPU, it&#8217;s a 80 cores ARM64v [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2022/06/23/4601/ampere-altra-mt-jade-openbmc-build-guide-on-arm64-platform/">Ampere Altra Mt. Jade OpenBMC and EDKII build guide on ARM64 platform</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Ampere announce Altra CPU, it&#8217;s a 80 cores ARM64v8 CPU for cloud native workloads. Altra Max CPU is 128 cores. Follow the CPU, Ampere also has a CRB (customer reference board) named Mt. Jade, and Ampere also open source OpenBMC and EDKII source code for Mt. Jade platform. <br /><br />This article is personal note, all information can be found from internet. And open source project keeps going, it might be some minor differences when you find this article. </p>



<div class="wp-block-rank-math-toc-block" id="rank-math-toc"><h2>Table of Contents</h2><nav><ul><li><a href="#before-build-source-code">Before Build Source Code</a></li><li><a href="#prepare-build-environment">Prepare Build Environment</a><ul><li><a href="#get-the-ubuntu-18-04-cloud-image">Get the Ubuntu 18.04 cloud image</a></li><li><a href="#prepare-hostname-and-userdata-for-vm">Prepare hostname and userdata for VM</a></li></ul></li><li><a href="#build-mt-jade-edkii">Build Mt. Jade EDKII</a><ul><li><a href="#prepare-vm-environment">Prepare VM environment</a></li><li><a href="#get-build-environment">Get build environment</a></li><li><a href="#build-and-sign-the-image">Build and Sign the image</a></li><li><a href="#manual-build-edkii">Manual Build EDKII</a></li></ul></li><li><a href="#build-mt-jade-open-bmc">Build Mt. Jade OpenBMC</a></li><li><a href="#prepare-build-environment-1">Prepare build environment</a></li><li><a href="#build-open-bmc">Build OpenBMC</a></li><li><a href="#upgrade-firmware">Upgrade Firmware</a><ul><li><a href="#update-open-bmc-firmware">Update OpenBMC firmware</a><ul><li><a href="#update-via-url">Update via URL</a></li><li><a href="#update-via-ssh">Update via SSH</a></li></ul></li><li><a href="#update-uefi-firmware">Update UEFI firmware</a></li><li><a href="#update-scp-firmware">Update SCP firmware</a></li></ul></li><li><a href="#serial-console">Serial Console</a></li><li><a href="#reference">Reference</a></li><li><a href="#error-message">Error Message</a><ul><li><a href="#error-templateconf-value-which-is-nvme-openbmc-meta-ampere-meta-mitchell-must-point-to-meta-some-layer-conf-templates-template-name">Error: TEMPLATECONF value (which is /nvme/openbmc/meta-ampere/meta-mitchell) must point to meta-some-layer/conf/templates/template-name</a></li><li><a href="#initializing-oe-build-env">Initializing OE build env</a></li><li><a href="#">
</a></li></ul></li></ul></nav></div>



<span id="more-4601"></span>



<h2 class="wp-block-heading" id="before-build-source-code">Before Build Source Code</h2>



<p>This procedure runs on ARM64 platform, it should be also run on x86 platform, but I have not try it. <br /><br />Build environment : Ampere eMAG CPU (32 cores) with 256G DRAM and uses 64G/128G RAM to build code, sometime if it cannot finsih compile tasks, probably your DRAM is not sufficient to build the code, I tried 16G and it doesn;t work.<br /><br />Because host is running Ubuntu 22.04, and OpenBMC and EDKII only can be built on Ubuntu 18.04, so, it needs to use either virtual machine or contianer technologies to have Ubuntu 18.04 environment. <br /><br />This note uses qemu to prepare build environment, tried docker but it doesn&#8217;t work, probably I will re-try it someday. </p>



<p>If use NFS or qemu overlayers filesystem to bridge folders ourside into VM, it might cause build problem, so, please increase disk size for you virtual machine virtual disk size, use nfs or share folder for copy images or source code only. <br /><br />If want to build a workable EDKII code and run it on Ampere Mt. Jade platform, it needs to have Ampere fimware ATF and SCP binary, it might register Ampere customer connect to download those image files, without it, it only can build OpenBMC binary. </p>



<h2 class="wp-block-heading" id="prepare-build-environment">Prepare Build Environment </h2>



<h3 class="wp-block-heading" id="get-the-ubuntu-18-04-cloud-image">Get the Ubuntu 18.04 cloud image</h3>



<pre class="wp-block-preformatted">$ wget https://cloud-images.ubuntu.com/releases/bionic/release/ubuntu-18.04-server-cloudimg-arm64.img
$ sudo apt install qemu-efi</pre>



<h3 class="wp-block-heading" id="prepare-hostname-and-userdata-for-vm">Prepare hostname and userdata for VM</h3>



<p>it needs to prepare two files, meta-file and user-data, following is example for meta-file </p>



<pre class="wp-block-preformatted">instance-id: Image-openbmc
local-hostname: openbmc
</pre>



<p>user-data file, this example username is ubuntu, password is ubuntu</p>



<pre class="wp-block-preformatted">#cloud-config
password: ubuntu
chpasswd: { expire: False }
ssh_pwauth: True
ssh_authorized_keys:
  - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+Y/6m4XFeEGKqR2H7wbsUQUVWvB0gC/+CeJqfyvOX++SETKapFtI5CiidkyW/B1GQM4XUlmE9zPlCAcolPfMpXB0CNQQ5l0F5Z+FW6b4RVjFV/KEcQ7R3XkKRa0XhC6hKkNc5P95fNhXr8Do1bSEmd9mPIiOrFaUEZ9EReO+ZTsGsytFIuQV8rOZfQjClktXrqk3F6jJ+TV3THcVNpKvnLfps56Hc/j9jdiadLv91yuifz4lCMbv/D/0hMtf4KhN5tV//QRgUxEUeC7aPW6sKD2GMYMxc9UsSyRRQ9IFWjJMkgzKyuxgNKe7u4WjERFoxEUrmFK01UsrX+lRw9e9n user@hostname
</pre>



<p>Than, it can create a configure file for QEMU</p>



<pre class="wp-block-preformatted">$ cloud-localds -v cloudinit.img user-data meta-file</pre>



<p>Increase Ubuntu cloud image disk size, bigger is better, suggest more than 200G, minimal should be around 100G.</p>



<pre class="wp-block-preformatted">$ qemu-img resize ubuntu-18.04-server-cloudimg-arm64.img +200G</pre>



<p>Prepare UEFI BIOS and storage for booting</p>



<pre class="wp-block-preformatted">dd if=/dev/zero of=flash0.img bs=1M count=64
dd if=/usr/share/qemu-efi/QEMU_EFI.fd of=flash0.img conv=notrunc
dd if=/dev/zero of=flash1.img bs=1M count=64</pre>



<p>Running the VM script, it will also create a QEMU virtfs for file sharing, but do not use that folder to build code. How to access share folder, it can reference this article <a href="https://blog.richliu.com/2017/09/25/2173/qemu-share-directory-with-host-without-networking/" target="_blank" rel="noreferrer noopener">QEMU Share Directory with Host Without Networking</a></p>



<p></p>



<pre class="wp-block-preformatted">IMAGE1=ubuntu-18.04-server-cloudimg-arm64.img
sudo qemu-system-aarch64 -name vm1 \
         -machine virt,gic_version=3,accel=kvm,usb=off \
         -cpu host -m 128G \
         -smp 32,sockets=1,cores=32,threads=1 \
         -nographic -nodefaults \
         -pflash flash0.img -pflash flash1.img \
         -drive file=$IMAGE1,if=none,id=disk1 \
         -device virtio-blk-device,drive=disk1 \
         -drive file=cloudinit.img,if=virtio,format=raw \
         -virtfs local,path=/nvme/obmc,mount_tag=host0,security_model=passthrough,id=host0 \
         -netdev tap,id=net0,ifname=tap0 \
         -device virtio-net-device,netdev=net0,mac=52:54:00:11:11:12 \
         -serial telnet::9001,server,nowait &gt; guest_log-1.txt 2&gt;&gt; guest_log-1.txt
</pre>



<h2 class="wp-block-heading" id="build-mt-jade-edkii">Build Mt. Jade EDKII</h2>



<h3 class="wp-block-heading" id="prepare-vm-environment">Prepare VM environment</h3>



<p>After login into VM, it needs to install software to compile EDKII. <br />Command to install basic packages. </p>



<pre class="wp-block-preformatted">sudo apt update 
sudo apt install -y git vim tmux lftp net-tools ethtool bc
sudo apt install -y \
  build-essential uuid-dev acpica-tools nasm \
  python3 python3-distutils python3-pip \
  gawk
sudo apt install -y libssl-dev gnu-efi
sudo apt install bison flex
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 1</pre>



<p>Next step is follow this document to download Ampere EDKII source code  and setup enviroment. <br />https://github.com/AmpereComputing/edk2.git<br /><br />First, prepare build environment parameters, if VM reboot, it needs to re-run it. </p>



<pre class="wp-block-preformatted">export WORKSPACE=/nvme/tianocore<br />mkdir -p $WORKSPACE<br />cd $WORKSPACE<br /><s>export PACKAGES_PATH=$PWD/edk2:$PWD/edk2-platforms</s><br /># PACKAGES_PATH is default include path, sometimes miss package can include more directories here. <br /># if still cannot find some files, try to run submodules command on next step again. <br />export PACKAGES_PATH=$PWD/edk2:$PWD/edk2-platforms:$PWD/edk2-non-osi/:$PWD/edk2-platforms/Features/</pre>



<p>Chang into that folder, clone Ampere Computiner edk2 source code. </p>



<pre class="wp-block-preformatted">cd $WORKSPACE
git clone https://github.com/AmpereComputing/edk2.git
cd edk2
git submodule init &amp;&amp; git submodule update
cd ..
git clone https://github.com/AmpereComputing/edk2-platforms.git</pre>



<h3 class="wp-block-heading" id="get-build-environment">Get build environment</h3>



<p>This step is to build the basic tools.</p>



<pre class="wp-block-preformatted">cd $WORKSPACE
. edk2/edksetup.sh

# Build BaseTool, only need to run once 
make -C edk2/BaseTools </pre>



<p>After compiled the EDK2 basic tool, next step is to prepare edk2-platforms and edk2-ampere-tools <br /><br />edk2-ampere-tools has a very good build script, <br />it can help to build the EDK2 and also package ATF into together. <br />we will introduct it on following steps. </p>



<pre class="wp-block-preformatted">cd edk2-platforms
git checkout -b test remotes/origin/ampere

# make a link to library to fix some problem
ln -sf /nvme/tianocore/edk2-platforms/Features/Intel/OutOfBandManagement .
cd ..
git clone https://github.com/AmpereComputing/edk2-ampere-tools
</pre>



<h3 class="wp-block-heading" id="build-and-sign-the-image">Build and Sign the image</h3>



<p>Because current tree Atftool migrate to OpenSSL 3.0, and Ubuntu 18.04 still use OpenSSL 1.0x, <br />I choice to roll back to old version to support OpenSSL 1.0x, support it can build Atftool on Ubuntu 22.04 or compile OpenSSL 3.0 manually, I might try it later. </p>



<pre class="wp-block-preformatted">cd /nvme/tianocore 
mkdir -p AtfTools
cd AtfTools
git init
git remote add origin -f https://github.com/ARM-software/arm-trusted-firmware.git
git config core.sparseCheckout true

echo -ne "include/tools_share\nmake_helpers\ntools/cert_create\ntools/fiptool" &gt; .git/info/sparse-checkout

git -C . checkout --track origin/master
# Due to current AtfTool only support OpenSSL 3.0 , switch to previous version 
git checkout -b test b94bf967e62b23a376a5026de69d06a0e8d6bf78
make -C tools/cert_create CRTTOOL=cert_create
$ make -C tools/fiptool FIPTOOL=fiptool</pre>



<p>configure PATH to  fiptool and cert_create</p>



<pre class="wp-block-preformatted">cd /nvme/tianocore
export PATH=$PATH:$PWD/AtfTools/tools/cert_create:$PWD/AtfTools/tools/fiptool
</pre>



<p>This step is parepare Mt. Jade ATF and SCP binary for compile, it needs to get both binary file from <a href="https://connect.amperecomputing.com/" target="_blank" rel="noreferrer noopener">Ampere customer connect</a>. and also suggest to use the same version as OpenBMC/EDKII</p>



<pre class="wp-block-preformatted">cd $WORKSPACE
mv &lt;path to&gt;/altra_atf_signed_2.06.20220426.slim .
mv &lt;path to&gt;/altra_scp_signed_2.06.20220426.slim .
cd edk2-ampere-tools
./edk2-build.sh -b RELEASE Jade --atf-image $WORKSPACE/altra_atf_signed_2.06.20220426.slim --scp-image $WORKSPACE/altra_scp_signed_2.06.20220426.slim</pre>



<p>If everything is perfect, the binary code would be looks like below. </p>



<pre class="wp-block-preformatted">Results: /nvme/tianocore/edk2-ampere-tools/BUILDS/jade_tianocore_atf_2.06.100
total 45888
-rw------- 1 root   root       3343 Jun 15 12:40 dbukey.auth
-rw------- 1 root   root       2002 Jun 15 12:40 del_dbukey.auth
-rw-r--r-- 1 root   root       2008 Jun 15 12:38 jade_board_setting.bin
-rw-rw-r-- 1 ubuntu ubuntu    14532 Jun 15 04:08 jade_board_setting.txt
-rw-r--r-- 1 root   root     670845 Jun 15 12:40 jade_scp_2.06.100.cap
-rw-r--r-- 1 root   root     262144 Jun 15 12:40 jade_scp_2.06.100.dbu.sig.img
-rw-r--r-- 1 root   root    8126464 Jun 15 12:38 jade_tianocore_2.06.100.fd
-rw-r--r-- 1 root   root   14040229 Jun 15 12:40 jade_tianocore_atf_2.06.100.cap
-rw-r--r-- 1 root   root   13631488 Jun 15 12:40 jade_tianocore_atf_2.06.100.dbu.sig.img
-rw-r--r-- 1 root   root   10225352 Jun 15 12:38 jade_tianocore_atf_2.06.100.img
------------------------------------------------------------
                          Ampere Jade (AARCH64) RELEASE pass
------------------------------------------------------------
pass    1
fail    0</pre>



<p id="block-c791d1c4-9fd3-4983-bb20-21d321ee9683">It can use the jade_tianocore_atf_2.06.100.img for firmware update. </p>



<p>Note:  When latest time I compile the edkII binary, latest version will fail to build, it need to roll back to previous version. </p>



<h3 class="wp-block-heading" id="manual-build-edkii">Manual Build EDKII</h3>



<p>If still want to build EDKII manually, here is some command can help you. </p>



<pre class="wp-block-preformatted">cd edk2-platform
build -a AARCH64 -t GCC5 -b RELEASE -D SECURE_BOOT_ENABLE -p Platform/Ampere/JadePkg/Jade.dsc
or to use all CPU to compile the EDKII.
build -n `nproc` -a AARCH64 -t GCC5 -b RELEASE -D SECURE_BOOT_ENABLE -p Platform/Ampere/JadePkg/Jade.dsc</pre>



<p>the generated image on $WORKSPACE/Build/Jade/RELEASE_GCC5/FV/BL33_JADE_UEFI.fd,<br />for this case, on the /nvme/tianocore/Build/Jade/RELEASE_GCC5/FV/BL33_JADE_UEFI.fd</p>



<p>then, it needs to use ampere special tool to generate EDKII image with Ampere ATF image.</p>



<h2 class="wp-block-heading" id="build-mt-jade-open-bmc">Build Mt. Jade OpenBMC</h2>



<h2 class="wp-block-heading" id="prepare-build-environment-1">Prepare build environment</h2>



<p>Before build OpenBMC, it needs to install necessary packages, <br />it can build both OpenBMC and EDKII on the same VM, or it can build it on different VM. <br /><br />Following is necessary packages for OpenBMC.</p>



<pre class="wp-block-preformatted">$ sudo apt-get install -yy \
     build-essential \
     chrpath \
     cpio \
     debianutils \
     diffstat \
     gawk \
     git \
     iputils-ping \
     libdata-dumper-simple-perl \
     liblz4-tool \
     libsdl1.2-dev \
     libthread-queue-any-perl \
     locales \
     python \
     python3 \
     socat \
     subversion \
     texinfo \
     wget \
     zstd</pre>



<p>Download Open BMC source code and OpenBMC build script. </p>



<pre class="wp-block-preformatted">$ cd /nvme
$ git clone https://github.com/ampere-openbmc/openbmc.git
$ git clone https://github.com/openbmc/openbmc-build-scripts.git
</pre>



<p>modify openbmc-build-scripts/build-setup.sh around line #140, <br />replace &#8220;Clone in openbmc master to ${obmc_dir}&#8221; to https://github.com/ampere-openbmc/openbmc.git<br /><br />it can download right source code. </p>



<pre class="wp-block-preformatted">git clone ${branch} https://github.com/ampere-openbmc/openbmc.git</pre>



<p>If you use more than 32 cores to build the source code, it might cause compile fail because some compile tool might have problem on build code on ARM64 massive code. A easy way to check that is run dmesg to check whether Linux kernel has OOM killer on some package compile fail message like nodejs.<br /><br />Limited CPU number to 32 , modify openbmc-build-scripts/build-setup.sh, on line 84. </p>



<pre class="wp-block-preformatted"> 84 # num_cpu=${num_cpu:-$(nproc)}
 85 num_cpu=32
</pre>



<h2 class="wp-block-heading" id="build-open-bmc">Build OpenBMC</h2>



<p>This step is to prepare test build environment </p>



<pre class="wp-block-preformatted">$ cd /nvme
$ target=mtjade WORKSPACE=/nvme/openbmc branch="--branch ampere --single-branch" ./openbmc-build-scripts/build-setup.sh</pre>



<p>Setup openbmc machine type to mt. Jade and compile OpenBMC. </p>



<pre class="wp-block-preformatted">$ <s>export TEMPLATECONF=meta-ampere/meta-jade</s>
$ export TEMPLATECONF=meta-ampere/meta-jade/conf/templates/default/
$ export TMPDIR=/nvme/temp
$ export LC_ALL=en_US.UTF-8

$ cd /nvme/openbmc
$ . openbmc-env
$ cd ..
$ source ./setup mtjade
$ bitbake obmc-phosphor-image
</pre>



<p>if system it mt.mitchell</p>



<pre class="wp-block-preformatted">$ export TEMPLATECONF=meta-ampere/meta-mitchell/conf/templates/default/
$ export TMPDIR=/nvme/temp
$ export LC_ALL=en_US.UTF-8

$ cd /nvme/openbmc
$ . openbmc-env
$ cd ..
$ source ./setup mtmitchell-dcscm
$ bitbake obmc-phosphor-image</pre>



<p>When compile, there is an openocd compile error, it cannot access to original website probably caused by the website was down. Temperory solutoin is to remove the package. <br />modify file meta-ampere/meta-common/recipes-ac01/packagegroups/packagegroup-ampere-apps.bb, find openocd and delete it, down. </p>



<p>When finish compile, the binary will locate on tmp/deploy/images/mtjade/, absoult path is /nvme/openbmc/build/mtjade/tmp/deploy/images/mtjade/<br /><br />ex: (only list partical files)</p>



<pre class="wp-block-preformatted">obmc-phosphor-image-mtjade-20220616040212.rootfs.manifest
obmc-phosphor-image-mtjade-20220616040212.rootfs.squashfs-xz
obmc-phosphor-image-mtjade-20220616040212.static.mtd
obmc-phosphor-image-mtjade-20220616040212.static.mtd.all.tar
obmc-phosphor-image-mtjade-20220616040212.static.mtd.tar
obmc-phosphor-image-mtjade-20220616040212.testdata.json
obmc-phosphor-image-mtjade.jffs2
obmc-phosphor-initramfs-mtjade-20220616004506.rootfs.cpio.xz
obmc-phosphor-initramfs-mtjade-20220616004506.rootfs.manifest
obmc-phosphor-initramfs-mtjade-20220616004506.testdata.json
</pre>



<p>obmc-phosphor-image-mtjade-20220616040212.static.mtd.tar is firmware file, it contain both obmc-phosphor-image-mtjade-20220616040212.static.mtd and obmc-phosphor-image-mtjade-20220616040212.rootfs.manifest files, and can be used for next step : firmware update.</p>



<h2 class="wp-block-heading" id="upgrade-firmware">Upgrade Firmware</h2>



<p><strong><span class="has-inline-color has-luminous-vivid-orange-color">*Notice: Update flash will take your own risk, especially physical damage your hardware.. </span></strong> <br /><br />If Mt. Jade is using AMI bios, suggest to use flash burner to update the OpenBMC firmware. <br />What I am using is GZU EZP XPro , it&#8217;s very cheap, only needs around US$30.- (please also purchase the SPI flash socket). <br /><br />This step need to un-plug BMC flash from Mt. Jade motherboard, please remeber the flash pin 1 location, it needs to follow the original position and put it back to socket. If you miss you will broken it. <br /></p>



<h3 class="wp-block-heading" id="update-open-bmc-firmware">Update OpenBMC firmware</h3>



<p>ref. <a href="https://github.com/openbmc/docs/blob/master/architecture/code-update/code-update.md" target="_blank" rel="noopener">OpenBMC Code Update</a></p>



<h4 class="wp-block-heading" id="update-via-url">Update via URL</h4>



<p>Suppose that it already has OpenBMC firmware, it can use software to upgrade firmware ,<br />first step is to get web token, then use this token on next step to upgrade firmware. <br /><br />Following is a simple script to upgrade flash, it can be integrated into your script. </p>



<pre class="wp-block-preformatted">export BMC_IP=192.168.1.190
export FWFILE=obmc-phosphor-image-mtjade-20220616040212.static.mtd.tar

export token=`curl -k -H "Content-Type: application/json" -X POST https://${BMC_IP}/login -d '{"username" :  "root", "password" :  "0penBmc"}' | grep token | awk '{print $2;}' | tr -d '"'`

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    84  100    37  100    47    116    147 --:--:-- --:--:-- --:--:--   264


curl -k -H "X-Auth-Token: $token" \
       -H "Content-Type: application/octet-stream" \
       -X POST -T ${FWFILE} \
        https://${BMC_IP}/redfish/v1/UpdateService

{
  "@odata.id": "/redfish/v1/TaskService/Tasks/1",
  "@odata.type": "#Task.v1_4_3.Task",
  "Id": "1",
  "TaskState": "Running",
  "TaskStatus": "OK"
}</pre>



<p>If  conosle doesn&#8217;t not update and reboot, please use console login the OpenBMC and run &#8220;reboot&#8221; manually. <br />It will show message like below on OpenBMC console. </p>



<pre class="wp-block-preformatted">Updating kernel...
Erasing block: 69/69 (100%)
Writing kb: 4397/4397 (100%)
Verifying kb: 4397/4397 (100%)
Updating rofs...
Erasing block: 366/366 (100%)
Writing kb: 11580/23376 (49%)
</pre>



<h4 class="wp-block-heading" id="update-via-ssh">Update via SSH</h4>



<p>Just update firmware (ex: obmc-phosphor-image-mtjade-20220616040212.static.mtd.tar) to BMC&#8217;s directory /tmp/images , it will shows a hash number like /tmp/images/d6718c8f, then run the following command</p>



<pre class="wp-block-preformatted">busctl set-property xyz.openbmc_project.Software.BMC.Updater \<br />  /xyz/openbmc_project/software/d6718c8f \<br />  xyz.openbmc_project.Software.Activation RequestedActivation s \<br />  xyz.openbmc_project.Software.Activation.RequestedActivations.Active</pre>



<h3 class="wp-block-heading" id="update-uefi-firmware">Update UEFI firmware </h3>



<p>Upgrade UEFI firmware<br />it needs to pack the UEFI image first , and it need to create MANIFEST file, looks like this </p>



<pre class="wp-block-preformatted">VER_purpose=xyz.openbmc_project.Software.Version.VersionPurpose.Host
version=jade_tianocore_atf_2.06.100
KeyType=OpenBMC
HashType=RSA-SHA256
MachineName=mtjade
</pre>



<p>make image file and MINIFEST file into the same file</p>



<pre class="wp-block-preformatted">$ tar -cvf jade_tianocore_atf_2.06.100.tar jade_tianocore_atf_2.06.100.img MANIFEST </pre>



<p>Run command below to upgrade UEFI firmware</p>



<pre class="wp-block-preformatted">export BMC_IP=192.168.1.190

export FWFILE=jade_tianocore_atf_2.06.100.tar

export token=`curl -k -H "Content-Type: application/json" -X POST https://${BMC_IP}/login -d '{"username" :  "root", "password" :  "0penBmc"}' | grep token | awk '{print $2;}' | tr -d '"'`

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    84  100    37  100    47    116    147 --:--:-- --:--:-- --:--:--   264


curl -k -H "X-Auth-Token: $token" \
       -H "Content-Type: application/octet-stream" \
       -X POST -T ${FWFILE} \
        https://${BMC_IP}/redfish/v1/UpdateService

</pre>



<p>Like OpenBMC, if it doesn&#8217;t update, just reboot to update it. <br />if stiall not work, try to upgrade it manually, yes, when I wrote this article, update via redfish doesn&#8217;t work, so, just copy it from github.</p>



<pre class="wp-block-preformatted"># on HOST
$ scp jade_tianocore_atf_2.06.100.tar root@192.168.1.190:/tmp

# on Target 
$ cd /tmp/images
$ mkdir fw
$ cd fw
$ tar xvf /tmp/jade_tianocore_atf_2.06.100.tar
$ firmware_update.sh /tmp/images/fw
--- Current Chassis State: On
--- Turning the Chassis off
--- Switch the host SPI bus to BMC.
Run update Primary Host SPI-NOR
--- Bind the ASpeed SMC driver
--- Locking power control
--- Flashing firmware to @/dev/mtd13
Erasing block: 157/157 (100%)
Writing kb: 9985/9985 (100%)
Verifying kb: 9985/9985 (100%)
--- Unlocking power control
--- Switch back to the primary Host SPI-NOR.
Turn on the Host
</pre>



<h3 class="wp-block-heading" id="update-scp-firmware">Update SCP firmware</h3>



<p>It needs to use sftp to transfer SCP firmware to target. <br />Following is example to upgrade SCP firmware.</p>



<pre class="wp-block-preformatted">On host
$ scp altra_scp_signed_2.06.20220426.slim root@192.168.1.190:/tmp

On OpenBMC side
$ ampere_firmware_upgrade.sh smpmpro /tmp/altra_scp_signed_2.06.20220426.slim</pre>



<p>After upgrade BIOS and SCP, if got any problem, suggest to reset bmc </p>



<pre class="wp-block-preformatted">$ ipmitool -U root -P 0penBmc -I lanplus -C 17 -H 192.168.2.18 mc reset cold</pre>



<h2 class="wp-block-heading" id="serial-console">Serial Console</h2>



<p>it can use command to get system CPU console.</p>



<pre class="wp-block-preformatted"># CPU console 
$ ssh root@192.168.190 -p 2200 
</pre>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1124" height="739" src="https://blog.richliu.com/wp-content/uploads/2022/06/image.png" alt="" class="wp-image-4631" srcset="https://blog.richliu.com/wp-content/uploads/2022/06/image.png 1124w, https://blog.richliu.com/wp-content/uploads/2022/06/image-600x394.png 600w, https://blog.richliu.com/wp-content/uploads/2022/06/image-768x505.png 768w" sizes="(max-width: 1124px) 100vw, 1124px" /></figure>



<h2 class="wp-block-heading" id="reference">Reference</h2>



<p><a href="https://github.com/ampere-openbmc/openbmc" target="_blank" rel="noreferrer noopener">Ampere OpenBMC github</a><br /><a href="https://github.com/AmpereComputing/edk2-ampere-tools" target="_blank" rel="noreferrer noopener">EDK2 Ampere Tool</a><br /><a href="https://github.com/AmpereComputing/edk2" target="_blank" rel="noreferrer noopener">Ampere EDK2</a><br /><a href="https://github.com/AmpereComputing" target="_blank" rel="noreferrer noopener">Ampere Computing Github</a></p>



<h2 class="wp-block-heading" id="error-message">Error Message </h2>



<h3 class="wp-block-heading" id="error-templateconf-value-which-is-nvme-openbmc-meta-ampere-meta-mitchell-must-point-to-meta-some-layer-conf-templates-template-name">Error: TEMPLATECONF value (which is /nvme/openbmc/meta-ampere/meta-mitchell) must point to meta-some-layer/conf/templates/template-name</h3>



<p>Error message </p>



<h3 class="wp-block-heading" id="initializing-oe-build-env">Initializing OE build env</h3>



<pre class="wp-block-preformatted">Error: TEMPLATECONF value (which is /nvme/openbmc/meta-ampere/meta-mitchell) must point to meta-some-layer/conf/templates/template-name</pre>



<p>This is because followed the old configuration, it needs to point to right folder like</p>



<pre class="wp-block-preformatted">export TEMPLATECONF=meta-ampere/meta-jade/conf/templates/default/
. openbmc-env</pre>



<p>.</p>



<h3 class="wp-block-heading"><br /></h3>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2022/06/23/4601/ampere-altra-mt-jade-openbmc-build-guide-on-arm64-platform/">Ampere Altra Mt. Jade OpenBMC and EDKII build guide on ARM64 platform</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.richliu.com/2022/06/23/4601/ampere-altra-mt-jade-openbmc-build-guide-on-arm64-platform/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>embedded system btrfs</title>
		<link>https://blog.richliu.com/2017/04/01/2124/embedded-system-btrfs/</link>
					<comments>https://blog.richliu.com/2017/04/01/2124/embedded-system-btrfs/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Sat, 01 Apr 2017 11:42:49 +0000</pubDate>
				<category><![CDATA[Embedded]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[btrfs]]></category>
		<guid isPermaLink="false">https://blog.richliu.com/?p=2124</guid>

					<description><![CDATA[<p>這一篇是 btrfs 用在 embedded system 的開發測試上會用到的指令. mkfs.btrfs  [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2017/04/01/2124/embedded-system-btrfs/">embedded system btrfs</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>這一篇是 btrfs 用在 embedded system 的開發測試上會用到的指令.<br />
<span id="more-2124"></span></p>
<p>mkfs.btrfs /dev/sda2<br />
這有一點要注意, 有些 btrfs tool 預設 sectorsize 是 4096, 但是新的系統不能再用 4096 了. 要用 65536 . 所以要改用</p>
<pre lang="bash">
$ mkfs.btrfs -s 65536 /dev/sda2
</pre>
<p>首先 btrfs 的 tag 是樹狀的, 最頂端的 tag 應該是 root level &#8220;0&#8221;.<br />
往下一層就是 level 5 , 所以一開始就要 mount 上去然後開 top level 5 的目錄. ex:</p>
<pre lang="bash">
$ mount /dev/sda2 /mnt/disk
$ cd /mnt/disk
$ btrfs subvolume create @
$ btrfs subvolume create @home
</pre>
<p>這樣就會有二個預設的 top level 5 的目錄, 先 umount 再 mount 新的 tag 過的 partition. install 系統, ex:</p>
<pre lang="bash">
$ umount /mnt/disk
$ mount -o subvol=@ /mnt/disk
$ mkdir -p /mnt/disk/home
$ mount -o subvol=@home /mnt/disk 
.... install linux into /mnt/disk 
# 在開機時直接 mount @home 到 /home , 這樣以後切換系統時就可以一直用 @home tag
$ echo "/dev/sda2 /home  btrfs  defaults,subvol=@home 0 0" >> /etc/fstab
</pre>
<p>做完之後, 就要做一個 snapshot, 以後就在 snapshot 上做事情, 弄壞了砍掉再重來就可以. </p>
<pre lang="bash">
(假設系統都還沒有 mount)
$ mount /dev/sda2 /mnt/disk
$ cd /mnt/disk
$ btrfs subvolume snapshot @ 1604
</pre>
<p>這樣就會產生一個 1604 的 snapshot. 內容和 @ 內是一模一樣的</p>
<p>接下來不管在 這個 snapshot 如何惡搞也不會影響到 @ 的內容</p>
<p>開機參數, 如何在開機時選擇那一個 subvol 開機, 如果是 embedded system 用 u-boot, 寫在 bootarg 內就可以了. 參數是 rootflags=subvol=<br />
ex: 在 uboot 下</p>
<pre lang="text">
$ setenv subvol 1604
$ setenv bootdev /dev/sda2
$ setenv updkrnargs=setenv bootargs  console=ttyAMA0,115200n8 earlycon=pl011,0x87e028000000 debug maxcpus=24 rootw
ait rw  rootflags=subvol=${subvol} root=${bootdev} coherent_pool=16M/
$ setenv start 'setenv ethact vnic3 ; dhcp ; run updkrnargs;  tftpboot $kernel_addr Image ; booti $kernel_addr - $fdtcontroladdr'
</pre>
<p>因為 u-boot 只能在 setenv 更新參數, 所以要再多一層 setenv 讀入參數.<br />
這樣開機時, 就可以隨興設定 subvol, 開到正確的 subvol 上. 如果以後要砍掉, 砍掉這個 subvol 後再重建一個 snapshot. 省掉不少重灌的時間, 是不是很方便呢? </p>
<p>砍掉 subvol,<br />
假設開到 @ 上去. </p>
<pre lang="bash">
$ mount /dev/sda2 /mnt/disk
$ cd /mnt/disk
$ btrfs subvol del 1604
$ btrfs subvol snapshot @ 1604
</pre>
<p>有時候開發到一半想要留個備份, 也可以 snapshot, 就像 git tag 一版</p>
<pre lang="bash">
$ mount -o subvol=1604 /dev/sda2 /mnt/disk
$ btrfs subvol snapshot /mnt/disk /mnt/disk/1604-backup
</pre>
<p>這樣就可以了, 接下去再怎麼亂搞也沒有關係, 都可以回到 1604-backup<br />
如果是開到 1604 時, 會看到 1604-backup 在根目錄, 也可以直接刪除</p>
<pre labg="bash">
# btrfs subvol del 1604-backup
Delete subvolume (no-commit): '//1604-backup'
</pre>
<p>是不是超方便的? 超像有 git 功能的 file system.<br />
提外話: Microsoft 搞了一個 git 專用的 file system<a href="https://blogs.msdn.microsoft.com/visualstudioalm/2017/02/03/announcing-gvfs-git-virtual-file-system/" target="_blank" rel="noopener">file system Announcing GVFS (Git Virtual File System)</a></p>
<p>如果系統是一般的 ubuntu, 沒有 u-boot, 想要改 grub 達到類似切換的效果. 個人的做法是在 @ 目錄下放一個檔案, 只要修改這個檔案之後, 就可以切換 subvol.</p>
<p>編輯 /etc/grub.d/10_linux, 找到 rootsubvol= 的字串, 改成圖內這樣</p>
<pre lang="text">
case x"$GRUB_FS" in
    xbtrfs)
        rootsubvol="`cat /root/defaultsubvol`" => 改成這樣, update 之後就可以切來切去了
        rootsubvol="${rootsubvol#/}"
        if [ "x${rootsubvol}" != x ]; then
            GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}"
        fi;;
</pre>
<p>以後就可以靠修改 @ 的 /root/defaultsubvol 然後再 update grub 達到切換不同 subvol 的目的.<br />
ex:</p>
<pre lang="bash">
$ mount -o subvol=@ /dev/sda2 /mnt/disk
$ for i in dev dev/pts sys proc run; do sudo mount --bind /$i mnt/disk/$i; done
$ chroot /mnt/disk
$ echo "1604-backup" > /root/defaultsubvol
$ update-grub
</pre>
<p>reboot 就會切換到 1604-backup </p>
<p>如果是己經開到 1604 下, 然後這時候針對 1604 的 root 用了 snapshot , 如果再開機的時候, subvol 就要加上上一層的名稱<br />
像是這案例就要下 1604/odp<br />
ex:</p>
<pre lang="bash">
$ btrfs subvol snapshot / /odp
reboot to subvol 1604/odp
$ btrfs subvol list / 
ID 257 gen 446 top level 5 path @
ID 258 gen 1809 top level 5 path @home
ID 262 gen 1812 top level 5 path 1604
ID 268 gen 1807 top level 5 path gentoo
ID 276 gen 1689 top level 268 path gentoo/gentoo-1
ID 277 gen 1810 top level 262 path 1604/odp
</pre>
<p>這也不難理解, odp 是從 1604 snapshot 出來的放在 1604 下, 所以開到 1604 下會有一個 odp 的目錄, 就是指向 odp 的 snapshot.<br />
簡單的說, 產生了一個新的目錄是 1604 根目錄的 snapshot.<br />
如果不想要多一個 1604 , 可以 mount root 針對 1604 snapshot , 檔案放到 root 下即可. </p>
<p>可能剛開始會不習慣, 不過用了幾次之後就會發現這非常的省時間.<br />
非常適合 embedded 開發用. </p>
<p>另外我不知道是不是我常常惡搞, 我的確有碰過一次整個 btrfs filesystem  壞掉. 雖然如此, 不影響它對我的方便性. </p>
<p>ref.<br />
<a href="https://wiki.archlinux.org/index.php/Btrfs" target="_blank" rel="noopener">ArchLinux Btrfs</a></p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2017/04/01/2124/embedded-system-btrfs/">embedded system btrfs</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.richliu.com/2017/04/01/2124/embedded-system-btrfs/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>[跟風] 程式設計師, 你調試過最難的 BUG</title>
		<link>https://blog.richliu.com/2015/01/07/1730/%e8%b7%9f%e9%a2%a8-%e7%a8%8b%e5%bc%8f%e8%a8%ad%e8%a8%88%e5%b8%ab-%e4%bd%a0%e8%aa%bf%e8%a9%a6%e9%81%8e%e6%9c%80%e9%9b%a3%e7%9a%84-bug/</link>
					<comments>https://blog.richliu.com/2015/01/07/1730/%e8%b7%9f%e9%a2%a8-%e7%a8%8b%e5%bc%8f%e8%a8%ad%e8%a8%88%e5%b8%ab-%e4%bd%a0%e8%aa%bf%e8%a9%a6%e9%81%8e%e6%9c%80%e9%9b%a3%e7%9a%84-bug/#comments</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Tue, 06 Jan 2015 16:22:32 +0000</pubDate>
				<category><![CDATA[ARM]]></category>
		<category><![CDATA[Embedded]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[IC Design]]></category>
		<category><![CDATA[工作]]></category>
		<category><![CDATA[arm]]></category>
		<category><![CDATA[Bug]]></category>
		<category><![CDATA[Cache]]></category>
		<category><![CDATA[Hardest Bug]]></category>
		<category><![CDATA[linux kernel]]></category>
		<guid isPermaLink="false">http://blog.richliu.com/?p=1730</guid>

					<description><![CDATA[<p>看到一篇文章 簡體中文翻譯: 程序员，你调试过的最难的 Bug 是？ 原文: What&#8217;s the [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2015/01/07/1730/%e8%b7%9f%e9%a2%a8-%e7%a8%8b%e5%bc%8f%e8%a8%ad%e8%a8%88%e5%b8%ab-%e4%bd%a0%e8%aa%bf%e8%a9%a6%e9%81%8e%e6%9c%80%e9%9b%a3%e7%9a%84-bug/">[跟風] 程式設計師, 你調試過最難的 BUG</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>看到一篇文章<br />
簡體中文翻譯: <a href="http://blog.jobbole.com/50995/" target="_blank" rel="noopener">程序员，你调试过的最难的 Bug 是？</a><br />
原文: <a href="http://www.quora.com/Whats-the-hardest-bug-youve-debugged" target="_blank" rel="noopener">What&#8217;s the hardest bug you&#8217;ve debugged?</a></p>
<p>看原文比翻譯好一點, 從原文大概只可能猜出, 改過 timer 之後, 可能影響到 interrupt 的速度.<br />
但是從最後的描述猜也可能是動到 clock tree 去影響 timer 進而影響到其他的行為.<br />
有碰到這種 BUG 的第一個一定先猜 timing , 純軟體的反而不會這樣想, 所以他覺得最難的 BUG<br />
我們看起來就還好.</p>
<p>這個描述讓我也想寫一下, 我碰過最難的 BUG.<br />
<span id="more-1730"></span></p>
<p>那是新的 SoC 剛回來的時候, 各個 block 都要驗, 我是負責帶領系統驗証部門的,<br />
所以一開始就有一大堆 BUG, 其中有一個 BUG 就是資料存取有問題, 而且要很久才會出現一次的.</p>
<p><strong>最難的 BUG 要件之一就是很久才會出現一次, 這表示會搞很久. </strong></p>
<p>因為當時我是負責 SATA 部份的驗証, 所以這個工作自然就是我去追了.<br />
看倌呀, SOC 就是統統要自己來, 從 hardware CPU/SATA/CLOCK 到 kernel 層都可能有問題.</p>
<p>第一件事情就是, 想辦法找出可以複製的方法. 我們知道資料存取有問題<br />
所以我就寫了一個 sh script 從 A Disk Copy 到 B Disk 再做比對. 然後一直 COPY 下去, 直到找到為止.</p>
<p>這個 sh script 大概可以在 200 次大檔案 COPY, 找到一次錯誤的結果.<br />
大概要花二個小時以上, 一開始的時候, 這個 script 執行下去, 其實並沒有辦法抓出問題.</p>
<p>流程大概是這樣<br />
# dd if=/dev/zero of=test bs=1M count=1024<br />
# md5sum test<br />
這樣就會有一次寫入, 一次讀出, 這樣就可以比對 md5.</p>
<p>有沒有看出什麼問題?</p>
<p>其實這個錯誤可能很少人會意會到, 就是測試 pattern 不能為零, 假設今天 block 寫錯了, 而資料是零, 再怎麼寫入讀出, 資料還是正確的. 所以後來我都改用 AV file 做 test pattern, 工程師的惡趣味就在這邊了.<br />
&#8220;我今天有 update 新的 test pattern 哦&#8230;. &#8221;<br />
大家就知道發生什麼事情了.</p>
<p>修改完 script 之後,  md5 checksum 的結果的確是不一樣. 這時就要猜測是什麼地方在作怪.<br />
首先一定先關心 SATA Hardware 是不是有問題, 所以就拿 PCIe SATA 還有 USB 來驗証比對.<br />
同時間, 看 Linux kernel 追 SATA 這一層在搞什麼飛機.</p>
<p>其實相對於 USB Protocol , AHCI SATA Interface 是很簡單的 interface, 很快的就排除掉這個犯人了. 而且 PCIe SATA 和 USB 的結果顯示也是會複製錯誤.</p>
<p>這下子人就可能是 CPU 和 Kernel 殺的. 還有記憶體.<br />
SoC 守則, 只要資料有錯, 八成是記憶體殺的. 各位可能會問, 那為什麼要先測 SATA? 因為記憶體己經先掃過一輪沒問題了, 所以當然先丟 SATA. 不過這邊的先掃過一輪沒有問題是不是真的沒有問題&#8230;.<br />
這個原因是這樣, 所謂的記憶體沒有問題是用 NON-OS Code 下去掃的, 可能會有切 MMU Mode 和 NonMMU Mode. 總之是這樣測的.</p>
<p>然後我就 mount ramdisk 開 memtest 狂測一天. 果然出問題了. 哼哼, 是你吧.<br />
不過接下來問題才大條. RAM 出問題很麻煩的. 要怎麼定位到到底是什麼出問題呢?</p>
<p>專業的讀者應該就會猜, 那就降速跑.<br />
正解, RAM 出問題就要先降速跑. 所以 DRAM 就跑在 200Mhz (DDR2-800 是 400Mhz, 最低應該是 DDR-400 跑在 200Mhz). 反正都降速, 所以 CPU 也從 600Mhz 降到 400Mhz 跑.<br />
當然老天一定不會這麼容易讓我們破關的, 所以資料錯誤的 BUG 還是可以重現.<br />
同時間 NON-OS 的測試結果仍然是顯示沒有問題.</p>
<p>然後就是猜了. 因為如果 NON-OS 的 memory test 是正確的, 而 Linux 是錯誤的, 那可能問題是出在其他的部份. 這麼複雜的系統一定就是要猜.</p>
<p>猜也是一門學問, 接下來就是先關 L1/L2 Cache .<br />
各位, 為什麼 CACHE 要最後再測, 因為 CACHE 關掉整個系統會變更慢. 所以預期二小時會發生的, 可能測試就要拉到二天, 我還有碰過 Cache 關掉就複製不出來的 BUG.</p>
<p>Disable Cache 有二項, 因為 L2 Enable 一定要 L1 也 Enable.<br />
Disable L1/L2<br />
Disable L2<br />
除了 Disable Cache 以外, 和 CPU 相關的還有 SMP (因為 SoC 有二顆 CPU), 還有 Cache Driver 新舊版的問題.</p>
<p>這幾個測試項測下來, 果然 Disable Cache 就不會出問題了, 而且是 Disable L2 Cache.</p>
<p>走到這邊大概己經測試了三個星期. 快搞死了, SoC 慢就算了, 掉資料是不允許的啊啊啊.<br />
對一個 engineer 來說這根本是不可接受的事.<br />
而且同時間還有一堆 BUG 待解待查. SoC 剛回來天天都是屁股在燒.</p>
<p>為了保險起見. 必需要找到資料錯誤的 Pattern .<br />
所以寫了一個可以 binary compare 並且顯示出那邊不一樣的小程式.<br />
翻了一下當年的痕跡, 原來除了 binary compare, 還有程式內加上 invalidate cache 的相關程式.<br />
我還記得為了這件事翻了整層的 Linux kernel cache 和 memory management 機制.</p>
<p>最後確認到是 cache 的問題是, 使用 binary compare 找出 32bytes, 相當於一條 L2 cache line size.<br />
而且可以重覆這個測試.</p>
<p>到這邊幾乎可以確定是 L2 cache Line 的問題, 而且是硬體的問題, 當然 L2 還有一些測試項目.<br />
像是調整 Cache Latency 之類的. 這個應該都做了, 不過做了以後應該是更久才會再出現一次.</p>
<p>所以我就將我知道的東西整理一下, 寫了一封信問 ARM . (還好當時公司有付錢買 ARM 的服務).</p>
<p>ARM 的回答也很乾脆,<br />
關掉那個 L2 Cache I Prefetch 的功能就可以了. 在 PL310 內, 這個功能只是 1 bit 的改變.<br />
(I Prefetch 是 Instruction Prefetch command , 快要執行到指令時, 先去記憶體先抓回來放在 Cache 內)</p>
<p><strong>然後就一切正常了&#8230;..</strong></p>
<p><strong>然後就一切正常了&#8230;..</strong></p>
<p><strong>然後就一切正常了&#8230;..</strong></p>
<p>1 個 bit, 快要一個月的青春啊~~ 所以這個 BUG 記到現在還在記.</p>
<p>這應該算難嗎? 不知道的 BUG 都很難, 知道之後就不難了.</p>
<p>==</p>
<p>後記1: NON-OS 為什麼沒有測出來, 其實 Cache 那邊的參數也是從 NON-OS 來的, 為什麼 NON-OS 沒有問題呢?<br />
猜想是因為 NON-OS 的 Code Size 很小, 所以 Code 都在 L1 Cache 內, 並不會動用到 I prefetch 的功能. 所以自然也驗不出來了.</p>
<p>後記2: 我覺得很多細節我都忘了, 所以這應該只是大致的情節. 雖然寫起來很輕鬆, 但是當時很慘烈呀~~~~</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2015/01/07/1730/%e8%b7%9f%e9%a2%a8-%e7%a8%8b%e5%bc%8f%e8%a8%ad%e8%a8%88%e5%b8%ab-%e4%bd%a0%e8%aa%bf%e8%a9%a6%e9%81%8e%e6%9c%80%e9%9b%a3%e7%9a%84-bug/">[跟風] 程式設計師, 你調試過最難的 BUG</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.richliu.com/2015/01/07/1730/%e8%b7%9f%e9%a2%a8-%e7%a8%8b%e5%bc%8f%e8%a8%ad%e8%a8%88%e5%b8%ab-%e4%bd%a0%e8%aa%bf%e8%a9%a6%e9%81%8e%e6%9c%80%e9%9b%a3%e7%9a%84-bug/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>kernel rootwait option</title>
		<link>https://blog.richliu.com/2012/11/09/1347/kermel-rootwait-option/</link>
					<comments>https://blog.richliu.com/2012/11/09/1347/kermel-rootwait-option/#comments</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Thu, 08 Nov 2012 18:40:30 +0000</pubDate>
				<category><![CDATA[Embedded]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[linux kernel]]></category>
		<category><![CDATA[mmc]]></category>
		<category><![CDATA[rootwait]]></category>
		<category><![CDATA[usb]]></category>
		<guid isPermaLink="false">http://blog.richliu.com/?p=1347</guid>

					<description><![CDATA[<p>之前都不知道 Linux kernel 有 rootwait option, 比 rootdelay=? 好用 [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2012/11/09/1347/kermel-rootwait-option/">kernel rootwait option</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>之前都不知道 Linux kernel 有 rootwait option, 比 rootdelay=? 好用多了. </p>
<p>尤其是用 usb or mmc 之類的 device 當作 root, 常用於 embedded system .<br />
(其實我也少用, 都混 IC vendor , rootwait 這種東西就交給系統廠去處理). </p>
<p>Example Command<br />
[TEXT]<br />
CONFIG_CMDLINE=&#8221;root=/dev/mmcblk0p1 rw init=/sbin/init mem=256M console=ttyS0,38400 rootwait&#8221;<br />
[/TEXT]</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2012/11/09/1347/kermel-rootwait-option/">kernel rootwait option</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.richliu.com/2012/11/09/1347/kermel-rootwait-option/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>STM32 的 USB DFU (Device Firmware Upgrade)</title>
		<link>https://blog.richliu.com/2011/06/19/1101/stm32-%e7%9a%84-usb-dfu-device-firmware-upgrade/</link>
					<comments>https://blog.richliu.com/2011/06/19/1101/stm32-%e7%9a%84-usb-dfu-device-firmware-upgrade/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Sun, 19 Jun 2011 15:59:13 +0000</pubDate>
				<category><![CDATA[Embedded]]></category>
		<category><![CDATA[Coretex-M]]></category>
		<category><![CDATA[DFU]]></category>
		<category><![CDATA[MDK]]></category>
		<category><![CDATA[MDK-ARM]]></category>
		<category><![CDATA[STM32]]></category>
		<guid isPermaLink="false">http://blog.richliu.com/?p=1101</guid>

					<description><![CDATA[<p>當用 STM32 (我用的是 Coretex-M 的 STM32F103ZC) 時, 如果沒有 ICE, 可以 [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2011/06/19/1101/stm32-%e7%9a%84-usb-dfu-device-firmware-upgrade/">STM32 的 USB DFU (Device Firmware Upgrade)</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>當用 STM32 (我用的是 Coretex-M 的 STM32F103ZC) 時, 如果沒有 ICE, 可以用 DFU 從 USB 切入 DFU Mode, 再用 USB 的軟體升級程式. </p>
<p>我不小心弄掛我系統的 DFU, 這邊稍稍講一下如何救回來<br />
* 還是需要 ICE 的.<br />
<span id="more-1101"></span></p>
<p>我用的是 STM32 系列 <a href="http://www.st.com/internet/mcu/product/164496.jsp" target="_blank" rel="noopener">STM32F103ZC </a>進去之後, 選 Design Support.<br />
下面會有一堆軟體. </p>
<p>首先要看到的是<br />
<a href="http://www.st.com/internet/com/SOFTWARE_RESOURCES/SW_COMPONENT/FIRMWARE/um0424.zip" target="_blank" rel="noopener">STM32F10x and STM32L1xx USB full-speed device library</a><br />
其中就有<br />
Device_Firmware_Upgrade 的目錄, 進去之後, (我是使用 MDK-ARM).<br />
<a href="http://www.flickr.com/photos/richliu_tw/5849242268/" title="DFU-1 by richliu(有錢劉), on Flickr" target="_blank" rel="noopener"><img loading="lazy" decoding="async" src="http://farm4.static.flickr.com/3420/5849242268_45ce29fdb6.jpg" width="500" height="375" alt="DFU-1"/></a><br />
選好自己的平台, 重新 Compile, 再 Update Firmware 即可. </p>
<p>記得接下來自己的程式要跑在 0x8003000 的位置.<br />
像是這樣.<br />
<a href="http://www.flickr.com/photos/richliu_tw/5849257390/" title="DFU-2 by richliu(有錢劉), on Flickr" target="_blank" rel="noopener"><img loading="lazy" decoding="async" src="http://farm6.static.flickr.com/5264/5849257390_fd09e6077f.jpg" width="500" height="372" alt="DFU-2"/></a></p>
<p>DFU Windows 相關的程式在這邊. 可以從 .hex 轉成 .dfu 的格式, 可以透過 usb device driver 上傳到 target 的 0x8003000 之後的位置<br />
<a href="http://www.st.com/internet/com/SOFTWARE_RESOURCES/SW_COMPONENT/FIRMWARE/um0412.zip" target="_blank" rel="noopener">DfuSe USB Device Firmware Upgrade STMicroelectronics Extension: Contains the Demo GUI, Debugging GUI, all sources files and the protocol layer</a><br />
大陸那邊有很多介紹的文章, 這邊就不寫了. </p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2011/06/19/1101/stm32-%e7%9a%84-usb-dfu-device-firmware-upgrade/">STM32 的 USB DFU (Device Firmware Upgrade)</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.richliu.com/2011/06/19/1101/stm32-%e7%9a%84-usb-dfu-device-firmware-upgrade/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Cortex-Mx STM32: Virtual COM port in Win7</title>
		<link>https://blog.richliu.com/2011/04/24/1052/cortex-mx-stm32-virtual-com-port-in-win7/</link>
					<comments>https://blog.richliu.com/2011/04/24/1052/cortex-mx-stm32-virtual-com-port-in-win7/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Sat, 23 Apr 2011 19:41:13 +0000</pubDate>
				<category><![CDATA[ARM]]></category>
		<category><![CDATA[Embedded]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Coretex-M]]></category>
		<category><![CDATA[STM32]]></category>
		<category><![CDATA[Virtual Com Port]]></category>
		<category><![CDATA[Windows 7]]></category>
		<guid isPermaLink="false">http://blog.richliu.com/?p=1052</guid>

					<description><![CDATA[<p>如果在 Win7 下使用 Virtual Com port, 會有抓不到的狀況, 請使用這個 STM32 Vi [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2011/04/24/1052/cortex-mx-stm32-virtual-com-port-in-win7/">Cortex-Mx STM32: Virtual COM port in Win7</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>如果在 Win7 下使用 Virtual Com port, 會有抓不到的狀況, 請使用這個 <a href="http://dl.dropbox.com/u/6241711/keep/stmcdc.zip" target="_blank" rel="noopener">STM32 Virtual COM port Driver </a></p>
<p>ref.<br />
<a href="https://my.st.com/public/STe2ecommunities/mcu/Lists/ARM%20CortexM3%20STM32/DispForm.aspx?ID=10698&amp;RootFolder=https%3a%2f%2fmy%2est%2ecom%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fARM%20CortexM3%20STM32%2fVirtual%20COM%20port%20in%20Win7%20or%20Vista%2032%2dbit&amp;Source=https%3A%2F%2Fmy%2Est%2Ecom%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2FARM%2520CortexM3%2520STM32%2FFlat%2Easpx%3FRootFolder%3Dhttps%253a%252f%252fmy%252est%252ecom%252fpublic%252fSTe2ecommunities%252fmcu%252fLists%252fARM%2520CortexM3%2520STM32%252fVirtual%2520COM%2520port%2520in%2520Win7%2520or%2520Vista%252032%252dbit%26FolderCTID%3D0x01200200770978C69A1141439FE559EB459D758000626BE2B829C32145B9EB5739142DC17E%26currentviews%3D1407" target="_blank" rel="noopener">Cortex-Mx STM32: Virtual COM port in Win7 or Vista 32-bit </a></p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2011/04/24/1052/cortex-mx-stm32-virtual-com-port-in-win7/">Cortex-Mx STM32: Virtual COM port in Win7</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.richliu.com/2011/04/24/1052/cortex-mx-stm32-virtual-com-port-in-win7/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>[ARM][Linux] 建立 ARM 平台的 Debian System</title>
		<link>https://blog.richliu.com/2009/12/25/829/armlinux-%e5%bb%ba%e7%ab%8b-arm-%e5%b9%b3%e5%8f%b0%e7%9a%84-debian-system/</link>
					<comments>https://blog.richliu.com/2009/12/25/829/armlinux-%e5%bb%ba%e7%ab%8b-arm-%e5%b9%b3%e5%8f%b0%e7%9a%84-debian-system/#comments</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Fri, 25 Dec 2009 05:43:01 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Embedded]]></category>
		<category><![CDATA[arm]]></category>
		<category><![CDATA[ARM11]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[debootstrap]]></category>
		<guid isPermaLink="false">http://blog.richliu.com/?p=829</guid>

					<description><![CDATA[<p>在 Embedded system 下, 使用現有的系統驗證 SoC 功能是非常棒的.最大的好處就是不用到處找 [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2009/12/25/829/armlinux-%e5%bb%ba%e7%ab%8b-arm-%e5%b9%b3%e5%8f%b0%e7%9a%84-debian-system/">[ARM][Linux] 建立 ARM 平台的 Debian System</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>在 Embedded system 下, 使用現有的系統驗證 SoC 功能是非常棒的.<br />最大的好處就是不用到處找工具編一堆有的沒有的, 時間可以花在更重要的地方</p>



<p>像我將 debian 裝好之後, 就可以跑 wireshark 了</p>



<p>本圖中, 最左邊的是 console, 中間的視窗是 EVB 上的 wireshark, 右邊的視窗是 PC 端的 wireshark<br /><a title="Flickr 上 richliu(有錢劉) 的 使用 wireshark *2 debug tcp stream" href="http://www.flickr.com/photos/richliu_tw/4186338737/" target="_blank" rel="noopener"><img loading="lazy" decoding="async" src="http://farm3.static.flickr.com/2545/4186338737_04601bbf13_m.jpg" alt="使用 wireshark *2 debug tcp stream" width="240" height="100"/></a></p>



<p>真是超好用的&#8230;&#8230;</p>



<span id="more-829"></span>



<p>首先先裝 debootstrap<br /># apt-get install debootstrap<br />再裝 sid 系統 (現在應該是 unstable)</p>



<pre class="wp-block-preformatted">debootstrap --verbose --foreign --arch armel sid ./sid http://ftp.tw.debian.org/debian
# 若以上連結失效, 可以改用
debootstrap --verbose --foreign --arch armel sid ./sid http://ftp.twaren.net/Debian/debian/
</pre>



<p id="block-a79ce910-9e82-4b55-82ab-0f551c1bfc43">在此一提, 我是用 ARM11MPCore 平台, 用 armel (使用 EABI) 比較好, 記得有些套件在 armel 才會有. arm 己經沒有了

抓完套件下來以後, 將 sid 打包起來, 丟到 target 上去, 再解壓到 /</p>



<p>接下來在 Target board 上下</p>



<pre class="wp-block-preformatted">/debootstrap/debootstrap --second-stage</pre>



<p><br />運氣好就可以解完, 如果解不完就重做一次看看<br />因為我是在 host PC 上做的, 所以在做的時候有一些 information 就會帶過去</p>



<p>修改 /etc/fstab</p>



<pre class="wp-block-preformatted"><br />/dev/sda1 / ext3 defaults,noatime,check=none 0 0<br />proc /proc proc defaults 0 0<br />devpts /dev/pts devpts mode=0620,gid=5 0 0</pre>



<p><br /></p>



<p>因為我是要常常開關測試, 所以不希望 fsck disk,<br />在 format disk 後, 可以考慮下這種參數</p>



<pre class="wp-block-preformatted">
# mke2fs -j /dev/sda
# tune2fs -c 0 -i 0 /dev/sda1
</pre>



<p>/etc/inittab 也要修改, getty 的部份可以全部關掉 (如果有 LCD 可以留 1,2 個下來)</p>



<p></p>



<pre class="wp-block-preformatted">

T0:23:respawn:/sbin/getty -L ttyS0 38400 vt100
#1:2345:respawn:/sbin/getty 38400 tty1
#2:23:respawn:/sbin/getty 38400 tty2
#3:23:respawn:/sbin/getty 38400 tty3
#4:23:respawn:/sbin/getty 38400 tty4
#5:23:respawn:/sbin/getty 38400 tty5
#6:23:respawn:/sbin/getty 38400 tty6
</pre>



<p><br />產生 sources.list</p>



<pre class="wp-block-preformatted"># echo "deb http://ftp.tw.debian.org/debian unstable main non-free contrib" > /etc/apt/sources.list
</pre>



<p><br />設定環境變數</p>



<pre class="wp-block-preformatted">echo LANG=\"C\" >> /etc/environment</pre>



<p></p>



<p><br />接下來就網路設一設, 然後就可以開始安裝環境了</p>



<pre class="wp-block-preformatted"># apt-get update
# apt-get install openssh-server
# apt-get install rcconf
</pre>



<p>接下來有用過 ubuntu 應該就很熟了&#8230;.</p>



<p>Ref.<br /><a title="deboostrap-debian" href="http://emqbit.com/deboostrap-debian" target="_blank" rel="noopener"><br />http://emqbit.com/deboostrap-debian</a><br />Ref. 這個不錯<br />https://help.ubuntu.com/community/Installation/FromLinux</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2009/12/25/829/armlinux-%e5%bb%ba%e7%ab%8b-arm-%e5%b9%b3%e5%8f%b0%e7%9a%84-debian-system/">[ARM][Linux] 建立 ARM 平台的 Debian System</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.richliu.com/2009/12/25/829/armlinux-%e5%bb%ba%e7%ab%8b-arm-%e5%b9%b3%e5%8f%b0%e7%9a%84-debian-system/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>ARM 的 Oprofile</title>
		<link>https://blog.richliu.com/2009/12/12/820/arm-%e7%9a%84-oprofile/</link>
					<comments>https://blog.richliu.com/2009/12/12/820/arm-%e7%9a%84-oprofile/#comments</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Fri, 11 Dec 2009 19:02:18 +0000</pubDate>
				<category><![CDATA[Embedded]]></category>
		<category><![CDATA[arm]]></category>
		<category><![CDATA[ARM11]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[oprofile]]></category>
		<guid isPermaLink="false">http://blog.richliu.com/?p=820</guid>

					<description><![CDATA[<p>最近在弄 ARM11 的 Oprofile, 結果發現執行 opcontrol 的動作之後, 沒有 log 的 [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2009/12/12/820/arm-%e7%9a%84-oprofile/">ARM 的 Oprofile</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>最近在弄 ARM11 的 Oprofile, 結果發現執行 opcontrol 的動作之後, 沒有 log 的動作.<br />
大致上的訊息是這樣的<br />
[Bash]<br />
# opcontrol &#8211;shutdown<br />
Stopping profiling.<br />
Killing daemon.<br />
# Stopping profiling.<br />
Killing daemon.<br />
opreport image:/vmlinux -l -w -g &gt; oprofile.txt<br />
error: no sample files found: profile specification too strict ?<br />
[/Bash]</p>
<p>這時請改用 timer interrupt</p>
<p>在 load oprofile modules 加上 timer=1<br />
若是 static link 時, 就要在 boot_cmd 加上 oprofile.timer=1</p>
<p>似乎目前的 kernel oprofile 不支援 ARM11MPCore.</p>
<p>http://oprofile.sourceforge.net/doc/detailed-parameters.html#timer</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2009/12/12/820/arm-%e7%9a%84-oprofile/">ARM 的 Oprofile</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.richliu.com/2009/12/12/820/arm-%e7%9a%84-oprofile/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
		<item>
		<title>[Linux][Kernel][Memory] smbd: page allocation failure. order:2, mode:0x20</title>
		<link>https://blog.richliu.com/2009/12/11/822/%e8%a8%98%e6%86%b6%e9%ab%94%e5%95%8f%e9%a1%8c-smbd-page-allocation-failure-order2-mode0x20/</link>
					<comments>https://blog.richliu.com/2009/12/11/822/%e8%a8%98%e6%86%b6%e9%ab%94%e5%95%8f%e9%a1%8c-smbd-page-allocation-failure-order2-mode0x20/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Fri, 11 Dec 2009 13:05:31 +0000</pubDate>
				<category><![CDATA[Embedded]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Jumbo Frame]]></category>
		<category><![CDATA[linux kernel]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[samba]]></category>
		<guid isPermaLink="false">http://blog.richliu.com/?p=822</guid>

					<description><![CDATA[<p>如果啟動了 Jumbo Frame 加上執行 Samba , 有可能會出現類似的訊息(系統抓下來似乎有點不全) [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2009/12/11/822/%e8%a8%98%e6%86%b6%e9%ab%94%e5%95%8f%e9%a1%8c-smbd-page-allocation-failure-order2-mode0x20/">[Linux][Kernel][Memory] smbd: page allocation failure. order:2, mode:0x20</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>如果啟動了 Jumbo Frame 加上執行 Samba , 有可能會出現類似的訊息(系統抓下來似乎有點不全)</p>
<p><span id="more-822"></span></p>
<blockquote><p>smbd: page allocation failure. order:2, mode:0x20<br />
Backtrace:<br />
[&lt;c002fd30&gt;] (dump_backtrace+0x0/0x108) from [&lt;c02ac488&gt;] (dump_stack+0x18/0x1c)<br />
[&lt;c02ac470&gt;] (dump_stack+0x0/0x1c) from [&lt;c0075734&gt;] (__alloc_pages_nodemask+0x3d0/0x55c)<br />
[&lt;c0075364&gt;] (__alloc_pages_nodemask+0x0/0x55c) from [&lt;c008f5d8&gt;] (cache_alloc_refill+0x2b0/0x598)<br />
[&lt;c008f328&gt;] (cache_alloc_refill+0x0/0x598) from [&lt;c008f978&gt;] (__kmalloc+0xb8/0xd8)<br />
[&lt;c008f8c0&gt;] (__kmalloc+0x0/0xd8) from [&lt;c0227a6c&gt;] (__alloc_skb+0x54/0x138)<br />
[&lt;c0227a18&gt;] (__alloc_skb+0x0/0x138) from [&lt;c022879c&gt;] (dev_alloc_skb+0x20/0x44)<br />
[&lt;c022877c&gt;] (dev_alloc_skb+0x0/0x44) from [&lt;c01e643c&gt;] (cns3xxx_receive_packet+0x228/0x3c8)<br />
[&lt;c01e6214&gt;] (cns3xxx_receive_packet+0x0/0x3c8) from [&lt;c01e661c&gt;] (cns3xxx_poll+0x40/0xd4)<br />
[&lt;c01e65dc&gt;] (cns3xxx_poll+0x0/0xd4) from [&lt;c022f264&gt;] (net_rx_action+0xb4/0x184)<br />
[&lt;c022f1b0&gt;] (net_rx_action+0x0/0x184) from [&lt;c0048544&gt;] (__do_softirq+0x90/0x11c)<br />
[&lt;c00484b4&gt;] (__do_softirq+0x0/0x11c) from [&lt;c0048614&gt;] (irq_exit+0x44/0x4c)<br />
[&lt;c00485d0&gt;] (irq_exit+0x0/0x4c) from [&lt;c002b04c&gt;] (_text+0x4c/0x90)<br />
[&lt;c002b000&gt;] (_text+0x0/0x90) from [&lt;c002bab8&gt;] (__irq_svc+0x38/0x80)<br />
Exception stack(0xc7acbcc0 to 0xc7acbd08)<br />
bcc0: c7acbd1c c7829960 c7acbd28 00000000 00000001 c7b53980 c7b539e4 c7acbd1c<br />
bce0: 00000000 00000000 c7acbf08 c7acbd14 c7acbd28 c7acbd08 c0222314 c0057a0c<br />
bd00: 60000013 ffffffff<br />
[&lt;c00579b0&gt;] (finish_wait+0x0/0x6c) from [&lt;c0222314&gt;] (sk_wait_data+0xcc/0xec)<br />
[&lt;c0222248&gt;] (sk_wait_data+0x0/0xec) from [&lt;c0255fc0&gt;] (tcp_recvmsg+0x600/0x8a8)<br />
[&lt;c02559c0&gt;] (tcp_recvmsg+0x0/0x8a8) from [&lt;c0221208&gt;] (sock_common_recvmsg+0x48/0x5c)<br />
[&lt;c02211c0&gt;] (sock_common_recvmsg+0x0/0x5c) from [&lt;c021e7d8&gt;] (sock_aio_read+0x138/0x144)<br />
[&lt;c021e6a0&gt;] (sock_aio_read+0x0/0x144) from [&lt;c0092918&gt;] (do_sync_read+0xc4/0x110)<br />
[&lt;c0092854&gt;] (do_sync_read+0x0/0x110) from [&lt;c00936ac&gt;] (vfs_read+0x164/0x16c)<br />
[&lt;c0093548&gt;] (vfs_read+0x0/0x16c) from [&lt;c0093790&gt;] (sys_read+0x44/0x74)<br />
[&lt;c009374c&gt;] (sys_read+0x0/0x74) from [&lt;c002be40&gt;] (ret_fast_syscall+0x0/0x2c)<br />
Mem-info:<br />
Normal per-cpu:<br />
CPU    0: hi:   42, btch:   7 usd:  32<br />
Active_anon:570 active_file:9598 inactive_anon:576<br />
inactive_file:17657 unevictable:0 dirty:3503 writeback:0 unstable:0<br />
free:419 slab:2389 mapped:1587 pagetables:87 bounce:0<br />
Normal free:1676kB min:1440kB low:1800kB high:2160kB active_anon:2280kB inactive_anon:2304kB active_file:38392kB inactive_file:70628kB unevictable:0kB present:130048kB pages_scanned:0 all_unreclaimable? no<br />
lowmem_reserve[]: 0 0<br />
Normal: 345*4kB 25*8kB 6*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 1676kB<br />
27277 total pagecache pages<br />
32768 pages of RAM<br />
543 free pages<br />
1251 reserved pages<br />
2389 slab pages<br />
29382 pages shared<br />
0 pages swap cached</p></blockquote>
<p>可以加大 kernel 預留的 Buffer, 我系統上原來是 1117, 可以用指令</p>
<p><strong>echo 8192 &gt; /proc/sys/vm/min_free_kbytes</strong><strong><br />
</strong></p>
<p>加大到 8Mbytes, 這樣可以減少 page allocation 失敗的機率, 在我們的測試內, 某些時候 8MByte 仍會出現, 可以考慮加大到 16Mbytes.</p>
<p>原因是因為在 interrupt 中, 向系統一次要求大塊的記憶體. 這時可以透過增加 min_free_kbytes 參數去避過這個問題.<br />
調整 slab 的參數或許也有用  ( echo x y z &gt; /proc/slab)</p>
<p>Ref.<br />
http://lime-technology.com/forum/index.php?topic=3999.0<br />
http://linux.derkeiler.com/Mailing-Lists/Kernel/2004-01/0059.html</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2009/12/11/822/%e8%a8%98%e6%86%b6%e9%ab%94%e5%95%8f%e9%a1%8c-smbd-page-allocation-failure-order2-mode0x20/">[Linux][Kernel][Memory] smbd: page allocation failure. order:2, mode:0x20</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.richliu.com/2009/12/11/822/%e8%a8%98%e6%86%b6%e9%ab%94%e5%95%8f%e9%a1%8c-smbd-page-allocation-failure-order2-mode0x20/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>ARMv6 的 Word Swap 指令</title>
		<link>https://blog.richliu.com/2009/05/23/761/armv6-%e7%9a%84-word-swap-%e6%8c%87%e4%bb%a4/</link>
					<comments>https://blog.richliu.com/2009/05/23/761/armv6-%e7%9a%84-word-swap-%e6%8c%87%e4%bb%a4/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Fri, 22 May 2009 16:20:11 +0000</pubDate>
				<category><![CDATA[ARM]]></category>
		<category><![CDATA[Embedded]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[ARMv6]]></category>
		<category><![CDATA[REV]]></category>
		<guid isPermaLink="false">http://blog.richliu.com/?p=761</guid>

					<description><![CDATA[<p>ARMv6 加入了幾個好用的 Swap 指令. 不需要用軟體算來算去 請參考 http://www.arm.c [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2009/05/23/761/armv6-%e7%9a%84-word-swap-%e6%8c%87%e4%bb%a4/">ARMv6 的 Word Swap 指令</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>ARMv6 加入了幾個好用的 Swap 指令. 不需要用軟體算來算去<br />
請參考 http://www.arm.com/pdfs/ARMv6_Architecture.pdf</p>
<p>REV<br />
REV16<br />
REVSH</p>
<p><a href="http://www.flickr.com/photos/richliu_tw/3486040982/" title="Flickr 上 richliu(有錢劉) 的 ARM_REV" target="_blank" rel="noopener"><img loading="lazy" decoding="async" src="http://farm4.static.flickr.com/3567/3486040982_f2f5228deb_o.png" width="692" height="384" alt="ARM_REV" /></a></p>
<p>最常用的應該是 REV 吧.</p>
<p>Realview inline assembly 很簡單.</p>
<blockquote><p>[C]unsigned int tmp = 0x12345678;<br />
__asm{<br />
         REV tmp, tmp<br />
}[/C]</p></blockquote>
<p>GNU C++ inline assembly 為(未測)</p>
<p>[C]<br />
unsigned int tmp = 0x12345678;<br />
__asm__ __volatile__ (<br />
   &#8220;REV %0,%0;&#8221; : &#8220;=r&#8221;(tmp) : &#8220;r&#8221;(tmp):&#8221;r5&#8221;);<br />
);[/C]</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2009/05/23/761/armv6-%e7%9a%84-word-swap-%e6%8c%87%e4%bb%a4/">ARMv6 的 Word Swap 指令</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.richliu.com/2009/05/23/761/armv6-%e7%9a%84-word-swap-%e6%8c%87%e4%bb%a4/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>[新聞][想法] Android Porting 到 EeePC 之後.</title>
		<link>https://blog.richliu.com/2009/01/09/690/%e6%96%b0%e8%81%9e%e6%83%b3%e6%b3%95-android-porting-%e5%88%b0-eeepc-%e4%b9%8b%e5%be%8c/</link>
					<comments>https://blog.richliu.com/2009/01/09/690/%e6%96%b0%e8%81%9e%e6%83%b3%e6%b3%95-android-porting-%e5%88%b0-eeepc-%e4%b9%8b%e5%be%8c/#comments</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Fri, 09 Jan 2009 06:53:16 +0000</pubDate>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Embedded]]></category>
		<category><![CDATA[亂扯淡]]></category>
		<category><![CDATA[Aspire One]]></category>
		<category><![CDATA[EeePC]]></category>
		<category><![CDATA[新聞]]></category>
		<category><![CDATA[評論]]></category>
		<guid isPermaLink="false">http://blog.richliu.com/?p=690</guid>

					<description><![CDATA[<p>畫虎爛時間又到了, 今天要講評的是, Android Porting 到 EeeePC 這件事. 首先是 Ee [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2009/01/09/690/%e6%96%b0%e8%81%9e%e6%83%b3%e6%b3%95-android-porting-%e5%88%b0-eeepc-%e4%b9%8b%e5%be%8c/">[新聞][想法] Android Porting 到 EeePC 之後.</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>畫虎爛時間又到了, 今天要講評的是, Android Porting 到 EeeePC 這件事.</p>
<p>首先是 EeeePC 可以執行 Android 平台.<a href="http://chinese.engadget.com/2009/01/03/android-netbooks-on-their-way/" target="_blank" rel="noopener"><br />
Android平台，並不是只有手機，連輕省筆電也有？</a><a href="http://chinese.engadget.com/2009/01/05/move-over-eee-android-now-running-on-hp-mini-note-2133/" target="_blank" rel="noopener"></a><br />
<a title="3160503771_cd8a12da38 (by richliu(有錢劉))" href="http://www.flickr.com/photos/richliu_tw/3180885241/" target="_blank" rel="noopener"><img loading="lazy" decoding="async" title="3160503771_cd8a12da38 (by richliu(有錢劉))" src="http://farm4.static.flickr.com/3332/3180885241_a5a93745f1_m.jpg" alt="3160503771_cd8a12da38 (by richliu(有錢劉))" width="229" height="240" /></a></p>
<p>再來就是 HP Mini 的平台.<a href="http://chinese.engadget.com/2009/01/05/move-over-eee-android-now-running-on-hp-mini-note-2133/" target="_blank" rel="noopener"><span id="ppt1419320"><br />
筆電跑Android又一例：HP Mini-Note 2133影片實況紀錄</span></a><br />
<a title="hp-2133-android- (by richliu(有錢劉))" href="http://www.flickr.com/photos/richliu_tw/3180885243/" target="_blank" rel="noopener"><img loading="lazy" decoding="async" title="hp-2133-android- (by richliu(有錢劉))" src="http://farm4.static.flickr.com/3336/3180885243_6d669967b7_m.jpg" alt="hp-2133-android- (by richliu(有錢劉))" width="240" height="180" /></a></p>
<p><span id="more-690"></span></p>
<p>其實除了 Netbook 的型式以外, Android 還以 Desktop phone 的型態存在, 這次 CES 展就有(<a title="Permanent Link: CES 2009 - NIMble Android Desktop Phone" rel="bookmark noopener" href="http://www.talkandroid.com/552-ces-2009-nimble-android-desktop-phone/" target="_blank">CES 2009 &#8211; NIMble Android Desktop Phone</a>)</p>
<p><a title="nimble-android-desktop-phon (by richliu(有錢劉))" href="http://flickr.com/photos/richliu_tw/3181188409/" target="_blank" rel="noopener"><img loading="lazy" decoding="async" title="nimble-android-desktop-phon (by richliu(有錢劉))" src="http://farm4.static.flickr.com/3107/3181188409_40029e9de4_m.jpg" alt="nimble-android-desktop-phon (by richliu(有錢劉))" width="240" height="160" /></a></p>
<p style="padding-left: 30px;">The NIMble device boasts a 7-inch multitouch screen (800&#215;400) along with 624MHz Marvel processor, MicroSD card expansion, Bluetooth and Wi-Fi.</p>
<p>在 Open Source 界, 一直沒有一個像樣的手機平台, 一來太開放的系統沒有大廠願意加入, 二來沒有夠力的廠商做後盾.<br />
手機整合比 Home Gateway 這種小 Device 難太多了.</p>
<p>從前從前 <a href="http://trolltech.com/products/device-creation" target="_blank" rel="noopener">Tolltech Qtopia</a> 有曾經嘗試過這個組合, 不過時機未到, 加上 Qtopia 的 License 問題, 可能也是讓大家卻步不前的阻力. 成功的經驗應該是 Motorola 的 E 系列手機吧, 但是隨著 Motorola 拱手將手機的江山讓出, 這一隻經典也慢慢的步入墳墓了.</p>
<p>後來有 <a href="http://www.openmoko.com/" target="_blank" rel="noopener">OpenMoko</a> 有推 Open Hardware 的手機, 雖然是說 Hardware 開放, Open Source.<br />
但是 OpenMoko 的 solution 根本就沒有完整的完成過. 只能說是高級的組合玩具. 不可以說是一隻手機.</p>
<p>再來看看 2008 年的手機市佔率(Ref. <a href="http://www.wretch.cc/blog/dawo/9572351" target="_blank" rel="noopener">2008全球智慧型手機市佔率 Worldwide Smartphone Sales</a>)</p>
<p><a title="Worldwide: Preliminary Smartphone Sales to End Users by Operating System, 2Q08 (Units) (by richliu(有錢劉))" href="http://flickr.com/photos/richliu_tw/3180973229/" target="_blank" rel="noopener"><img loading="lazy" decoding="async" title="Worldwide: Preliminary Smartphone Sales to End Users by Operating System, 2Q08 (Units) (by richliu(有錢劉))" src="http://farm4.static.flickr.com/3364/3180973229_80c44c64f1_o.png" alt="Worldwide: Preliminary Smartphone Sales to End Users by Operating System, 2Q08 (Units) (by richliu(有錢劉))" width="484" height="211" /></a></p>
<p>Research In Motion 是黑苺機, 有固定消費群, 不過非英語系國家很少人用<br />
Palm OS 不成氣候, 我猜從 Windows 平台往 Linux 平台移, 還是沒有長進, 時不我予, 當初丟掉大好江山, 拿不回來啦 :p</p>
<p>Symbian 後面都是追兵, 不要說緊緊追擊的 Windows Mobile. 更可怕的對手是 iPhone.<br />
即便它己經成為一個開放系統, 但是仍然沒有太多 Open Source 社群人土的加入.</p>
<p>但是前年 11 月 Google Annonce 他的手機平台 Android. 起初我也是不是很在意,<br />
不過當他發表 T-Mobile G1, 而預購數量可以到達 150 萬隻, 我就知道. 這個市場起來了.</p>
<p>更因為 Android 是一個開放平台, 用 Apache License Aggrement. 所以吸引了各家底層和<br />
Open Source 愛好者加入(有 Fun 的事情才有人搞), 而上層使用 SUN 的 JAVA 平台, 使得<br />
跨平台更為容易.而 JAVA 應該是目前使用人口最多的程式語言, 所以要寫些什麼應該不是<br />
很難的事情.</p>
<p>話講回來, 我很嚴肅的看待 Android 在 EeePC 出現這一件事. 這應該可以視作是一個 mile stone, 比 ARM 贊助 Ubuntu Porting 到 ARM 平台更有意思.</p>
<p>其實也是筆者個人長期忽視 Google 的力量, 因為, Android 就是 Google OS. 籍由 Linux 和 JAVA 這二個高度跨平台的 OS/Language, 除非是低階產品, 要不然我想不出來有那一個平台是不能跑的? 沒有.<br />
當然沒有 GUI 的 OS 一定不是 Windows CE/Windows Mobile 的天下, 那都是 VxWorks/Linux 的市場.(中階部份)</p>
<p>所以筆電可以在 x86 上跑 Android, Software 廠商就會比較願意在上面開發專用的 Software, 一次二個平台用. 那 Costdown 的時侯就是 Costdown 到 ARM 上執行. 平台有差別嗎? 沒有.<br />
如果平台沒有差別的時候, 第一個被威脅的當然就是微軟了.</p>
<p>所以接下來我的猜測</p>
<ol>
<li>Intel ATOM 佔領手機市場失敗</li>
<li>繼 Eee Phone 使用 Android 平台, 未來可能會出現用 Android 的 EeePC 平台</li>
<li>Android EeePC 平台使用 ARM 做為處理器.</li>
</ol>
<p>文章最後, 我還是要酸一下 EeePC .<br />
做為一個市場的先行者, 去年一下就拱手讓人.</p>
<h2><a href="http://taiwan.cnet.com/crave/0,2000088746,20134971,00.htm" target="_blank" rel="noopener"><strong></strong><strong>2008年Q3 acer netbook出貨量最多</strong></a></h2>
<p>根據研究機構<a href="http://www.displaysearch.com/cps/rde/xchg/displaysearch/hs.xsl/Strong_mini_note_shipments_buoy_notebook_PC_Market_Q3_08.asp" target="_blank" rel="noopener">DisplaySearch</a>的報告，Acer在2008年Q3賣掉了215萬台輕省筆電，囊括38.3％的Netbook市佔率，Asus只賣掉170萬台，市佔率落在30.3％。整個Q3的netbook出貨量為561萬台。<br />
<span style="color: #ff0000;">才二季就被幹掉, 這也太強了.</span></p>
<h2><a href="http://ascii.jp/elem/000/000/198/198626/" target="_blank" rel="noopener">日本迷你筆電滿意度排名</a></h2>
<p style="padding-left: 30px;">日文看不懂沒有關係, 我整理出重點<br />
整體滿意度<br />
1) Aspire One<br />
3) EeePC<br />
設計<br />
1) Aspire One<br />
3) EeePC<br />
方便移動<br />
2) EeePC<br />
5) Aspire One<br />
電池<br />
2) EeePC<br />
5) Aspire One<br />
價格性能比<br />
1) Aspire One<br />
2) EeePC</p>
<p>當然看了<a href="http://www.programmer-club.com/pc2020v5/forum/ShowSameTitleN.asp?URL=N&amp;board_pc2" target="_blank" rel="noopener">某人的文章</a>, 我怎麼覺得某人要負責呢? 幹 RD 的去干擾 PM, 當主管的和小弟搶工作作. 怎麼看都不對,<br />
我猜內部不太和諧, RD 不肯聽 PM 的自己硬幹, PM 沒有 RD 的 Support 什麼事都做不了. (當然背後實際的原因是, ACER 的通路還是比 ASUS 好, 而且外型的確也是勝出, 這二點應該是 ACER 大勝的原因, RD 因素? 那大家就多想想了)</p>
<p>現在迷你筆電也是百家爭嗚了, 去年我就這樣預測. 不過這也是屁話, 本來就會發生的事.</p>
<p>現在就看 Android 在 2009 能不能搶下 10% 的市場. 我認為會啦, 因為連我不用智慧型手機的人, 不小心都買一隻了, Android 有無窮的魅力呀~</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2009/01/09/690/%e6%96%b0%e8%81%9e%e6%83%b3%e6%b3%95-android-porting-%e5%88%b0-eeepc-%e4%b9%8b%e5%be%8c/">[新聞][想法] Android Porting 到 EeePC 之後.</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.richliu.com/2009/01/09/690/%e6%96%b0%e8%81%9e%e6%83%b3%e6%b3%95-android-porting-%e5%88%b0-eeepc-%e4%b9%8b%e5%be%8c/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title>[DirectFB] 用 DirectFB + GTK+ 的問題</title>
		<link>https://blog.richliu.com/2008/12/29/670/directfb-directfb-programs-terminating-with-signal-11/</link>
					<comments>https://blog.richliu.com/2008/12/29/670/directfb-directfb-programs-terminating-with-signal-11/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Mon, 29 Dec 2008 09:35:22 +0000</pubDate>
				<category><![CDATA[Embedded]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[directfb]]></category>
		<guid isPermaLink="false">http://blog.richliu.com/?p=670</guid>

					<description><![CDATA[<p>記錄用 GTK_on_DirectFB_for_Embedded_Systems DirectFB progr [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2008/12/29/670/directfb-directfb-programs-terminating-with-signal-11/">[DirectFB] 用 DirectFB + GTK+ 的問題</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>記錄用</p>
<p><a href="http://www.directfb.org/wiki/index.php/Projects:GTK_on_DirectFB_for_Embedded_Systems" target="_blank" rel="noopener">GTK_on_DirectFB_for_Embedded_Systems</a></p>
<p>DirectFB programs terminating with signal 11</p>
<p>如果執行 dfbinfo 或是其他 directfb 的程式碰到這樣的問題, 在<br />
~/.directfbrc 加上一行 disable-module=x11input</p>
<p>在 DirectFB 1.3.0 測試 OK</p>
<p>Reference:</p>
<p><a href="http://www.mail-archive.com/directfb-users@directfb.org/msg08053.html" target="_blank" rel="noopener"><span class="subject">[directfb-users] DirectFB programs terminating with signal 11</span></a></p>
<p>pkg-config &#8211;libs cairo 都找到 /usr/local/lib/pkgconfig<br />
修改 /usr/local/lib/pkgconfig/cairo.pc 內, 移除 /usr/local/lib/pkgconfig</p>
<p>編輯 gtk+ 找不到 Pango</p>
<p style="text-align: left; padding-left: 30px;">*** Pango not found. Pango built with Cairo support is required<br />
*** to build GTK+. See http://www.pango.org for Pango information.
</p>
<p style="text-align: left;">修改 /usr/local/lib/pkgconfig/pango.pc 在修改 Libs 那一行為</p>
<p style="text-align: left;">Libs: -L${libdir} -lpango-1.0 -lfontconfig -lpng -ldirectfb</p>
<p style="text-align: left;">編到</p>
<p style="text-align: left;">gdkcursor-directfb.c:231: error: &#8216;__u32&#8217; undeclared (first use in this function)</p>
<p style="text-align: left;">直接在 gdkcursor-directfb.c 加上<br />
#define __u32 u32<br />
#define __u8 u8
</p>
<p style="text-align: left;">
<p><!--/htdig_noindex--> <!--X-TopPNI-End--> <!--X-MsgBody--> <!--X-Subject-Header-Begin--></p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2008/12/29/670/directfb-directfb-programs-terminating-with-signal-11/">[DirectFB] 用 DirectFB + GTK+ 的問題</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.richliu.com/2008/12/29/670/directfb-directfb-programs-terminating-with-signal-11/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>ARM RealView ICE, RealView Trace 開箱文</title>
		<link>https://blog.richliu.com/2008/12/22/665/arm-realview-ice-realview-trace-%e9%96%8b%e7%ae%b1%e6%96%87/</link>
					<comments>https://blog.richliu.com/2008/12/22/665/arm-realview-ice-realview-trace-%e9%96%8b%e7%ae%b1%e6%96%87/#comments</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Mon, 22 Dec 2008 06:51:35 +0000</pubDate>
				<category><![CDATA[Embedded]]></category>
		<category><![CDATA[工作]]></category>
		<category><![CDATA[arm]]></category>
		<category><![CDATA[Realview ICE]]></category>
		<category><![CDATA[Realview Trace]]></category>
		<category><![CDATA[開箱文]]></category>
		<guid isPermaLink="false">http://blog.richliu.com/?p=665</guid>

					<description><![CDATA[<p>最近公司買了 ARM Realview ICE 和 RealView Trace. 所以就照一照, 弄個開箱文 [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2008/12/22/665/arm-realview-ice-realview-trace-%e9%96%8b%e7%ae%b1%e6%96%87/">ARM RealView ICE, RealView Trace 開箱文</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>最近公司買了 ARM Realview ICE 和 RealView Trace.<br />
所以就照一照, 弄個開箱文. 這二台加起來超過 US$7,000.- 以上<br />
RealView Development Suite Professional Floating License 要價 US$12,000.- 以上, 軟體果然比硬體貴多了<br />
我猜 ARM 應該覺得大家都會用盜版呀&#8230;.<br />
<span id="more-665"></span></p>
<p>Realview ICE 的外盒, 很大一盒 :p<br />
<a href="https://blog.richliu.com/wp-content/uploads/2008/12/dsc00843_3126840625_o.jpg"><img loading="lazy" decoding="async" class="aligncenter size-large wp-image-3138" src="https://blog.richliu.com/wp-content/uploads/2008/12/dsc00843_3126840625_o-1024x768.jpg" alt="" width="620" height="465" srcset="https://blog.richliu.com/wp-content/uploads/2008/12/dsc00843_3126840625_o-1024x768.jpg 1024w, https://blog.richliu.com/wp-content/uploads/2008/12/dsc00843_3126840625_o-300x225.jpg 300w, https://blog.richliu.com/wp-content/uploads/2008/12/dsc00843_3126840625_o-768x576.jpg 768w, https://blog.richliu.com/wp-content/uploads/2008/12/dsc00843_3126840625_o.jpg 2048w" sizes="(max-width: 620px) 100vw, 620px" /></a></p>
<p>拆了外箱<br />
<a href="https://blog.richliu.com/wp-content/uploads/2008/12/dsc00844_3126840075_o.jpg"><img loading="lazy" decoding="async" class="aligncenter size-large wp-image-3139" src="https://blog.richliu.com/wp-content/uploads/2008/12/dsc00844_3126840075_o-1024x768.jpg" alt="" width="620" height="465" srcset="https://blog.richliu.com/wp-content/uploads/2008/12/dsc00844_3126840075_o-1024x768.jpg 1024w, https://blog.richliu.com/wp-content/uploads/2008/12/dsc00844_3126840075_o-300x225.jpg 300w, https://blog.richliu.com/wp-content/uploads/2008/12/dsc00844_3126840075_o-768x576.jpg 768w, https://blog.richliu.com/wp-content/uploads/2008/12/dsc00844_3126840075_o.jpg 2048w" sizes="(max-width: 620px) 100vw, 620px" /></a></p>
<p>第一層, 手冊和 RVD 的光碟片<br />
<a href="https://blog.richliu.com/wp-content/uploads/2008/12/dsc00845_3126842195_o.jpg"><img loading="lazy" decoding="async" class="aligncenter size-large wp-image-3140" src="https://blog.richliu.com/wp-content/uploads/2008/12/dsc00845_3126842195_o-1024x768.jpg" alt="" width="620" height="465" srcset="https://blog.richliu.com/wp-content/uploads/2008/12/dsc00845_3126842195_o-1024x768.jpg 1024w, https://blog.richliu.com/wp-content/uploads/2008/12/dsc00845_3126842195_o-300x225.jpg 300w, https://blog.richliu.com/wp-content/uploads/2008/12/dsc00845_3126842195_o-768x576.jpg 768w, https://blog.richliu.com/wp-content/uploads/2008/12/dsc00845_3126842195_o.jpg 2048w" sizes="(max-width: 620px) 100vw, 620px" /></a></p>
<p>第二層, Realview ICE 的本體<br />
<a href="https://blog.richliu.com/wp-content/uploads/2008/12/dsc00846_3127668966_o.jpg"><img loading="lazy" decoding="async" class="aligncenter size-large wp-image-3142" src="https://blog.richliu.com/wp-content/uploads/2008/12/dsc00846_3127668966_o-1024x768.jpg" alt="" width="620" height="465" srcset="https://blog.richliu.com/wp-content/uploads/2008/12/dsc00846_3127668966_o-1024x768.jpg 1024w, https://blog.richliu.com/wp-content/uploads/2008/12/dsc00846_3127668966_o-300x225.jpg 300w, https://blog.richliu.com/wp-content/uploads/2008/12/dsc00846_3127668966_o-768x576.jpg 768w, https://blog.richliu.com/wp-content/uploads/2008/12/dsc00846_3127668966_o.jpg 2048w" sizes="(max-width: 620px) 100vw, 620px" /></a></p>
<p>拿出重要的線材擺在一起, 最右邊的線是 LVDS 的線, 傳輸距離長, 可以用的 clock 較高(up to 50Mhz)<br />
<a href="https://blog.richliu.com/wp-content/uploads/2008/12/dsc00847_3126842937_o.jpg"><img loading="lazy" decoding="async" class="aligncenter size-large wp-image-3143" src="https://blog.richliu.com/wp-content/uploads/2008/12/dsc00847_3126842937_o-1024x768.jpg" alt="" width="620" height="465" srcset="https://blog.richliu.com/wp-content/uploads/2008/12/dsc00847_3126842937_o-1024x768.jpg 1024w, https://blog.richliu.com/wp-content/uploads/2008/12/dsc00847_3126842937_o-300x225.jpg 300w, https://blog.richliu.com/wp-content/uploads/2008/12/dsc00847_3126842937_o-768x576.jpg 768w, https://blog.richliu.com/wp-content/uploads/2008/12/dsc00847_3126842937_o.jpg 2048w" sizes="(max-width: 620px) 100vw, 620px" /></a></p>
<p>來一個 LVDS to 20pin JTAG 轉接頭的特寫<br />
<a href="https://blog.richliu.com/wp-content/uploads/2008/12/dsc00848_3127670988_o.jpg"><img loading="lazy" decoding="async" class="aligncenter size-large wp-image-3144" src="https://blog.richliu.com/wp-content/uploads/2008/12/dsc00848_3127670988_o-1024x768.jpg" alt="" width="620" height="465" srcset="https://blog.richliu.com/wp-content/uploads/2008/12/dsc00848_3127670988_o-1024x768.jpg 1024w, https://blog.richliu.com/wp-content/uploads/2008/12/dsc00848_3127670988_o-300x225.jpg 300w, https://blog.richliu.com/wp-content/uploads/2008/12/dsc00848_3127670988_o-768x576.jpg 768w, https://blog.richliu.com/wp-content/uploads/2008/12/dsc00848_3127670988_o.jpg 2048w" sizes="(max-width: 620px) 100vw, 620px" /></a></p>
<p>RealView Trace 的盒子, 其實和 RealView ICE 的一樣大, 只是比較薄而己<br />
<a href="https://blog.richliu.com/wp-content/uploads/2008/12/dsc00850_3127671598_o.jpg"><img loading="lazy" decoding="async" class="aligncenter size-large wp-image-3145" src="https://blog.richliu.com/wp-content/uploads/2008/12/dsc00850_3127671598_o-1024x768.jpg" alt="" width="620" height="465" srcset="https://blog.richliu.com/wp-content/uploads/2008/12/dsc00850_3127671598_o-1024x768.jpg 1024w, https://blog.richliu.com/wp-content/uploads/2008/12/dsc00850_3127671598_o-300x225.jpg 300w, https://blog.richliu.com/wp-content/uploads/2008/12/dsc00850_3127671598_o-768x576.jpg 768w, https://blog.richliu.com/wp-content/uploads/2008/12/dsc00850_3127671598_o.jpg 2048w" sizes="(max-width: 620px) 100vw, 620px" /></a></p>
<p>內層只有手冊和 RealView Trace<br />
<a href="https://blog.richliu.com/wp-content/uploads/2008/12/dsc00851_3127672572_o.jpg"><img loading="lazy" decoding="async" class="aligncenter size-large wp-image-3146" src="https://blog.richliu.com/wp-content/uploads/2008/12/dsc00851_3127672572_o-1024x768.jpg" alt="" width="620" height="465" srcset="https://blog.richliu.com/wp-content/uploads/2008/12/dsc00851_3127672572_o-1024x768.jpg 1024w, https://blog.richliu.com/wp-content/uploads/2008/12/dsc00851_3127672572_o-300x225.jpg 300w, https://blog.richliu.com/wp-content/uploads/2008/12/dsc00851_3127672572_o-768x576.jpg 768w, https://blog.richliu.com/wp-content/uploads/2008/12/dsc00851_3127672572_o.jpg 2048w" sizes="(max-width: 620px) 100vw, 620px" /></a></p>
<p>來個疊疊樂, 但是 Realview ICE 和 Realview Trace 就是要這樣疊起來用的, 所以是一定要疊的<br />
<a href="https://blog.richliu.com/wp-content/uploads/2008/12/dsc00859_3127673032_o.jpg"><img loading="lazy" decoding="async" class="aligncenter size-large wp-image-3147" src="https://blog.richliu.com/wp-content/uploads/2008/12/dsc00859_3127673032_o-1024x768.jpg" alt="" width="620" height="465" srcset="https://blog.richliu.com/wp-content/uploads/2008/12/dsc00859_3127673032_o-1024x768.jpg 1024w, https://blog.richliu.com/wp-content/uploads/2008/12/dsc00859_3127673032_o-300x225.jpg 300w, https://blog.richliu.com/wp-content/uploads/2008/12/dsc00859_3127673032_o-768x576.jpg 768w, https://blog.richliu.com/wp-content/uploads/2008/12/dsc00859_3127673032_o.jpg 2048w" sizes="(max-width: 620px) 100vw, 620px" /></a></p>
<p>因為手上有 ETM 的 ARM11 Demoboard 都在使用中, 所以 Realview Trace 就先收起來了.<br />
根據在國內廠商接觸的經驗, 買 ARM Realview ICE 的應該很多, 會買到 Realview Trace 的應該就很少了<br />
IC Design House 如果不是做 ARM11 以上的高階產品, 要包 ETM, 用不到 RealView Trace.<br />
系統廠買到的機會還比較高, 因為案子可能會用 ARM11, 然後像 Qualcomm 可能就會包 ETM<br />
進系統. 這時系統廠整合的時候有機會用到 Realview Trace.<br />
但是系統廠 cost down 的很嚴重, 所以最多也只會買到 Realview ICE.<br />
目前我想得到的公司應該只有 Faraday Technology (智原), 他們有 ARM CPU 的 IP</p>
<p>如果你知道還有那一家公司還有買 Realview Trace, 要告訴我們, 讓大家拜一下 <img src="https://s.w.org/images/core/emoji/15.0.3/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>後記: 其實我的開箱文沒有辦法寫得金光閃閃, 瑞氣千條, 開箱之後產品會發光, 我都是有圖就好, 大家多包涵了.</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2008/12/22/665/arm-realview-ice-realview-trace-%e9%96%8b%e7%ae%b1%e6%96%87/">ARM RealView ICE, RealView Trace 開箱文</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.richliu.com/2008/12/22/665/arm-realview-ice-realview-trace-%e9%96%8b%e7%ae%b1%e6%96%87/feed/</wfw:commentRss>
			<slash:comments>8</slash:comments>
		
		
			</item>
		<item>
		<title>[新聞][想法] Ubuntu announces ARM port</title>
		<link>https://blog.richliu.com/2008/11/21/648/%e6%96%b0%e8%81%9e%e6%83%b3%e6%b3%95-ubuntu-announces-arm-port/</link>
					<comments>https://blog.richliu.com/2008/11/21/648/%e6%96%b0%e8%81%9e%e6%83%b3%e6%b3%95-ubuntu-announces-arm-port/#comments</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Fri, 21 Nov 2008 08:03:30 +0000</pubDate>
				<category><![CDATA[Embedded]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[arm]]></category>
		<category><![CDATA[netbook]]></category>
		<category><![CDATA[ubuntu]]></category>
		<guid isPermaLink="false">http://blog.richliu.com/?p=648</guid>

					<description><![CDATA[<p>原文在 http://linuxdevices.com/news/NS9527593286.html 節錄如下 [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2008/11/21/648/%e6%96%b0%e8%81%9e%e6%83%b3%e6%b3%95-ubuntu-announces-arm-port/">[新聞][想法] Ubuntu announces ARM port</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>原文在 http://linuxdevices.com/news/NS9527593286.html<br />
節錄如下:</p>
<blockquote><p><span style="font-size: small; font-family: Arial,Helvetica;">Canonical announced it will port Ubuntu Desktop Linux to the ARMv7 architecture. Targeted at netbooks, the Ubuntu ARM distribution could set the stage for Intel to lose the &#8220;software advantage&#8221; that has enabled x86 to shrug off attacks from other architectures for the last 30 years.</span></p></blockquote>
<p>沒有想到 ARM netbook 來的這麼快, OLPC 的構想, eeePC 的成功, 到現在 Linux Desktop 可以殺出重圍, 在 Windows XP 的環境下, 取得些許市佔率, 靠 netbook 取得一席之地, 這是眾人並未預期的.</p>
<p>ARMv7 架構的 Cortex-A 系列 CPU 應該是可以達到 netbook 低標的 CPU , 有著可以接受的效能, 可以接受的 NEON(MMX like) 的 SIMD 系統, 用軟體可以撥 HD 影片. 而眾家 2D/3D Engine 其實也很成熟了, 所以從市場的角度看. Netbook 的出現其實是讓 Embedded System 往上去吃原本 Desktop 的市場. ARM 選擇 Canonical 的 ubuntu 應該是看上市佔率高, Desktop 整合度高. 雖然 Debian 早就有 ARM 套件, 但是商業運作上還是不如 Canonical , Desktop 整合度看起來也不夠好.</p>
<p>Ubuntu ARM 版本會基於 Cortex-A 系列 CPU 發行, 未來會考慮 ARMv6(ARM11 系列), ARMv5(ARM9 系列)指令集. 不過我想應該 Cortex 弄完了以後, 其他平台並不是太大的問題.</p>
<p>這一塊並不是 Microsoft 不想染指, 而是心有餘而力不足. MCE 的出現不就是 Microsoft 進入客廳的試腳石, 除了高級用戶外, 似乎並沒有看到 MCE 在太多家庭出現. 至少我去別人家沒有看過, 我自己家也沒有, 說不定明年發消費券之後, 我會考慮去弄一台 MCE + HTPC 弄個可以播的系統出來. 我現在的客廳的電腦播 H.264 有點吃力(Pentium4 2.0G). 但是接下來能, Microsoft 能用 Windows CE 去吃這一塊嗎? 至少目前沒有看到這樣的可能性.</p>
<p>我在想, 如果未來 ubuntu 堪用以後, 是不是 Linux Desktop 會大大方方的走入 Home Digital 的市場<br />
像是 MID 手持系統, 或是 Tivo 這種錄影機, 甚至是 BT Download, 結合 bt movie download, 也有可能開拓隨選即播的市場.</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2008/11/21/648/%e6%96%b0%e8%81%9e%e6%83%b3%e6%b3%95-ubuntu-announces-arm-port/">[新聞][想法] Ubuntu announces ARM port</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.richliu.com/2008/11/21/648/%e6%96%b0%e8%81%9e%e6%83%b3%e6%b3%95-ubuntu-announces-arm-port/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>[新聞][想法] Google 瀏覽器引擎可在 ARM 平台執行.</title>
		<link>https://blog.richliu.com/2008/10/30/623/%e6%96%b0%e8%81%9e%e6%83%b3%e6%b3%95-google-%e7%80%8f%e8%a6%bd%e5%99%a8%e5%bc%95%e6%93%8e%e5%8f%af%e5%9c%a8-arm-%e5%b9%b3%e5%8f%b0%e5%9f%b7%e8%a1%8c/</link>
					<comments>https://blog.richliu.com/2008/10/30/623/%e6%96%b0%e8%81%9e%e6%83%b3%e6%b3%95-google-%e7%80%8f%e8%a6%bd%e5%99%a8%e5%bc%95%e6%93%8e%e5%8f%af%e5%9c%a8-arm-%e5%b9%b3%e5%8f%b0%e5%9f%b7%e8%a1%8c/#comments</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Thu, 30 Oct 2008 03:30:12 +0000</pubDate>
				<category><![CDATA[Embedded]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[arm]]></category>
		<category><![CDATA[Google]]></category>
		<guid isPermaLink="false">http://blog.richliu.com/?p=623</guid>

					<description><![CDATA[<p>原文在 EETIME Google&#8217;s browser engine running on ARM [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2008/10/30/623/%e6%96%b0%e8%81%9e%e6%83%b3%e6%b3%95-google-%e7%80%8f%e8%a6%bd%e5%99%a8%e5%bc%95%e6%93%8e%e5%8f%af%e5%9c%a8-arm-%e5%b9%b3%e5%8f%b0%e5%9f%b7%e8%a1%8c/">[新聞][想法] Google 瀏覽器引擎可在 ARM 平台執行.</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><a title="Google Chrome (by richliu(有錢劉))" href="http://flickr.com/photos/richliu_tw/2985326335/" target="_blank" rel="noopener"><img loading="lazy" decoding="async" class="alignleft" title="Google Chrome (by richliu(有錢劉))" src="http://farm4.static.flickr.com/3002/2985326335_130684fcdd_m.jpg" alt="Google Chrome (by richliu(有錢劉))" width="125" height="144" /></a>原文在 EETIME <a href="http://www.eetimes.com/showArticle.jhtml?articleID=210300117" target="_blank" rel="noopener"><span class="storyheadline">Google&#8217;s browser engine running on ARM</span></a></p>
<p>節錄內文如下</p>
<blockquote><p>Google has ported a core part of its new browser to the ARM processor as well as to the x86. Google co-founder Sergey Brin said all or parts of the new <a href="http://www.google.com/chrome" target="_blank" rel="noopener">Chrome browser</a> could be available for mobile devices such as cellphones within a few months.</p></blockquote>
<p>個人的想法是, 果然 Google Browser 是想取代 OS 做成桌面平台, 目前 Mobile Phone 幾乎都是 ARM chip 的天下, 現在<span style="color: #0000ff;">連桌機(Desktop Mobile Phone)都有可能用 ARM, 以後還有 MID, 低價 NetBook</span> . 等等..<br />
拉回來看, 至少 iPhone 內用的是 ARM11 620Mhz 的 CPU. 別忘了還有 Android 哦. PC 市場打不過 Microsoft , 但是 Embedded 市場就難說, 至少 Embedded System 的市場非 Microsoft 還是佔大宗, 主要還是價格因素.</p>
<p>延續之前的話題, 為什麼不是 Wintel 的組合呢? 在 Embedded System 的市場, 價格決定一切呀, Wintel 平台我猜光 License + Hardware 目標價在 US$40. ARM 平台大概是 US$20. 雖然效能不如 ATOM, 但是從手機的評價看起來, ARM 平台不會差到那邊去, 但是價格只有一半, 或是更低.</p>
<p>不過大家看了這麼久, 會有一個問題, 為什麼不是 MIPS 呢? 話說 MIPS 這家公司似乎營運不太好. ARM 還是大宗, 所以 Porting 本來就是要找市佔率大的呀..</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2008/10/30/623/%e6%96%b0%e8%81%9e%e6%83%b3%e6%b3%95-google-%e7%80%8f%e8%a6%bd%e5%99%a8%e5%bc%95%e6%93%8e%e5%8f%af%e5%9c%a8-arm-%e5%b9%b3%e5%8f%b0%e5%9f%b7%e8%a1%8c/">[新聞][想法] Google 瀏覽器引擎可在 ARM 平台執行.</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.richliu.com/2008/10/30/623/%e6%96%b0%e8%81%9e%e6%83%b3%e6%b3%95-google-%e7%80%8f%e8%a6%bd%e5%99%a8%e5%bc%95%e6%93%8e%e5%8f%af%e5%9c%a8-arm-%e5%b9%b3%e5%8f%b0%e5%9f%b7%e8%a1%8c/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title>[新聞][想法] ARM想進入迷你筆電市場</title>
		<link>https://blog.richliu.com/2008/10/16/609/%e6%96%b0%e8%81%9e%e6%83%b3%e6%b3%95-arm%e6%83%b3%e9%80%b2%e5%85%a5%e8%bf%b7%e4%bd%a0%e7%ad%86%e9%9b%bb%e5%b8%82%e5%a0%b4/</link>
					<comments>https://blog.richliu.com/2008/10/16/609/%e6%96%b0%e8%81%9e%e6%83%b3%e6%b3%95-arm%e6%83%b3%e9%80%b2%e5%85%a5%e8%bf%b7%e4%bd%a0%e7%ad%86%e9%9b%bb%e5%b8%82%e5%a0%b4/#comments</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Thu, 16 Oct 2008 06:56:56 +0000</pubDate>
				<category><![CDATA[Embedded]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[工作]]></category>
		<category><![CDATA[arm]]></category>
		<category><![CDATA[netbook]]></category>
		<category><![CDATA[zdnet]]></category>
		<category><![CDATA[新聞]]></category>
		<guid isPermaLink="false">http://blog.richliu.com/2008/10/16/609/</guid>

					<description><![CDATA[<p>其實進入 Netbook 這個市場, 對 ARM 來說應該不是這麼難, 現在 ARM CPU 的 Perfor [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2008/10/16/609/%e6%96%b0%e8%81%9e%e6%83%b3%e6%b3%95-arm%e6%83%b3%e9%80%b2%e5%85%a5%e8%bf%b7%e4%bd%a0%e7%ad%86%e9%9b%bb%e5%b8%82%e5%a0%b4/">[新聞][想法] ARM想進入迷你筆電市場</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p> 其實進入 Netbook 這個市場, 對 ARM 來說應該不是這麼難, 現在 ARM CPU 的 Performance 不比當年了, 重點是價格相對於ATOM 的系統會便宜很多.<br />
搭配 ARM 的公司幾乎都是做 SoC. 成本還比 ATOM 低.<br />
至於效能嘛, 當然還是差了一點, 不過買 Netbook 的人會很在意效能嗎?</p>
<p>以目前我們在規劃的產品來說, ARM11 MPCore, PCIe, SATA, Gigabit Nic , LCD Control, 2D/3D 加速引擊, 己經具備了低階 Netbook 所需的元素, 問題就在於, 怎麼樣整合 Linux 進來用.  要和誰合作?</p>
<p>而市場目標是什麼, 投票用 Linux, 教學用, 還是家用多媒體環境呢?<br />
像 ARM 都是客制化市場, 或許出可以放 FullHD 的類 eeeBox 也不是不可能.<br />
而成本還更低, 因為內建 H.264 decoder engine.</p>
<p>至於 ARM 和 Microsoft 合作執行 Windows XP, 我個人則是認為這還要一段時間, 畢竟不僅僅是換 CPU 而己, 很多 Driver , 人員訓練, SoC 的選用, 都是問題. 不像是 Linux, 只要是有 ARM solution, 幾乎都有 Linux 的 driver, 差別就在有沒有整合進 Linux kernel main tree 和 open source 了.</p>
<p>問題還是在於, 市場對於這樣產品的接受度如何? 畢竟搭載龍芯(Dragon)的 Netbook 早就現身了, 但是一直都沒有大賣的訊息出來. 到底是從 Dragon MIPs CPU 的效能太差呢? 還是整合的 Linux Package 不實用? 這些都是 ARM 進入這個市場需要面對的.</p>
<p>不過我個人是樂觀其成, 畢竟 PC 市場己經非效能導向, 而是從高階到低階都有市場, 說不定下一次就是我們家的產品跟著上, 運氣好的話說不定會有我們家產品做的 Netbook :p</p>
<p>原文節錄如下.</p>
<p><span id="more-609"></span></p>
<p><a href="http://www.zdnet.com.tw/news/ce/0,2000085674,20132477,00.htm?feed=RSS:+CNET%A5x%C6W+-+%B3%CC%B7s20%ABh%B7s%BBD" target="_blank" rel="noopener">ARM想進入迷你筆電市場</a></p>
<p><cite>ZDNET新聞專區：曠文溱</cite> <cite>2008/10/15 22:26:02</cite></p>
<p>明（09）年的Computex展，就會看到數款搭載ARM架構處理器的迷你筆電（Netbook），該公司高層指出。</p>
<p>搶在IDF即將於下週一（10/20）在台北舉辦之前，近年來因為英特爾宣佈行動網路裝置（MID）計畫，而有點懷恨在心的ARM，今（15）日在台宣佈即將攻進英特爾已經開花結果的Netbook。</p>
<p>該公司表示從去（07）年中的Computex，ARM就積極與ODM/OEM大廠，以及軟體業者洽談，進行產品的相容性測試，成果即將在明年揭曉。</p>
<p>「ARM的陣容龐大（指合作伙伴數），勢必具有成本優勢；單晶片設計可以增加電池續航力；在高畫質影音表現上遠勝過英特爾的Atom，」ARM行動運算總監Bob Morris洋洋灑灑列出該公司的勝出點。</p>
<p>不 過，<font color="#ff0000">軟體支援性恐怕會是ARM的痛腳之一</font>。Netbook和手持裝置的使用行為終究不一樣，消費者要的是和在電腦上不無二致的使用經驗。雖然在手機市場獨 占鼇頭多年，但是能否把所有在電腦上運行的軟體搬移到ARM架構上，舉例而言，微軟的Windows XP作業系統，就是ARM必須要準備的功夫。</p>
<p><font color="#ff0000">「ARM和微軟持續合作，」Morris說，「不過，還無法肯定支援Windows XP的ARM架構Netbook什麼時候會推出市場。」該公司初期將以Linux為主要支援對象。</font></p>
<p>原 本井水不犯河水的英特爾和ARM，從去年開始即開始產生市場互相侵輒的景況。起自於英特爾在去年秋季IDF上，宣佈新一代MID平台將採用一款名為 Silverthorne的晶片。暗批傳統採用ARM晶片的手機在連網時總讓使用者受挫，表將以運算性能更為強大、也有更多軟體支援的x86處理器進軍手 持裝置市場。</p>
<p>英特爾一放話，立刻惹惱過去並未大肆宣傳，一向隱身在所有手機之內的ARM。ARM反唇相譏搭載英特爾處理器的UMPC或者MID，不過就是規格比較爛的電腦。</p>
<p>「ARM不會特別要劃出一個市場、歸類一個產品類別叫做MID，ARM是要讓手持裝置擁有連網能力，」Morris說。</p>
<p>MID不過是第一波戰火。眼看Netbook市場已成為筆記型電腦市場主要成長動能，ARM也躍躍欲試。雖然該公司尚無法揭露合作伙伴，但已表現信心滿滿。</p>
<p>Morris引用研究機構ABI Research的數據，指出從明年至2013年全球Netbook市場，採用ARM架構的系統出貨量，將從393萬台成長至2366萬台；於此同時，x86架構的平台出貨量，由1062萬台增長至3550萬台。</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2008/10/16/609/%e6%96%b0%e8%81%9e%e6%83%b3%e6%b3%95-arm%e6%83%b3%e9%80%b2%e5%85%a5%e8%bf%b7%e4%bd%a0%e7%ad%86%e9%9b%bb%e5%b8%82%e5%a0%b4/">[新聞][想法] ARM想進入迷你筆電市場</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.richliu.com/2008/10/16/609/%e6%96%b0%e8%81%9e%e6%83%b3%e6%b3%95-arm%e6%83%b3%e9%80%b2%e5%85%a5%e8%bf%b7%e4%bd%a0%e7%ad%86%e9%9b%bb%e5%b8%82%e5%a0%b4/feed/</wfw:commentRss>
			<slash:comments>7</slash:comments>
		
		
			</item>
		<item>
		<title>Trace32 在 Ubuntu 上執行的問題</title>
		<link>https://blog.richliu.com/2008/04/07/581/trace32-%e5%9c%a8-ubuntu-%e4%b8%8a%e5%9f%b7%e8%a1%8c%e7%9a%84%e5%95%8f%e9%a1%8c/</link>
					<comments>https://blog.richliu.com/2008/04/07/581/trace32-%e5%9c%a8-ubuntu-%e4%b8%8a%e5%9f%b7%e8%a1%8c%e7%9a%84%e5%95%8f%e9%a1%8c/#comments</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Mon, 07 Apr 2008 06:43:19 +0000</pubDate>
				<category><![CDATA[Embedded]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[UNIX]]></category>
		<category><![CDATA[Trace32]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[usb]]></category>
		<guid isPermaLink="false">http://blog.richliu.com/2008/04/07/581/</guid>

					<description><![CDATA[<p>Trace32 在 ubuntu 上會抓不到 USB device, 在 Gentoo 上並沒有這樣的問題.  [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2008/04/07/581/trace32-%e5%9c%a8-ubuntu-%e4%b8%8a%e5%9f%b7%e8%a1%8c%e7%9a%84%e5%95%8f%e9%a1%8c/">Trace32 在 Ubuntu 上執行的問題</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Trace32 在 ubuntu 上會抓不到 USB device, 在 Gentoo 上並沒有這樣的問題.<br />
這是因為 ubuntu USB device 預設不會建立相容目錄 /proc/bus/usb .</p>
<p>這時候就要修改 /etc/init.d/mountdevsubfs.sh , 找到<br />
[TEXT]<br />
#<br />
# Magic to make /proc/bus/usb work<br />
#<br />
mkdir -p /dev/bus/usb/.usbfs<br />
domount usbfs &#8220;&#8221; /dev/bus/usb/.usbfs -obusmode=0700,devmode=0600,listmode=0644<br />
ln -s .usbfs/devices /dev/bus/usb/devices<br />
mount &#8211;rbind /dev/bus/usb /proc/bus/usb<br />
[/TEXT]<br />
將最後四行的 &#8220;#&#8221; unmark 掉.</p>
<p>然後建立 system group 給 usb 的使用者<br />
sudo addgroup &#8211;system usbusers<br />
# Output  GID 128</p>
<p># 加入 USER  到 usbusers 群組.<br />
sudo adduser $USER usbusers</p>
<p># 修改 /etc/fstab:<br />
sudo vim /etc/fstab</p>
<p># 加上這一行.<br />
# 128 是&#8221;usbusers&#8221; 的 GID<br />
none /proc/bus/usb usbfs devgid=128,devmode=664 0 0</p>
<p>重開機之後, 執行 t32usbchecker , 大功告成</p>
<blockquote><p># ./t32usbchecker</p>
<p>Trace32 simple USB Checker</p>
<p>Checking /proc/bus/usb/001/001 &#8230; not useable<br />
Checking /proc/bus/usb/001/004 &#8230; not useable<br />
Checking /proc/bus/usb/001/005 &#8230; not useable<br />
Checking /proc/bus/usb/001/006 &#8230; not useable<br />
Checking /proc/bus/usb/001/007 &#8230; not useable<br />
Checking /proc/bus/usb/002/001 &#8230; not useable<br />
Checking /proc/bus/usb/003/001 &#8230; not useable<br />
Checking /proc/bus/usb/004/001 &#8230; not useable<br />
Checking /proc/bus/usb/004/003 &#8230; useable</p>
<p>Checking USB communication with /proc/bus/usb/004/003 &#8230;<br />
Resetting Trace32&#8230;</p>
<p>USB communication OK.</p></blockquote>
<p>其他如果有需要用到 /proc/bus/usb 的程式也可以用這種解法, 例如 VirtualBox </p>
<p>Ref.<br />
<a href="https://bugs.launchpad.net/ubuntu/gutsy/+source/kvm/+bug/156085" target="_blank" rel="noopener">Bug #156085 in kvm (Ubuntu Gutsy) Could not open /proc/bus/usb/devices</a></p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2008/04/07/581/trace32-%e5%9c%a8-ubuntu-%e4%b8%8a%e5%9f%b7%e8%a1%8c%e7%9a%84%e5%95%8f%e9%a1%8c/">Trace32 在 Ubuntu 上執行的問題</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.richliu.com/2008/04/07/581/trace32-%e5%9c%a8-ubuntu-%e4%b8%8a%e5%9f%b7%e8%a1%8c%e7%9a%84%e5%95%8f%e9%a1%8c/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Wii 上也可以執行 Linux 了.</title>
		<link>https://blog.richliu.com/2008/02/27/561/wii-%e4%b8%8a%e4%b9%9f%e5%8f%af%e4%bb%a5%e5%9f%b7%e8%a1%8c-linux-%e4%ba%86/</link>
					<comments>https://blog.richliu.com/2008/02/27/561/wii-%e4%b8%8a%e4%b9%9f%e5%8f%af%e4%bb%a5%e5%9f%b7%e8%a1%8c-linux-%e4%ba%86/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Tue, 26 Feb 2008 16:55:01 +0000</pubDate>
				<category><![CDATA[Embedded]]></category>
		<category><![CDATA[GAME]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Wii]]></category>
		<guid isPermaLink="false">http://blog.richliu.com/2008/02/27/561/</guid>

					<description><![CDATA[<p>Digg 報導, Wii 上己經可以執行 Linux 了. 目前是提供 Linux kernel 2.6.24 [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2008/02/27/561/wii-%e4%b8%8a%e4%b9%9f%e5%8f%af%e4%bb%a5%e5%9f%b7%e8%a1%8c-linux-%e4%ba%86/">Wii 上也可以執行 Linux 了.</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><a href="http://digg.com/linux_unix/Linux_runs_natively_on_the_Wii" target="_blank" rel="noopener">Digg</a> 報導, Wii 上己經可以執行 Linux 了.</p>
<p>目前是提供 Linux kernel 2.6.24 的 <a href="http://downloads.sourceforge.net/gc-linux/linux-2.6.24-gc.patch.gz" target="_blank" rel="noopener">patch</a>. 而這是使用  <a href="http://www.usbgecko.com/faq.htm" class="external" title="http://www.usbgecko.com/faq.htm" target="_blank" rel="noopener">USB Gecko</a> 的成果.<br />
不過如果連 USB Gecko 都出來了, Linux support Wii 只是早晚的事情吧 XD</p>
<p>謎之音 : 不知道這個 USB Gecko可不可以拿來當金手指.</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2008/02/27/561/wii-%e4%b8%8a%e4%b9%9f%e5%8f%af%e4%bb%a5%e5%9f%b7%e8%a1%8c-linux-%e4%ba%86/">Wii 上也可以執行 Linux 了.</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.richliu.com/2008/02/27/561/wii-%e4%b8%8a%e4%b9%9f%e5%8f%af%e4%bb%a5%e5%9f%b7%e8%a1%8c-linux-%e4%ba%86/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
