Intel x86 Quark D2000 MCU Developer Kit 共學團

緣起
前一陣子知道 Intel 出 MCU, 這這這是怎麼回事,超級好奇以 Intel 這樣超高技術與製程能力,會是做出什麼樣的 MCU? 一直沒在 MCU 市場琢磨的 Intel, 做的 MCU 能看嗎?
由於機緣,入手了一台,想說研究一下,看看到底是個什麼樣的東西
循著網站步驟,安裝完軟體,不用 ICE,就可以使用在 Eclipse 下中斷,Debug
仔細一看,板子開源, Debugger tool, IDE, 韌體全開源, SDK/Sample code 也全部開放,再加上 Intel 的文件與品質與 NT 533 的入手價格
這一定得好好研究透徹啊,搞清楚其中所有環節,保證讓你功力提昇一甲子
哈爸自己也已經研究了好幾天了,還是很多部份實在不懂,於是想跟大家一起共學,大家一同研究,透過一同研究,彼此分享學習,順便交交朋友
共學方式
- 意願表達即可加入
- 會加入一個臉書串
- 在此共筆研究心得
- 另找時間在 StarFab(清大育成中心) 聚會討論
第一次線上共學
時間:8/16 20:00-21:00
方式: Zoom
- Topic: Intel x86 Quark D2000 MCU Developer Kit 共學團 - 第一次線上共學
- Time: Aug 16, 2016 8:00 PM (GMT+8:00) Taipei
- Join from PC, Mac, Linux, iOS or Android: https://zoom.us/j/2227091234?pwd=BI9xwepvbWM%3D
- Password: 0816
介紹:
- 在實體聚會之前,先讓大家彼此分享一下目前學習的心得,也讓大家進入狀況,或是問一些問題。
Agenda:
0-5m 等待大家加入
5-25m 哈爸介紹目前共筆內容與共學形式
25-35m 參與者一分鐘自介
35-55m Q&A 或 夥伴心得分享
55-60 結尾
會議前準備:
- 可將學習心得更新到此共筆,或是事前提問,以增加會議效率
第一次實體共學
時間:8/23 19:00-20:30
地點: StarFab Studio (新竹清大新育成中心 R918)
Agenda:
- 30m 一般性介紹 (哈爸)
- 25m 硬體簡介,原理圖,Layout 說明
- 25m 使用者韌體介紹
- 10m Q&A
會議前準備:
- 可將學習心得更新到此共筆,或是事前提問,以增加會議效率
會議記錄:
研究筆記
- Upgrade ROM by command line base
Open Command Window :
cd IntelSWTools/ISSM_2016.0.0XX
issm_env.bat
cd %ISSM_DEBUGGER_ROOT%/openocd
bin\openocd -f scripts/board/quark_d2000_onboard.cfg
=> OCD already open or attach to GDB
On a new window (or use a Terminal Emulator) open a telnet connection to OpenOCD :
telnet localhost 4444
clk32M
load_image ../../../firmware/bsp/1.0/soc/quark_d2000/rom/quark_d2000_rom.bin 0x0
- Open On-Chip Debugger 0.8.0-dev-g7845893 (2015-11-26-17:02)
- Licensed under GNU GPL v2
- For bug reports, read
- http://openocd.sourceforge.net/doc/doxygen/bugs.html
- Info : only one transport option; autoselect 'jtag'
- adapter speed: 1000 kHz
- trst_only separate trst_push_pull
- flash_rom
- Info : clock speed 1000 kHz
- Info : JTAG tap: quark_d2000.cltap tap/device found: 0x0e786013 (mfg: 0x009, part: 0xe786, ver: 0x0)
- Enabling lmt core tap
- Info : JTAG tap: quark_d2000.lmt enabled
- Info : accepting 'gdb' connection from 3333
- target state: halted
- target halted due to debug-request at 0x0000026e in protected mode
- force hard breakpoints
- Warn : negative acknowledgment, but no packet pending
- Warn : negative acknowledgment, but no packet pending
- Warn : negative acknowledgment, but no packet pending
- Warn : negative acknowledgment, but no packet pending
- Info : JTAG tap: quark_d2000.cltap tap/device found: 0x0e786013 (mfg: 0x009, part: 0xe786, ver: 0x0)
- Enabling lmt core tap
- Info : JTAG tap: quark_d2000.lmt enabled
- target state: halted
- target halted due to debug-request at 0x0000fff0 in real mode
- set_hwbp hardware breakpoint 0 set at 0x00180048 (hwreg=0)
- target running
- redirect to PM, tapstatus=0x08302c1c
- hit hardware breakpoint (hwreg=0) at 0x00180048
- unset_hwbp hardware breakpoint 0 removed from 0x00180048 (hwreg=0)
- Info : JTAG tap: quark_d2000.cltap tap/device found: 0x0e786013 (mfg: 0x009, part: 0xe786, ver: 0x0)
- Enabling lmt core tap
- Info : JTAG tap: quark_d2000.lmt enabled
- target state: halted
- target halted due to debug-request at 0x0000fff0 in real mode
- target running
- Warn : keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not sent! (1239). Workaround: increase "set remotetimeout" in GDB
- tools/debugger/openocd/scripts/board/quark_d2000_onboard.cfg
- hello_test, hello_test(flashing) configuration have no different in debug section, the difference in startup is flashing load image
- Hint
- setup environment variable
- source /opt/intel/issm_2016.0.019/issm_env.sh , add to ~/.bashrc
- manual test openocd
- cd $ISSM_DEBUGGER_ROOT/openocd
- bin\openocd -f scripts/board/quark_d2000_onboard.cfg
- open another shell: telnet localhost 4444
- command line ocd+gdb
- osboxes@osboxes:~/bin$ cat myocd
- cd /opt/intel/issm_2016.0.019/tools/debugger/openocd
- bin/openocd -f scripts/board/quark_d2000_onboard.cfg
- osboxes@osboxes:~/bin$ ./myocd
- Open On-Chip Debugger 0.8.0-dev-g7845893 (2015-11-26-17:02)
- Licensed under GNU GPL v2
- For bug reports, read
- http://openocd.sourceforge.net/doc/doxygen/bugs.html
- Info : only one transport option; autoselect ’jtag’
- adapter speed: 1000 kHz
- trst_only separate trst_push_pull
- flash_rom
- Info : clock speed 1000 kHz
- Info : JTAG tap: quark_d2000.cltap tap/device found: 0x0e786013 (mfg: 0x009, part: 0xe786, ver: 0x0)
- Enabling lmt core tap
- Info : JTAG tap: quark_d2000.lmt enabled
- redirect to PM, tapstatus=0x08302c14
- unknown break reason at 0x0000fff0
- Info : accepting ’gdb’ connection from 3333
- Error: lakemont_halt target not running
- in procedure ’halt’
- osboxes@osboxes:~/bin$ cat mygdb
- sudo /opt/intel/issm_2016.0.019/tools/debugger/gdb/gdb-ia
- osboxes@osboxes:~/bin$ ./mygdb
- GNU gdb (GDB) 7.9
- Copyright (C) 2015 Free Software Foundation, Inc.
- License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
- This is free software: you are free to change and redistribute it.
- There is NO WARRANTY, to the extent permitted by law. Type "show copying"
- and "show warranty" for details.
- This GDB was configured as "x86_64-unknown-linux-gnu".
- Type "show configuration" for configuration details.
- For bug reporting instructions, please see:
- <http://www.gnu.org/software/gdb/bugs/>.
- Find the GDB manual and other documentation resources online at:
- <http://www.gnu.org/software/gdb/documentation/>.
- For help, type "help".
- Type "apropos word" to search for commands related to "word".
- (gdb) target remote :3333
- Remote debugging using :3333
- 0x0000fff0 in ?? ()
- (gdb) x 0x150
- 0x150: 0x8ef000be
- osboxes@osboxes:/opt/intel/issm_2016.0.019/tools/debugger/openocd$ telnet localhost 4444
- Trying 127.0.0.1...
- Connected to localhost.
- Escape character is ’^]’.
- Open On-Chip Debugger
- > clk32M
- adapter speed: 3 kHz
- adapter speed: 1000 kHz
- JTAG tap: quark_d2000.cltap tap/device found: 0x0e786013 (mfg: 0x009, part: 0xe786, ver: 0x0)
- Enabling lmt core tap
- JTAG tap: quark_d2000.lmt enabled
- target state: halted
- target halted due to debug-request at 0x0000fff0 in real mode
- > load_image ../../../firmware/bsp/1.0/soc/quark_d2000/rom/quark_d2000_rom.bin 0x0
- The requested flash write overlaps the OTP DATA protected region 0x00000000 - 0x0000014f, skipping that part
- The following command will allow it:
- set QUARK_D2000_OTPC_DATA_WRITE_ENABLED 1
- ....8192 bytes written at address 0x00000000
- downloaded 8192 bytes in 125.258965s (0.064 KiB/s)
- Studio run configration startup init command
- monitor mww 0xb0800570 0x8 #Reset Control, Cold Reset (COLD) = 1
- monitor reset halt
- flushregs
- tbreak main
- continue
- #0xB0100018 : Flash CTRL (CTRL), Bits(3): Rom read disable for upper 4k region of ROM.
- #0xB0100014 : Flash Status,
- proc del_flash0 {} { mww 0xB0100018 0x80 ; sleep 2000 ; mdw 0xB0100014 }
- Trace openocd code startup
- main.c: main()
- openocd.c: openocd_main(argc, argv);
- cmd_ctx = setup_command_handler(NULL);
- openocd.c: openocd_thread(argc, argv, cmd_ctx);
- parse_cmdline_args(cmd_ctx, argc, argv)
- server_preinit()
- parse_config_file(cmd_ctx)
- server_init(cmd_ctx)
- server_loop(cmd_ctx)
- server_quit()
- Quark D2000 software API code trace
- at $ISSM_ROOT/firmware, software API come from Doxygen output from here.
- How to flash program by using command line without Eclipse
- Using gdb to debug in the command line
- target remote localhost:3333
- monitor gdb_breakpoint_override hard
- set remotetimeout 30
- monitor clk32M
- file ~/intel/issm_2016.0.019/workspace/accel_test/debug/quark_d2000/obj/accel_test.elf
- load
- monitor reset halt
- flushregs
- tb main
- c
- (gdb) target remote :3333
- Remote debugging using :3333
- 0x00000191 in ?? ()
- (gdb) monitor gdb_breakpoint_override hard
- force hard breakpoints
- (gdb) set remotetimeout 30
- (gdb) monitor clk32M
- adapter speed: 3 kHz
- adapter speed: 1000 kHz
- JTAG tap: quark_d2000.cltap tap/device found: 0x0e786013 (mfg: 0x009, part: 0xe786, ver: 0x0)
- Enabling lmt core tap
- JTAG tap: quark_d2000.lmt enabled
- target state: halted
- target halted due to debug-request at 0x0000fff0 in real mode
- (gdb) file ~/intel/issm_2016.0.019/workspace/accel_test/debug/quark_d2000/obj/accel_test.elf
- A program is being debugged already.
- Are you sure you want to change the file? (y or n) y
- Reading symbols from ~/intel/issm_2016.0.019/workspace/accel_test/debug/quark_d2000/obj/accel_test.elf...done.
- (gdb) load
- Loading section .text, size 0x4098 lma 0x180000
- Loading section .rodata, size 0x217 lma 0x1840a0
- Loading section .eh_frame, size 0x24c lma 0x1842b8
- Ignoring packet error, continuing...
- Loading section .data, size 0x2cc lma 0x184504
- Start address 0x180000, load size 18375
- Transfer rate: 46 bytes/sec, 2296 bytes/write.
- Reply contains invalid hex digit 79
- (gdb) monitor reset halt
- U(gdb) flushregs
- Register cache flushed.
- (gdb) tb main
- Temporary breakpoint 1 at 0x18019f: file main.c, line 86.
- (gdb) c
- Continuing.
- target running
- The environment run in VirtualBox( Host: Mac, Guest: Ubuntu 14.04 ), the gdb load image very slow, about transfer rate 46 bytes/sec. Check to see if there is any way to speed up
- adapter_khz 1000 => 46 bytes/sec
- adapter_khz 2000 => 80 bytes/sec
- Using windows native debug flash and debug will run quick. After flash, using following gdb script can re-run program, and single step works
- monitor reset halt
- flushregs
- tb main
- c
Q&A
Q1 : [ 請自入提出 ]
哪裡買
參考資料
- Quark D2000
- Overview
- Documents
- Hardware
- Intel® System Studio 2016 for Microcontrollers
- Software
- API in Intel® Quark™ Microcontroller Software Interface
- Intel community for Quark MCU
- chip BuyFromMouser, NT 139 for 1 pcs, NT 90 each for 4K
- OpenOCD
- OpenOCD User’s Guide
- General Commands
- Script used Jim-Tcl ( User Manual )
- Developer Guide
- OpenOCD git
- Others
- OpenOCD/CMSIS-DAP Debugging with Eclipse and without an IDE