首頁 > 評測 > ARM中的R,一款Cortex R內(nèi)核開發(fā)板:三星ARTIK 055開發(fā)體驗

ARM中的R,一款Cortex R內(nèi)核開發(fā)板:三星ARTIK 055開發(fā)體驗

  • 作者:zhanzr
  • 來源:21ic
  • [導讀]
  • 三星公司的Exynos系列處理器針對IoT市場目前推出了兩款: Exynos i S111, Exynos i T200. S111是針對NB-IoT市場的, T200即本文評測的這款針對WiFi市場. 就T200而言, 無論是開發(fā)工具, 還是配套SDK的完善度, 都是比較優(yōu)秀的. 但是缺點是來的太遲了, T200這款芯片可以大約對標樂鑫的ESP32.

Contact your local distributor for more details on DS-5.

除了上述原因之外, T200的開發(fā)還涉及到SDK的問題. 目前這個SDK包含了TizenRT操作系統(tǒng)與一大堆的中間件. 三星公司使用arm-none-eabi-gcc作為編譯器, 一來是GCC系列對于類POSIX系統(tǒng)(TizenRT基于Nuttx系統(tǒng), 是一個類POSIX的操作系統(tǒng))的支持比ARM公司的工具要好, 二來也是個開源(也意味著免費)的方案.

image15.png

圖 TizenRT操作系統(tǒng)的框圖

image16.png

表 整個軟件架構(gòu)包含的中間件/驅(qū)動列表

Demo1: cJSON測試

開發(fā)第一個自定義的應用: cJSON測試. cJSON是個輕量級的json庫. 這種庫用于Cortex R系列的內(nèi)核上非常合適. cJSON的官方git地址: https://github.com/DaveGamble/cJSON

clone或者下載下來, 將源代碼置于ARTIK工程的源代碼目錄下. 只需要這四個文件:

cJSON.c cJSON.h cJSON_Utils.c cJSON_Utils.h

不需要任何改動, 在要使用cJSON的文件中包含"cJSON.h"即可開始使用這個庫.

測試代碼也是從官方的測試用例中摳出來的:

typedef struct str_poi_record

{

const char *precision;

double lat;

double lon;

const char *address;

const char *city;

const char *state;

const char *zip;

const char *country;

}poi_record;

/* Our "days of the week" array: */

const char *str_weekdays[7] =

{

"Sunday",

"Monday",

"Tuesday",

"Wednesday",

"Thursday",

"Friday",

"Saturday"

};

/* Our matrix: */

const int numbers[3][3] =

{

{0, -1, 0},

{1, 0, 0},

{0 ,0, 1}

};

/* Our "gallery" item: */

const int ids[4] = { 116, 943, 234, 38793 };

/* Our array of "records": */

const poi_record fields[2] =

{

{

"zip",

37.7668,

-1.223959e+2,

"",

"SAN FRANCISCO",

"CA",

"94107",

"US"

},

{

"zip",

37.371991,

-1.22026e+2,

"",

"SUNNYVALE",

"CA",

"94085",

"US"

}

};

/* Create a bunch of objects as demonstration. */

static int print_preallocated(cJSON *root)

{

/* declarations */

char *out = NULL;

char *buf = NULL;

char *buf_fail = NULL;

size_t len = 0;

size_t len_fail = 0;

/* formatted print */

out = cJSON_Print(root);

/* create buffer to succeed */

/* the extra 5 bytes are because of inaccuracies when reserving memory */

len = strlen(out) + 5;

buf = (char*)malloc(len);

if (buf == NULL)

{

printf("Failed to allocate memory.\n");

exit(1);

}

/* create buffer to fail */

len_fail = strlen(out);

buf_fail = (char*)malloc(len_fail);

if (buf_fail == NULL)

{

printf("Failed to allocate memory.\n");

exit(1);

}

/* Print to buffer */

if (!cJSON_PrintPreallocated(root, buf, (int)len, 1)) {

printf("cJSON_PrintPreallocated failed!\n");

if (strcmp(out, buf) != 0) {

printf("cJSON_PrintPreallocated not the same as cJSON_Print!\n");

printf("cJSON_Print result:\n%s\n", out);

printf("cJSON_PrintPreallocated result:\n%s\n", buf);

}

free(out);

free(buf_fail);

free(buf);

return -1;

}

/* success */

printf("%s\n", buf);

/* force it to fail */

if (cJSON_PrintPreallocated(root, buf_fail, (int)len_fail, 1)) {

printf("cJSON_PrintPreallocated failed to show error with insufficient memory!\n");

printf("cJSON_Print result:\n%s\n", out);

printf("cJSON_PrintPreallocated result:\n%s\n", buf_fail);

free(out);

free(buf_fail);

free(buf);

return -1;

}

free(out);

free(buf_fail);

free(buf);

return 0;

}

/* Create a bunch of objects as demonstration. */

static void create_objects(void)

{

/* declare a few. */

cJSON *root = NULL;

cJSON *fmt = NULL;

cJSON *img = NULL;

cJSON *thm = NULL;

cJSON *fld = NULL;

  • 本文系21ic原創(chuàng),未經(jīng)許可禁止轉(zhuǎn)載!

網(wǎng)友評論