Skip to content

Commit

Permalink
[mingw32] fix build error when generate Windows version SDK
Browse files Browse the repository at this point in the history
Signed-off-by: Yang, Xiao <yusheng.yx@alibaba-inc.com>
  • Loading branch information
Yang, Xiao committed Nov 21, 2018
1 parent a0e55bc commit e941e19
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 22 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@

# 快速开始

用户可以通过[在Ubuntu快速的体验Link Kit SDK](https://code.aliyun.com/edward.yangx/public-docs/wikis/user-guide/linkkit/Quick_Start)感受如何将设备连接到阿里云物联网平台, 并如何将设备的数据发送到平台/以及如何从物联网平台接收数据
用户可以通过[在Ubuntu快速的体验Link Kit SDK](https://help.aliyun.com/document_detail/96624.html)感受如何将设备连接到阿里云物联网平台, 并如何将设备的数据发送到平台/以及如何从物联网平台接收数据

# 移植说明
Link Kit SDK是一个与OS/硬件平台无关的用C编写的代码, 定义了HAL层来对接与硬件相关的功能, 因此在使用Link Kit SDK时用户需要去实现相关的HAL函数

目前Link Kit SDK已实现了在Linux/Windows/AliOS上HAL的实现, 同时对于一些常见的OS或者模组也进行了适配, 可以[访问此处](https://code.aliyun.com/edward.yangx/public-docs/wikis/user-guide/Linkkit_User_Manual)查看如何在相应平台上进行SDK的编译与集成
目前Link Kit SDK已实现了在Linux/Windows/AliOS上HAL的实现, 同时对于一些常见的OS或者模组也进行了适配, 可以[访问此处](https://help.aliyun.com/document_detail/97557.html)查看如何在相应平台上进行SDK的编译与集成

# 编程文档

SDK提供了一系列的编程文档来描述如何使用SDK提供的软件功能, 请[访问此处](https://code.aliyun.com/edward.yangx/public-docs/wikis/user-guide/Linkkit_User_Manual)进行了解
SDK提供了一系列的编程文档来描述如何使用SDK提供的软件功能, 请[访问此处](https://help.aliyun.com/document_detail/96627.html)进行了解
10 changes: 7 additions & 3 deletions src/board/config.win7.mingw32
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ CONFIG_ENV_CFLAGS += \
-DCC_IS_MINGW32 \
-D_PLATFORM_IS_WINDOWS_ \

CONFIG_ENV_LDFLAGS += -lws2_32

CROSS_PREFIX := i686-w64-mingw32-

CONFIG_src/protocol/coap/cloud :=
CONFIG_src/services/uOTA :=
CONFIG_tests :=
CONFIG_src/protocol/coap/cloud :=
CONFIG_src/services/uOTA :=
CONFIG_tests :=
CONFIG_src/services/awss :=
CONFIG_src/services/dev_bind :=
2 changes: 1 addition & 1 deletion src/ref-impl/hal/os/win7/HAL_OS_win7.c
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ int HAL_Fseek(void *stream, long offset, int framewhere)
return fseek((FILE *)stream, offset, framewhere);
}

int HAL_Fclose(FILE *stream)
int HAL_Fclose(void *stream)
{
return fclose((FILE *)stream);
}
Expand Down
42 changes: 28 additions & 14 deletions src/services/linkkit/dm/dm_msg_process.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ int dm_msg_proc_thing_model_down_raw(_IN_ dm_msg_source_t *source)
char device_name[DEVICE_NAME_MAXLEN] = {0};

/* Parse Product Key And Device Name */
res = dm_msg_uri_parse_pkdn((char *)source->uri, strlen(source->uri), 2, 4, product_key, device_name);
res = dm_msg_uri_parse_pkdn((char *)source->uri, strlen(source->uri), 2 + DM_URI_OFFSET, 4 + DM_URI_OFFSET, product_key,
device_name);
if (res != SUCCESS_RETURN) {
return FAIL_RETURN;
}
Expand All @@ -107,7 +108,8 @@ int dm_msg_proc_thing_model_up_raw_reply(_IN_ dm_msg_source_t *source)

dm_log_info(DM_URI_THING_MODEL_UP_RAW_REPLY);

res = dm_msg_uri_parse_pkdn((char *)source->uri, strlen(source->uri), 2, 4, product_key, device_name);
res = dm_msg_uri_parse_pkdn((char *)source->uri, strlen(source->uri), 2 + DM_URI_OFFSET, 4 + DM_URI_OFFSET, product_key,
device_name);
if (res != SUCCESS_RETURN) {
return FAIL_RETURN;
}
Expand All @@ -132,7 +134,8 @@ int dm_msg_proc_thing_service_property_set(_IN_ dm_msg_source_t *source, _IN_ dm
dm_log_info(DM_URI_THING_SERVICE_PROPERTY_SET);

/* Request */
res = dm_msg_uri_parse_pkdn((char *)source->uri, strlen(source->uri), 2, 4, product_key, device_name);
res = dm_msg_uri_parse_pkdn((char *)source->uri, strlen(source->uri), 2 + DM_URI_OFFSET, 4 + DM_URI_OFFSET, product_key,
device_name);
if (res < SUCCESS_RETURN) {
return res;
}
Expand Down Expand Up @@ -171,7 +174,8 @@ int dm_msg_proc_thing_service_property_get(_IN_ dm_msg_source_t *source, _IN_ dm
dm_log_info(DM_URI_THING_SERVICE_PROPERTY_GET);

/* Request */
res = dm_msg_uri_parse_pkdn((char *)source->uri, strlen(source->uri), 2, 4, product_key, device_name);
res = dm_msg_uri_parse_pkdn((char *)source->uri, strlen(source->uri), 2 + DM_URI_OFFSET, 4 + DM_URI_OFFSET, product_key,
device_name);
if (res < SUCCESS_RETURN) {
return res;
}
Expand Down Expand Up @@ -230,7 +234,8 @@ int dm_msg_proc_thing_service_property_post(_IN_ dm_msg_source_t *source, _IN_ d
dm_log_info(DM_URI_THING_EVENT_PROPERTY_POST);

/* Request */
res = dm_msg_uri_parse_pkdn((char *)source->uri, strlen(source->uri), 2, 4, product_key, device_name);
res = dm_msg_uri_parse_pkdn((char *)source->uri, strlen(source->uri), 2 + DM_URI_OFFSET, 4 + DM_URI_OFFSET, product_key,
device_name);
if (res != SUCCESS_RETURN) {
return FAIL_RETURN;
}
Expand Down Expand Up @@ -263,7 +268,8 @@ int dm_msg_proc_thing_service_request(_IN_ dm_msg_source_t *source)
dm_log_info("Service Identifier: %.*s", strlen(source->uri) - serviceid_pos - 1, source->uri + serviceid_pos + 1);

/* Parse Product Key And Device Name */
res = dm_msg_uri_parse_pkdn((char *)source->uri, strlen(source->uri), 2, 4, product_key, device_name);
res = dm_msg_uri_parse_pkdn((char *)source->uri, strlen(source->uri), 2 + DM_URI_OFFSET, 4 + DM_URI_OFFSET, product_key,
device_name);
if (res != SUCCESS_RETURN) {
return FAIL_RETURN;
}
Expand All @@ -284,12 +290,14 @@ int dm_msg_proc_thing_event_post_reply(_IN_ dm_msg_source_t *source)
int res = 0, eventid_start_pos = 0, eventid_end_pos = 0;
dm_msg_response_payload_t response;

res = dm_utils_memtok((char *)source->uri, strlen(source->uri), DM_URI_SERVICE_DELIMITER, 6, &eventid_start_pos);
res = dm_utils_memtok((char *)source->uri, strlen(source->uri), DM_URI_SERVICE_DELIMITER, 6 + DM_URI_OFFSET,
&eventid_start_pos);
if (res != SUCCESS_RETURN) {
return FAIL_RETURN;
}

res = dm_utils_memtok((char *)source->uri, strlen(source->uri), DM_URI_SERVICE_DELIMITER, 7, &eventid_end_pos);
res = dm_utils_memtok((char *)source->uri, strlen(source->uri), DM_URI_SERVICE_DELIMITER, 7 + DM_URI_OFFSET,
&eventid_end_pos);
if (res != SUCCESS_RETURN) {
return FAIL_RETURN;
}
Expand Down Expand Up @@ -410,7 +418,8 @@ int dm_msg_proc_rrpc_request(_IN_ dm_msg_source_t *source)
dm_log_info("Rrpc Id: %.*s", strlen(source->uri) - rrpcid_pos - 1, source->uri + rrpcid_pos + 1);

/* Parse Product Key And Device Name */
res = dm_msg_uri_parse_pkdn((char *)source->uri, strlen(source->uri), 2, 4, product_key, device_name);
res = dm_msg_uri_parse_pkdn((char *)source->uri, strlen(source->uri), 2 + DM_URI_OFFSET, 4 + DM_URI_OFFSET, product_key,
device_name);
if (res != SUCCESS_RETURN) {
return FAIL_RETURN;
}
Expand Down Expand Up @@ -462,7 +471,8 @@ int dm_msg_proc_thing_topo_add_notify(_IN_ dm_msg_source_t *source, _IN_ dm_msg_
dm_log_info(DM_URI_THING_TOPO_ADD_NOTIFY);

/* Request */
res = dm_msg_uri_parse_pkdn((char *)source->uri, strlen(source->uri), 2, 4, product_key, device_name);
res = dm_msg_uri_parse_pkdn((char *)source->uri, strlen(source->uri), 2 + DM_URI_OFFSET, 4 + DM_URI_OFFSET, product_key,
device_name);
if (res < SUCCESS_RETURN) {
return res;
}
Expand Down Expand Up @@ -498,7 +508,8 @@ int dm_msg_proc_thing_disable(_IN_ dm_msg_source_t *source, _IN_ dm_msg_dest_t *
dm_log_info(DM_URI_THING_DISABLE);

/* Request */
res = dm_msg_uri_parse_pkdn((char *)source->uri, strlen(source->uri), 2, 4, product_key, device_name);
res = dm_msg_uri_parse_pkdn((char *)source->uri, strlen(source->uri), 2 + DM_URI_OFFSET, 4 + DM_URI_OFFSET, product_key,
device_name);
if (res < SUCCESS_RETURN) {
return res;
}
Expand Down Expand Up @@ -531,7 +542,8 @@ int dm_msg_proc_thing_enable(_IN_ dm_msg_source_t *source, _IN_ dm_msg_dest_t *d
dm_log_info(DM_URI_THING_DISABLE);

/* Request */
res = dm_msg_uri_parse_pkdn((char *)source->uri, strlen(source->uri), 2, 4, product_key, device_name);
res = dm_msg_uri_parse_pkdn((char *)source->uri, strlen(source->uri), 2 + DM_URI_OFFSET, 4 + DM_URI_OFFSET, product_key,
device_name);
if (res < SUCCESS_RETURN) {
return res;
}
Expand Down Expand Up @@ -564,7 +576,8 @@ int dm_msg_proc_thing_delete(_IN_ dm_msg_source_t *source, _IN_ dm_msg_dest_t *d
dm_log_info(DM_URI_THING_DELETE);

/* Request */
res = dm_msg_uri_parse_pkdn((char *)source->uri, strlen(source->uri), 2, 4, product_key, device_name);
res = dm_msg_uri_parse_pkdn((char *)source->uri, strlen(source->uri), 2 + DM_URI_OFFSET, 4 + DM_URI_OFFSET, product_key,
device_name);
if (res < SUCCESS_RETURN) {
return res;
}
Expand Down Expand Up @@ -597,7 +610,8 @@ int dm_msg_proc_thing_gateway_permit(_IN_ dm_msg_source_t *source, _IN_ dm_msg_d
dm_log_info(DM_URI_THING_DELETE);

/* Request */
res = dm_msg_uri_parse_pkdn((char *)source->uri, strlen(source->uri), 2, 4, product_key, device_name);
res = dm_msg_uri_parse_pkdn((char *)source->uri, strlen(source->uri), 2 + DM_URI_OFFSET, 4 + DM_URI_OFFSET, product_key,
device_name);
if (res < SUCCESS_RETURN) {
return res;
}
Expand Down
6 changes: 6 additions & 0 deletions src/services/linkkit/dm/iotx_dm_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@
#endif
#define DM_free(ptr) {LITE_free(ptr);ptr = NULL;}

#if defined(COAP_COMM_ENABLED) && !defined(MQTT_COMM_ENABLED)
#define DM_URI_OFFSET 1
#else
#define DM_URI_OFFSET 0
#endif

#if 1
#define dm_log_emerg(...) log_emerg("DM", __VA_ARGS__)
#define dm_log_crit(...) log_crit("DM", __VA_ARGS__)
Expand Down
2 changes: 2 additions & 0 deletions src/tools/mock_build_options.mk
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

ifneq (,$(filter -D_PLATFORM_IS_WINDOWS_,$(CFLAGS)))
CFLAGS := $(filter-out -DOTA_ENABLED,$(CFLAGS))
CFLAGS := $(filter-out -DWIFI_PROVISION_ENABLED,$(CFLAGS))
CFLAGS := $(filter-out -DDEV_BIND_ENABLED,$(CFLAGS))
endif

ifeq (Darwin,$(shell uname))
Expand Down
2 changes: 1 addition & 1 deletion src/tools/parse_make_settings.mk
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ $(foreach v, \
)

ifeq (y,$(strip $(FEATURE_COAP_COMM_ENABLED)))
CFLAGS += -DDM_MESSAGE_CACHE_DISABLED
# CFLAGS += -DDM_MESSAGE_CACHE_DISABLED
endif

ifeq (y,$(strip $(FEATURE_DEVICE_MODEL_RAWDATA_SOLO)))
Expand Down

0 comments on commit e941e19

Please sign in to comment.