hello Nordic
i am want to run an ncs based application (that is running on nrf52840, -> trying to create single code for 2 boards i have), when i set to run the same application on the nrf52832 i see compilation fails cause not enough space for ram. so to see where i stand and how/what i can reduce in ram i tested how much ram is taken for the simplest peripheral example.
here are the results:
Path Size %
==============================================================================================================
Root 30888 100.00%
├── (hidden) 3065 9.92%
├── (no paths) 5076 16.43%
│ ├── SystemCoreClock 4 0.01%
│ ├── _SEGGER_RTT 168 0.54%
│ ├── __compound_literal.0 24 0.08%
│ ├── __compound_literal.1 24 0.08%
│ ├── __compound_literal.10 20 0.06%
│ ├── __compound_literal.11 20 0.06%
│ ├── __compound_literal.12 24 0.08%
│ ├── __compound_literal.13 20 0.06%
│ ├── __compound_literal.14 12 0.04%
│ ├── __compound_literal.15 9 0.03%
│ ├── __compound_literal.16 4 0.01%
│ ├── __compound_literal.17 10 0.03%
│ ├── __compound_literal.18 8 0.03%
│ ├── __compound_literal.19 20 0.06%
│ ├── __compound_literal.2 28 0.09%
│ ├── __compound_literal.20 4 0.01%
│ ├── __compound_literal.21 4 0.01%
│ ├── __compound_literal.22 4 0.01%
│ ├── __compound_literal.23 8 0.03%
│ ├── __compound_literal.24 4 0.01%
│ ├── __compound_literal.25 4 0.01%
│ ├── __compound_literal.26 4 0.01%
│ ├── __compound_literal.27 8 0.03%
│ ├── __compound_literal.28 4 0.01%
│ ├── __compound_literal.3 24 0.08%
│ ├── __compound_literal.4 64 0.21%
│ ├── __compound_literal.5 24 0.08%
│ ├── __compound_literal.6 28 0.09%
│ ├── __compound_literal.7 84 0.27%
│ ├── __compound_literal.8 28 0.09%
│ ├── __compound_literal.9 16 0.05%
│ ├── _kernel 48 0.16%
│ ├── _sw_isr_table 312 1.01%
│ ├── bt_auth 4 0.01%
│ ├── bt_dev 504 1.63%
│ ├── cli.2 16 0.05%
│ ├── default_settings_nvs.0 64 0.21%
│ ├── dev.0 4 0.01%
│ ├── dynamic_regions.0 12 0.04%
│ ├── events.0 60 0.19%
│ ├── gpio_initialized.0 1 0.00%
│ ├── hci_buffer.0 73 0.24%
│ ├── heartrate.0 1 0.00%
│ ├── hrm.0 2 0.01%
│ ├── ident.1 1 0.00%
│ ├── k_sys_work_q 160 0.52%
│ ├── on.3 4 0.01%
│ ├── once.1 1 0.00%
│ ├── ops.0 32 0.10%
│ ├── pub_key_cb.0 8 0.03%
│ ├── rtt_term_mutex 20 0.06%
│ ├── settings_handlers 8 0.03%
│ ├── settings_load_srcs 8 0.03%
│ ├── settings_save_dst 4 0.01%
│ ├── str.1 30 0.10%
│ ├── str.3 129 0.42%
│ ├── sym_4UPCEGANXTW4CY2APTG4M3ASURYRAOSICOABFVQ 4 0.01%
│ ├── sym_BQU3DXYQO6CVRTZ73QCZ3ROACVRWF5BM63HWZBA 4 0.01%
│ ├── sym_I2ECAHYJUC2B2QUHO3QKLB2MXHP4E2UH6ISXFDY 4 0.01%
│ ├── sym_RIJRDO5P75BJM27PPQHZSDMFCKFZWFJNGCJA52I 4 0.01%
│ ├── sym_SXHUVOM4EI7L4NGF2KWSQ6ZLB3KNNMW76PXITUA 467 1.51%
│ ├── sym_VQ35Q3R547AGSAUE3MG4FJPAHAQLVUOXVCL6PHY 3 0.01%
│ ├── sym_X2CGJY32WPU5QR6XFTHTAS6KO4LV2ENSTHTXMQI 28 0.09%
│ ├── sym_Z5WZCMHZDI7RNMVB5GZYQIRS7P3BTO7552UV62I 1 0.00%
│ ├── sym_ZBLSXVK5T67DMHUVRGQNLJO5IMUQ4ERRIIDJ55A 4 0.01%
│ ├── wait_q.0 8 0.03%
│ ├── z_idle_threads 128 0.41%
│ ├── z_interrupt_stacks 2080 6.73%
│ └── z_main_thread 128 0.41%
├── / 304 0.98%
│ └── home 304 0.98%
│ └── zhershkovitch 304 0.98%
│ └── workspace 304 0.98%
│ └── sample_test 304 0.98%
│ └── peripheral 304 0.98%
│ └── src 304 0.98%
│ ├── cts.c 11 0.04%
│ │ ├── ct 10 0.03%
│ │ └── ct_update 1 0.00%
│ └── main.c 293 0.95%
│ ├── auth_cb_display 36 0.12%
│ ├── conn_callbacks 28 0.09%
│ ├── gatt_callbacks 8 0.03%
│ ├── ind_params 24 0.08%
│ ├── indicating 1 0.00%
│ ├── signed_value 4 0.01%
│ ├── simulate_vnd 1 0.00%
│ ├── vnd_auth_uuid 17 0.06%
│ ├── vnd_auth_value 21 0.07%
│ ├── vnd_enc_uuid 17 0.06%
│ ├── vnd_long_cep 2 0.01%
│ ├── vnd_long_value 75 0.24%
│ ├── vnd_uuid 17 0.06%
│ ├── vnd_value 21 0.07%
│ └── vnd_wwr_value 21 0.07%
├── WORKSPACE 5513 17.85%
│ ├── modules 1128 3.65%
│ │ ├── crypto 4 0.01%
│ │ │ └── tinycrypt 4 0.01%
│ │ │ └── lib 4 0.01%
│ │ │ └── source 4 0.01%
│ │ │ └── ecc.c 4 0.01%
│ │ │ └── g_rng_function 4 0.01%
│ │ ├── debug 1040 3.37%
│ │ │ └── segger 1040 3.37%
│ │ │ └── SEGGER 1040 3.37%
│ │ │ └── SEGGER_RTT.c 1040 3.37%
│ │ │ ├── _acDownBuffer 16 0.05%
│ │ │ └── _acUpBuffer 1024 3.32%
│ │ └── hal 84 0.27%
│ │ └── nordic 84 0.27%
│ │ └── nrfx 84 0.27%
│ │ └── drivers 84 0.27%
│ │ └── src 84 0.27%
│ │ ├── nrfx_gpiote.c 80 0.26%
│ │ │ └── m_cb 80 0.26%
│ │ └── nrfx_ppi.c 4 0.01%
│ │ └── m_channels_allocated 4 0.01%
│ └── nrf 4385 14.20%
│ ├── drivers 72 0.23%
│ │ └── mpsl 72 0.23%
│ │ ├── clock_control 4 0.01%
│ │ │ └── nrfx_clock_mpsl.c 4 0.01%
│ │ │ └── event_handler 4 0.01%
│ │ └── flash_sync 68 0.22%
│ │ └── flash_sync_mpsl.c 68 0.22%
│ │ └── _context 68 0.22%
│ ├── lib 20 0.06%
│ │ └── multithreading_lock 20 0.06%
│ │ └── multithreading_lock.c 20 0.06%
│ │ └── mpsl_lock 20 0.06%
│ └── subsys 4293 13.90%
│ ├── bluetooth 3049 9.87%
│ │ └── controller 3049 9.87%
│ │ ├── hci_driver.c 2978 9.64%
│ │ │ ├── entropy_source 4 0.01%
│ │ │ ├── recv_thread_data 128 0.41%
│ │ │ ├── recv_thread_stack 1056 3.42%
│ │ │ ├── sdc_mempool 1766 5.72%
│ │ │ └── sem_recv 24 0.08%
│ │ └── hci_internal.c 71 0.23%
│ │ └── cmd_complete_or_status 71 0.23%
│ └── mpsl 1244 4.03%
│ └── init 1244 4.03%
│ └── mpsl_init.c 1244 4.03%
│ ├── sem_signal 24 0.08%
│ ├── signal_thread_data 128 0.41%
│ ├── signal_thread_stack 1056 3.42%
│ └── timeslot_context 36 0.12%
└── ZEPHYR_BASE 16930 54.81%
├── arch 1 0.00%
│ └── arm 1 0.00%
│ └── core 1 0.00%
│ └── aarch32 1 0.00%
│ └── mpu 1 0.00%
│ └── arm_mpu.c 1 0.00%
│ └── static_regions_num 1 0.00%
├── drivers 292 0.95%
│ ├── clock_control 88 0.28%
│ │ └── clock_control_nrf.c 88 0.28%
│ │ ├── __devstate_dts_ord_26 4 0.01%
│ │ ├── data 80 0.26%
│ │ └── hfclk_users 4 0.01%
│ ├── console 4 0.01%
│ │ └── uart_console.c 4 0.01%
│ │ └── uart_console_dev 4 0.01%
│ ├── entropy 88 0.28%
│ │ └── entropy_nrf5.c 88 0.28%
│ │ ├── __devstate_dts_ord_36 4 0.01%
│ │ └── entropy_nrf5_data 84 0.27%
│ ├── flash 36 0.12%
│ │ └── soc_flash_nrf.c 36 0.12%
│ │ ├── __devstate_dts_ord_52 4 0.01%
│ │ ├── dev_layout 8 0.03%
│ │ └── sem_lock 24 0.08%
│ ├── gpio 32 0.10%
│ │ └── gpio_nrfx.c 32 0.10%
│ │ ├── __devstate_dts_ord_10 4 0.01%
│ │ └── gpio_nrfx_p0_data 28 0.09%
│ ├── serial 24 0.08%
│ │ └── uart_nrfx_uarte.c 24 0.08%
│ │ ├── __devstate_dts_ord_49 4 0.01%
│ │ └── uarte_0_data 20 0.06%
│ └── timer 20 0.06%
│ ├── nrf_rtc_timer.c 16 0.05%
│ │ ├── cc_data 8 0.03%
│ │ ├── int_mask 4 0.01%
│ │ └── last_count 4 0.01%
│ └── sys_clock_init.c 4 0.01%
│ └── __devstate_sys_init_sys_clock_driver_init0 4 0.01%
├── kernel 3529 11.43%
│ ├── init.c 1409 4.56%
│ │ ├── z_idle_stacks 352 1.14%
│ │ ├── z_main_stack 1056 3.42%
│ │ └── z_sys_post_kernel 1 0.00%
│ ├── sched.c 12 0.04%
│ │ ├── pending_current 4 0.01%
│ │ ├── slice_max_prio 4 0.01%
│ │ └── slice_time 4 0.01%
│ ├── system_work_q.c 2080 6.73%
│ │ └── sys_work_q_stack 2080 6.73%
│ ├── timeout.c 20 0.06%
│ │ ├── announce_remaining 4 0.01%
│ │ ├── curr_tick 8 0.03%
│ │ └── timeout_list 8 0.03%
│ └── work.c 8 0.03%
│ └── pending_cancels 8 0.03%
├── lib 8 0.03%
│ ├── libc 4 0.01%
│ │ └── minimal 4 0.01%
│ │ └── source 4 0.01%
│ │ └── stdout 4 0.01%
│ │ └── stdout_console.c 4 0.01%
│ │ └── _stdout_hook 4 0.01%
│ └── os 4 0.01%
│ └── printk.c 4 0.01%
│ └── _char_out 4 0.01%
└── subsys 13100 42.41%
├── bluetooth 10270 33.25%
│ ├── host 10261 33.22%
│ │ ├── att.c 1077 3.49%
│ │ │ ├── _k_mem_slab_buf_att_slab 68 0.22%
│ │ │ ├── _k_mem_slab_buf_chan_slab 328 1.06%
│ │ │ ├── _k_mem_slab_buf_req_slab 84 0.27%
│ │ │ ├── att_slab 28 0.09%
│ │ │ ├── cancel 28 0.09%
│ │ │ ├── chan_slab 28 0.09%
│ │ │ ├── net_buf_data_prep_pool 325 1.05%
│ │ │ ├── net_buf_prep_pool 120 0.39%
│ │ │ ├── prep_pool 40 0.13%
│ │ │ └── req_slab 28 0.09%
│ │ ├── buf.c 1328 4.30%
│ │ │ ├── discardable_pool 40 0.13%
│ │ │ ├── hci_rx_pool 40 0.13%
│ │ │ ├── net_buf_data_discardable_pool 135 0.44%
│ │ │ ├── net_buf_data_hci_rx_pool 730 2.36%
│ │ │ ├── net_buf_data_num_complete_pool 7 0.02%
│ │ │ ├── net_buf_discardable_pool 72 0.23%
│ │ │ ├── net_buf_hci_rx_pool 240 0.78%
│ │ │ ├── net_buf_num_complete_pool 24 0.08%
│ │ │ └── num_complete_pool 40 0.13%
│ │ ├── conn.c 765 2.48%
│ │ │ ├── acl_conns 192 0.62%
│ │ │ ├── acl_tx_pool 40 0.13%
│ │ │ ├── callback_list 4 0.01%
│ │ │ ├── conn_change 16 0.05%
│ │ │ ├── conn_tx 48 0.16%
│ │ │ ├── frag_pool 40 0.13%
│ │ │ ├── free_tx 24 0.08%
│ │ │ ├── net_buf_acl_tx_pool 72 0.23%
│ │ │ ├── net_buf_data_acl_tx_pool 219 0.71%
│ │ │ ├── net_buf_data_frag_pool 62 0.20%
│ │ │ └── net_buf_frag_pool 48 0.16%
│ │ ├── ecc.c 76 0.25%
│ │ │ ├── dh_key_cb 4 0.01%
│ │ │ ├── pub_key 64 0.21%
│ │ │ └── pub_key_cb_slist 8 0.03%
│ │ ├── gatt.c 330 1.07%
│ │ │ ├── callback_list 8 0.03%
│ │ │ ├── cf_cfg 32 0.10%
│ │ │ ├── db_hash 120 0.39%
│ │ │ ├── gatt_sc 88 0.28%
│ │ │ ├── init 4 0.01%
│ │ │ ├── last_static_handle 2 0.01%
│ │ │ ├── sc_ccc 24 0.08%
│ │ │ ├── sc_cfg 24 0.08%
│ │ │ ├── sc_restore_params 24 0.08%
│ │ │ └── service_init 4 0.01%
│ │ ├── hci_core.c 4314 13.97%
│ │ │ ├── cmd_data 24 0.08%
│ │ │ ├── disconnected_handles 2 0.01%
│ │ │ ├── hci_cmd_pool 40 0.13%
│ │ │ ├── net_buf_data_hci_cmd_pool 140 0.45%
│ │ │ ├── net_buf_hci_cmd_pool 48 0.16%
│ │ │ ├── ready_cb 4 0.01%
│ │ │ ├── rx_thread_data 128 0.41%
│ │ │ ├── rx_thread_stack 2232 7.23%
│ │ │ ├── tx_thread_data 128 0.41%
│ │ │ └── tx_thread_stack 1568 5.08%
│ │ ├── hci_ecc.c 1428 4.62%
│ │ │ ├── cmd_sem 24 0.08%
│ │ │ ├── ecc 96 0.31%
│ │ │ ├── ecc_thread_data 128 0.41%
│ │ │ ├── ecc_thread_stack 1176 3.81%
│ │ │ └── flags 4 0.01%
│ │ ├── keys.c 144 0.47%
│ │ │ ├── aging_counter_val 4 0.01%
│ │ │ ├── key_pool 136 0.44%
│ │ │ └── last_keys_updated 4 0.01%
│ │ ├── l2cap.c 232 0.75%
│ │ │ └── bt_l2cap_pool 232 0.75%
│ │ ├── settings.c 16 0.05%
│ │ │ └── save_id_work 16 0.05%
│ │ └── smp.c 551 1.78%
│ │ ├── bondable 1 0.00%
│ │ ├── bt_smp_pool 520 1.68%
│ │ ├── oobd_present 1 0.00%
│ │ ├── sc_local_pkey_ready 24 0.08%
│ │ ├── sc_public_key 4 0.01%
│ │ └── sc_supported 1 0.00%
│ └── services 9 0.03%
│ ├── bas.c 1 0.00%
│ │ └── battery_level 1 0.00%
│ ├── dis.c 7 0.02%
│ │ └── dis_pnp_id 7 0.02%
│ └── hrs.c 1 0.00%
│ └── hrs_blsc 1 0.00%
├── logging 2765 8.95%
│ ├── log_backend_rtt.c 38 0.12%
│ │ ├── backend_cb_log_backend_rtt 8 0.03%
│ │ ├── char_buf 16 0.05%
│ │ ├── host_present 1 0.00%
│ │ ├── log_output_rtt_control_block 12 0.04%
│ │ └── panic_mode 1 0.00%
│ ├── log_backend_uart.c 25 0.08%
│ │ ├── backend_cb_log_backend_uart 8 0.03%
│ │ ├── log_output_uart_control_block 12 0.04%
│ │ ├── uart_dev 4 0.01%
│ │ └── uart_output_buf 1 0.00%
│ ├── log_core.c 1642 5.32%
│ │ ├── backend_attached 1 0.00%
│ │ ├── buffered_cnt 4 0.01%
│ │ ├── dropped_cnt 4 0.01%
│ │ ├── initialized 4 0.01%
│ │ ├── list 8 0.03%
│ │ ├── log_process_thread_sem 24 0.08%
│ │ ├── log_process_thread_timer 56 0.18%
│ │ ├── log_strdup_pool 28 0.09%
│ │ ├── log_strdup_pool_buf 576 1.86%
│ │ ├── logging_stack 800 2.59%
│ │ ├── logging_thread 128 0.41%
│ │ ├── panic_mode 1 0.00%
│ │ ├── proc_tid 4 0.01%
│ │ └── timestamp_func 4 0.01%
│ ├── log_msg.c 1052 3.41%
│ │ ├── log_msg_pool 28 0.09%
│ │ └── log_msg_pool_buf 1024 3.32%
│ └── log_output.c 8 0.03%
│ ├── freq 4 0.01%
│ └── timestamp_div 4 0.01%
├── pm 24 0.08%
│ └── power.c 24 0.08%
│ ├── pm_notifiers 8 0.03%
│ ├── post_ops_done 4 0.01%
│ └── z_power_state 12 0.04%
├── settings 37 0.12%
│ └── src 37 0.12%
│ ├── settings.c 20 0.06%
│ │ └── settings_lock 20 0.06%
│ ├── settings_init.c 1 0.00%
│ │ └── settings_subsys_initialized 1 0.00%
│ └── settings_nvs.c 16 0.05%
│ └── settings_nvs_itf 16 0.05%
└── storage 4 0.01%
└── flash_map 4 0.01%
└── flash_map_default.c 4 0.01%
└── flash_map 4 0.01%
==============================================================================================================
30888
it takes almost half the ram of the nrf52832
and it seems to me very poor situation, any ideas how can i reduce ram take with ncs ?
obviously i have many more things on my app that i will try to reduce but currently zephyr part in my app takes 80% of the ram ... it looks like there was no way for ncs supporting the smaller socs (below nrf52840, nrf53, nrf9160 etc.)
what is your say/ advice on that matter (and ideas for reducing ram take )?
hope to read from you soon
best regards
Ziv
