Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

Selecting .conf overlays when building project

I am trying to easily switch between having CONFIG_LOG enabled and disabled using a makefile, and a file called overlay-log.conf which contains only the line CONFIG_LOG=y.

This is my Makefile:

NRF_PATH=~/ncs/nrf                                                                                               
BOARD="nrf5340dk_nrf5340_cpuapp"                                                 
                                                                                 
# --------------------------------                                               
                                                                                 
build:                                                                           
    cd $(NRF_PATH) && west build -p auto -b $(BOARD) $(shell pwd)                
                                                                                 
build_log:                                                                       
    cd $(NRF_PATH) && west build -p auto -b $(BOARD) $(shell pwd) -- -DOVERLAY_CONFIG=overlay-log.conf
                                                                                 
flash: build                                                                     
    cd $(NRF_PATH) && west flash --erase                                         
                                                                                 
flash_log: build_log                                                             
    cd $(NRF_PATH) && west flash --erase

My problem is, it doesn't seem to work as expected, sometimes I execute make flash and the logs are enabled. (I want my flash commands to build and also flash) Any idea what the issue could be?

Related