首页 > 评测 > ARM中的R,一款Cortex R内核开发板:三星ARTIK 055开发体验

ARM中的R,一款Cortex R内核开发板:三星ARTIK 055开发体验

  • 作者:zhanzr
  • 来源:21ic
  • [导读]
  • 三星公司的Exynos系列处理器针对IoT市场目前推出了两款: Exynos i S111, Exynos i T200. S111是针对NB-IoT市场的, T200即本文评测的这款针对WiFi市场. 就T200而言, 无论是开发工具, 还是配套SDK的完善度, 都是比较优秀的. 但是缺点是来的太迟了, T200这款芯片可以大约对标乐鑫的ESP32.

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

除了上述原因之外, T200的开发还涉及到SDK的问题. 目前这个SDK包含了TizenRT操作系统与一大堆的中间件. 三星公司使用arm-none-eabi-gcc作为编译器, 一来是GCC系列对于类POSIX系统(TizenRT基于Nuttx系统, 是一个类POSIX的操作系统)的支持比ARM公司的工具要好, 二来也是个开源(也意味着免费)的方案.

image15.png

图 TizenRT操作系统的框图

image16.png

表 整个软件架构包含的中间件/驱动列表

Demo1: cJSON测试

开发第一个自定义的应用: cJSON测试. cJSON是个轻量级的json库. 这种库用于Cortex R系列的内核上非常合适. 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原创,未经许可禁止转载!

网友评论