본문으로 바로가기

[nRF52 ] Release 모드 DEBUG 로그 안 나오게 설정하기

category Nordic_nRF52 2023. 8. 31. 15:06

 :  SES (Segger embedded Studio) 의 Release 모드 선택시는 LOG(Serial or RTT)를 안나오게 하고

    Debug 모드시는 Log 데이타가 나오게  만들어 봤습니다.

 

  ▶ 프로젝트 파일을 열어서 release/ debug 시 설정사항을 확인합니다.

     Project --> Open Solution in Editor  선택

   ==> Release 시 정의된 NDEBUG 보이시죠.. 이거 헤더파일에서  사용 할겁니다.

 

 ▶ sdk_config.h 파일 열어서 NRF_LOG_ENABLED 부분 찾기

  ==> NRF_LOG_ENABLED 가 정의가 안되어 있을경우 설정이 1 로 되어 있습니다.

 

  sdk_config.h 파일  앞부분의 app_config.h 파일 사용하기 

   ==>  USE_APP_CONFIG  정의 및 app_config.h 파일  추가가 필요하네요.

 

  프로젝트 파일에  USE_APP_CONFIG 정의 Common에 추가해 줍니다.

 

    파일추가 없이 빌드하면 아래처럼 에러가 발생을 합니다.

 

  sdk_config.h 파일이 있는 곳에 app_config.h 파일 추가하기

 

  app_config.h 파일 수정하기

#if defined (NDEBUG)    <-- Release Configuration 에서 정의된 변수
#define NRF_LOG_ENABLED					0
#endif

 

 → 이후 Release 모드로 빌드하면 LOG 가 안나오고 Debug 모드에서만 로그가 나오네요.

 

 

 

< 기타>

 ▶ 빌드로그 (참고용)

Rebuilding ‘xxx_pca10040_s132’ from solution ‘xxx_pca10040_s132’ in configuration ‘Release’
1> Assembling ‘thumb_crt0.s’
2> Compiling ‘nrf_log_backend_rtt.c’
3> Compiling ‘nrf_log_backend_serial.c’
4> Compiling ‘nrf_log_backend_uart.c’
5> Compiling ‘nrf_log_default_backends.c’
6> Compiling ‘nrf_log_frontend.c’
7> Compiling ‘nrf_log_str_formatter.c’
8> Compiling ‘app_button.c’
1> Compiling ‘app_error.c’
2> Compiling ‘app_error_handler_gcc.c’
3> Compiling ‘app_error_weak.c’
5> Compiling ‘app_scheduler.c’
1> Compiling ‘app_timer2.c’
7> Compiling ‘app_util_platform.c’
4> Compiling ‘crc16.c’
6> Compiling ‘drv_rtc.c’
8> Compiling ‘fds.c’
2> Compiling ‘hardfault_implementation.c’
7> Compiling ‘nrf_assert.c’
3> Compiling ‘nrf_atfifo.c’
4> Compiling ‘nrf_atflags.c’
5> Compiling ‘nrf_atomic.c’
2> Compiling ‘nrf_balloc.c’
7> Compiling ‘nrf_fprintf.c’
6> Compiling ‘nrf_fprintf_format.c’
1> Compiling ‘nrf_fstorage.c’
3> Compiling ‘nrf_fstorage_sd.c’
5> Compiling ‘nrf_memobj.c’
4> Compiling ‘nrf_pwr_mgmt.c’
8> Compiling ‘nrf_ringbuf.c’
7> Compiling ‘nrf_section_iter.c’
2> Compiling ‘nrf_sortlist.c’
6> Compiling ‘nrf_strerror.c’
1> Compiling ‘sensorsim.c’
3> Assembling ‘ses_startup_nrf52.s’
5> Assembling ‘ses_startup_nrf_common.s’
8> Compiling ‘system_nrf52.c’
3> Compiling ‘boards.c’
1> Compiling ‘nrf_drv_clock.c’
7> Compiling ‘nrf_drv_uart.c’
5> Compiling ‘nrfx_atomic.c’
2> Compiling ‘nrfx_clock.c’
4> Compiling ‘nrfx_gpiote.c’
6> Compiling ‘nrfx_prs.c’
8> Compiling ‘nrfx_uart.c’
5> Compiling ‘nrfx_uarte.c’
3> Compiling ‘bsp.c’
7> Compiling ‘bsp_btn_ble.c’
1> Compiling ‘main.c’
2> Compiling ‘bt_protocol.c’
6> Compiling ‘SEGGER_RTT.c’
4> Compiling ‘SEGGER_RTT_Syscalls_SES.c’
8> Compiling ‘SEGGER_RTT_printf.c’
2> D:\Project\SES\nRF5SDK_1702\nRF5_SDK\examples\ble_peripheral\xxx\bt_protocol.c:69:6: warning: implicit declaration of function 'app_uart_get' [-Wimplicit-function-declaration]
1> D:\Project\SES\nRF5SDK_1702\nRF5_SDK\examples\ble_peripheral\xxx\main.c:1268:25: warning: initialization of 'unsigned char *' from incompatible pointer type 'uint8_t (*)[6]' {aka 'unsigned char (*)[6]'} [-Wincompatible-pointer-types]
1> D:\Project\SES\nRF5SDK_1702\nRF5_SDK\examples\ble_peripheral\xxx\main.c:1415:17: warning: passing argument 1 of 'strcmp' from incompatible pointer type [-Wincompatible-pointer-types]
1> In file included from D:\Project\SES\nRF5SDK_1702\nRF5_SDK\examples\ble_peripheral\xxx\main.c:62:
1> C:/Program Files/SEGGER/SEGGER Embedded Studio for ARM 5.42a/include/string.h:288:24: note: expected 'const char *' but argument is of type 'unsigned char (*)[16]'
1> D:\Project\SES\nRF5SDK_1702\nRF5_SDK\examples\ble_peripheral\xxx\main.c:1603:13: warning: passing argument 1 of 'strlen' from incompatible pointer type [-Wincompatible-pointer-types]
1> In file included from D:\Project\SES\nRF5SDK_1702\nRF5_SDK\examples\ble_peripheral\xxx\main.c:62:
1> C:/Program Files/SEGGER/SEGGER Embedded Studio for ARM 5.42a/include/string.h:464:27: note: expected 'const char *' but argument is of type 'unsigned char (*)[16]'
1> D:\Project\SES\nRF5SDK_1702\nRF5_SDK\examples\ble_peripheral\xxx\main.c:2218:4: warning: implicit declaration of function 'set_mouse_Delta' [-Wimplicit-function-declaration]
1> D:\Project\SES\nRF5SDK_1702\nRF5_SDK\examples\ble_peripheral\xxx\main.c:2219:4: warning: implicit declaration of function 'hid_mouse_movement' [-Wimplicit-function-declaration]
1> D:\Project\SES\nRF5SDK_1702\nRF5_SDK\examples\ble_peripheral\xxx\main.c:2808:6: warning: conflicting types for 'set_mouse_Delta'
1> D:\Project\SES\nRF5SDK_1702\nRF5_SDK\examples\ble_peripheral\xxx\main.c:2218:4: note: previous implicit declaration of 'set_mouse_Delta' was here
1> D:\Project\SES\nRF5SDK_1702\nRF5_SDK\examples\ble_peripheral\xxx\main.c:2813:6: warning: conflicting types for 'hid_mouse_movement'
1> D:\Project\SES\nRF5SDK_1702\nRF5_SDK\examples\ble_peripheral\xxx\main.c:2219:4: note: previous implicit declaration of 'hid_mouse_movement' was here
3> Compiling ‘auth_status_tracker.c’
7> Compiling ‘ble_advdata.c’
6> Compiling ‘ble_advertising.c’
4> Compiling ‘ble_conn_params.c’
5> Compiling ‘ble_conn_state.c’
2> Compiling ‘ble_link_ctx_manager.c’
3> Compiling ‘ble_srv_common.c’
8> Compiling ‘gatt_cache_manager.c’
2> Compiling ‘gatts_cache_manager.c’
7> Compiling ‘id_manager.c’
4> Compiling ‘nrf_ble_gatt.c’
6> Compiling ‘nrf_ble_qwr.c’
3> Compiling ‘peer_data_storage.c’
5> Compiling ‘peer_database.c’
8> Compiling ‘peer_id.c’
2> Compiling ‘peer_manager.c’
6> Compiling ‘peer_manager_handler.c’
1> Compiling ‘pm_buffer.c’
4> Compiling ‘security_dispatcher.c’
7> Compiling ‘security_manager.c’
1> Compiling ‘utf.c’
8> Compiling ‘ble_bas.c’
5> Compiling ‘ble_dis.c’
3> Compiling ‘ble_hids.c’
6> Compiling ‘ble_nus.c’
1> Compiling ‘nrf_sdh.c’
2> Compiling ‘nrf_sdh_ble.c’
4> Compiling ‘nrf_sdh_soc.c’
1> Generating linker script ‘xxx_pca10040_s132.ld’
1> Linking xxx_pca10040_s132.elf
Build complete

 

 

참고하세요.

반응형