From: 孙春阳 Date: Thu, 12 Jun 2025 14:54:00 +0000 (+0800) Subject: 把user_app_reserved ram加到heapsize里,增加可用内存 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=fdd52d79be1c7add31522d9516d8569762e1a5b9;p=mirrors%2FFD230.git 把user_app_reserved ram加到heapsize里,增加可用内存 lwip配置优化,降低不必要的缓存, 优化sys_thread_new函数,从heap创建stack --- diff --git a/code/sdk/drivers/boards/brandy_evb/memory_config/include/psram_32.h b/code/sdk/drivers/boards/brandy_evb/memory_config/include/psram_32.h index 28be5a48e..4989f88a0 100755 --- a/code/sdk/drivers/boards/brandy_evb/memory_config/include/psram_32.h +++ b/code/sdk/drivers/boards/brandy_evb/memory_config/include/psram_32.h @@ -28,11 +28,12 @@ #define PSRAM_HM_APP_SYS_LENGTH psram_align_size(0x2A800, POOL_ADDR_ALIGNSIZE) #define PSRAM_USER_APP_RESERVE_ADDR (PSRAM_HM_APP_SYS_ADDR + PSRAM_HM_APP_SYS_LENGTH) -#define PSRAM_USER_APP_RESERVE_LENGTH psram_align_size(0x69E380, POOL_ADDR_ALIGNSIZE) +// #define PSRAM_USER_APP_RESERVE_LENGTH psram_align_size(0x69E380, POOL_ADDR_ALIGNSIZE) +#define PSRAM_USER_APP_RESERVE_LENGTH psram_align_size(0x0, POOL_ADDR_ALIGNSIZE) /* Heap start address */ #define PSRAM_HEAP_ADDR (PSRAM_USER_APP_RESERVE_ADDR + PSRAM_USER_APP_RESERVE_LENGTH) -#define PSRAM_HEAP_LENGTH psram_align_size(0x700000, POOL_ADDR_ALIGNSIZE) +#define PSRAM_HEAP_LENGTH psram_align_size((0x700000+0x69E380), POOL_ADDR_ALIGNSIZE) /* plt reserve address */ #define PSRAM_PLT_RESERVE_ADDR (PSRAM_HEAP_ADDR + PSRAM_HEAP_LENGTH) diff --git a/code/sdk/open_source/openharmony/third_party/lwip/port/lwip-2.1/porting/include/lwip/lwipopts.h b/code/sdk/open_source/openharmony/third_party/lwip/port/lwip-2.1/porting/include/lwip/lwipopts.h index 71af562d3..07e77c12d 100644 --- a/code/sdk/open_source/openharmony/third_party/lwip/port/lwip-2.1/porting/include/lwip/lwipopts.h +++ b/code/sdk/open_source/openharmony/third_party/lwip/port/lwip-2.1/porting/include/lwip/lwipopts.h @@ -92,9 +92,9 @@ #define LWIP_SOCKET_POLL_FUNC // Options for old lwipopts.h -#define MEM_SIZE (512*1024) // (4*1024*1024) // (512*1024) +#define MEM_SIZE (512*1024) //(4*1024*1024) // (512*1024) #define IP_FRAG_MAX_MTU 1500 -#define LWIP_CONFIG_NUM_SOCKETS 128 +#define LWIP_CONFIG_NUM_SOCKETS 64 #define IP_REASS_MAX_MEM_SIZE (MEM_SIZE / 4) // Options in old opt.h that differs from new opt.h @@ -178,7 +178,7 @@ #define SO_REUSE 1 #define TCPIP_MBOX_SIZE 512 #define TCPIP_THREAD_PRIO 16 //osPriorityBelowNormal 16 -#define TCPIP_THREAD_STACKSIZE 0x6000 +#define TCPIP_THREAD_STACKSIZE 0x2000 #define TCP_MAXRTX 64 // #define TCP_MSS 1400 #define TCP_MSS (IP_FRAG_MAX_MTU - 20 - 20) diff --git a/code/sdk/open_source/openharmony/third_party/lwip/port/lwip-2.1/porting/src/sys_arch.c b/code/sdk/open_source/openharmony/third_party/lwip/port/lwip-2.1/porting/src/sys_arch.c index cc93ac20e..9b89ab052 100644 --- a/code/sdk/open_source/openharmony/third_party/lwip/port/lwip-2.1/porting/src/sys_arch.c +++ b/code/sdk/open_source/openharmony/third_party/lwip/port/lwip-2.1/porting/src/sys_arch.c @@ -73,7 +73,18 @@ sys_thread_t sys_thread_new(const char *name, lwip_thread_fn thread, void *arg, task.usTaskPrio = prio; task.pArgs = (UINTPTR)arg; task.uwResved = LOS_TASK_STATUS_DETACHED; - ret = LOS_TaskCreate(&taskID, &task); + + void *stack_mem = memalign(16, task.uwStackSize); // 16字节对齐 + if (stack_mem!=NULL) + { +#ifdef LOSCFG_TASK_STACK_STATIC_ALLOCATION + ret = LOS_TaskCreateStatic(&taskID, &task, stack_mem); +#else + ret = LOS_TaskCreate(&taskID, &task); +#endif + }else{ + ret = LOS_TaskCreate(&taskID, &task); + } if (ret != LOS_OK) { LWIP_DEBUGF(SYS_DEBUG, ("sys_thread_new: LOS_TaskCreate error %u\n", ret)); return -1; diff --git a/code/sdk/open_source/openharmony/third_party/lwip/port/test/lwip_test.h b/code/sdk/open_source/openharmony/third_party/lwip/port/test/lwip_test.h index 33596887e..b4983a3eb 100644 --- a/code/sdk/open_source/openharmony/third_party/lwip/port/test/lwip_test.h +++ b/code/sdk/open_source/openharmony/third_party/lwip/port/test/lwip_test.h @@ -56,7 +56,7 @@ extern int g_testTemp; #define PEER_IP LOCALHOST #define BUF_SIZE (128 * 1) #define IOV_LENGTH 2 -#define STACK_TEST_SIZE (0x800UL) +#define STACK_TEST_SIZE (0x1800UL) #define ICUNIT_ASSERT_NOT_EQUAL(a, b, c) if ((a) == (b)) { \ g_testError = (c); \