Skip to content

Commit 3a4e80f

Browse files
committed
Merge branch 'fix/build_over_2.0.7' into 'main'
fix: Build issue due to inclusion of esp_hosted_wifi_config.h in public headers See merge request app-frameworks/esp_hosted_mcu!72
2 parents 6a6d37b + 08c6580 commit 3a4e80f

File tree

10 files changed

+119
-85
lines changed

10 files changed

+119
-85
lines changed

CMakeLists.txt

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,83 +3,82 @@ if(CONFIG_ESP_HOSTED_ENABLED)
33
set(FG_root_dir ".")
44
set(host_dir "${FG_root_dir}/host")
55

6-
set(COMPONENT_SRCS "${host_dir}/esp_hosted_host_init.c" "${host_dir}/api/src/esp_wifi_weak.c" "${host_dir}/api/src/esp_hosted_api.c" "${host_dir}/drivers/transport/transport_drv.c" "${host_dir}/drivers/serial/serial_ll_if.c" "${host_dir}/utils/common.c" "${host_dir}/utils/util.c" "${host_dir}/utils/stats.c" "${host_dir}/drivers/serial/serial_drv.c")
6+
set(srcs "${host_dir}/esp_hosted_host_init.c" "${host_dir}/api/src/esp_wifi_weak.c" "${host_dir}/api/src/esp_hosted_api.c" "${host_dir}/drivers/transport/transport_drv.c" "${host_dir}/drivers/serial/serial_ll_if.c" "${host_dir}/utils/common.c" "${host_dir}/utils/util.c" "${host_dir}/utils/stats.c" "${host_dir}/drivers/serial/serial_drv.c")
77

88
# only these directories are public. Others are private
9-
set(COMPONENT_ADD_PUBLIC_INCLUDEDIRS "${host_dir}" "${host_dir}/api/include")
9+
set(pub_include "${host_dir}" "${host_dir}/api/include")
1010

11-
set(COMPONENT_ADD_INCLUDEDIRS "${host_dir}/drivers/transport" "${host_dir}/drivers/transport/spi" "${host_dir}/drivers/transport/sdio" "${host_dir}/drivers/serial" "${host_dir}/utils")
11+
set(priv_include "${host_dir}/drivers/transport" "${host_dir}/drivers/transport/spi" "${host_dir}/drivers/transport/sdio" "${host_dir}/drivers/serial" "${host_dir}/utils" "${host_dir}/api/priv")
1212

1313
# rpc files - wrap -> slaveif -> core
1414
set(rpc_dir "${host_dir}/drivers/rpc")
1515
set(rpc_core_dir "${rpc_dir}/core")
1616
set(rpc_slaveif_dir "${rpc_dir}/slaveif")
1717
set(rpc_wrap_dir "${rpc_dir}/wrap")
18-
list(APPEND COMPONENT_SRCS "${rpc_core_dir}/rpc_core.c" "${rpc_core_dir}/rpc_req.c" "${rpc_core_dir}/rpc_rsp.c" "${rpc_core_dir}/rpc_evt.c"
18+
list(APPEND srcs "${rpc_core_dir}/rpc_core.c" "${rpc_core_dir}/rpc_req.c" "${rpc_core_dir}/rpc_rsp.c" "${rpc_core_dir}/rpc_evt.c"
1919
"${rpc_slaveif_dir}/rpc_slave_if.c"
2020
"${rpc_wrap_dir}/rpc_wrap.c")
21-
list(APPEND COMPONENT_ADD_INCLUDEDIRS "${rpc_core_dir}" "${rpc_slaveif_dir}" "${rpc_wrap_dir}")
21+
list(APPEND priv_include "${rpc_core_dir}" "${rpc_slaveif_dir}" "${rpc_wrap_dir}")
2222

2323
# virtual serial
2424
set(virt_serial_dir "${host_dir}/drivers/virtual_serial_if")
25-
list(APPEND COMPONENT_SRCS "${virt_serial_dir}/serial_if.c")
26-
list(APPEND COMPONENT_ADD_INCLUDEDIRS "${virt_serial_dir}")
25+
list(APPEND srcs "${virt_serial_dir}/serial_if.c")
26+
list(APPEND priv_include "${virt_serial_dir}")
2727

2828
# mempool
29-
list(APPEND COMPONENT_SRCS "${host_dir}/drivers/mempool/mempool.c")
30-
list(APPEND COMPONENT_ADD_INCLUDEDIRS "${host_dir}/drivers/mempool" )
29+
list(APPEND srcs "${host_dir}/drivers/mempool/mempool.c")
30+
list(APPEND priv_include "${host_dir}/drivers/mempool" )
3131

3232
# slave and host common files
3333
set(common_dir "${FG_root_dir}/common")
34-
list(APPEND COMPONENT_SRCS "${common_dir}/protobuf-c/protobuf-c/protobuf-c.c" "${common_dir}/proto/esp_hosted_rpc.pb-c.c" )
35-
list(APPEND COMPONENT_ADD_INCLUDEDIRS "${common_dir}" "${common_dir}/log" "${common_dir}/rpc" "${common_dir}/transport" "${common_dir}/protobuf-c" "${common_dir}/proto" )
34+
list(APPEND srcs "${common_dir}/protobuf-c/protobuf-c/protobuf-c.c" "${common_dir}/proto/esp_hosted_rpc.pb-c.c" )
35+
list(APPEND priv_include "${common_dir}" "${common_dir}/log" "${common_dir}/rpc" "${common_dir}/transport" "${common_dir}/protobuf-c" "${common_dir}/proto" )
3636

3737
# host ESP32 specific files
38-
list(APPEND COMPONENT_SRCS "${host_dir}/port/esp/freertos/src/esp_hosted_ota.c")
38+
list(APPEND srcs "${host_dir}/port/esp/freertos/src/esp_hosted_ota.c")
3939

4040
# bt (NimBLE)
4141
### TODO config for HCI over UART
42-
list(APPEND COMPONENT_ADD_INCLUDEDIRS "${host_dir}/drivers/bt")
42+
list(APPEND priv_include "${host_dir}/drivers/bt")
4343
if(CONFIG_ESP_HOSTED_NIMBLE_HCI_VHCI OR CONFIG_ESP_HOSTED_BLUEDROID_HCI_VHCI)
44-
list(APPEND COMPONENT_SRCS "${host_dir}/drivers/bt/vhci_drv.c")
44+
list(APPEND srcs "${host_dir}/drivers/bt/vhci_drv.c")
4545
else()
46-
list(APPEND COMPONENT_SRCS "${host_dir}/drivers/bt/hci_stub_drv.c")
46+
list(APPEND srcs "${host_dir}/drivers/bt/hci_stub_drv.c")
4747
endif()
4848

4949
# transport files
5050
if(CONFIG_ESP_HOSTED_SDIO_HOST_INTERFACE)
51-
list(APPEND COMPONENT_SRCS "${host_dir}/drivers/transport/sdio/sdio_drv.c")
51+
list(APPEND srcs "${host_dir}/drivers/transport/sdio/sdio_drv.c")
5252
elseif(CONFIG_ESP_HOSTED_SPI_HD_HOST_INTERFACE)
53-
list(APPEND COMPONENT_SRCS "${host_dir}/drivers/transport/spi_hd/spi_hd_drv.c")
53+
list(APPEND srcs "${host_dir}/drivers/transport/spi_hd/spi_hd_drv.c")
5454
elseif(CONFIG_ESP_HOSTED_SPI_HOST_INTERFACE)
55-
list(APPEND COMPONENT_SRCS "${host_dir}/drivers/transport/spi/spi_drv.c")
55+
list(APPEND srcs "${host_dir}/drivers/transport/spi/spi_drv.c")
5656
elseif(CONFIG_ESP_HOSTED_UART_HOST_INTERFACE)
57-
list(APPEND COMPONENT_SRCS "${host_dir}/drivers/transport/uart/uart_drv.c")
57+
list(APPEND srcs "${host_dir}/drivers/transport/uart/uart_drv.c")
5858
endif()
5959

6060
# config files
61-
list(APPEND COMPONENT_ADD_INCLUDEDIRS "${host_dir}/port/esp/freertos/include")
62-
list(APPEND COMPONENT_SRCS "${host_dir}/port/esp/freertos/src/esp_hosted_config.c" "${host_dir}/port/esp/freertos/src/esp_hosted_transport_config.c")
61+
list(APPEND priv_include "${host_dir}/port/esp/freertos/include")
62+
list(APPEND srcs "${host_dir}/port/esp/freertos/src/esp_hosted_config.c" "${host_dir}/port/esp/freertos/src/esp_hosted_transport_config.c")
6363

6464
# transport port files
65-
list(APPEND COMPONENT_SRCS "${host_dir}/port/esp/freertos/src/os_wrapper.c")
65+
list(APPEND srcs "${host_dir}/port/esp/freertos/src/os_wrapper.c")
6666
if(CONFIG_ESP_HOSTED_SDIO_HOST_INTERFACE)
67-
list(APPEND COMPONENT_SRCS "${host_dir}/port/esp/freertos/src/sdio_wrapper.c")
67+
list(APPEND srcs "${host_dir}/port/esp/freertos/src/sdio_wrapper.c")
6868
elseif(CONFIG_ESP_HOSTED_SPI_HD_HOST_INTERFACE)
69-
list(APPEND COMPONENT_SRCS "${host_dir}/port/esp/freertos/src/spi_hd_wrapper.c")
69+
list(APPEND srcs "${host_dir}/port/esp/freertos/src/spi_hd_wrapper.c")
7070
elseif(CONFIG_ESP_HOSTED_SPI_HOST_INTERFACE)
71-
list(APPEND COMPONENT_SRCS "${host_dir}/port/esp/freertos/src/spi_wrapper.c")
71+
list(APPEND srcs "${host_dir}/port/esp/freertos/src/spi_wrapper.c")
7272
elseif(CONFIG_ESP_HOSTED_UART_HOST_INTERFACE)
73-
list(APPEND COMPONENT_SRCS "${host_dir}/port/esp/freertos/src/uart_wrapper.c")
73+
list(APPEND srcs "${host_dir}/port/esp/freertos/src/uart_wrapper.c")
7474
endif()
7575

7676
endif()
7777

78-
idf_component_register(SRCS ${COMPONENT_SRCS}
78+
idf_component_register(SRCS ${srcs}
7979
PRIV_REQUIRES soc esp_event esp_netif esp_timer driver esp_wifi bt esp_http_client
80-
EXCLUDE_SRCS ${EXCLUDE_COMPONENT_SRCS}
81-
INCLUDE_DIRS ${COMPONENT_ADD_PUBLIC_INCLUDEDIRS}
82-
PRIV_INCLUDE_DIRS ${COMPONENT_ADD_INCLUDEDIRS})
80+
INCLUDE_DIRS ${pub_include}
81+
PRIV_INCLUDE_DIRS ${priv_include})
8382

8483
idf_component_set_property(${COMPONENT_NAME} WHOLE_ARCHIVE TRUE)
8584

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#ifndef __ESP_HOSTED_WIFI_REMOTE_GLUE_H__
8+
#define __ESP_HOSTED_WIFI_REMOTE_GLUE_H__
9+
10+
#ifdef __cplusplus
11+
extern "C" {
12+
#endif
13+
14+
#include "esp_hosted_interface.h"
15+
#include "esp_wifi_remote.h"
16+
#include "esp_wifi.h"
17+
18+
struct esp_remote_channel_config {
19+
esp_hosted_if_type_t if_type;
20+
bool secure;
21+
};
22+
23+
typedef struct esp_remote_channel_config * esp_remote_channel_config_t;
24+
25+
/* Transport/Channel related data structures and macros */
26+
#define ESP_HOSTED_CHANNEL_CONFIG_DEFAULT() { \
27+
.secure = true, \
28+
}
29+
30+
/* Function pointer types for channel callbacks */
31+
typedef esp_err_t (*esp_remote_channel_rx_fn_t)(void *h, void *buffer,
32+
void *buff_to_free, size_t len);
33+
typedef esp_err_t (*esp_remote_channel_tx_fn_t)(void *h, void *buffer, size_t len);
34+
35+
/* Transport/Channel Management API Functions - use managed component typedef */
36+
esp_remote_channel_t esp_hosted_add_channel(esp_remote_channel_config_t config,
37+
esp_remote_channel_tx_fn_t *tx, const esp_remote_channel_rx_fn_t rx);
38+
esp_err_t esp_hosted_remove_channel(esp_remote_channel_t channel);
39+
40+
#ifdef __cplusplus
41+
}
42+
#endif
43+
44+
#endif /* __ESP_HOSTED_WIFI_REMOTE_GLUE_H__ */
Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,45 +4,23 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7-
/** prevent recursive inclusion **/
8-
#ifndef __ESP_HOSTED_API_H__
9-
#define __ESP_HOSTED_API_H__
7+
/* prevent recursive inclusion */
8+
#ifndef __ESP_HOSTED_API_PRIV_H__
9+
#define __ESP_HOSTED_API_PRIV_H__
1010

1111
#ifdef __cplusplus
1212
extern "C" {
1313
#endif
1414

15-
/** Includes **/
15+
/* Includes */
1616
#include "stdbool.h"
1717
#include "esp_wifi.h"
1818
#include "esp_wifi_remote.h"
1919
#include "esp_hosted_api_types.h"
2020
#include "esp_hosted_ota.h"
2121
#include "esp_hosted_wifi_config.h"
2222

23-
/** Exported variables **/
24-
#define ESP_HOSTED_CHANNEL_CONFIG_DEFAULT() { \
25-
.secure = true, \
26-
}
27-
28-
struct esp_remote_channel_config {
29-
int if_type; // values should be of esp_hosted_if_type_t
30-
bool secure;
31-
};
32-
33-
/** Inline functions **/
34-
35-
/** Exported Functions **/
36-
esp_err_t esp_hosted_init(void);
37-
esp_err_t esp_hosted_deinit(void);
38-
esp_err_t esp_hosted_reinit(void);
39-
40-
esp_err_t esp_hosted_setup(void);
41-
esp_err_t esp_hosted_slave_reset(void);
42-
esp_remote_channel_t esp_hosted_add_channel(esp_remote_channel_config_t config,
43-
esp_remote_channel_tx_fn_t *tx, const esp_remote_channel_rx_fn_t rx);
44-
esp_err_t esp_hosted_remove_channel(esp_remote_channel_t channel);
45-
23+
/* Remote WiFi API Functions - Port/Implementation Specific */
4624
esp_err_t esp_wifi_remote_init(const wifi_init_config_t *arg);
4725
esp_err_t esp_wifi_remote_deinit(void);
4826
esp_err_t esp_wifi_remote_set_mode(wifi_mode_t mode);
@@ -86,9 +64,9 @@ esp_err_t esp_wifi_remote_set_max_tx_power(int8_t power);
8664
esp_err_t esp_wifi_remote_get_max_tx_power(int8_t *power);
8765
esp_err_t esp_wifi_remote_sta_get_negotiated_phymode(wifi_phy_mode_t *phymode);
8866
esp_err_t esp_wifi_remote_sta_get_aid(uint16_t *aid);
89-
esp_err_t esp_hosted_get_coprocessor_fwversion(esp_hosted_coprocessor_fwver_t *ver_info);
9067

9168
#if H_WIFI_DUALBAND_SUPPORT
69+
/* Dual-band WiFi API (Depends upon co-processor used) */
9270
esp_err_t esp_wifi_remote_set_band(wifi_band_t band);
9371
esp_err_t esp_wifi_remote_get_band(wifi_band_t *band);
9472
esp_err_t esp_wifi_remote_set_band_mode(wifi_band_mode_t band_mode);
@@ -103,4 +81,4 @@ esp_err_t esp_wifi_remote_get_bandwidths(wifi_interface_t ifx, wifi_bandwidths_t
10381
}
10482
#endif
10583

106-
#endif
84+
#endif /* __ESP_HOSTED_API_PRIV_H__ */

host/api/src/esp_hosted_api.c

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ extern "C" {
1010

1111
/** Includes **/
1212
#include "esp_hosted_transport_config.h"
13-
#include "esp_wifi_remote.h"
1413
#include "esp_hosted_wifi_config.h"
15-
#include "esp_hosted_api.h"
14+
#include "esp_hosted_api_priv.h"
15+
#include "esp_hosted_wifi_remote_glue.h"
1616
#include "esp_check.h"
1717
#include "transport_drv.h"
1818
#include "rpc_wrap.h"
@@ -30,10 +30,6 @@ struct esp_remote_channel {
3030

3131
//static semaphore_handle_t transport_up_sem;
3232

33-
typedef esp_err_t (*esp_remote_channel_rx_fn_t)(void *h, void *buffer,
34-
void *buff_to_free, size_t len);
35-
typedef esp_err_t (*esp_remote_channel_tx_fn_t)(void *h, void *buffer, size_t len);
36-
3733
/** Inline functions **/
3834

3935
/** Exported Functions **/
@@ -96,7 +92,7 @@ static void set_host_modules_log_level(void)
9692
esp_log_level_set("rpc_rsp", ESP_LOG_WARN);
9793
esp_log_level_set("rpc_evt", ESP_LOG_WARN);
9894
}
99-
esp_err_t esp_hosted_init(void)
95+
int esp_hosted_init(void)
10096
{
10197
if (esp_hosted_init_done)
10298
return ESP_OK;
@@ -120,7 +116,7 @@ esp_err_t esp_hosted_init(void)
120116
return ESP_OK;
121117
}
122118

123-
esp_err_t esp_hosted_deinit(void)
119+
int esp_hosted_deinit(void)
124120
{
125121
ESP_LOGI(TAG, "ESP-Hosted deinit\n");
126122
rpc_unregister_event_callbacks();
@@ -141,16 +137,7 @@ static inline esp_err_t esp_hosted_reconfigure(void)
141137
return ESP_OK;
142138
}
143139

144-
esp_err_t esp_hosted_reinit(void)
145-
{
146-
ESP_LOGI(TAG, "ESP-Hosted re-init\n");
147-
ESP_ERROR_CHECK(esp_hosted_deinit());
148-
ESP_ERROR_CHECK(esp_hosted_init());
149-
ESP_ERROR_CHECK(esp_hosted_reconfigure());
150-
return ESP_OK;
151-
}
152-
153-
esp_err_t esp_hosted_slave_reset(void)
140+
int esp_hosted_connect_to_slave(void)
154141
{
155142
ESP_LOGI(TAG, "ESP-Hosted Try to communicate with ESP-Hosted slave\n");
156143
return esp_hosted_reconfigure();
@@ -399,8 +386,8 @@ esp_err_t esp_wifi_remote_sta_get_aid(uint16_t *aid)
399386
{
400387
return rpc_wifi_sta_get_aid(aid);
401388
}
402-
403389
#if H_WIFI_DUALBAND_SUPPORT
390+
/* Dual-band WiFi API - always available at high level, but returns ESP_ERR_NOT_SUPPORTED when co-processor do not support */
404391
esp_err_t esp_wifi_remote_set_band(wifi_band_t band)
405392
{
406393
return rpc_wifi_set_band(band);

host/api/src/esp_wifi_weak.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* Used when WiFi-Remote does not provide required esp_wifi calls
2020
*/
2121

22-
#include "esp_hosted_api.h"
22+
#include "esp_hosted_api_priv.h"
2323
#include "esp_hosted_wifi_config.h"
2424

2525
#define WEAK __attribute__((weak))

host/drivers/rpc/wrap/rpc_wrap.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
#include "esp_hosted_rpc.h"
3030
#include "esp_log.h"
3131
#include "esp_hosted_wifi_config.h"
32-
#include "esp_hosted_api.h"
3332
#include "esp_hosted_transport.h"
3433

3534
DEFINE_LOG_TAG(rpc_wrap);

host/drivers/rpc/wrap/rpc_wrap.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ extern "C" {
2525
#include "common.h"
2626
#include "esp_wifi.h"
2727
#include "esp_hosted_wifi_config.h"
28-
#include "esp_hosted_api.h"
2928
#include "esp_hosted_api_types.h"
29+
#include "esp_hosted_ota.h"
3030

3131
/** Exported variables **/
3232

@@ -81,7 +81,7 @@ esp_err_t rpc_wifi_set_max_tx_power(int8_t power);
8181
esp_err_t rpc_wifi_get_max_tx_power(int8_t *power);
8282
esp_err_t rpc_wifi_sta_get_negotiated_phymode(wifi_phy_mode_t *phymode);
8383
esp_err_t rpc_wifi_sta_get_aid(uint16_t *aid);
84-
esp_err_t rpc_ota(const char* image_url);
84+
8585
esp_err_t rpc_get_coprocessor_fwversion(esp_hosted_coprocessor_fwver_t *ver_info);
8686

8787
esp_err_t rpc_ota_begin(void);

host/esp_hosted.h

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,38 @@
77
#ifndef __ESP_HOSTED_H__
88
#define __ESP_HOSTED_H__
99

10-
#include "esp_hosted_api.h"
10+
#ifdef __cplusplus
11+
extern "C" {
12+
#endif
13+
1114
#include "esp_hosted_config.h"
1215
#include "esp_hosted_bt_config.h"
1316
#include "esp_hosted_transport_config.h"
17+
#include "esp_hosted_api_types.h"
1418

1519
typedef struct esp_hosted_transport_config esp_hosted_config_t;
1620

21+
/* --------- Hosted Minimal APIs --------- */
22+
int esp_hosted_init(void);
23+
int esp_hosted_deinit(void);
24+
25+
int esp_hosted_connect_to_slave(void);
26+
int esp_hosted_get_coprocessor_fwversion(esp_hosted_coprocessor_fwver_t *ver_info);
27+
28+
/* --------- Exhaustive API list --------- */
29+
/*
30+
* 1. All Wi-Fi supported APIs
31+
* File: host/api/src/esp_wifi_weak.c
32+
*
33+
* 2. Communication Bus APIs (Set and get transport config)
34+
* File : host/api/include/esp_hosted_transport_config.h
35+
*
36+
* 3. Co-Processor OTA API
37+
* File : host/api/include/esp_hosted_ota.h
38+
*/
39+
40+
#ifdef __cplusplus
41+
}
42+
#endif
43+
1744
#endif /* __ESP_HOSTED_H__ */

host/esp_hosted_host_init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include "os_header.h"
88
#include "os_wrapper.h"
99
#include "esp_log.h"
10-
#include "esp_hosted_api.h"
10+
#include "esp_hosted.h"
1111
#include "esp_private/startup_internal.h"
1212

1313
DEFINE_LOG_TAG(host_init);

idf_component.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: "2.0.7"
1+
version: "2.0.8"
22
description: ESP-Hosted-MCU provide drivers to act any ESP chipset as Wi-Fi or Bluetooth co-processor.
33
url: https://github.com/espressif/esp-hosted-mcu
44
examples:

0 commit comments

Comments
 (0)