Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to support WiFiSocketServerRTOS 8266 build #1

Open
wants to merge 4 commits into
base: release/v3.4
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions components/heap/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,12 @@ menu "Heap memory"
help
Enables heap tracing API.

config HEAP_PRIO_8BIT_RAM
bool "Prioritize allocation of 8-bit access capable RAM"
default n
depends on !HEAP_DISABLE_IRAM
help
Set DRAM region ahead of IRAM region during initialization, so that allocations
can be made against it first.

endmenu
18 changes: 18 additions & 0 deletions components/heap/port/esp8266/esp_heap_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,23 @@ void heap_caps_init(void)
extern char _bss_end;
size_t heap_region_num = 0;

#if CONFIG_HEAP_PRIO_8BIT_RAM
g_heap_region[heap_region_num].start_addr = (uint8_t *)&_bss_end;
g_heap_region[heap_region_num].total_size = ((size_t)(0x40000000 - (uint32_t)&_bss_end));
g_heap_region[heap_region_num].caps = MALLOC_CAP_8BIT | MALLOC_CAP_32BIT | MALLOC_CAP_DMA;
heap_region_num++;

// CONFIG_HEAP_PRIO_8BIT_RAM is only available when CONFIG_HEAP_DISABLE_IRAM=n
extern char _iram_end;
const size_t iram_size = 0x40100000 + CONFIG_SOC_IRAM_SIZE - ((size_t)&_iram_end);

if (iram_size > HEAP_REGION_IRAM_MIN && iram_size < HEAP_REGION_IRAM_MAX) {
g_heap_region[heap_region_num].start_addr = (uint8_t *)&_iram_end;
g_heap_region[heap_region_num].total_size = iram_size;
g_heap_region[heap_region_num].caps = MALLOC_CAP_32BIT | MALLOC_CAP_EXEC;
heap_region_num++;
}
#else
#ifndef CONFIG_HEAP_DISABLE_IRAM
extern char _iram_end;
const size_t iram_size = 0x40100000 + CONFIG_SOC_IRAM_SIZE - ((size_t)&_iram_end);
Expand All @@ -55,6 +72,7 @@ void heap_caps_init(void)
g_heap_region[heap_region_num].total_size = ((size_t)(0x40000000 - (uint32_t)&_bss_end));
g_heap_region[heap_region_num].caps = MALLOC_CAP_8BIT | MALLOC_CAP_32BIT | MALLOC_CAP_DMA;
heap_region_num++;
#endif

esp_heap_caps_init_region(g_heap_region, heap_region_num);
}
7 changes: 7 additions & 0 deletions components/lwip/port/esp8266/freertos/sys_arch.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ sys_mutex_lock(sys_mutex_t *pxMutex)
BaseType_t ret = xSemaphoreTake(*pxMutex, portMAX_DELAY);

LWIP_ASSERT("failed to take the mutex", ret == pdTRUE);
(void)ret;
}

/**
Expand All @@ -94,6 +95,7 @@ sys_mutex_unlock(sys_mutex_t *pxMutex)
BaseType_t ret = xSemaphoreGive(*pxMutex);

LWIP_ASSERT("failed to give the mutex", ret == pdTRUE);
(void)ret;
}

/**
Expand Down Expand Up @@ -133,6 +135,7 @@ sys_sem_new(sys_sem_t *sem, u8_t count)
if (count == 1) {
BaseType_t ret = xSemaphoreGive(*sem);
LWIP_ASSERT("sys_sem_new: initial give failed", ret == pdTRUE);
(void)ret;
}

return ERR_OK;
Expand All @@ -150,6 +153,7 @@ sys_sem_signal(sys_sem_t *sem)
/* queue full is OK, this is a signal only... */
LWIP_ASSERT("sys_sem_signal: sane return value",
(ret == pdTRUE) || (ret == errQUEUE_FULL));
(void)ret;
}

/*-----------------------------------------------------------------------------------*/
Expand Down Expand Up @@ -246,6 +250,7 @@ sys_mbox_post(sys_mbox_t *mbox, void *msg)
{
BaseType_t ret = xQueueSendToBack((*mbox)->os_mbox, &msg, portMAX_DELAY);
LWIP_ASSERT("mbox post failed", ret == pdTRUE);
(void)ret;
}

/**
Expand Down Expand Up @@ -385,6 +390,8 @@ sys_mbox_free(sys_mbox_t *mbox)
vQueueDelete((*mbox)->os_mbox);
free(*mbox);
*mbox = NULL;

(void)msgs_waiting;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion components/spi_flash/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set(srcs "src/partition"
set(srcs "src/partition.c"
"src/spi_flash_raw.c"
"src/spi_flash.c")
if(BOOTLOADER_BUILD)
Expand Down
7 changes: 7 additions & 0 deletions components/tcpip_adapter/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,11 @@ config TCPIP_ADAPTER_GLOBAL_DATA_LINK_IRAM
help
Link TCPIP adapter global data(.bss .data COMMON) from DRAM to IRAM.

config TCPIP_ADAPTER_HOSTNAME_MAX_LENGTH
int "Max hostname length"
range 1 253
default 32
help
Maximum number of characters in the local hostname

endmenu
1 change: 0 additions & 1 deletion components/tcpip_adapter/include/tcpip_adapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,6 @@ esp_interface_t tcpip_adapter_get_esp_if(void *dev);
*/
esp_err_t tcpip_adapter_get_sta_list(wifi_sta_list_t *wifi_sta_list, tcpip_adapter_sta_list_t *tcpip_sta_list);

#define TCPIP_HOSTNAME_MAX_SIZE 32
/**
* @brief Set the hostname to the interface
*
Expand Down
6 changes: 4 additions & 2 deletions components/tcpip_adapter/tcpip_adapter_lwip.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
#include "FreeRTOS.h"
#include "timers.h"

#include "sdkconfig.h"

struct tcpip_adapter_pbuf {
struct pbuf_custom pbuf;

Expand Down Expand Up @@ -1217,13 +1219,13 @@ esp_err_t tcpip_adapter_set_hostname(tcpip_adapter_if_t tcpip_if, const char *ho
{
#if LWIP_NETIF_HOSTNAME
struct netif *p_netif;
static char hostinfo[TCPIP_ADAPTER_IF_MAX][TCPIP_HOSTNAME_MAX_SIZE + 1];
static char hostinfo[TCPIP_ADAPTER_IF_MAX][CONFIG_TCPIP_ADAPTER_HOSTNAME_MAX_LENGTH + 1];

if (tcpip_if >= TCPIP_ADAPTER_IF_MAX || hostname == NULL) {
return ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS;
}

if (strlen(hostname) > TCPIP_HOSTNAME_MAX_SIZE) {
if (strlen(hostname) > CONFIG_TCPIP_ADAPTER_HOSTNAME_MAX_LENGTH) {
return ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS;
}

Expand Down