diff --git a/features/FEATURE_COMMON_PAL/nanostack-hal-mbed-cmsis-rtos/arm_hal_interrupt.c b/features/FEATURE_COMMON_PAL/nanostack-hal-mbed-cmsis-rtos/arm_hal_interrupt.c index 21ce05a293..2110f8efa6 100644 --- a/features/FEATURE_COMMON_PAL/nanostack-hal-mbed-cmsis-rtos/arm_hal_interrupt.c +++ b/features/FEATURE_COMMON_PAL/nanostack-hal-mbed-cmsis-rtos/arm_hal_interrupt.c @@ -12,7 +12,7 @@ static uint8_t sys_irq_disable_counter; static mbed_rtos_storage_mutex_t critical_mutex; static const osMutexAttr_t critical_mutex_attr = { - .name = "critical_mutex", + .name = "nanostack_critical_mutex", .attr_bits = osMutexRecursive, .cb_mem = &critical_mutex, .cb_size = sizeof critical_mutex, diff --git a/features/FEATURE_COMMON_PAL/nanostack-hal-mbed-cmsis-rtos/arm_hal_timer.cpp b/features/FEATURE_COMMON_PAL/nanostack-hal-mbed-cmsis-rtos/arm_hal_timer.cpp index 4ab6f718f3..662eddae86 100644 --- a/features/FEATURE_COMMON_PAL/nanostack-hal-mbed-cmsis-rtos/arm_hal_timer.cpp +++ b/features/FEATURE_COMMON_PAL/nanostack-hal-mbed-cmsis-rtos/arm_hal_timer.cpp @@ -37,6 +37,7 @@ static void timer_thread(void *arg) void platform_timer_enable(void) { static osThreadAttr_t timer_thread_attr = {0}; + timer_thread_attr.name = "pal_timer_thread"; timer_thread_attr.stack_mem = &timer_thread_stk[0]; timer_thread_attr.cb_mem = &timer_thread_tcb; timer_thread_attr.stack_size = sizeof(timer_thread_stk); diff --git a/features/FEATURE_COMMON_PAL/nanostack-hal-mbed-cmsis-rtos/ns_event_loop.c b/features/FEATURE_COMMON_PAL/nanostack-hal-mbed-cmsis-rtos/ns_event_loop.c index 01d5675e0e..27c02b5a81 100644 --- a/features/FEATURE_COMMON_PAL/nanostack-hal-mbed-cmsis-rtos/ns_event_loop.c +++ b/features/FEATURE_COMMON_PAL/nanostack-hal-mbed-cmsis-rtos/ns_event_loop.c @@ -19,6 +19,7 @@ static void event_loop_thread(void *arg); static uint64_t event_thread_stk[MBED_CONF_NANOSTACK_HAL_EVENT_LOOP_THREAD_STACK_SIZE/8]; static mbed_rtos_storage_thread_t event_thread_tcb; static const osThreadAttr_t event_thread_attr = { + .name = "nanostack_event_thread", .priority = osPriorityNormal, .stack_mem = &event_thread_stk[0], .stack_size = sizeof event_thread_stk, @@ -28,7 +29,7 @@ static const osThreadAttr_t event_thread_attr = { static osThreadId_t event_thread_id; static mbed_rtos_storage_mutex_t event_mutex; static const osMutexAttr_t event_mutex_attr = { - .name = "event_mutex", + .name = "nanostack_event_mutex", .attr_bits = osMutexRecursive, .cb_mem = &event_mutex, .cb_size = sizeof event_mutex, diff --git a/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_Freescale/k64f_emac.c b/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_Freescale/k64f_emac.c index 9291363852..b4c9d1e822 100644 --- a/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_Freescale/k64f_emac.c +++ b/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_Freescale/k64f_emac.c @@ -712,18 +712,18 @@ err_t eth_arch_enetif_init(struct netif *netif) LWIP_ASSERT("RxReadySem creation error", (err == ERR_OK)); #ifdef LWIP_DEBUG - sys_thread_new("receive_thread", packet_rx, netif->state, DEFAULT_THREAD_STACKSIZE*5, RX_PRIORITY); + sys_thread_new("k64f_emac_rx_thread", packet_rx, netif->state, DEFAULT_THREAD_STACKSIZE*5, RX_PRIORITY); #else - sys_thread_new("receive_thread", packet_rx, netif->state, DEFAULT_THREAD_STACKSIZE, RX_PRIORITY); + sys_thread_new("k64f_emac_thread", packet_rx, netif->state, DEFAULT_THREAD_STACKSIZE, RX_PRIORITY); #endif /* Transmit cleanup task */ err = sys_sem_new(&k64f_enetdata.TxCleanSem, 0); LWIP_ASSERT("TxCleanSem creation error", (err == ERR_OK)); - sys_thread_new("txclean_thread", packet_tx, netif->state, DEFAULT_THREAD_STACKSIZE, TX_PRIORITY); + sys_thread_new("k64f_emac_txclean_thread", packet_tx, netif->state, DEFAULT_THREAD_STACKSIZE, TX_PRIORITY); /* PHY monitoring task */ - sys_thread_new("phy_thread", k64f_phy_task, netif, DEFAULT_THREAD_STACKSIZE, PHY_PRIORITY); + sys_thread_new("k64f_emac_phy_thread", k64f_phy_task, netif, DEFAULT_THREAD_STACKSIZE, PHY_PRIORITY); /* Allow the PHY task to detect the initial link state and set up the proper flags */ osDelay(10); diff --git a/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_NUVOTON/TARGET_NUC472/nuc472_netif.c b/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_NUVOTON/TARGET_NUC472/nuc472_netif.c index 7cdb7a9a60..cd954a6a43 100644 --- a/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_NUVOTON/TARGET_NUC472/nuc472_netif.c +++ b/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_NUVOTON/TARGET_NUC472/nuc472_netif.c @@ -435,17 +435,17 @@ err_t #if defined (__GNUC__) // mbed OS 2.0, DEFAULT_THREAD_STACKSIZE*3 // mbed OS 5.0, DEFAULT_THREAD_STACKSIZE*5 - sys_thread_new("receive_thread", __packet_rx_task, &RxReadySem, DEFAULT_THREAD_STACKSIZE*5, osPriorityNormal); + sys_thread_new("nuc472_emac_rx_thread", __packet_rx_task, &RxReadySem, DEFAULT_THREAD_STACKSIZE*5, osPriorityNormal); #else - sys_thread_new("receive_thread", __packet_rx_task, &RxReadySem, DEFAULT_THREAD_STACKSIZE, osPriorityNormal); + sys_thread_new("nuc472_emac_rx_thread", __packet_rx_task, &RxReadySem, DEFAULT_THREAD_STACKSIZE, osPriorityNormal); #endif /* PHY monitoring task */ #if defined (__GNUC__) // mbed OS 2.0, DEFAULT_THREAD_STACKSIZE // mbed OS 5.0, DEFAULT_THREAD_STACKSIZE*2 - sys_thread_new("phy_thread", __phy_task, netif, DEFAULT_THREAD_STACKSIZE*2, osPriorityNormal); + sys_thread_new("nuc472_emac_phy_thread", __phy_task, netif, DEFAULT_THREAD_STACKSIZE*2, osPriorityNormal); #else - sys_thread_new("phy_thread", __phy_task, netif, DEFAULT_THREAD_STACKSIZE, osPriorityNormal); + sys_thread_new("nuc472_emac_phy_thread", __phy_task, netif, DEFAULT_THREAD_STACKSIZE, osPriorityNormal); #endif /* Allow the PHY task to detect the initial link state and set up the proper flags */ osDelay(10); diff --git a/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_NXP/lpc17_emac.c b/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_NXP/lpc17_emac.c index 91515c43cc..d62fa90bf0 100644 --- a/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_NXP/lpc17_emac.c +++ b/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_NXP/lpc17_emac.c @@ -1031,16 +1031,16 @@ err_t eth_arch_enetif_init(struct netif *netif) LWIP_ASSERT("TXLockMutex creation error", (err == ERR_OK)); /* Packet receive task */ - lpc_enetdata.RxThread = sys_thread_new("receive_thread", packet_rx, netif->state, DEFAULT_THREAD_STACKSIZE, RX_PRIORITY); + lpc_enetdata.RxThread = sys_thread_new("lpc17_emac_rx_thread", packet_rx, netif->state, DEFAULT_THREAD_STACKSIZE, RX_PRIORITY); LWIP_ASSERT("RxThread creation error", (lpc_enetdata.RxThread)); /* Transmit cleanup task */ err = sys_sem_new(&lpc_enetdata.TxCleanSem, 0); LWIP_ASSERT("TxCleanSem creation error", (err == ERR_OK)); - sys_thread_new("txclean_thread", packet_tx, netif->state, DEFAULT_THREAD_STACKSIZE, TX_PRIORITY); + sys_thread_new("lpc17_emac_txclean_thread", packet_tx, netif->state, DEFAULT_THREAD_STACKSIZE, TX_PRIORITY); /* periodic PHY status update */ - sys_thread_new("phy_thread", phy_update, netif, DEFAULT_THREAD_STACKSIZE, TX_PRIORITY); + sys_thread_new("lpc17_emac_phy_thread", phy_update, netif, DEFAULT_THREAD_STACKSIZE, TX_PRIORITY); #endif return ERR_OK; diff --git a/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_RZ_A1H/rza1_emac.c b/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_RZ_A1H/rza1_emac.c index 0953de1da4..65515507a0 100644 --- a/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_RZ_A1H/rza1_emac.c +++ b/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_RZ_A1H/rza1_emac.c @@ -195,8 +195,8 @@ err_t eth_arch_enetif_init(struct netif *netif) sys_sem_new(&recv_ready_sem, 0); /* task */ - sys_thread_new("rza1_recv_task", rza1_recv_task, netif, DEFAULT_THREAD_STACKSIZE, RECV_TASK_PRI); - sys_thread_new("rza1_phy_task", rza1_phy_task, netif, DEFAULT_THREAD_STACKSIZE, PHY_TASK_PRI); + sys_thread_new("rza1_emac_rx_thread", rza1_recv_task, netif, DEFAULT_THREAD_STACKSIZE, RECV_TASK_PRI); + sys_thread_new("rza1_emac_phy_thread", rza1_phy_task, netif, DEFAULT_THREAD_STACKSIZE, PHY_TASK_PRI); return ERR_OK; } diff --git a/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_STM/stm32xx_emac.c b/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_STM/stm32xx_emac.c index de1bd17f69..c834912a2f 100644 --- a/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_STM/stm32xx_emac.c +++ b/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_STM/stm32xx_emac.c @@ -451,8 +451,8 @@ err_t eth_arch_enetif_init(struct netif *netif) sys_mutex_new(&tx_lock_mutex); /* task */ - sys_thread_new("_eth_arch_rx_task", _eth_arch_rx_task, netif, DEFAULT_THREAD_STACKSIZE, RECV_TASK_PRI); - sys_thread_new("_eth_arch_phy_task", _eth_arch_phy_task, netif, DEFAULT_THREAD_STACKSIZE, PHY_TASK_PRI); + sys_thread_new("stm32_emac_rx_thread", _eth_arch_rx_task, netif, DEFAULT_THREAD_STACKSIZE, RECV_TASK_PRI); + sys_thread_new("stm32_emac_phy_thread", _eth_arch_phy_task, netif, DEFAULT_THREAD_STACKSIZE, PHY_TASK_PRI); /* initialize the hardware */ _eth_arch_low_level_init(netif); diff --git a/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_VK_RZ_A1H/rza1_emac.c b/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_VK_RZ_A1H/rza1_emac.c index 0953de1da4..65515507a0 100644 --- a/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_VK_RZ_A1H/rza1_emac.c +++ b/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_VK_RZ_A1H/rza1_emac.c @@ -195,8 +195,8 @@ err_t eth_arch_enetif_init(struct netif *netif) sys_sem_new(&recv_ready_sem, 0); /* task */ - sys_thread_new("rza1_recv_task", rza1_recv_task, netif, DEFAULT_THREAD_STACKSIZE, RECV_TASK_PRI); - sys_thread_new("rza1_phy_task", rza1_phy_task, netif, DEFAULT_THREAD_STACKSIZE, PHY_TASK_PRI); + sys_thread_new("rza1_emac_rx_thread", rza1_recv_task, netif, DEFAULT_THREAD_STACKSIZE, RECV_TASK_PRI); + sys_thread_new("rza1_emac_phy_thread", rza1_phy_task, netif, DEFAULT_THREAD_STACKSIZE, PHY_TASK_PRI); return ERR_OK; } diff --git a/features/FEATURE_LWIP/lwip-interface/lwip-sys/arch/lwip_sys_arch.c b/features/FEATURE_LWIP/lwip-interface/lwip-sys/arch/lwip_sys_arch.c index d02fe9321f..7c6ecbc0e0 100644 --- a/features/FEATURE_LWIP/lwip-interface/lwip-sys/arch/lwip_sys_arch.c +++ b/features/FEATURE_LWIP/lwip-interface/lwip-sys/arch/lwip_sys_arch.c @@ -378,6 +378,7 @@ void sys_sem_free(sys_sem_t *sem) {} * @return a new mutex */ err_t sys_mutex_new(sys_mutex_t *mutex) { memset(&mutex->data, 0, sizeof(mutex->data)); + mutex->attr.name = "lwip_mutex"; mutex->attr.cb_mem = &mutex->data; mutex->attr.cb_size = sizeof(mutex->data); mutex->id = osMutexNew(&mutex->attr); @@ -417,6 +418,7 @@ mbed_rtos_storage_mutex_t lwip_sys_mutex_data; void sys_init(void) { us_ticker_read(); // Init sys tick + lwip_sys_mutex_attr.name = "lwip_sys_mutex"; lwip_sys_mutex_attr.cb_mem = &lwip_sys_mutex_data; lwip_sys_mutex_attr.cb_size = sizeof(lwip_sys_mutex_data); lwip_sys_mutex = osMutexNew(&lwip_sys_mutex_attr); @@ -517,7 +519,7 @@ sys_thread_t sys_thread_new(const char *pcName, sys_thread_t t = (sys_thread_t)&thread_pool[thread_pool_index]; thread_pool_index++; - t->attr.name = pcName; + t->attr.name = pcName ? pcName : "lwip_unnamed_thread"; t->attr.priority = (osPriority_t)priority; t->attr.cb_size = sizeof(t->data); t->attr.cb_mem = &t->data; diff --git a/features/FEATURE_UVISOR/source/rtx/box_init.c b/features/FEATURE_UVISOR/source/rtx/box_init.c index e63a8468e4..63f257243f 100644 --- a/features/FEATURE_UVISOR/source/rtx/box_init.c +++ b/features/FEATURE_UVISOR/source/rtx/box_init.c @@ -111,6 +111,7 @@ void __uvisor_lib_box_init(void * lib_config) __uvisor_initialize_rpc_queues(); + thread_attr.name = "uvisor_box_main_thread"; thread_attr.priority = box_main->priority; thread_attr.stack_size = box_main->stack_size; diff --git a/features/FEATURE_UVISOR/source/rtx/rtx_malloc_wrapper.c b/features/FEATURE_UVISOR/source/rtx/rtx_malloc_wrapper.c index ce14382984..ddb90ba931 100644 --- a/features/FEATURE_UVISOR/source/rtx/rtx_malloc_wrapper.c +++ b/features/FEATURE_UVISOR/source/rtx/rtx_malloc_wrapper.c @@ -65,6 +65,7 @@ static int init_allocator() if ((__uvisor_ps->mutex_id == NULL) && is_kernel_initialized()) { /* Point the mutex attr to the data. */ + __uvisor_ps->mutex_attr.name = "uvisor_malloc_mutex"; __uvisor_ps->mutex_attr.attr_bits = 0; /* Non-recursive */ __uvisor_ps->mutex_attr.cb_mem = &__uvisor_ps->mutex_data; __uvisor_ps->mutex_attr.cb_size = sizeof(__uvisor_ps->mutex_data); diff --git a/features/FEATURE_UVISOR/source/rtx/unsupported_page_allocator.c b/features/FEATURE_UVISOR/source/rtx/unsupported_page_allocator.c index 7bb3a57535..c0423a97ab 100644 --- a/features/FEATURE_UVISOR/source/rtx/unsupported_page_allocator.c +++ b/features/FEATURE_UVISOR/source/rtx/unsupported_page_allocator.c @@ -54,7 +54,7 @@ int uvisor_page_free(const UvisorPageTable *const table) static osMutexId_t g_page_allocator_mutex_id = NULL; static osRtxMutex_t g_page_allocator_mutex_data; static osMutexDef_t g_page_allocator_mutex_attr = { - .name = "", + .name = "uvisor_page_alloc_mutex", .attr_bits = 0, /* Non-recursive */ .cb_mem = &g_page_allocator_mutex_data, .cb_size = sizeof(g_page_allocator_mutex_data) diff --git a/rtos/Thread.cpp b/rtos/Thread.cpp index cb602c2e58..990a126062 100644 --- a/rtos/Thread.cpp +++ b/rtos/Thread.cpp @@ -43,7 +43,7 @@ void Thread::constructor(osPriority priority, memset(&_attr, 0, sizeof(_attr)); _attr.priority = priority; _attr.stack_size = stack_size; - _attr.name = name; + _attr.name = name ? name : "application_unnamed_thread"; _attr.stack_mem = (uint32_t*)stack_mem; } diff --git a/rtos/mbed_boot.c b/rtos/mbed_boot.c index efe6cc39d4..ee443c1de9 100644 --- a/rtos/mbed_boot.c +++ b/rtos/mbed_boot.c @@ -315,7 +315,7 @@ void mbed_start_main(void) _main_thread_attr.cb_size = sizeof(_main_obj); _main_thread_attr.cb_mem = &_main_obj; _main_thread_attr.priority = osPriorityNormal; - _main_thread_attr.name = "MAIN"; + _main_thread_attr.name = "main_thread"; osThreadId_t result = osThreadNew((osThreadFunc_t)pre_main, NULL, &_main_thread_attr); if ((void *)result == NULL) { error("Pre main thread not created"); @@ -381,6 +381,7 @@ extern int main(int argc, char* argv[]); void pre_main (void) { + singleton_mutex_attr.name = "singleton_mutex"; singleton_mutex_attr.attr_bits = osMutexRecursive; singleton_mutex_attr.cb_size = sizeof(singleton_mutex_obj); singleton_mutex_attr.cb_mem = &singleton_mutex_obj; @@ -437,16 +438,19 @@ int __wrap_main(void) { void pre_main(void) { + singleton_mutex_attr.name = "singleton_mutex"; singleton_mutex_attr.attr_bits = osMutexRecursive; singleton_mutex_attr.cb_size = sizeof(singleton_mutex_obj); singleton_mutex_attr.cb_mem = &singleton_mutex_obj; singleton_mutex_id = osMutexNew(&singleton_mutex_attr); + malloc_mutex_attr.name = "malloc_mutex"; malloc_mutex_attr.attr_bits = osMutexRecursive; malloc_mutex_attr.cb_size = sizeof(malloc_mutex_obj); malloc_mutex_attr.cb_mem = &malloc_mutex_obj; malloc_mutex_id = osMutexNew(&malloc_mutex_attr); + env_mutex_attr.name = "env_mutex"; env_mutex_attr.attr_bits = osMutexRecursive; env_mutex_attr.cb_size = sizeof(env_mutex_obj); env_mutex_attr.cb_mem = &env_mutex_obj; @@ -520,6 +524,7 @@ static uint8_t low_level_init_needed; void pre_main(void) { + singleton_mutex_attr.name = "singleton_mutex"; singleton_mutex_attr.attr_bits = osMutexRecursive; singleton_mutex_attr.cb_size = sizeof(singleton_mutex_obj); singleton_mutex_attr.cb_mem = &singleton_mutex_obj;