(Intel Quark) D2000 >> C/C++

Hello, world!


連接UART_A TX、RX並且上電


main.c

#include "qm_common.h"

int main(void)
{
  QM_PUTS("Hello, world!");
  return 0;
}

Makefile

APP_NAME = hello
SOC ?= quark_d2000
TARGET ?= x86
BASE_DIR := xxx/qmsi
APP_DIR := .
include $(BASE_DIR)/examples/app.mk

P.S. BASE_DIR必須指到qmsi資料夾。

編譯程式

$ wget https://github.com/steward-fu/d2000/releases/download/v1.0/issm-toolchain-linux-2017-02-07.tar.gz
$ tar xvf issm-toolchain-linux-2017-02-07.tar.gz
$ sudo mv issm-toolchain-linux-2017-02-07 /opt/d2000
$ export IAMCU_TOOLCHAIN_DIR=/opt/d2000/tools/compiler/gcc-ia/5.2.1/bin
$ make
  APP_NAME = hello
  SOC = quark_d2000
  TARGET = x86
  APP_DIR = .
  BUILD = release
  CSTD = c99
  VERSION = '1.4.0'
  make -C /home/steward/Downloads/qmsi/drivers SOC=quark_d2000 TARGET=x86 BUILD=release V=0 CSTD=c99 ITA_NO_ASSERT=0
  make[1]: Entering directory '/home/steward/Downloads/qmsi/drivers'
  BUILD = release
  CSTD = c99
  VERSION = '1.4.0'
  make[1]: Nothing to be done for 'all'.
  make[1]: Leaving directory '/home/steward/Downloads/qmsi/drivers'
  CC release/quark_d2000/x86/obj/./main.o
  CC release/quark_d2000/x86/obj/./app_entry.o
  CC release/quark_d2000/x86/obj/./newlib-syscalls.o
  LD release/quark_d2000/x86/bin/hello.bin
  Size release/quark_d2000/x86/bin/hello.bin
     text     data      bss      dec      hex  filename
      380        8       12      400      190  ./release/quark_d2000/x86/obj/hello.elf
  Objcopy release/quark_d2000/x86/bin/hello.bin

接著使用gdb下載檔案

$ gdb
(gdb) target remote :3333
(gdb) monitor clk32M 5000
(gdb) monitor load_image /tmp/quark_d2000_rom_fm_hmac.bin 0x0
(gdb) monitor load_image /tmp/hello.bin 0x00180000

完成


返回上一頁