
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>esWizardry</title>
    <description>More on embedded system, programming, android, technology, thought and fascinating things.
</description>
    <link>http://eswizardry.com/</link>
    <atom:link href="http://eswizardry.com/feed.xml" rel="self" type="application/rss+xml"/>
    <pubDate>Mon, 01 Jul 2024 10:44:21 +0000</pubDate>
    <lastBuildDate>Mon, 01 Jul 2024 10:44:21 +0000</lastBuildDate>
    <generator>Jekyll v3.9.5</generator>
    
      <item>
        <title>TDD for Embedded C using Ceedling with MSP430</title>
        <description>&lt;p&gt;&lt;a href=&quot;/2015/09/14/tdd-with-ceedling-msp430/&quot;&gt;&lt;img src=&quot;/assets/try-tdd-msp430/tdd-circle-of-life.jpg&quot; /&gt;&lt;/a&gt;
&lt;!--more--&gt;&lt;/p&gt;

&lt;p&gt;หลังจากที่ก่อนหน้านี้ได้ลอง TDD บน MSP430 โดยใช้ ASSERT มาโครแบบง่ายๆ กันไปแล้ววันนี้จะมาแนะนำ framework ตัวหนึ่งที่หน้าสนใจสำหรับใช้ในการพัฒนาแบบ TDD และถึงแม้ว่าจะไม่ได้พัฒนาโดยใช้ TDD ก็ยังสามารถใช้ framework ตัวนี้ในการสร้าง Unit test ได้สำหรับทดสอบโค้ดหรือแม้แต่ใช้เป็น  build tool ก็ได้เช่นกัน&lt;/p&gt;

&lt;p&gt;##&lt;a href=&quot;http://www.throwtheswitch.org/ceedling/&quot;&gt;CEEDLING&lt;/a&gt; คืออะไร?
Ceedling เป็นเครื่งมือที่ช่วยในการ build โปรเจ็คของภาษา C ซึ่งใช้ rake (make ไฟล์ของภาษา Ruby) เป็นตัว build โดย Ceedling จะรวบรวมเครื่องมือที่จำเป็นสำหรับการพัฒนาซอฟแวร์ตามแบบ TDD มารวมกันเพื่อความสะดวกและง่ายในการใช้งาน โดยประกอบไปด้วย Unity (unit test framework), CMock (mock up generator สำหรับภาษา C) และ CException (Exeption handler สำหรับภาษา C)&lt;/p&gt;

&lt;p&gt;##เตรียมความพร้อม
ก่อนจะไปต่อขอให้ติดตั้ง Ceedling ตามลิงค์ข้างล่างนี้ก่อนครับ
&lt;a href=&quot;http://www.throwtheswitch.org/ceedling/&quot;&gt;http://www.throwtheswitch.org/ceedling/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;##มาลองใช้งานกันเลย
หลังจากติดตั้ง &lt;a href=&quot;http://www.throwtheswitch.org/ceedling/&quot;&gt;CEEDLING&lt;/a&gt;  เสร็จแล้วก็ให้เปิด terminal ขึ้นมาแล้ว cd ไปที่ฟลเดอร์ที่เราจะใช้ทำงานแล้วก็ป้อนคำสั่ง &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ceedling example temp_sensor&lt;/code&gt; เพื่อลองเล่นกับตัวอย่างกันก่อนโดย &lt;a href=&quot;http://www.throwtheswitch.org/ceedling/&quot;&gt;CEEDLING&lt;/a&gt; จะทำการสร้างตัวอย่างขึ้นมาแล้วได้เอาต์พุตตามนี้&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;eswizardry@eswizardry-PC/d/Documents/temp_sensor
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;ceedling example temp_sensor
      create  temp_sensor/vendor/ceedling/docs/CeedlingPacket.pdf
      create  temp_sensor/vendor/ceedling/docs/CExceptionSummary.pdf
      create  temp_sensor/vendor/ceedling/docs/CMock Summary.pdf
      create  temp_sensor/vendor/ceedling/docs/Unity Summary.pdf
      create  temp_sensor/vendor/ceedling/plugins
      create  temp_sensor/vendor/ceedling/plugins/bullseye/assets/template.erb
      create  temp_sensor/vendor/ceedling/plugins/bullseye/bullseye.rake
      create  temp_sensor/vendor/ceedling/plugins/bullseye/config/defaults.yml
      create  temp_sensor/vendor/ceedling/plugins/bullseye/lib/bullseye.rb
................................
Example project &lt;span class=&quot;s1&quot;&gt;'temp_sensor'&lt;/span&gt; created!
 - Tool documentation is located &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;vendor/ceedling/docs
 - Execute &lt;span class=&quot;s1&quot;&gt;'rake -T'&lt;/span&gt; to view available &lt;span class=&quot;nb&quot;&gt;test&lt;/span&gt; &amp;amp; build tasks&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;จากนั้นให้ cd เข้าไปที่โฟลเดอร์ที่ ceedling สร้างขึ้น
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cd temp_sensor&lt;/code&gt;
แล้วก็สั่งรันคำสั่ง &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rake -T&lt;/code&gt; เพื่อที่จะดูว่าเราสามารถทำอะไรกับโปรเจ็คนี้ได้บ้าง&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;eswizardry@eswizardry-PC/d/Documents/temp_sensor
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;temp_sensor/

eswizardry@eswizardry-PC/d/Documents/temp_sensor
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;rake &lt;span class=&quot;nt&quot;&gt;-T&lt;/span&gt;
rake clean                &lt;span class=&quot;c&quot;&gt;# Delete all build artifacts and temporary products&lt;/span&gt;
rake clobber              &lt;span class=&quot;c&quot;&gt;# Delete all generated files (and build artifacts)&lt;/span&gt;
rake environment          &lt;span class=&quot;c&quot;&gt;# List all configured environment variables&lt;/span&gt;
rake files:header         &lt;span class=&quot;c&quot;&gt;# List all collected header files&lt;/span&gt;
rake files:source         &lt;span class=&quot;c&quot;&gt;# List all collected source files&lt;/span&gt;
rake files:test           &lt;span class=&quot;c&quot;&gt;# List all collected test files&lt;/span&gt;
rake logging              &lt;span class=&quot;c&quot;&gt;# Enable logging&lt;/span&gt;
rake paths:source         &lt;span class=&quot;c&quot;&gt;# List all collected source paths&lt;/span&gt;
rake paths:support        &lt;span class=&quot;c&quot;&gt;# List all collected support paths&lt;/span&gt;
rake paths:test           &lt;span class=&quot;c&quot;&gt;# List all collected test paths&lt;/span&gt;
rake summary              &lt;span class=&quot;c&quot;&gt;# Execute plugin result summaries (no build trigg...&lt;/span&gt;
rake &lt;span class=&quot;nb&quot;&gt;test&lt;/span&gt;:&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;               &lt;span class=&quot;c&quot;&gt;# Run single test ([*] real test or source file n...&lt;/span&gt;
rake &lt;span class=&quot;nb&quot;&gt;test&lt;/span&gt;:all             &lt;span class=&quot;c&quot;&gt;# Run all unit tests&lt;/span&gt;
rake &lt;span class=&quot;nb&quot;&gt;test&lt;/span&gt;:delta           &lt;span class=&quot;c&quot;&gt;# Run tests for changed files&lt;/span&gt;
rake &lt;span class=&quot;nb&quot;&gt;test&lt;/span&gt;:path[dir]       &lt;span class=&quot;c&quot;&gt;# Run tests whose test path contains [dir] or [di...&lt;/span&gt;
rake &lt;span class=&quot;nb&quot;&gt;test&lt;/span&gt;:pattern[regex]  &lt;span class=&quot;c&quot;&gt;# Run tests by matching regular expression pattern&lt;/span&gt;
rake verbosity[level]     &lt;span class=&quot;c&quot;&gt;# Set verbose output (silent:[0] - obnoxious:[4])&lt;/span&gt;
rake version              &lt;span class=&quot;c&quot;&gt;# Display build environment version info&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;จากนั้นลองคำสั่ง &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rake test:all&lt;/code&gt; เพื่อทดสอบการทดสอบทั้งหมด&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;eswizardry@eswizardry-PC/d/Documents/temp_sensor
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;rake &lt;span class=&quot;nb&quot;&gt;test&lt;/span&gt;:all


Test &lt;span class=&quot;s1&quot;&gt;'TestAdcConductor.c'&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;-------------------------&lt;/span&gt;
Creating mock &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;AdcModel...
...

Test &lt;span class=&quot;s1&quot;&gt;'TestAdcHardware.c'&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;------------------------&lt;/span&gt;
Creating mock &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;AdcHardwareConfigurator...
...

Test &lt;span class=&quot;s1&quot;&gt;'TestAdcModel.c'&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;---------------------&lt;/span&gt;
Creating mock &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;TaskScheduler...
...

Test &lt;span class=&quot;s1&quot;&gt;'TestExecutor.c'&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;---------------------&lt;/span&gt;
Creating mock &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;Model...
...


Test &lt;span class=&quot;s1&quot;&gt;'TestMain.c'&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;-----------------&lt;/span&gt;
Creating mock &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;Executor...
Generating runner &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;TestMain.c...
Compiling TestMain_runner.c...
Compiling TestMain.c...
Compiling MockExecutor.c...
Compiling Main.c...
Linking TestMain.out...
build/test/out/Main.o: In &lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;main&lt;span class=&quot;s1&quot;&gt;':
d:\Documents\temp_sensor/src/Main.c:43: multiple definition of `main'&lt;/span&gt;
build/test/out/TestMain_runner.o:d:&lt;span class=&quot;se&quot;&gt;\D&lt;/span&gt;ocuments&lt;span class=&quot;se&quot;&gt;\t&lt;/span&gt;emp_sensor/build/test/runners/Tes
tMain_runner.c:72: first defined here
collect2.exe: error: ld returned 1 &lt;span class=&quot;nb&quot;&gt;exit &lt;/span&gt;status
ERROR: Shell &lt;span class=&quot;nb&quot;&gt;command &lt;/span&gt;failed.
&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; Shell executed &lt;span class=&quot;nb&quot;&gt;command&lt;/span&gt;:
&lt;span class=&quot;s1&quot;&gt;'gcc.exe &quot;build/test/out/TestMain_runner.o&quot; &quot;build/test/out/TestMain.o&quot; &quot;build/t
est/out/MockExecutor.o&quot; &quot;build/test/out/unity.o&quot; &quot;build/test/out/Main.o&quot; &quot;build/
test/out/cmock.o&quot; -o &quot;build/test/out/TestMain.out&quot; -lm'&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; And exited with status: &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;1].
...

&lt;span class=&quot;nt&quot;&gt;-----------&lt;/span&gt;
TEST OUTPUT
&lt;span class=&quot;nt&quot;&gt;-----------&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;TestAdcConductor.c]
  - &lt;span class=&quot;s2&quot;&gt;&quot;&quot;&lt;/span&gt;

&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;TestAdcHardware.c]
  - &lt;span class=&quot;s2&quot;&gt;&quot;&quot;&lt;/span&gt;

&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;TestAdcModel.c]
  - &lt;span class=&quot;s2&quot;&gt;&quot;&quot;&lt;/span&gt;

&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;TestExecutor.c]
  - &lt;span class=&quot;s2&quot;&gt;&quot;&quot;&lt;/span&gt;

&lt;span class=&quot;nt&quot;&gt;--------------------&lt;/span&gt;
OVERALL TEST SUMMARY
&lt;span class=&quot;nt&quot;&gt;--------------------&lt;/span&gt;
TESTED:  17
PASSED:  17
FAILED:   0
IGNORED:  0&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;ceedling จะทำการ build และสั่งรันการทดสอบทั้งหมดและแจ้งผลการทดสอบตามเอาต์พุตด้านบน&lt;/p&gt;

&lt;p&gt;##มาสร้างโปรเจ็คใหม่ด้วย Ceedling กัน
หลังจากลองทดสอบกับตัวอย่างกันไปแล้วทีนี้เรามาสร้างโปรเจ็คใหม่ตั้งแต่เริ่มต้นกันเลย
ขั้นแรกให้ cd ออกจากโปรเจ็คตัวอย่างก่อน &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cd ..&lt;/code&gt; จากนั้นให้ป้อนคำสั่ง &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cd temp_sensor&lt;/code&gt;
ceedling ก็จะทำการสร้างไฟล์ที่จำเป็นสำหรับโปรเจ็คใหม่ของเรา&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;eswizardry@eswizardry-PC/d/Documents/
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;ceedling new try-embedded-tdd
      create  try-embedded-tdd/vendor/ceedling/docs/CeedlingPacket.pdf
      create  try-embedded-tdd/vendor/ceedling/docs/CExceptionSummary.pdf
      create  try-embedded-tdd/vendor/ceedling/docs/CMock Summary.pdf
      create  try-embedded-tdd/vendor/ceedling/docs/Unity Summary.pdf
      create  try-embedded-tdd/vendor/ceedling/plugins
...................................

Project &lt;span class=&quot;s1&quot;&gt;'try-embedded-tdd'&lt;/span&gt; created!
 - Tool documentation is located &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;vendor/ceedling/docs
 - Execute &lt;span class=&quot;s1&quot;&gt;'rake -T'&lt;/span&gt; to view available &lt;span class=&quot;nb&quot;&gt;test&lt;/span&gt; &amp;amp; build tasks&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;หลังจากนั้นก็ cd เข้าไปที่โปรเจ็คที่เราพึ่งสร้างขึ้นมา &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cd try-embedded-tdd/&lt;/code&gt;
ถัดมาก็ป้อนคำสั่ง &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rake module:create[led_driver]&lt;/code&gt;เพื่อสร้างไฟล์หรือโมดูลที่จะใช้ในการพัฒนา งานของเราโดยในที่นี้ผมจะขอยกตัวอย่างการพัฒนา led driver แบบง่ายละกันโดยให้ module นี้ชื่อว่า led_driver
หลังจากป้อนคำสั่ง ceedling ก็จะทำการสร้างไฟล์ &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;led_driver.c&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;led_driver.h&lt;/code&gt; และ ไฟล์ &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;test_led_driver.c&lt;/code&gt; เพื่อเอาไว้พัฒนาและเขียนการทดสอบสำหรับโมดูลที่สร้างขึ้น&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;eswizardry@eswizardry-PC/d/Documents/try-embedded-tdd
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;rake module:create[led_driver]
Generating &lt;span class=&quot;s1&quot;&gt;'led_driver'&lt;/span&gt;...
&lt;span class=&quot;nb&quot;&gt;mkdir&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; ./test/.
&lt;span class=&quot;nb&quot;&gt;mkdir&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; ./src/.
File ./test/./test_led_driver.c created
File ./src/./led_driver.c created
File ./src/./led_driver.h created&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;ทีนี้เราก็มาลองสั่งรันการทดสอบโมดูลที่เราพึ่งสร้างขึ้นมาโดยใช้คำสั่ง
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rake test:all&lt;/code&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;eswizardry@eswizardry-PC/d/Documents/try-embedded-tdd
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;rake &lt;span class=&quot;nb&quot;&gt;test&lt;/span&gt;:all


Test &lt;span class=&quot;s1&quot;&gt;'test_led_driver.c'&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;------------------------&lt;/span&gt;
Generating runner &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;test_led_driver.c...
Compiling test_led_driver_runner.c...
Compiling test_led_driver.c...
Compiling unity.c...
Compiling led_driver.c...
Compiling cmock.c...
Linking test_led_driver.out...
Running test_led_driver.out...

&lt;span class=&quot;nt&quot;&gt;-----------&lt;/span&gt;
TEST OUTPUT
&lt;span class=&quot;nt&quot;&gt;-----------&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;test_led_driver.c]
  - &lt;span class=&quot;s2&quot;&gt;&quot;&quot;&lt;/span&gt;

&lt;span class=&quot;nt&quot;&gt;--------------------&lt;/span&gt;
IGNORED TEST SUMMARY
&lt;span class=&quot;nt&quot;&gt;--------------------&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;test_led_driver.c]
  Test: test_module_generator_needs_to_be_implemented
  At line &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;14&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;Implement me!&quot;&lt;/span&gt;

&lt;span class=&quot;nt&quot;&gt;--------------------&lt;/span&gt;
OVERALL TEST SUMMARY
&lt;span class=&quot;nt&quot;&gt;--------------------&lt;/span&gt;
TESTED:  1
PASSED:  0
FAILED:  0
IGNORED: 1&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;โดยผลทดสอบที่ได้จะเห็นว่าไม่มีการทดสอบเกิดขึ้นเพราะเรายังไม่ได้สร้างการทดสอบใดๆ เลยยกเว้นการทดสอบที่ ceedling สร้างขึ้นโดยอัตโนมัติ และใส่สถานะว่าให้ทำการข้ามการทดสอบนี้ไว้และมีการเจ้งเตือนรายละเอียดไว้ที่ดังนี้&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;nt&quot;&gt;--------------------&lt;/span&gt;
IGNORED TEST SUMMARY
&lt;span class=&quot;nt&quot;&gt;--------------------&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;test_led_driver.c]
  Test: test_module_generator_needs_to_be_implemented
  At line &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;14&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;Implement me!&quot;&lt;/span&gt;

&lt;span class=&quot;nt&quot;&gt;--------------------&lt;/span&gt;
OVERALL TEST SUMMARY
&lt;span class=&quot;nt&quot;&gt;--------------------&lt;/span&gt;
TESTED:  1
PASSED:  0
FAILED:  0
IGNORED: 1&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;โดยถ้าเราไปเปิดไฟล์ &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;test_led_drive.c&lt;/code&gt; ดูก็จะพบกับโค้ดที่ ceedling สร้างขึ้นดังนี้&lt;/p&gt;

&lt;p&gt;###test_led_driver.c&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-c&quot; data-lang=&quot;c&quot;&gt;&lt;span class=&quot;cp&quot;&gt;#include&lt;/span&gt; &lt;span class=&quot;cpf&quot;&gt;&quot;unity.h&quot;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;
#include&lt;/span&gt; &lt;span class=&quot;cpf&quot;&gt;&quot;led_driver.h&quot;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;
&lt;/span&gt;
&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;setUp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;tearDown&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;test_module_generator_needs_to_be_implemented&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;TEST_IGNORE_MESSAGE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Implement me!&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;ต่อไปก็แก้ไขไฟล์ &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;test_led_driver.c&lt;/code&gt; ตามตัวอย่างข้างล่างเพื่อเพิ่มการทดสอบเข้าไปโดยผมได้ทำการเขียนโค้ดสำหรับการทดสอบก่อนตามหลักการของ TDD โดยจากการทดสอบที่สร้างขึ้นผมได้เขียนเพื่อทดว่าหลังจากที่เรียกฟังก์ชัน &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ledDriver_Initial()&lt;/code&gt; แล้วสถานะ &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;LED&lt;/code&gt; ต้องเป็น &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;0&lt;/code&gt; เท่านั้นนอกเหนือจากนี้คือไม่ผ่าน (fail)&lt;/p&gt;

&lt;p&gt;###test_led_driver.c&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-c&quot; data-lang=&quot;c&quot;&gt;&lt;span class=&quot;cp&quot;&gt;#include&lt;/span&gt; &lt;span class=&quot;cpf&quot;&gt;&quot;unity.h&quot;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;
#include&lt;/span&gt; &lt;span class=&quot;cpf&quot;&gt;&quot;led_driver.h&quot;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;
&lt;/span&gt;
&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;setUp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;tearDown&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;test_LedOffAfterInitial&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;char&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ledPort&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;n&quot;&gt;ledPort&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0xFF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;ledDeriver_Initial&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ledPort&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;TEST_ASSERT_EQUAL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ledPort&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;จากนั้นก็แก้ไข header ไฟล์ &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;led_driver.c&lt;/code&gt; และ &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;led_driver.h&lt;/code&gt; เพื่อให้ไฟล์ &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;test_led_driver.c&lt;/code&gt; สามารถเรียกใช้งานฟังก์ชัน &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ledDeriver_Initial()&lt;/code&gt; ได้&lt;/p&gt;

&lt;p&gt;###led_driver.c&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-c&quot; data-lang=&quot;c&quot;&gt;&lt;span class=&quot;cp&quot;&gt;#include&lt;/span&gt; &lt;span class=&quot;cpf&quot;&gt;&quot;led_driver.h&quot;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;
&lt;/span&gt;

&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;ledDeriver_Initial&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;char&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ledAddress&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;###led_driver.h&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-c&quot; data-lang=&quot;c&quot;&gt;&lt;span class=&quot;cp&quot;&gt;#ifndef led_driver_H
#define led_driver_H
&lt;/span&gt;
&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;ledDeriver_Initial&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;char&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ledAddress&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;cp&quot;&gt;#endif // led_driver_H&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;และหลังจากเขียนการทดสอบเสร็จเราจะทำการทดสอบกันโดยคาดหวังว่าผลการทดสอบต้องไม่ผ่าน (fail) เพราะเรายังไม่ได้เขียนโค้ดให้กับ &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ledDeriver_Initial()&lt;/code&gt; เลยมีแค่ prototype ให้เรียกใช้งานเท่านั้น
แต่ก็อาจมีกรณีที่มันผ่านโดยเราไม่ได้ตั้งใจอยู่เหมือนกันถ้าเราเขียนการทดสอบผิด อย่างเช่นลืมให้ค่าตั้งต้น (initial) กับตัวแปรที่ทำการทดสอบเราก็อาจจะได้ค่าที่สุ่มมาหรือไม่เป็นไปตามความคาดหมาย&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;“การเขียนการทดสอบให้ไม่ผ่าน (fail) นี้ถือเป็นหัวใจของ TDD เลยทีเดียวหากไม่ได้เขียนการทดสอบและทดสอบให้ไม่ผ่าน (fail) ก่อนไปเขียนโค้ดที่ใช้งาน (production code) แล้ว ก็คงไม่สามารถเรียกการพัฒนาของเราว่าทำตามหลักการ TDD ได้เลย”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;eswizardry@eswizardry-PC/d/Documents/try-embedded-tdd
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;rake &lt;span class=&quot;nb&quot;&gt;test&lt;/span&gt;:all


Test &lt;span class=&quot;s1&quot;&gt;'test_led_driver.c'&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;------------------------&lt;/span&gt;
Generating runner &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;test_led_driver.c...
Compiling test_led_driver_runner.c...
Compiling test_led_driver.c...
Compiling led_driver.c...
Linking test_led_driver.out...
Running test_led_driver.out...

&lt;span class=&quot;nt&quot;&gt;-----------&lt;/span&gt;
TEST OUTPUT
&lt;span class=&quot;nt&quot;&gt;-----------&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;test_led_driver.c]
  - &lt;span class=&quot;s2&quot;&gt;&quot;&quot;&lt;/span&gt;

&lt;span class=&quot;nt&quot;&gt;-------------------&lt;/span&gt;
FAILED TEST SUMMARY
&lt;span class=&quot;nt&quot;&gt;-------------------&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;test_led_driver.c]
  Test: test_LedOffAfterInitial
  At line &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;18&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;Expected 0 Was 255&quot;&lt;/span&gt;

&lt;span class=&quot;nt&quot;&gt;--------------------&lt;/span&gt;
OVERALL TEST SUMMARY
&lt;span class=&quot;nt&quot;&gt;--------------------&lt;/span&gt;
TESTED:  1
PASSED:  0
FAILED:  1
IGNORED: 0

&lt;span class=&quot;nt&quot;&gt;---------------------&lt;/span&gt;
BUILD FAILURE SUMMARY
&lt;span class=&quot;nt&quot;&gt;---------------------&lt;/span&gt;
Unit &lt;span class=&quot;nb&quot;&gt;test &lt;/span&gt;failures.&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;ทีนี้เราก็มาถึงขั้นตอนการเขียนโค้ด (production code) เพื่อให้ผ่านการทดสอบกันแล้ว
โดยตามหลัการของ TDD เริ่มแรกให้เราเขียนโค้ดที่น้อยที่สุดที่สามารถผ่านการทดสอบได้เข้าไปหากเราทดสอบได้ผ่านแล้วค่อยมาทำการ refactor กันทีหลัง
โดยผมเพิ่มโค้ดเข้าไปใน &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;led_driver.c&lt;/code&gt;ดังนี้&lt;/p&gt;

&lt;p&gt;###led_driver.c&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-c&quot; data-lang=&quot;c&quot;&gt;&lt;span class=&quot;cp&quot;&gt;#include&lt;/span&gt; &lt;span class=&quot;cpf&quot;&gt;&quot;led_driver.h&quot;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;
&lt;/span&gt;

&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;ledDeriver_Initial&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;char&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ledAddress&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ledAddress&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;ต่อไปเรามาลองทำการทดสอบโค้ดที่เราเพิ่มเข้าไปดูว่าสามารถผ่านการทดสอบได้หรือไม่
โดยป้อนคำสั่ง &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rake test:all&lt;/code&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;eswizardry@eswizardry-PC/d/Documents/try-embedded-tdd
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;rake &lt;span class=&quot;nb&quot;&gt;test&lt;/span&gt;:all


Test &lt;span class=&quot;s1&quot;&gt;'test_led_driver.c'&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;------------------------&lt;/span&gt;
Compiling led_driver.c...
Linking test_led_driver.out...
Running test_led_driver.out...

&lt;span class=&quot;nt&quot;&gt;-----------&lt;/span&gt;
TEST OUTPUT
&lt;span class=&quot;nt&quot;&gt;-----------&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;test_led_driver.c]
  - &lt;span class=&quot;s2&quot;&gt;&quot;&quot;&lt;/span&gt;

&lt;span class=&quot;nt&quot;&gt;--------------------&lt;/span&gt;
OVERALL TEST SUMMARY
&lt;span class=&quot;nt&quot;&gt;--------------------&lt;/span&gt;
TESTED:  1
PASSED:  1
FAILED:  0
IGNORED: 0&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;หลังจากนั้นก็ให้เราทำการเพิ่มโค้ดการทดสอบและโค้ดการทำงานในส่วนที่เหลือไปเรื่อยๆ จนกว่าจะได้ฟังก์ชันการทำงานทั้งหมดที่เราต้องการโดยสำหรับโค้ดตัวอย่างทั้งหมดสามรถดูเพิ่มเติมได้ที่ &lt;a href=&quot;https://github.com/eswizardry/try-embedded-tdd&quot;&gt;GitHub&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;p&gt;##แก้ไขให้โปรเจ็คคอมไพล์และทดสอบบน IAR-MSP430 คอมไพเลอร์และ C-spy simulator
ให้เปิดไฟล์ &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;project.yml&lt;/code&gt;ขึ้นมาแก้ไขโดยผมจะนำเสนอแค่ในส่วนหลักๆ ที่น่าสนใจเท่านั้นส่วนที่เหลือให้ดูได้จากไฟล์ที่ &lt;a href=&quot;https://github.com/eswizardry/try-embedded-tdd&quot;&gt;GitHub&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;โดยหลักๆ ที่ต้องทำการแก้ไขก็จะเป็นการเพิ่ม complier option ของ IAR เข้าไปแค่นั้นเองโดยเราสามารถใช้ compiler option ที่มาจาก output เวลาที่เราทำการ build โดย IAR ได้เลย
ซึ่งก่อนที่จะกด build ให้เราเปิด option ของ IAR IDE ที่ &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;IAR Embedded Workbench IDE &amp;gt; Tools &amp;gt; Options... &amp;gt; IDE Options &amp;gt; Messages &amp;gt; Show build messages &amp;gt; select 'All'&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;รายละเอียดเพิ่มเติมดูได้จาก &lt;a href=&quot;http://supp.iar.com/Support/?note=47884&quot;&gt;IAR Technical Note 47884&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;###test compiler&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ruby&quot; data-lang=&quot;ruby&quot;&gt;  &lt;span class=&quot;ss&quot;&gt;:test_compiler&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;ss&quot;&gt;:executable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;icc430&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;exe&lt;/span&gt;
    &lt;span class=&quot;ss&quot;&gt;:arguments&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;${1}&quot;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;o&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;${2}&quot;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;no_cse&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;no_unroll&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;no_inline&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;no_code_motion&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;no_tbaa&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;debug&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;D__MSP430GENERIC__&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;e&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;double&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;32&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dlib_config&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;C:&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\P&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;rogram Files (x86)&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\I&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;AR Systems&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\E&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;mbedded Workbench 6.5&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\430\L&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;IB&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\D&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;LIB&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\d&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;l430fn.h&quot;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;I&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;$&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Ol&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;multiplier&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;16&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;segment&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;__data16&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;DATA16&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;segment&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;__data20&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;DATA20&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;diag_suppress&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Pa050&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;diag_suppress&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Pe111&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;DTEST&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;###test linker&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ruby&quot; data-lang=&quot;ruby&quot;&gt;&lt;span class=&quot;ss&quot;&gt;:test_linker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;ss&quot;&gt;:executable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;xlink&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;exe&lt;/span&gt;
    &lt;span class=&quot;ss&quot;&gt;:arguments&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;${1}&quot;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;o&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;${2}&quot;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;__program_start&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;f&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;C:&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\P&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;rogram Files (x86)&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\I&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;AR Systems&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\E&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;mbedded Workbench 6.5&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\430\c&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;onfig&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\l&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;nk430f5438.xcl&quot;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;f&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;C:&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\P&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;rogram Files (x86)&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\I&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;AR Systems&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\E&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;mbedded Workbench 6.5&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\430\c&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;onfig&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\m&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;ultiplier.xcl&quot;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;D_STACK_SIZE&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;50&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;rt&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;C:&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\P&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;rogram Files (x86)&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\I&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;AR Systems&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\E&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;mbedded Workbench 6.5&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\430\l&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;ib&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\d&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;lib&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\d&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;l430fn.r43&quot;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;D_DATA16_HEAP_SIZE&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;50&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;__program_start&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;D_DATA20_HEAP_SIZE&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;50&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;ส่วนสุดท้ายสำหรับการทดสอบคือการแก้ไขค่าให้ การทดสอบของเรารันบน IAR simulator (IAR c-spy)&lt;/p&gt;

&lt;p&gt;###test fixture&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ruby&quot; data-lang=&quot;ruby&quot;&gt;  &lt;span class=&quot;ss&quot;&gt;:test_fixture&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;ss&quot;&gt;:executable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;D&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:\&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Documents&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;try&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;embedded&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;tdd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;TestProj&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;cspy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;bat&lt;/span&gt;
    &lt;span class=&quot;ss&quot;&gt;:name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;msp430 simulator test fixture&quot;&lt;/span&gt;
    &lt;span class=&quot;ss&quot;&gt;:stderr_redirect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:win&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;#inform Ceedling what model of $stderr capture to use&lt;/span&gt;
    &lt;span class=&quot;ss&quot;&gt;:arguments&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;${1}&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;และอีกส่วนหนึ่งที่ต้องแก้ไขคือ executable ไฟล์ นี้เราต้องแก้ไขค่าให้เป็น &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.d43&lt;/code&gt; ไม่อย่างนั้นจะไม่สามารถรันบน IAR c-spy ได้&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ruby&quot; data-lang=&quot;ruby&quot;&gt;&lt;span class=&quot;ss&quot;&gt;:extension&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;ss&quot;&gt;:executable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;d43&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;ต่อไปเรามาลองทำการทดสอบอีกครั้งกับ compiler และ simulator ของ IAR
ก่อนอื่นให้ทำการ clean build ก่อนหน้านี้ที่ใช้ GCC ก่อน&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;eswizardry@eswizardry-PC/d/Documents/try-embedded-tdd
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;rake clean

Cleaning build artifacts...
&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;For large projects, this task may take a long &lt;span class=&quot;nb&quot;&gt;time &lt;/span&gt;to &lt;span class=&quot;nb&quot;&gt;complete&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;


eswizardry@eswizardry-PC/d/Documents/try-embedded-tdd
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;rake clobber

Clobbering all generated files...
&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;For large projects, this task may take a long &lt;span class=&quot;nb&quot;&gt;time &lt;/span&gt;to &lt;span class=&quot;nb&quot;&gt;complete&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;

eswizardry@eswizardry-PC/d/Documents/try-embedded-tdd
&lt;span class=&quot;err&quot;&gt;$&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;จากนั้นป้อนคำสั่ง &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rake test:all&lt;/code&gt;
ก็จะพบกับ test output ที่เปลี่ยนไปโดยบอกรายละเอียดการทดสอบ โดยใช้ IAR c-spy แทน&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;eswizardry@eswizardry-PC/d/Documents/try-embedded-tdd
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;rake &lt;span class=&quot;nb&quot;&gt;test&lt;/span&gt;:all


Test &lt;span class=&quot;s1&quot;&gt;'test_led_driver.c'&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;------------------------&lt;/span&gt;
Generating runner &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;test_led_driver.c...
Compiling test_led_driver_runner.c...
Compiling test_led_driver.c...
Compiling unity.c...
Compiling led_driver.c...
Compiling cmock.c...
Linking test_led_driver.d43...
Running test_led_driver.d43...

&lt;span class=&quot;nt&quot;&gt;-----------&lt;/span&gt;
TEST OUTPUT
&lt;span class=&quot;nt&quot;&gt;-----------&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;test_led_driver.c]
  - &lt;span class=&quot;s2&quot;&gt;&quot;&quot;&lt;/span&gt;
  - &lt;span class=&quot;s2&quot;&gt;&quot;d:&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\D&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;ocuments&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\t&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;ry-embedded-tdd&amp;gt;&quot;&lt;/span&gt;C:&lt;span class=&quot;se&quot;&gt;\P&lt;/span&gt;rogram Files &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;x86&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\I&lt;/span&gt;AR Systems&lt;span class=&quot;se&quot;&gt;\E&lt;/span&gt;mbedde
Workbench 6.5&lt;span class=&quot;se&quot;&gt;\c&lt;/span&gt;ommon&lt;span class=&quot;se&quot;&gt;\b&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;in&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\c&lt;/span&gt;spybat&lt;span class=&quot;s2&quot;&gt;&quot; &quot;&lt;/span&gt;C:&lt;span class=&quot;se&quot;&gt;\P&lt;/span&gt;rogram Files &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;x86&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\I&lt;/span&gt;AR Systems&lt;span class=&quot;se&quot;&gt;\E&lt;/span&gt;mbedded
orkbench 6.5&lt;span class=&quot;se&quot;&gt;\4&lt;/span&gt;30&lt;span class=&quot;se&quot;&gt;\b&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;in&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\4&lt;/span&gt;30proc.dll&lt;span class=&quot;s2&quot;&gt;&quot; &quot;&lt;/span&gt;C:&lt;span class=&quot;se&quot;&gt;\P&lt;/span&gt;rogram Files &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;x86&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\I&lt;/span&gt;AR Systems&lt;span class=&quot;se&quot;&gt;\E&lt;/span&gt;mbedded
orkbench 6.5&lt;span class=&quot;se&quot;&gt;\4&lt;/span&gt;30&lt;span class=&quot;se&quot;&gt;\b&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;in&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\4&lt;/span&gt;30sim.dll&lt;span class=&quot;s2&quot;&gt;&quot;  build/test/out/test_led_driver.d43 --plugin
:&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\P&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;rogram Files (x86)&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\I&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;AR Systems&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\E&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;mbedded Workbench 6.5&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\4&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\b&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;in&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\4&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;30bat.dll&quot;&lt;/span&gt; -
ackend &lt;span class=&quot;nt&quot;&gt;-B&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;--hardware_multiplier&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;32&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;--hwmult_type&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;8&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;-p&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;C:&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\P&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;rogram Fi
s (x86)&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\I&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;AR Systems&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\E&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;mbedded Workbench 6.5&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\4&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\c&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;onfig&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\m&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;sp430fr5739.ddf&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;--cor
430Xv2&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;--data_model=small&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;--iv_base&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;0xFF90&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;--odd_word_check&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;-d&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;sim
&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;--derivativeSim&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot; &quot;&lt;/span&gt;MSP430FR5739&lt;span class=&quot;s2&quot;&gt;&quot; &quot;&lt;/span&gt;
  - &lt;span class=&quot;s2&quot;&gt;&quot;&quot;&lt;/span&gt;
  - &lt;span class=&quot;s2&quot;&gt;&quot;     IAR C-SPY Command Line Utility V6.6.3.2839&quot;&lt;/span&gt;
  - &lt;span class=&quot;s2&quot;&gt;&quot;     Copyright 2000-2013 IAR Systems AB.&quot;&lt;/span&gt;
  - &lt;span class=&quot;s2&quot;&gt;&quot;&quot;&lt;/span&gt;
  - &lt;span class=&quot;s2&quot;&gt;&quot;&quot;&lt;/span&gt;

&lt;span class=&quot;nt&quot;&gt;--------------------&lt;/span&gt;
OVERALL TEST SUMMARY
&lt;span class=&quot;nt&quot;&gt;--------------------&lt;/span&gt;
TESTED:  3
PASSED:  3
FAILED:  0
IGNORED: 0


eswizardry@eswizardry-PC/d/Documents/try-embedded-tdd
&lt;span class=&quot;err&quot;&gt;$&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;p&gt;สำหรับไฟล์ทั้งหมดที่ใช้ในบทความนี้สามารถดาวน์โหลดไปลองเล่นกันได้ที่ &lt;a href=&quot;https://github.com/eswizardry/try-embedded-tdd&quot;&gt;GitHub&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;…&amp;lt;3&lt;/p&gt;
</description>
        <pubDate>Mon, 14 Sep 2015 00:00:00 +0000</pubDate>
        <link>http://eswizardry.com/2015/09/14/tdd-with-ceedling-msp430/</link>
        <guid isPermaLink="true">http://eswizardry.com/2015/09/14/tdd-with-ceedling-msp430/</guid>
        
        <category>tdd</category>
        
        <category>msp430</category>
        
        
      </item>
    
      <item>
        <title>แกะกล่อง Arduino UNO</title>
        <description>&lt;p&gt;&lt;a href=&quot;/2015/08/03/review-arduino-uno/&quot;&gt;&lt;img src=&quot;/assets/review-uno/arduino-uno.jpg&quot; /&gt;&lt;/a&gt;
&lt;!--more--&gt;&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;
บล็อกก่อนหน้าผมได้เขียนแนะนำเกี่ยวกับ Arduino ไปแล้ววันนี้จะมาแนะนำบอร์ดอย่างเป็นทางการจาก Arduino ที่ได้รับความนิยมสูงสุดในตอนนี้คือเจ้า Arduino &lt;a href=&quot;https://www.arduino.cc/en/Main/arduinoBoardUno&quot;&gt;UNO&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;a href=&quot;https://www.arduino.cc/en/Main/arduinoBoardUno&quot;&gt;UNO&lt;/a&gt; ในภาษาสเปนกับอิตาเลียนนั้นแปลว่า One ในภาษาอังกฤษ หรือ หนึ่งในภาษาไทยนั่นเอง&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;br /&gt;
บอร์ด Arduino &lt;a href=&quot;https://www.arduino.cc/en/Main/arduinoBoardUno&quot;&gt;UNO&lt;/a&gt; นั้นเป็นบอร์ดที่ออกมาตั้งแต่ปลายปี 2010 แต่ด้วยความที่ตัวผมเองทำงานด้านนี้อยู่แล้วและมองว่า Arduino เป็นแค่ของเล่นหรือสำหรับมือใหม่ก็เลยไม่ได้สนใจที่จะหามาลองเล่นจนแต่ช่วงนี้ว่างๆ และเห็นพัฒนาการของ Arduino ผ่านมามากกว่าห้าปีแล้วและคิดว่า มันมีอะไรดี จึงลองหามาเล่นซักหน่อย&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;
&lt;img src=&quot;/assets/review-uno/uno-box.jpg&quot; alt=&quot;uno-box&quot; /&gt;
&lt;br /&gt;&lt;/p&gt;

&lt;h2 id=&quot;ภายในกล่องมีอะไรบ้าง&quot;&gt;ภายในกล่องมีอะไรบ้าง&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;ครั้งแรกที่ผมได้รับพัสดุเจ้า Arduino และเจอกับกล่องผมก็ประหลาดใจเล็กน้อยเพราะว่ามันมีขนาดเล็กกว่าที่ผมคิดไว้พอสมควร&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;br /&gt;
&lt;img src=&quot;/assets/review-uno/uno-inpalm.jpg&quot; alt=&quot;uno-inpalm&quot; /&gt;
&lt;br /&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;ภายในกล่องก็จะประกอบไปด้วยตัวบอร์ด แผ่นพับที่มีข้อความขอบคุณ และสติ๊กเกอร์ Arduino&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;br /&gt;
&lt;img src=&quot;/assets/review-uno/uno-unbox.jpg&quot; alt=&quot;uno-unbox&quot; /&gt;
&lt;br /&gt;&lt;/p&gt;

&lt;h2 id=&quot;ฮาร์ดแวร์ของ-uno&quot;&gt;ฮาร์ดแวร์ของ &lt;a href=&quot;https://www.arduino.cc/en/Main/arduinoBoardUno&quot;&gt;UNO&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.arduino.cc/en/Main/arduinoBoardUno&quot;&gt;UNO&lt;/a&gt; นั้นใช้ &lt;a href=&quot;http://www.atmel.com/devices/atmega328.aspx&quot;&gt;Atmega328&lt;/a&gt; (มีหน่วยควมจำแบบ Flash 32kB ใช้เป็น bootloader ไป 0.5kB, SRAM 2kB และ EEPROM อีก 1kB) เป็นไมโครคอนโทรลเลอร์หลักซึ่งใช้แพ็คเกจแบบ &lt;a href=&quot;https://en.wikipedia.org/wiki/Dual_in-line_package&quot;&gt;DIP&lt;/a&gt; ทำให้ง่ายต่อการพัฒนาเช่นเวลาที่เราต้องการนำชิปที่ถูกโปรแกรมไปใช้ในบอร์ดอื่น หรือเวลาที่ชิปเสียเราก็สามารถที่จะหาซื้อชิปมาเปลี่ยนเองได้ง่ายๆ&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;มี I/O ให้ใช้งานทั้งหมด 20 ขา (แบ่งเป็นดิจิตอล I/O 16 ขา และ อินพุตแบบแอนาล็อกอีก 6 ขา) ใช้คริสตัลความถี่ 16 MHz มี USB คอนเน็คเตอร์แบบ B, หัวต่อ DC adaptor, พอร์ตสำหรับโปรแกรมแบบ ICSP, และสวิตช์สำหรับรีเซ็ท&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;ตัวบอร์ดสามารถเลือกแหล่งจ่ายไฟได้โดยอัตโนมัติระหว่างจากพอร์ต USB และแหล่งจ่ายภายนอก แต่สิ่งที่ผมคิดว่ามันยังขาดอยู่ก็คือสวิตช์เปิดปิดซึ่งไม่มีเราต้องทำการเปิดปิดโดยการดึงปลั๊กหรือถอดสาย USB เท่านั้น&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;อ้อเกือบลืมอีกอย่างว่าบนบอร์ดนั้นยังประกอบไปด้วยไมโครคอนโทรลเลอร์อีกตัวหนึ่งคือ &lt;a href=&quot;http://www.atmel.com/devices/ATMEGA16U2.aspx&quot;&gt;Atmega16U2&lt;/a&gt; ซึ่งทำหน้าที่เป็น &lt;a href=&quot;http://www.ftdichip.com/Products/Cables/USBRS232.htm&quot;&gt;USB-to-Serial convertor&lt;/a&gt;&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;h2 id=&quot;ทดลองจ่ายไฟ&quot;&gt;ทดลองจ่ายไฟ&lt;/h2&gt;
&lt;p&gt;จากนี้ไปเราก็มาลองจ่ายไฟให้กับเจ้าบอร์ด &lt;a href=&quot;https://www.arduino.cc/en/Main/arduinoBoardUno&quot;&gt;UNO&lt;/a&gt; กันครับการจ่ายไฟให้กับบอร์ดที่ง่ายและถูกที่สุดก็ผ่านสาย USB นั่นแหละครับโดยใช้สาย USB ที่มีหัวต่อเป็นแบบ type A-to-B ครับ&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;
&lt;img src=&quot;/assets/review-uno/uno-cable.jpg&quot; alt=&quot;uno-cable&quot; /&gt;
&lt;br /&gt;&lt;/p&gt;

&lt;p&gt;หลังจากเราเสียบสาย USB เข้ากับคอมพิวเตอร์และบอร์ดเรียบร้อยแล้วให้สังเกตว่าจะมี &lt;a href=&quot;https://en.wikipedia.org/wiki/Light-emitting_diode&quot;&gt;LED&lt;/a&gt; สีส้มกระพริบถี่ๆ ประมาณ 2-3 วินาทีจากนั้นก็จะกระพริบทุกๆ ครึ่งวินาทีนั้นก็คือโปรแกรมที่ถูกติดตั้งมาจากโรงงานครับโดย &lt;a href=&quot;https://en.wikipedia.org/wiki/Light-emitting_diode&quot;&gt;LED&lt;/a&gt; สีส้มนั้นจะถูกต่อกับดิจิตอล I/O ขาที่ 13&lt;/p&gt;

&lt;p&gt;สำหรับการแกะกล่อง Arduino &lt;a href=&quot;https://www.arduino.cc/en/Main/arduinoBoardUno&quot;&gt;UNO&lt;/a&gt; ก็จบเพียงแค่นี้ครับ เดี๋ยวไว้ว่างๆ จะมานำเสนอเกี่ยวกับการใช้งาน&lt;/p&gt;
</description>
        <pubDate>Mon, 03 Aug 2015 00:00:00 +0000</pubDate>
        <link>http://eswizardry.com/2015/08/03/review-arduino-uno/</link>
        <guid isPermaLink="true">http://eswizardry.com/2015/08/03/review-arduino-uno/</guid>
        
        <category>arduino</category>
        
        
      </item>
    
      <item>
        <title>รู้จักกับ Arduino</title>
        <description>&lt;p&gt;&lt;a href=&quot;/2015/08/02/introducing-arduino/&quot;&gt;&lt;img src=&quot;/assets/intro-arduino/arduino-logo.jpg&quot; /&gt;&lt;/a&gt;
&lt;!--more--&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.arduino.cc/&quot;&gt;Arduino&lt;/a&gt; (ออกเสียงว่า อา-ดู-อี-โน่) หลายคนอาจคิดว่าผมมาแนะนำนักฟุตบอลดาวรุ่งจาก อิตาลี แต่จริงๆ แล้วเจ้าตัว &lt;a href=&quot;https://www.arduino.cc/&quot;&gt;Arduino&lt;/a&gt; นี้ก็คือบอร์ดไมโครคอนโทรลเลอร์ขนาดเล็กที่มีพอร์ตซึ่งสามารถเชื่อมต่อกับคอมพิวเตอร์และทำให้คอมพิวเตอร์มีความสามารถในการในการรับสัญญาณจากอุปกรณ์ภายนอกและควบคุมอุปกรณ์ภายนอกได้มากกว่าที่คอมพิวเตอร์ทั่วไปจะทำได้&lt;/p&gt;

&lt;h2 id=&quot;กว่าจะมาเป็น-arduino-ในทุกวันนี้&quot;&gt;กว่าจะมาเป็น &lt;a href=&quot;https://www.arduino.cc/&quot;&gt;Arduino&lt;/a&gt; ในทุกวันนี้&lt;/h2&gt;
&lt;blockquote&gt;
  &lt;p&gt;&lt;a href=&quot;https://www.arduino.cc/&quot;&gt;Arduino&lt;/a&gt; นั้นเดิมทีถูกพัฒนาขึ้นมาเพื่อเป็นเครื่องมือในการสอนนักศึกษา ในปี 2005 โดย &lt;a href=&quot;http://www.massimobanzi.com/&quot;&gt;Massimo Banzi&lt;/a&gt; และ &lt;a href=&quot;https://twitter.com/dcuartielles&quot;&gt;David Cuartielles&lt;/a&gt; ซึ่งก็ประสบความสำเร็จเป็นอย่างมากในแง่ของการสอน จากนั้นก็แพร่หลายมาสู่นักประดิษฐ์ ศิลปิน และ นักพัฒนาทั่วโลก
และสิ่งที่ทำให้ &lt;a href=&quot;https://www.arduino.cc/&quot;&gt;Arduino&lt;/a&gt; ประสบความสำเร็จเป็นอย่างมากคือบอร์ด &lt;a href=&quot;https://www.arduino.cc/&quot;&gt;Arduino&lt;/a&gt; นั้นถูกออกแบบภายใต้สัญญาแบบ &lt;a href=&quot;http://creativecommons.org/&quot;&gt;Creative Commons License&lt;/a&gt; ทำให้เกิดการต่อยอดและสร้างบอร์ดทางเลือกออกมาได้อย่างอิสระ&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;br /&gt;
&lt;img src=&quot;/assets/intro-arduino/arduino-uno.jpg&quot; alt=&quot;arduino-uno&quot; /&gt;
&lt;br /&gt;&lt;/p&gt;

&lt;p&gt;โดยเจ้าบอร์ด &lt;a href=&quot;https://www.arduino.cc/&quot;&gt;Arduino&lt;/a&gt; นี้จะมี I/O ซึ่งสามารถเชื่อมต่อเข้ากับอุปกรณ์และเซนเซอร์ได้มากมายยกตัวอย่างเช่น มอเตอร์, รีเลย์, เซนเซอร์แสง, ลำโพง และอื่นๆ อีกมากมาย
และ &lt;a href=&quot;https://www.arduino.cc/&quot;&gt;Arduino&lt;/a&gt; นี้เราสามารถที่จะโปรแกรมให้มันถูกควบคุมโดยคอมพิวเตอร์ หรือเราจะโปรแกรมให้ทำงานแบบ stand alone ก็ได้
ตัวบอร์ดนั้นถูกออกแบบภายใต้โครงการแบบโอเพนซอร์ส ซึ่งนั่นก็หมายความว่าใครก็สามารถที่จะนำแบบของ &lt;a href=&quot;https://www.arduino.cc/&quot;&gt;Arduino&lt;/a&gt; มาสร้างเองได้ จึงทำให้ปัจจุบันจะมีบอร์ดที่ไม่ใช่ official ออกมาขายในราคาถูกอย่างมากมายไม่ว่าจะเป็น&lt;/p&gt;

&lt;h4 id=&quot;freeduino&quot;&gt;&lt;a href=&quot;http://www.freeduino.org/freeduino_open_designs.html&quot;&gt;Freeduino&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;&lt;img src=&quot;/assets/intro-arduino/arduino-freeduino.jpg&quot; alt=&quot;arduino-uno&quot; /&gt;
&lt;br /&gt;&lt;/p&gt;

&lt;h4 id=&quot;roboduino&quot;&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/File:DFRobot_Arduino.jpg&quot;&gt;Roboduino&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;&lt;img src=&quot;/assets/intro-arduino/arduino-roboduino.jpg&quot; alt=&quot;roboduino&quot; /&gt;
&lt;br /&gt;&lt;/p&gt;

&lt;h4 id=&quot;seeduino&quot;&gt;&lt;a href=&quot;http://www.seeedstudio.com/wiki/Seeeduino_v3.0&quot;&gt;Seeduino&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;&lt;img src=&quot;/assets/intro-arduino/arduino-seeeduino.jpg&quot; alt=&quot;arduino-seeeduino&quot; /&gt;
&lt;br /&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;แม้ว่าตัวฮาร์ดแวร์ของ &lt;a href=&quot;https://www.arduino.cc/&quot;&gt;Arduino&lt;/a&gt; นั้นจะเป็นโอเพนซอร์สแต่ชื่อ &lt;a href=&quot;https://www.arduino.cc/&quot;&gt;Arduino&lt;/a&gt; นั้นสงวนลิขสิทธิ์นะครับ&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;ทำไมต้องเป็น-arduino&quot;&gt;ทำไมต้องเป็น &lt;a href=&quot;https://www.arduino.cc/&quot;&gt;Arduino&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;หลายคนที่เล่่นหรือทำงานเกี่ยวกับไมโครคอนโทรลเลอร์อยู่แล้วก็อาจจะสงสัยว่าทำไมต้องใช้ &lt;a href=&quot;https://www.arduino.cc/&quot;&gt;Arduino&lt;/a&gt; ด้วยทั้งที่มีบอร์ดไมโครคอนโทรลเลอร์แบบนี้เยอะแยะ
ความพิเศษของเจ้า &lt;a href=&quot;https://www.arduino.cc/&quot;&gt;Arduino&lt;/a&gt; อยู่ที่ตัวฮาร์ดแวร์และซอฟต์แวร์นั้นถูกออกแบบมาให้ง่ายต่อการนำไปพัฒนาและใช้งานได้โดยที่ไม่จำเป็นต้องเป็นมืออาชีพหรือศึกษามาทางด้านไฟฟ้าและอิเล็กทรอนิกส์มาก่อน&lt;/p&gt;

&lt;p&gt;ส่วนข้างล่างนี้ก็เป็นการแจกแจงข้อดีของ &lt;a href=&quot;https://www.arduino.cc/&quot;&gt;Arduino&lt;/a&gt; ที่ผมแปลมาจาก &lt;a href=&quot;http://www.arduino.cc/en/Guide/Introduction&quot;&gt;arduino.cc&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;ราคาถูก&lt;/strong&gt;: บอร์ด &lt;a href=&quot;https://www.arduino.cc/&quot;&gt;Arduino&lt;/a&gt; นั้นมีราคาที่ถูกมากเมื่อเทียบกับบอร์ดไมโครคอนโทรลเลอร์อื่นและบอร์ดที่ถูกที่สุดเราสามารถที่จะประกอบได้เองอีกด้วย หรือบอร์ดสำเร็จรูปเราก็สามารถหาซื้อได้ในราคาประมาณ $50 เท่านั้นเอง&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;สามารถทำงานได้หลายแพลตฟอร์ม&lt;/strong&gt;: ซอฟต์แวร์ในการพัฒนานั้นสามารถทำงานได้ทั้งบน Windows, Macintosh OS X และ Linux สำหรับไมโครคอนโทรลเลอร์ส่วนมากจะทำงานได้บน Windows เท่านั้น&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;ง่าย&lt;/strong&gt;: ซอฟแวร์ในการพัฒนานั้นถูกออกแบบมาให้ใช้งานง่ายสำหรับมือใหม่ แต่ก็ยังคงความยืดหยุ่นและมีความสามรถครบครันสำหรับมืออาชีพ สำหรับคุณครูหรือผู้สอนสามารถที่จะใช้ &lt;a href=&quot;https://www.arduino.cc/&quot;&gt;Arduino&lt;/a&gt; ซึ่งอยู่บนพื้นฐานของแพลตฟอร์ม &lt;a href=&quot;https://processing.org/&quot;&gt;Processing&lt;/a&gt; ในการสอนเขียนโปรแกรมเพื่อให้นักเรียนนักศึกษาสามารถเข้าใจการเขียนโปรแกรมได้ดียิ่งขึ้น&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;โอเพนซอร์ส&lt;/strong&gt;: อย่างที่กล่าวไปแล้วว่า &lt;a href=&quot;https://www.arduino.cc/&quot;&gt;Arduino&lt;/a&gt; นั้นเป็นแพลตฟอร์มที่เปิดเผยวงจรและซอร์สโค้ดซึ่งใครๆ ก็สามารถสร้างหรือนำไปต่อยอดได้&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;ตัวอย่างของบอร์ดชีลด์ที่ได้รับความนิยมก็อย่างเช่น&quot;&gt;ตัวอย่างของบอร์ดชีลด์ที่ได้รับความนิยมก็อย่างเช่น&lt;/h2&gt;
&lt;p&gt;นอกจากบอร์ด &lt;a href=&quot;https://www.arduino.cc/&quot;&gt;Arduino&lt;/a&gt; แล้วเรายังได้เห็นการต่อยอดของฮาร์ดแวร์ออกมาในรูปแบบของ &lt;a href=&quot;https://www.arduino.cc/en/Main/Products&quot;&gt;Shield (ชีลด์)&lt;/a&gt;  ซึ่งเป็นบอร์ดเสริมช่วยเพิ่มความสามารถให้กับ &lt;a href=&quot;https://www.arduino.cc/&quot;&gt;Arduino&lt;/a&gt; และลดการบัดกรีได้ทำให้การพัฒนาหรือประดิษฐ์อุปกรณ์ด้วยไมโครคอนโทรลเลอร์ง่ายขึ้นไปอีกขั้น&lt;/p&gt;

&lt;h4 id=&quot;ethernet-shield&quot;&gt;&lt;a href=&quot;https://www.arduino.cc/en/Main/ArduinoEthernetShield&quot;&gt;Ethernet Shield&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;&lt;img src=&quot;/assets/intro-arduino/shield-ethernet.jpg&quot; alt=&quot;shield-ethernet&quot; /&gt;
&lt;br /&gt;&lt;/p&gt;

&lt;h4 id=&quot;motor-shield&quot;&gt;&lt;a href=&quot;https://www.arduino.cc/en/Main/ArduinoMotorShieldR3&quot;&gt;Motor Shield&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;&lt;img src=&quot;/assets/intro-arduino/shield-motor.jpg&quot; alt=&quot;shield-motor&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;h4 id=&quot;proto-shield&quot;&gt;&lt;a href=&quot;https://www.arduino.cc/en/Main/ArduinoProtoShield&quot;&gt;Proto Shield&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;&lt;img src=&quot;/assets/intro-arduino/shield-proto.jpg&quot; alt=&quot;shield-proto&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;h4 id=&quot;gsm-shield&quot;&gt;&lt;a href=&quot;https://www.arduino.cc/en/Main/ArduinoGSMShield&quot;&gt;GSM Shield&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;&lt;img src=&quot;/assets/intro-arduino/shield-gsm.jpg&quot; alt=&quot;shield-gsm&quot; /&gt;&lt;/p&gt;
</description>
        <pubDate>Sun, 02 Aug 2015 00:00:00 +0000</pubDate>
        <link>http://eswizardry.com/2015/08/02/introducing-arduino/</link>
        <guid isPermaLink="true">http://eswizardry.com/2015/08/02/introducing-arduino/</guid>
        
        <category>arduino</category>
        
        
      </item>
    
      <item>
        <title>[How To] การลบข้อมูลบัตรเครดิตออกจาก Google Play)</title>
        <description>&lt;p&gt;&lt;a href=&quot;/2015/08/02/delete-credit-from-googleplay/&quot;&gt;&lt;img src=&quot;/assets/google-play/google-wallet.jpg&quot; /&gt;&lt;/a&gt;
&lt;!--more--&gt;&lt;/p&gt;

&lt;p&gt;หลายคนที่ใช้แอนดรอยน์และต้องการซื้อแอพจากก็ต้องทำการผูกบัตรเครดิตเข้ากับบัญชี &lt;a href=&quot;https://play.google.com/store/&quot;&gt;Google Play store &lt;/a&gt; ซึ่งบางคนก็ไม่สบายใจที่ต้องเอาบัตรเครดิตไปผูกอยู่กับบัญชี Google เพราะกลัวจะถูกแฮ็ก
ผมเองก็เป็นหนึ่งในนั้น ผมก็เลยใช้วิธีการว่าเวลาที่จะซื้อก็กรอกข้อมูลบัตรเครดิตหลังจากซื้อแอพที่เราต้องการเสร็จแล้วก็จะทำการลบข้อมูลบัตรเครดิตของเราออก
ซึ่งครั้งแรกเลยผมก็ยังงงอยู่เหมือนกันว่าจะไปลบข้อมูลตรงไหน เพราะว่าข้อมูลบัตรเครดิตของเรานั้นมันอยู่ในอีกบริการหนึ่งของ Google ครับคือ &lt;a href=&quot;https://wallet.google.com/&quot;&gt;Google wallet&lt;/a&gt; ซึ่งวิธีการทีละขั้นตอนก็ดังนี้ครับ&lt;/p&gt;

&lt;h3 id=&quot;1-ให้ล็อกอินเข้าไปที่-google-wallet&quot;&gt;1. ให้ล็อกอินเข้าไปที่ &lt;a href=&quot;https://wallet.google.com/&quot;&gt;Google wallet&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;br /&gt;
&lt;img src=&quot;/assets/google-play/wallet-fpage.jpg&quot; alt=&quot;first-page&quot; /&gt;
&lt;br /&gt;&lt;/p&gt;

&lt;h3 id=&quot;2-ไปที่-payments-methods-ก็จะพบข้อมูลบัตรเครดิตของเรา-ให้เลือก-remove-ครับ&quot;&gt;2. ไปที่ Payments methods ก็จะพบข้อมูลบัตรเครดิตของเรา ให้เลือก Remove ครับ&lt;/h3&gt;
&lt;p&gt;&lt;br /&gt;
&lt;img src=&quot;/assets/google-play/payment-methods.jpg&quot; alt=&quot;payment-methods&quot; /&gt;
&lt;br /&gt;&lt;/p&gt;

&lt;h3 id=&quot;3-จากนั้นก็จะมีหน้าต่าง-pop-up-ขึ้นมาให้เรากดยืนยัน&quot;&gt;3. จากนั้นก็จะมีหน้าต่าง pop up ขึ้นมาให้เรากดยืนยัน&lt;/h3&gt;
&lt;p&gt;&lt;br /&gt;
&lt;img src=&quot;/assets/google-play/confirmation.jpg&quot; alt=&quot;confirmation&quot; /&gt;
&lt;br /&gt;&lt;/p&gt;

&lt;h3 id=&quot;4-แค่นี้ก็เรียบร้อยครับ&quot;&gt;4. แค่นี้ก็เรียบร้อยครับ&lt;/h3&gt;
&lt;p&gt;&lt;br /&gt;
&lt;img src=&quot;/assets/google-play/hooley-finish.jpg&quot; alt=&quot;finish&quot; /&gt;&lt;/p&gt;
</description>
        <pubDate>Sun, 02 Aug 2015 00:00:00 +0000</pubDate>
        <link>http://eswizardry.com/2015/08/02/delete-credit-from-googleplay/</link>
        <guid isPermaLink="true">http://eswizardry.com/2015/08/02/delete-credit-from-googleplay/</guid>
        
        <category>android</category>
        
        
      </item>
    
      <item>
        <title>ลอง TDD บน MSP430 (Embedded C)</title>
        <description>&lt;p&gt;&lt;a href=&quot;/2015/07/23/try-tdd-msp430/&quot;&gt;&lt;img src=&quot;/assets/try-tdd-msp430/tdd-circle-of-life.jpg&quot; /&gt;&lt;/a&gt;
&lt;!--more--&gt;&lt;/p&gt;

&lt;p&gt;ช่วงนี้กำลังศึกษา &lt;a href=&quot;https://goo.gl/MqLc6h&quot;&gt;TDD&lt;/a&gt; บนระบบสมองกลฝังตัว (&lt;a href=&quot;https://goo.gl/Nzbv4M&quot;&gt;Embedded system&lt;/a&gt;) อยู่โดย &lt;a href=&quot;https://goo.gl/sPGrJx&quot;&gt;unit test framework&lt;/a&gt; หลักก็กำลังศึกษาอยู่ก็คือ &lt;a href=&quot;http://www.throwtheswitch.org&quot;&gt;unity&lt;/a&gt; และก็ค้นหาวิธีใช้งานใน google จนไปเจอ repo ใน github ของนาย &lt;a href=&quot;https://goo.gl/OgBP7y&quot;&gt;jotux&lt;/a&gt; เข้าโดยเขาเขียน มาโครง่ายๆ ขึ้นมาสำหรับใช้เป็น test framework ของ &lt;a href=&quot;http://goo.gl/xcRgsD&quot;&gt;msp430&lt;/a&gt; และใช้ คอมไพเลอร์ของ &lt;a href=&quot;https://goo.gl/IryKTA&quot;&gt;IAR&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;ซึ่งถ้าสำหรับคนที่เริ่มต้นศึกษา TDD นี่ถือว่าเป็นตัวอย่างที่ดีมาก เพราะมันตรงไป ตรงมา ไม่มีอะไรซับซ้อน ทำเห็นเรามองภาพรวมทั้งหมดในตัวที่ใช้ทำ test ได้ เพราะหลายๆ คนอาจจะยังนึกภาพไม่ออกว่าเราจะทำ TDD และ test automation บนไมโครคอนโทรลเลอร์กันยังไง&lt;/p&gt;

&lt;p&gt;##ครั้งแรกกับ TDD
จริงๆ แล้วจะเรียก ครั้งแรกกับ TDD ก็ยังไม่ถูกนักเพราะในบล็อกนี้จะแค่ลองเล่นกับโค้ดที่เขาเขียนมาเรียบร้อยแล้วไม่ได้ลงรายละเอียดเกี่ยวกับการเขียน test เพื่อทดสอบ production code กันหรอก&lt;/p&gt;

&lt;p&gt;##เตรียมความพร้อม
ก่อนอื่นเลยให้ โคลน &lt;a href=&quot;https://goo.gl/OgBP7y&quot;&gt;github repo&lt;/a&gt;  มาไว้ที่เครื่องก่อน
ในเครื่องต้องมี &lt;a href=&quot;https://goo.gl/IryKTA&quot;&gt;IAR-EW MSP430&lt;/a&gt; รวมทั้งให้เพิ่มโฟลเดอร์ของ &lt;a href=&quot;http://goo.gl/iaUqor&quot;&gt;Iarbuild&lt;/a&gt; เข้าไปใน system path ให้เรียบร้อย&lt;/p&gt;

&lt;p&gt;##มาลองเล่นกันเลย !
เปิด terminal ขึ้นมาแล้ว cd ไปที่ repo ที่เราโคลนมา เข้าไปที่ โฟลเดอร์ &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.\example\test&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;ป้อนคำสั่งเพื่อ clean project &lt;br /&gt;
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;IarBuild.exe .\..\test\canary.ewp -clean Debug&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
8
9
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;PS D:&lt;span class=&quot;se&quot;&gt;\D&lt;/span&gt;ocuments&lt;span class=&quot;se&quot;&gt;\I&lt;/span&gt;AR4Unity&lt;span class=&quot;se&quot;&gt;\e&lt;/span&gt;xample&lt;span class=&quot;se&quot;&gt;\t&lt;/span&gt;est&amp;gt; IarBuild.exe .&lt;span class=&quot;se&quot;&gt;\.&lt;/span&gt;.&lt;span class=&quot;se&quot;&gt;\t&lt;/span&gt;est&lt;span class=&quot;se&quot;&gt;\c&lt;/span&gt;anary.ewp &lt;span class=&quot;nt&quot;&gt;-clean&lt;/span&gt; Debug

     IAR Command Line Build Utility V6.6.3.2839
     Copyright 2002-2013 IAR Systems AB.

Deleting outputs &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;configuration Debug
Updating build tree...

8  file&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;s&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; deleted.
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;ป้อนคำสั่งเพื่อ build project  &lt;br /&gt;
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;IarBuild.exe .\..\test\canary.ewp -make Debug&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
14
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;PS D:&lt;span class=&quot;se&quot;&gt;\D&lt;/span&gt;ocuments&lt;span class=&quot;se&quot;&gt;\I&lt;/span&gt;AR4Unity&lt;span class=&quot;se&quot;&gt;\e&lt;/span&gt;xample&lt;span class=&quot;se&quot;&gt;\t&lt;/span&gt;est&amp;gt; IarBuild.exe .&lt;span class=&quot;se&quot;&gt;\.&lt;/span&gt;.&lt;span class=&quot;se&quot;&gt;\t&lt;/span&gt;est&lt;span class=&quot;se&quot;&gt;\c&lt;/span&gt;anary.ewp &lt;span class=&quot;nt&quot;&gt;-make&lt;/span&gt; Debug

     IAR Command Line Build Utility V6.6.3.2839
     Copyright 2002-2013 IAR Systems AB.

Building configuration: canary - Debug
Updating build tree...
main.c
test_uart.c
Linking


Total number of errors: 0
Total number of warnings: 0
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;จากนั้นสั่งรัน test  &lt;br /&gt;
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.\..\settings\canary.cspy.bat .\Debug\Exe\canary.d43&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;โดยอันนี้จะเป็นการเรียกรัน test เพื่อทดสอบกับ simulator ของ IAR เลยซึ่งก็มีข้อดีคือเราได้ทดสอบโค้ดกับสภาพแวดล้อมเสมือนจริงทำให้เราสามารถเชื่อมั่นในโค้ดของเราได้มากขึ้น ซึ่งหลายครั้งเวลาทำ TDD สำหรับระบบสมองกลฝังตัวมักจะทำการคอมไพล์และทดสอบบนเครื่องที่ใช้พัฒนาเนื่องจากมีความง่ายกว่านั่นเอง&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;PS D:&lt;span class=&quot;se&quot;&gt;\D&lt;/span&gt;ocuments&lt;span class=&quot;se&quot;&gt;\I&lt;/span&gt;AR4Unity&lt;span class=&quot;se&quot;&gt;\e&lt;/span&gt;xample&lt;span class=&quot;se&quot;&gt;\t&lt;/span&gt;est&amp;gt; .&lt;span class=&quot;se&quot;&gt;\.&lt;/span&gt;.&lt;span class=&quot;se&quot;&gt;\s&lt;/span&gt;ettings&lt;span class=&quot;se&quot;&gt;\c&lt;/span&gt;anary.cspy.bat .&lt;span class=&quot;se&quot;&gt;\D&lt;/span&gt;ebug&lt;span class=&quot;se&quot;&gt;\E&lt;/span&gt;xe&lt;span class=&quot;se&quot;&gt;\c&lt;/span&gt;anary.d43

D:&lt;span class=&quot;se&quot;&gt;\D&lt;/span&gt;ocuments&lt;span class=&quot;se&quot;&gt;\I&lt;/span&gt;AR4Unity&lt;span class=&quot;se&quot;&gt;\e&lt;/span&gt;xample&lt;span class=&quot;se&quot;&gt;\t&lt;/span&gt;est&amp;gt;&lt;span class=&quot;s2&quot;&gt;&quot;C:&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\P&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;rogram Files (x86)&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\I&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;AR Systems&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\E&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;mbedded Workbench 6.5&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\c&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;ommon&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\b&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;in&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\c&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;spybat&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;C:&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\P&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;
rogram Files (x86)&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\I&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;AR Systems&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\E&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;mbedded Workbench 6.5&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\4&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\b&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;in&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\4&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;30proc.dll&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;C:&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\P&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;rogram Files (x86)&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\I&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;AR Systems&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\E&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;mbedded
Workbench 6.5&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\4&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\b&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;in&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\4&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;30sim.dll&quot;&lt;/span&gt;  .&lt;span class=&quot;se&quot;&gt;\D&lt;/span&gt;ebug&lt;span class=&quot;se&quot;&gt;\E&lt;/span&gt;xe&lt;span class=&quot;se&quot;&gt;\c&lt;/span&gt;anary.d43 &lt;span class=&quot;nt&quot;&gt;--plugin&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;C:&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\P&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;rogram Files (x86)&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\I&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;AR Systems&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\E&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;mbedded Workbenc
h 6.5&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\4&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\b&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;in&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\4&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;30bat.dll&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--macro&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;D:&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\D&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;ocuments&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\I&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;AR4Unity&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\e&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;xample&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\t&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;est&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\c&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;ycle_counter.mac&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--backend&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-B&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;--hardware_multi
plier&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;32&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;--hwmult_type&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;8&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;-p&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;D:&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\D&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;ocuments&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\I&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;AR4Unity&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\e&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;xample&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\t&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;est&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\t&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;est_msp430fr5739.ddf&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;--core=430Xv2&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;--data
_model=small&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;--iv_base&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;0xFF90&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;--odd_word_check&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;-d&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;sim&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;--derivativeSim&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;MSP430FR5739&quot;&lt;/span&gt;

     IAR C-SPY Command Line Utility V6.6.3.2839
     Copyright 2000-2013 IAR Systems AB.


~~~~UNIT TESTING~~~~

Uart Suite
PASS - test_RxBufferEnqueue&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;test_uart.c:21&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;|time:0.003|
PASS - test_RxBufferEnqueue&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;test_uart.c:31&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;|time:0.004|
PASS - test_RxBufferEnqueue&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;test_uart.c:46&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;|time:0.003|
PASS - test_RxBufferDequeue&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;test_uart.c:58&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;|time:0.003|
PASS - test_RxBufferDequeue&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;test_uart.c:69&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;|time:0.003|
PASS - test_RxBufferDequeue&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;test_uart.c:77&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;|time:0.003|
PASS - test_RxBufferDequeue&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;test_uart.c:79&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;|time:0.003|
PASS - test_RxBufferDequeue&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;test_uart.c:81&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;|time:0.003|

Tests run: 8
Tests Failed: 0
ALL TESTS PASSED
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;ต่อไปลองเข้าไปแก้ให้การทดสอบมันไม่ผ่านบ้างหน้าตามันจะเป็นยังไง
ให้เปิดไฟล์ &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/example/test/unit_test/test_uart.c&lt;/code&gt; ขึ้นมาแก้ไขบรรทัดที่ 21&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;จาก&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-c&quot; data-lang=&quot;c&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;n&quot;&gt;TEST_ASSERT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Rx buf size incorrect after buffering 1 byte&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;rx_size&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;เป็น&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-c&quot; data-lang=&quot;c&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;n&quot;&gt;TEST_ASSERT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Rx buf size incorrect after buffering 1 byte&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;rx_size&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;p&gt;จากนั้นสั่ง clean, build และรัน test อีกรอบจะเจอว่ามีกรณีที่ทดสอบไม่ผ่านอยู่&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;PS D:&lt;span class=&quot;se&quot;&gt;\D&lt;/span&gt;ocuments&lt;span class=&quot;se&quot;&gt;\I&lt;/span&gt;AR4Unity&lt;span class=&quot;se&quot;&gt;\e&lt;/span&gt;xample&lt;span class=&quot;se&quot;&gt;\t&lt;/span&gt;est&amp;gt; IarBuild.exe .&lt;span class=&quot;se&quot;&gt;\.&lt;/span&gt;.&lt;span class=&quot;se&quot;&gt;\t&lt;/span&gt;est&lt;span class=&quot;se&quot;&gt;\c&lt;/span&gt;anary.ewp &lt;span class=&quot;nt&quot;&gt;-clean&lt;/span&gt; Debug

     IAR Command Line Build Utility V6.6.3.2839
     Copyright 2002-2013 IAR Systems AB.

Deleting outputs &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;configuration Debug
Updating build tree...

8  file&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;s&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; deleted.
PS D:&lt;span class=&quot;se&quot;&gt;\D&lt;/span&gt;ocuments&lt;span class=&quot;se&quot;&gt;\I&lt;/span&gt;AR4Unity&lt;span class=&quot;se&quot;&gt;\e&lt;/span&gt;xample&lt;span class=&quot;se&quot;&gt;\t&lt;/span&gt;est&amp;gt; IarBuild.exe .&lt;span class=&quot;se&quot;&gt;\.&lt;/span&gt;.&lt;span class=&quot;se&quot;&gt;\t&lt;/span&gt;est&lt;span class=&quot;se&quot;&gt;\c&lt;/span&gt;anary.ewp &lt;span class=&quot;nt&quot;&gt;-make&lt;/span&gt; Debug

     IAR Command Line Build Utility V6.6.3.2839
     Copyright 2002-2013 IAR Systems AB.

Building configuration: canary - Debug
Updating build tree...
main.c
test_uart.c
Linking


Total number of errors: 0
Total number of warnings: 0
PS D:&lt;span class=&quot;se&quot;&gt;\D&lt;/span&gt;ocuments&lt;span class=&quot;se&quot;&gt;\I&lt;/span&gt;AR4Unity&lt;span class=&quot;se&quot;&gt;\e&lt;/span&gt;xample&lt;span class=&quot;se&quot;&gt;\t&lt;/span&gt;est&amp;gt; .&lt;span class=&quot;se&quot;&gt;\.&lt;/span&gt;.&lt;span class=&quot;se&quot;&gt;\s&lt;/span&gt;ettings&lt;span class=&quot;se&quot;&gt;\c&lt;/span&gt;anary.cspy.bat .&lt;span class=&quot;se&quot;&gt;\D&lt;/span&gt;ebug&lt;span class=&quot;se&quot;&gt;\E&lt;/span&gt;xe&lt;span class=&quot;se&quot;&gt;\c&lt;/span&gt;anary.d43

D:&lt;span class=&quot;se&quot;&gt;\D&lt;/span&gt;ocuments&lt;span class=&quot;se&quot;&gt;\I&lt;/span&gt;AR4Unity&lt;span class=&quot;se&quot;&gt;\e&lt;/span&gt;xample&lt;span class=&quot;se&quot;&gt;\t&lt;/span&gt;est&amp;gt;&lt;span class=&quot;s2&quot;&gt;&quot;C:&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\P&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;rogram Files (x86)&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\I&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;AR Systems&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\E&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;mbedded Workbench 6.5&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\c&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;ommon&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\b&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;in&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\c&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;spybat&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;C:&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\P&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;
rogram Files (x86)&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\I&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;AR Systems&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\E&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;mbedded Workbench 6.5&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\4&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\b&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;in&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\4&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;30proc.dll&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;C:&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\P&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;rogram Files (x86)&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\I&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;AR Systems&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\E&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;mbedded
Workbench 6.5&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\4&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\b&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;in&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\4&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;30sim.dll&quot;&lt;/span&gt;  .&lt;span class=&quot;se&quot;&gt;\D&lt;/span&gt;ebug&lt;span class=&quot;se&quot;&gt;\E&lt;/span&gt;xe&lt;span class=&quot;se&quot;&gt;\c&lt;/span&gt;anary.d43 &lt;span class=&quot;nt&quot;&gt;--plugin&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;C:&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\P&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;rogram Files (x86)&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\I&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;AR Systems&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\E&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;mbedded Workbenc
h 6.5&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\4&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\b&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;in&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\4&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;30bat.dll&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--macro&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;D:&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\D&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;ocuments&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\I&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;AR4Unity&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\e&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;xample&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\t&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;est&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\c&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;ycle_counter.mac&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--backend&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-B&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;--hardware_multi
plier&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;32&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;--hwmult_type&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;8&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;-p&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;D:&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\D&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;ocuments&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\I&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;AR4Unity&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\e&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;xample&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\t&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;est&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\t&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;est_msp430fr5739.ddf&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;--core=430Xv2&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;--data
_model=small&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;--iv_base&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;0xFF90&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;--odd_word_check&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;-d&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;sim&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;--derivativeSim&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;MSP430FR5739&quot;&lt;/span&gt;

     IAR C-SPY Command Line Utility V6.6.3.2839
     Copyright 2000-2013 IAR Systems AB.


~~~~UNIT TESTING~~~~

Uart Suite
FAIL - test_RxBufferEnqueue&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;test_uart.c:21&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;-Rx&lt;/span&gt; buf size incorrect after buffering 1 byte|time:0.003|
PASS - test_RxBufferEnqueue&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;test_uart.c:31&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;|time:0.004|
PASS - test_RxBufferEnqueue&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;test_uart.c:46&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;|time:0.003|
PASS - test_RxBufferDequeue&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;test_uart.c:58&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;|time:0.003|
PASS - test_RxBufferDequeue&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;test_uart.c:69&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;|time:0.003|
PASS - test_RxBufferDequeue&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;test_uart.c:77&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;|time:0.003|
PASS - test_RxBufferDequeue&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;test_uart.c:79&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;|time:0.003|
PASS - test_RxBufferDequeue&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;test_uart.c:81&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;|time:0.003|

Tests run: 8
Tests Failed: 1
PS D:&lt;span class=&quot;se&quot;&gt;\D&lt;/span&gt;ocuments&lt;span class=&quot;se&quot;&gt;\I&lt;/span&gt;AR4Unity&lt;span class=&quot;se&quot;&gt;\e&lt;/span&gt;xample&lt;span class=&quot;se&quot;&gt;\t&lt;/span&gt;est&amp;gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;p&gt;ซึ่งเวลาที่มีกรณีทดสอบไม่ผ่านก็จะมีข้อความบอกรายละเอียดเพิ่มเติมตามรูปแบบของมาโครที่ได้ออกแบบไว้&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;FAIL - test_RxBufferEnqueue&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;test_uart.c:21&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;-Rx&lt;/span&gt; buf size incorrect after buffering 1 byte|time:0.003|
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;p&gt;ด้านล่างนี้คือโค้ดบางส่วนของ TEST_ASSERT มาโครที่ใช้สำหรับทดสอบจะเห็นได้ว่ามีโค้ดแค่นิดเดียวเองซึ่งถึงแม้ว่าจะเป็นมือใหม่ก็สามารถทำความเข้าใจและปรับปรุงให้เป็น test framework ในแบบที่เราต้องการได้&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-c&quot; data-lang=&quot;c&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;cp&quot;&gt;#define PRINT_PASS()     printf(&quot;PASS - %s(%s:%d)&quot;,__FUNCTION__,__FILE__,__LINE__)
#define PRINT_FAIL(m)    printf(&quot;FAIL - %s(%s:%d)-%s&quot;,__FUNCTION__,__FILE__,__LINE__,m)
&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;#define TEST_ASSERT(message, test)  \
    do                              \
    {                               \
        if (test)                   \
        {                           \
            tests_failed++;         \
            PRINT_FAIL(message);    \
        }                           \
        else                        \
        {                           \
            PRINT_PASS();           \
        }                           \
        tests_run++;                \
        printf(&quot;|time:%.3f|\n&quot;,(float)((_cycle_cnt - _cycle_start))/16000000); \
        _cycle_start = _cycle_cnt;  \
    } while (0)&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;p&gt;…&amp;lt;3&lt;/p&gt;
</description>
        <pubDate>Thu, 23 Jul 2015 00:00:00 +0000</pubDate>
        <link>http://eswizardry.com/2015/07/23/try-tdd-msp430/</link>
        <guid isPermaLink="true">http://eswizardry.com/2015/07/23/try-tdd-msp430/</guid>
        
        <category>tdd</category>
        
        <category>msp430</category>
        
        
      </item>
    
      <item>
        <title>มาเพิ่มแท็บให้กับ SourceInsight ด้วย TabSiPlus</title>
        <description>&lt;p&gt;&lt;a href=&quot;/2015/07/15/tabsi-sourceinsight/&quot;&gt;&lt;img src=&quot;/assets/tabSiPlus/SI-about-logo.jpg&quot; /&gt;&lt;/a&gt;
&lt;!--more--&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.sourceinsight.com/&quot;&gt;SourceInsight&lt;/a&gt; เป็น &lt;a href=&quot;https://en.wikipedia.org/wiki/Text_editor&quot;&gt;Text editor&lt;/a&gt; ตัวหนึ่งที่ผมใช้ทำงานเป็นหลัก (ส่วนมากใช้อยู่ที่ทำงาน) ก่อนจะเปลี่ยนมาใช้ &lt;a href=&quot;http://www.sublimetext.com/&quot;&gt;Sublime Text&lt;/a&gt; ในปัจจุบันซึ่งก็ใช้ในการพัฒนาและเขียนบล็อกในเว็บนี้ด้วย&lt;/p&gt;

&lt;h2 id=&quot;sourceinsight&quot;&gt;SourceInsight&lt;/h2&gt;
&lt;p&gt;เป็น &lt;a href=&quot;https://en.wikipedia.org/wiki/Text_editor&quot;&gt;Text editor&lt;/a&gt; ที่พัฒนาโดยบริษัท SourceDynamic มี features ที่เด่นดังนี้&lt;/p&gt;

&lt;h3 id=&quot;sourceinsight-features&quot;&gt;&lt;a href=&quot;http://www.sourceinsight.com/prodinfo.html&quot;&gt;SourceInsight Features&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;Call Graphs and Class Tree Diagrams&lt;/li&gt;
  &lt;li&gt;Context Sensitive Dynamic Type Resolution&lt;/li&gt;
  &lt;li&gt;Symbol Windows For Each File&lt;/li&gt;
  &lt;li&gt;Automatic Display of Declarations in the Context Window&lt;/li&gt;
  &lt;li&gt;Syntax Formatting - Like Syntax Coloring but More&lt;/li&gt;
  &lt;li&gt;Context-Sensitive Smart Rename&lt;/li&gt;
  &lt;li&gt;Finds References Quickly&lt;/li&gt;
  &lt;li&gt;Mixed Language Editing&lt;/li&gt;
  &lt;li&gt;Keyword Searches Like an Internet Search on Your Code Base&lt;/li&gt;
  &lt;li&gt;Symbolic Auto-Completion&lt;/li&gt;
  &lt;li&gt;Quick Access to All Symbols and Files&lt;/li&gt;
  &lt;li&gt;Project Orientation&lt;/li&gt;
  &lt;li&gt;etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;จากฟังก์ชันการทำงานนี่ถือว่าเป็น &lt;a href=&quot;https://en.wikipedia.org/wiki/Text_editor&quot;&gt;Text editor&lt;/a&gt; ที่ครบเครื่องมาก ถ้าจะมีตัวเปรียบเทียบที่ทำความสารถได้ขนาดนี้โดยไม่ต้องมีส่วนเสริม (plug-in) แล้วล่ะก็เห็นจะมีแต่ &lt;a href=&quot;http://www.slickedit.com/&quot;&gt;SlickEdit&lt;/a&gt; อีกตัวซึ่งตัวนี้อาจมีฟังก์ชันเยอะกว่า &lt;a href=&quot;http://www.sourceinsight.com/&quot;&gt;SourceInsight&lt;/a&gt; ด้วยซ้ำไปแต่สำหรับผมคิดว่ามันเยอะเกินพอดีทำให้กินทรัพยากรของเครื่องมากไปและหน้าตาของมันแม้จะดูทันสมัยแต่ก็เต็มไปด้วย scroll bar ซึ่งกินพื้นที่การทำงานบนหน้าจอไปเยอะเลย รู้สึกว่ามันรก&lt;/p&gt;

&lt;p&gt;กลับมาที่ &lt;a href=&quot;http://www.sourceinsight.com/&quot;&gt;SourceInsight&lt;/a&gt; พระเอกของเรากันต่อ สำหรับผมแล้วนอกจากหน้าตาที่ดูออกจะโบราณแล้ว ( เนื่องจากว่า &lt;a href=&quot;http://www.sourceinsight.com/&quot;&gt;SourceInsight&lt;/a&gt; นั้นไม่มีการพัฒนาเพื่อเพิ่มฟังก์ชันต่างๆ ไปหลายปีแล้วหรือจะบอกว่าเลิกพัฒนาไปแล้วก็ได้, นอกจากแก้ bug หรือพอร์ตไป windows เวอร์ชันใหม่) ก็มีอีกอย่างที่ผมอยากได้จาก &lt;a href=&quot;http://www.sourceinsight.com/&quot;&gt;SourceInsight&lt;/a&gt; คือแท็บของไฟล์ที่เราเปิดทำงานอยู่ทั้งหมดเพื่อเพิ่มความสะดวกในการเปลี่ยนไปทำงานกับไฟล์อื่นๆ และยังทำให้รู้สถานะว่าเราเปิดไฟล์อะไรค้างไว้บ้าง&lt;/p&gt;

&lt;p&gt;ด้านล่างคือ SourceInsight แบบดั้งเดิมที่ยังไม่มี tab
&lt;img src=&quot;/assets/tabSiPlus/SI-noTap.jpg&quot; alt=&quot;notap&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;tabsiplus&quot;&gt;&lt;a href=&quot;http://goo.gl/1vI6AT&quot;&gt;TabSiPlus&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;http://goo.gl/1vI6AT&quot;&gt;TabSiPlus&lt;/a&gt; เป็น plug-in ของ SourceInsight ที่พัฒนาโดยโปรแกรมเมอร์ชาวจีนซึ่งใช้ชื่อว่า Simon.W&lt;/p&gt;

&lt;h3 id=&quot;สิ่งที่จำเป็นต้องมีในการใช้งาน-tabsiplus&quot;&gt;สิ่งที่จำเป็นต้องมีในการใช้งาน &lt;a href=&quot;http://goo.gl/1vI6AT&quot;&gt;TabSiPlus&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.microsoft.com/en-us/download/details.aspx?id=29&quot;&gt;Microsoft Visual C++ 2008 Redistributable Package&lt;/a&gt;
อันนี้ต้องถูกติดตั้งในเครื่องเพื่อการทำงานที่ถูกต้องของ TabSiPlus&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;การใช้งาน-tabsiplus&quot;&gt;การใช้งาน &lt;a href=&quot;http://goo.gl/1vI6AT&quot;&gt;TabSiPlus&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;หลังจากโหลด TabSiplus มาแล้วให้ copy โฟลเดอร์ไปไว้ที่เราต้องการได้เลยหลังจากนั้นเปิดเข้าไปในโฟลเดอร์
แล้วดับเบิ้ลคลิก TabSiHost ถ้าไม่มีข้อผิดพลาดอะไรแค่นี้ TabSiPlus ก็ทำงานเรียบร้อยแล้ว
&lt;img src=&quot;/assets/tabSiPlus/tapSi-host-run.jpg&quot; alt=&quot;้host&quot; /&gt;&lt;/p&gt;

&lt;p&gt;เปิด SourceInsight ขึ้นมาก็จะเจอกับ Tab ที่เพิ่มขึ้นมา
&lt;img src=&quot;/assets/tabSiPlus/SI-addTap-toTop.jpg&quot; alt=&quot;taptop&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;tabsiplus-customization&quot;&gt;&lt;a href=&quot;http://goo.gl/1vI6AT&quot;&gt;TabSiPlus&lt;/a&gt; customization&lt;/h2&gt;
&lt;p&gt;ใหเปิดเข้าไปในโฟลเดอร์ของ TabSiPlus อีกทีจากนั้นเปิดไฟล์ Tabtest ขึ้นมาเพื่อปรับแต่ง theme ของ tab
&lt;img src=&quot;/assets/tabSiPlus/tapSi-folder-setting.jpg&quot; alt=&quot;้tabtest&quot; /&gt;&lt;/p&gt;

&lt;p&gt;เปิดขึ้นมาแล้วจะเจอกับหน้าปรับแต่งธีมที่มีเครื่องหมายคำถามเต็มไปหมด
&lt;img src=&quot;/assets/tabSiPlus/tapSi-load-setting.jpg&quot; alt=&quot;้font&quot; /&gt;&lt;/p&gt;

&lt;p&gt;หน้านี้ปรับแต่ง font
&lt;img src=&quot;/assets/tabSiPlus/tapsi-font-setting.jpg&quot; alt=&quot;้font&quot; /&gt;&lt;/p&gt;

&lt;p&gt;หน้านี้ปรับ option ว่าต้องการให้มีไอคอนสำหรับปิดแท็บไหม และกรุ๊ปแท็บที่มีชื่อเดียวกันไหม
&lt;img src=&quot;/assets/tabSiPlus/tapSi-addexitIconOption-setting.jpg&quot; alt=&quot;้option&quot; /&gt;&lt;/p&gt;

&lt;p&gt;อันข้างล่างคือตัวอย่างธีมที่ผมปรับแต่งไว้
&lt;img src=&quot;/assets/tabSiPlus/tapSi-save-setting.jpg&quot; alt=&quot;้option&quot; /&gt;&lt;/p&gt;

&lt;h4 id=&quot;และภายในหน้าต่างของ-sourceinsight-ที่มี-tabsiplus-เกาะอยู่เรายังสามารถปรับแต่ง-option-ต่างได้อีกหลายอย่างเช่น&quot;&gt;และภายในหน้าต่างของ SourceInsight ที่มี TabSiPlus เกาะอยู่เรายังสามารถปรับแต่ง option ต่างได้อีกหลายอย่างเช่น&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;เลือก theme ที่เราสร้างขึ้น&lt;/li&gt;
  &lt;li&gt;ปรับให้แท็บอยู่ข้างล่างหรือข้างบน&lt;/li&gt;
  &lt;li&gt;อื่นๆ ลองปรับแต่งกันดูได้ครับ&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/assets/tabSiPlus/SI-tapOption-click.jpg&quot; alt=&quot;้optioUI&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/tabSiPlus/tapSiPlus-option-menu.jpg&quot; alt=&quot;้optioUI&quot; /&gt;&lt;/p&gt;

&lt;p&gt;บล็อกนี้หลักๆแล้วผมต้องการบันทึกไว้กันลืมสำหรับตัวเองเผื่ออนาคตได้กลับมาใช้ SourceInsight อีก…&amp;lt;3&lt;/p&gt;
</description>
        <pubDate>Wed, 15 Jul 2015 00:00:00 +0000</pubDate>
        <link>http://eswizardry.com/2015/07/15/tabsi-sourceinsight/</link>
        <guid isPermaLink="true">http://eswizardry.com/2015/07/15/tabsi-sourceinsight/</guid>
        
        <category>tools</category>
        
        
      </item>
    
      <item>
        <title>การใช้งาน GitHub Page เพื่อโฮสเว็บไซต์ที่สร้างด้วย Jekyll</title>
        <description>&lt;p&gt;&lt;a href=&quot;/2015/07/15/github-page/&quot;&gt;&lt;img src=&quot;/assets/github-pages-jekyll.jpg&quot; /&gt;&lt;/a&gt;
&lt;!--more--&gt;
หลังจากบล็อกที่แล้วได้นำเสนอการสร้างเว็บไซต์ด้วย &lt;a href=&quot;http://jekyllrb.com/&quot;&gt;Jekyll&lt;/a&gt; กันไปแล้วต่อไปเราจะมาดูวิธีการใช้งานและโฮสต์เว็บด้วย &lt;a href=&quot;https://pages.github.com/&quot;&gt;GitHub Pages&lt;/a&gt; กัน&lt;/p&gt;

&lt;h2 id=&quot;ทำไมต้องโฮสต์เว็บไซต์ที่-github-page&quot;&gt;ทำไมต้องโฮสต์เว็บไซต์ที่ GitHub Page?&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;ฟรี!&lt;/strong&gt; GitHub ให้เราสามารถโฮสต์เว็บส่วนตัวได้แบบฟรีๆ 1 เว็บ&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;ง่าย&lt;/strong&gt; Jekyll นั้นถูกสร้างมาเพื่อใช้กับ GitHub เพราะว่าเว็บที่จะโฮสต์บน GitHub ได้ต้องเป็น static website (สร้างจาก HTML&amp;amp;CSS และ JavaScript เท่านั้น) ซึ่ง Jekyll เองก็เป็น static site genarator&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Git practicing&lt;/strong&gt; ได้เรียนรู้การใช้งานใช้งาน Git และ GitHup ไปในตัว&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;h2 id=&quot;สิ่งที่จำเป็นต้องมีก่อนการใช้งาน-github-page&quot;&gt;สิ่งที่จำเป็นต้องมีก่อนการใช้งาน GitHub Page&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;Git ถ้ายังไม่มีให้ไป &lt;a href=&quot;https://git-scm.com/download&quot;&gt;Download&lt;/a&gt; และ install ก่อน&lt;/li&gt;
  &lt;li&gt;GitHub user ถ้ายังไม่มีก็สามารถสมัครใช้งานใหม่ได้ที่ &lt;a href=&quot;https://github.com/&quot;&gt;GitHub&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;ถ้ามีครบแล้วก็ไปขั้นตอนต่อไปเลย&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;h2 id=&quot;สร้าง-repository-บน-github&quot;&gt;สร้าง Repository บน GitHub&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;ให้ล็อกอินเข้าไปที่ GitHup user ของเราเพื่อสร้าง repository ใหม่ &lt;strong&gt;+New repository&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/assets/gh-page/new-repo.jpg&quot; alt=&quot;new-repo&quot; /&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;จากนั้นก็สร้าง repository โดยใช้ชื่อ reposotory เป็นไปตามรูปแบบนี้เท่านั้น &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Username.github.io&lt;/code&gt; ถ้าเป็นรูปแบอื่นไม่ได้ รวมทั้งต้องกำหนด public ด้วยเพราะว่าเราจะสร้างเว็บซึ่งต้องให้คนอื่นเข้าถึงด้วย&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/assets/gh-page/create-repo.jpg&quot; alt=&quot;create-repo&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;h2 id=&quot;โคลน-repository-ที่เราพึ่งสร้างลงมาที่เครื่องเรา&quot;&gt;โคลน repository ที่เราพึ่งสร้างลงมาที่เครื่องเรา&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;เปิด terminal ขึ้นมา (จะใช้ command prompt, Git bash อื่นๆ) แล้วสร้าง folder ที่จะใช้ทำงาน&lt;/li&gt;
&lt;/ul&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;mkdir&lt;/span&gt; /path/to/source-code
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; /path/to/source-code
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;ul&gt;
  &lt;li&gt;ไปที่ GitHub repositoy ของเราแล้ว copy URL ของ repository ที่เราสร้างขึ้นมา&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/assets/gh-page/copy-to-clipboard.jpg&quot; alt=&quot;copy-to-clipboard&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;โคลน repository โดยใช้คำสั่ง Git&lt;/li&gt;
&lt;/ul&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git clone https://github.com/username/username.github.io.git
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;username.github.io
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;h2 id=&quot;ทดสอบการอัพโหลดไฟล์ขึ้น-github-ด้วยคำสั่ง-git&quot;&gt;ทดสอบการอัพโหลดไฟล์ขึ้น GitHub ด้วยคำสั่ง Git&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;สร้างไฟล์ใหม่ไว้ใน folder ของที่เราทำงานอยู่ให้ชื่อ &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;index.html&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;โดยในไฟล์ให้พิมพ์ช้อความ &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Hello World&lt;/code&gt;เข้าไป&lt;/li&gt;
&lt;/ul&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
8
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git add index.html
...

&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git commit index.html &lt;span class=&quot;nt&quot;&gt;-m&lt;/span&gt; “Initial commit with my Hello world”
...

&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git push origin master
...
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;ul&gt;
  &lt;li&gt;เสร็จเรียบร้อย ให้เปิดบราวเซอร์ขึ้นมาแล้วเข้าไปที่ URL ของ repository เรา “https://&lt;strong&gt;username&lt;/strong&gt;.github.io”
ก็จะเจอกับข้อความ &lt;br /&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
  &lt;p&gt;Hello World&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;h2 id=&quot;อัพโหลดเว็บไซต์ที่สร้างด้วย-jekyll-จากบล็อกที่แล้วไปที่-githup-page&quot;&gt;อัพโหลดเว็บไซต์ที่สร้างด้วย &lt;a href=&quot;http://eswizardry.com2015/07/12/introducing-jekyll/&quot;&gt;Jekyll&lt;/a&gt; จาก&lt;a href=&quot;http://eswizardry.com/2015/07/12/introducing-jekyll/&quot;&gt;บล็อก&lt;/a&gt;ที่แล้วไปที่ GitHup Page&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;copy ไฟล์ที่อยู่ในโฟลเดอร์ “my-awesome-site” ทั้งหมดไปแทนที่ไฟล์ในโฟลเดอร์ที่เราโคลนมาเมื่อก่อนหน้าจากนั้นก็ใช้คำสั่ง Git เพื่ออัพไฟล์ไปที่ GitHub&lt;/li&gt;
&lt;/ul&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
8
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git add &lt;span class=&quot;nt&quot;&gt;-A&lt;/span&gt;
...

&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git commit &lt;span class=&quot;nt&quot;&gt;-m&lt;/span&gt; “Add Jekyll”
...

&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git push origin master
...
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;สำเร็จแล้ว!&lt;/p&gt;
</description>
        <pubDate>Wed, 15 Jul 2015 00:00:00 +0000</pubDate>
        <link>http://eswizardry.com/2015/07/15/github-page/</link>
        <guid isPermaLink="true">http://eswizardry.com/2015/07/15/github-page/</guid>
        
        <category>github</category>
        
        <category>jekyll</category>
        
        <category>web</category>
        
        
      </item>
    
      <item>
        <title>มาสร้างเว็บบล็อกด้วย Jekyll กันเถอะ</title>
        <description>&lt;p&gt;&lt;a href=&quot;/2015/07/12/introducing-jekyll/&quot;&gt;&lt;img src=&quot;/assets/jekylllogo.jpg&quot; /&gt;&lt;/a&gt;
&lt;!--more--&gt;
&lt;strong&gt;สวัสดีชาวโลก&lt;/strong&gt; นี่เป็นโพสต์แรกของเว็บบล็อกแห่งนี้ขอประเดิมด้วยแนะนำการสร้างเว็บบล็อกด้วย &lt;a href=&quot;http://jekyllrb.com/&quot;&gt;Jekyll&lt;/a&gt; และโฮสต์เว็บด้วย &lt;a href=&quot;https://pages.github.com/&quot;&gt;GitHub Pages&lt;/a&gt; ซึ่งเว็บบล็อกแห่งนี้ก็สร้างและโฮสต์โดยทั้งสองอย่างที่กล่าวมา&lt;br /&gt;&lt;/p&gt;

&lt;h2 id=&quot;รู้จักกับ-jekyll&quot;&gt;รู้จักกับ &lt;a href=&quot;http://jekyllrb.com/&quot;&gt;Jekyll&lt;/a&gt;&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;Jekyll คือ &lt;a href=&quot;https://rubygems.org/&quot;&gt;ruby gem&lt;/a&gt; ซึ่งทำหน้าที่เป็น parsing engine เพื่อใช้ในการสร้างเว็บไซต์ &lt;a href=&quot;https://en.wikipedia.org/wiki/Static_web_page&quot;&gt;static websites&lt;/a&gt; โดยการ parsing จากไฟล์ templates, HTML &amp;amp; CSS, markdown, รูปภาพ และ อื่นๆ โดย Jekyll นี้จัดว่าเป็นหนึ่งใน &lt;a href=&quot;https://staticsitegenerators.net/&quot;&gt;static site generator&lt;/a&gt; โดยมีสโลแกนว่า &lt;strong&gt;“Simple, blog-aware, static sites”&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;ติดตั้ง-jekyll&quot;&gt;ติดตั้ง &lt;a href=&quot;http://jekyllrb.com/&quot;&gt;Jekyll&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;ก่อนที่จะเริ่มสร้างเว็บไซต์ด้วย &lt;a href=&quot;http://jekyllrb.com/&quot;&gt;Jekyll&lt;/a&gt; มาดูกันก่อนว่าเราต้องใช้อะไรบ้าง&lt;/p&gt;

&lt;h3 id=&quot;สิ่งที่จำเป็นต้องมีก่อนการสร้างเว็บด้วย-jekyll-dependencies&quot;&gt;สิ่งที่จำเป็นต้องมีก่อนการสร้างเว็บด้วย Jekyll (Dependencies)&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.ruby-lang.org/en/&quot;&gt;Ruby&lt;/a&gt;.
    &lt;ul&gt;
      &lt;li&gt;การติดตั้ง ruby นั้นตรงไปตรงมาให้ดับเบิ้ลคลิกไฟล์ติดตั้ง ruby ที่ดาวน์โหลดมาแล้วทำตาม installation guide ได้เลย แต่ตอนติดตั้งให้เลือกด้วยว่าให้ เพิ่ม ruby เข้าไปที่ system path ของ windows ด้วย&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.ruby-lang.org/en/&quot;&gt;Ruby Devkit&lt;/a&gt;.
    &lt;ul&gt;
      &lt;li&gt;การติดตั้ง ruby devkit นั้นยุ่งยากนิดหน่อยอันนี้จะบอกวิธีการทำทีละขั้นตอนตามนี้&lt;/li&gt;
      &lt;li&gt;เปิด command prompt ขึ้นมาแล้วใช้คำสั่ง &lt;code class=&quot;language-html highlighter-rouge&quot;&gt;ruby -v&lt;/code&gt; เพื่อตรวจสอบเวอร์ชันของ ruby&lt;/li&gt;
      &lt;li&gt;เมื่อรู้เวอร์ชันแล้วก้อเข้าไปดาวน์โหลดตัวติดตั้ง &lt;a href=&quot;http://rubyinstaller.org/downloads/&quot;&gt;Devkit&lt;/a&gt; ที่สอดคล้องกับ ruby&lt;/li&gt;
      &lt;li&gt;ติดตั้งโดยดับเบิ้ลคลิกไฟล์ดาวน์โหลดมาเพื่อติดตั้ง อันนี้แนะนำว่าให้ติดตั้งไว้ที่ C:\Devkit&lt;/li&gt;
      &lt;li&gt;จากนั้นพิมพ์คำสั่ง &lt;code class=&quot;language-html highlighter-rouge&quot;&gt;cd c:\DevKit&lt;/code&gt; เพื่อเข้าไปยังโฟลเดอร์ที่ติดตั้งและใช้คำสั่ง &lt;code class=&quot;language-html highlighter-rouge&quot;&gt;ruby dk.rb init&lt;/code&gt; และ &lt;code class=&quot;language-html highlighter-rouge&quot;&gt;ruby dk.rb install&lt;/code&gt; ตามลำดับ&lt;/li&gt;
      &lt;li&gt;เพื่อความแน่ใจว่าติดตั้งเรียบร้อย ลองใช้คำสั่ง &lt;code class=&quot;language-html highlighter-rouge&quot;&gt;gem install json --platform=ruby&lt;/code&gt; และลองรัน ๋JSON ดู &lt;code class=&quot;language-html highlighter-rouge&quot;&gt;ruby -rubygems -e &quot;require 'json'; puts JSON.load('[42]').inspect&quot;&lt;/code&gt;&lt;/li&gt;
      &lt;li&gt;ถ้าไม่มีอะไรผิดพลาดก็จะได้ผลลัพธ์ตามด้านล่างนี้&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;    C:&lt;span class=&quot;se&quot;&gt;\D&lt;/span&gt;evkit&amp;gt;ruby &lt;span class=&quot;nt&quot;&gt;-rubygems&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;require 'jso
    n'; puts JSON.load('[42]').inspect&quot;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;42]
    
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;install-jekyll&quot;&gt;Install Jekyll&lt;/h3&gt;
&lt;p&gt;ถ้ามีตามข้างบนครบแล้วก็มาติดตั้ง Jekyll กันเลย โดยเปิด command prompt ขึ้นมาแล้วก็พิมพ์คำสั่งสำหรับติดตั้ง &lt;code class=&quot;language-html highlighter-rouge&quot;&gt;gem install jekyll&lt;/code&gt; จากนั้นก็รอจนกว่าจะติดตั้งเสร็จ อันนี้ใช้เวลาพอสมควรขึ้นอยู่กับความเร็วของเครื่องและอินเตอร์เน็ต&lt;/p&gt;

&lt;h2 id=&quot;สร้างเว็บไซต์ใน-1-นาทีด้วย-jekyll&quot;&gt;สร้างเว็บไซต์ใน 1 นาทีด้วย &lt;a href=&quot;http://jekyllrb.com/&quot;&gt;Jekyll&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;หลังจากติดตั้งเสร็จเรียบร้อยเราสามารถทดลองรันเว็บไซต์ตัวอย่างของ Jekyll โดยเปิด command prompt ขึ้นมาแล้ว cd ไปยัง directory ที่เราจะใช้ทำงาน อย่างของผมใช้ D:\doucuments ก็สามารถใช้ &lt;code class=&quot;language-html highlighter-rouge&quot;&gt;cd D:\doucuments&lt;/code&gt; จากนั้นก็พิมพ์คำสั่งตามด้านล่าง&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; gem &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;jekyll
&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; jekyll new my-awesome-site
&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;my-awesome-site
&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; jekyll serve
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;หลังจากรันคำสั่งด้านบนเสร็จจะได้ผลลัพธ์ตามนี้
&lt;img src=&quot;/assets/cmd-jekyll-serve.jpg&quot; alt=&quot;Jekyll-serve&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;
จากนั้นให้เปิดเว็บเบราเซอร์แแล้วป้อน &lt;a href=&quot;http://localhost:4000&quot;&gt;http://localhost:4000&lt;/a&gt;
&lt;img src=&quot;/assets/awesome-site-localhost4000.jpg&quot; alt=&quot;awesome-site&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;
แค่นี้เราก็ได้เว็บไซต์แรกที่สร้างด้วย &lt;a href=&quot;http://jekyllrb.com/&quot;&gt;Jekyll&lt;/a&gt; แล้วเห็นไหมว่าง่ายและใช้เวลาน้อยกว่าต้มมาม่าซะอีก&lt;/p&gt;

&lt;p&gt;ทีแรกกะว่าจะรวมการโฮสต์เว็บที่สร้างขึ้นมาจาก Jekyll ด้วยแต่ขอยกไปไว้บล็อกถัดไปดีกว่า เดี๋ยวผมจะมานำเสนอเกี่ยวกับการโฮสต์เว็บไซต์ด้วย &lt;a href=&quot;https://pages.github.com/&quot;&gt;GitHub Pages&lt;/a&gt; ต่อ…&amp;lt;3&lt;/p&gt;
</description>
        <pubDate>Sun, 12 Jul 2015 00:00:00 +0000</pubDate>
        <link>http://eswizardry.com/2015/07/12/introducing-jekyll/</link>
        <guid isPermaLink="true">http://eswizardry.com/2015/07/12/introducing-jekyll/</guid>
        
        <category>jekyll</category>
        
        <category>web</category>
        
        
      </item>
    
  </channel>
</rss>
