I'm using a batch script (based off this) to build my firmware from the command line. I want to a clean build every time.
This is the batch script:
:: Batch file to build an Eclipse project from the command line on Windows :: Example for using MCUXpresso IDE @echo off :: path to GNU tools and compiler: arm-none-eabi-gcc.exe, .... SET TOOLCHAIN_PATH=C:\nxp\MCUXpressoIDE_10.2.1_795\ide\tools\bin :: path to MAKE SET MAKE_PATH=C:\nxp\MCUXpressoIDE_10.2.1_795\ide\msys\bin :: variable to the command line Eclipse IDE executable SET IDE=C:\nxp\MCUXpressoIDE_10.2.1_795\ide\mcuxpressoidec.exe :: variable for the main firmware path SET HOST_FIRMWARE=.\Host_MCU\RTCP_Host echo %PATH%|findstr /i /c:"%TOOLCHAIN_PATH:"=%">nul || set PATH=%PATH%;%TOOLCHAIN_PATH%;%MAKE_PATH% ECHO Building main firmware "%IDE%" -nosplash --launcher.suppressErrors -application org.eclipse.cdt.managedbuilder.core.headlessbuild -import "%HOST_FIRMWARE%" -cleanBuild RTCP_Host/Release
The problem is this will clean the Debug configuration and build the Release version of the firmware, which is not what I expect at all. This is with MCUXpresso IDE v10.2.1 [Build 795]
This is the output from executing the above batch file. You can clearly see it cleans the Debug configuration and builds the Release configuration. How can I clean and build the Release configuration from the command line?
Building main firmware Opening 'RTCP_Host'. 10:44:14 **** Clean-only build of configuration Debug for project RTCP_Host **** make -r -j8 clean rm -rf ./startup/startup_mkv31f51212.o ./source/MT25Q.o ./source/RTCP_BLE_Frame_Comm.o ./source/RTCP_BSP_ADC.o ./source/RTCP_BSP_Timers.o ./source/RTCP_CRC_16.o ./source/RTCP_Cmd_Process.o ./source/RTCP_UART_Interrupt_Handler.o ./source/main.o ./drivers/fsl_adc16.o ./drivers/fsl_clock.o ./drivers/fsl_cmp.o ./drivers/fsl_common.o ./drivers/fsl_crc.o ./drivers/fsl_dac.o ./drivers/fsl_dmamux.o ./drivers/fsl_dspi.o ./drivers/fsl_dspi_cmsis.o ./drivers/fsl_dspi_edma.o ./drivers/fsl_edma.o ./drivers/fsl_ewm.o ./drivers/fsl_flexbus.o ./drivers/fsl_ftfx_cache.o ./drivers/fsl_ftfx_controller.o ./drivers/fsl_ftfx_flash.o ./drivers/fsl_ftfx_flexnvm.o ./drivers/fsl_ftm.o ./drivers/fsl_gpio.o ./drivers/fsl_i2c.o ./drivers/fsl_i2c_cmsis.o ./drivers/fsl_i2c_edma.o ./drivers/fsl_llwu.o ./drivers/fsl_lptmr.o ./drivers/fsl_lpuart.o ./drivers/fsl_lpuart_cmsis.o ./drivers/fsl_lpuart_edma.o ./drivers/fsl_pdb.o ./drivers/fsl_pit.o ./drivers/fsl_pmc.o ./drivers/fsl_rcm.o ./drivers/fsl_rnga.o ./drivers/fsl_sim.o ./drivers/fsl_smc.o ./drivers/fsl_uart.o ./drivers/fsl_uart_cmsis.o ./drivers/fsl_uart_edma.o ./drivers/fsl_vref.o ./drivers/fsl_wdog.o ./board/board.o ./board/clock_config.o ./board/peripherals.o ./board/pin_mux.o ./CMSIS/system_MKV31F51212.o ./startup/startup_mkv31f51212.d ./source/MT25Q.d ./source/RTCP_BLE_Frame_Comm.d ./source/RTCP_BSP_ADC.d ./source/RTCP_BSP_Timers.d ./source/RTCP_CRC_16.d ./source/RTCP_Cmd_Process.d ./source/RTCP_UART_Interrupt_Handler.d ./source/main.d ./drivers/fsl_adc16.d ./drivers/fsl_clock.d ./drivers/fsl_cmp.d ./drivers/fsl_common.d ./drivers/fsl_crc.d ./drivers/fsl_dac.d ./drivers/fsl_dmamux.d ./drivers/fsl_dspi.d ./drivers/fsl_dspi_cmsis.d ./drivers/fsl_dspi_edma.d ./drivers/fsl_edma.d ./drivers/fsl_ewm.d ./drivers/fsl_flexbus.d ./drivers/fsl_ftfx_cache.d ./drivers/fsl_ftfx_controller.d ./drivers/fsl_ftfx_flash.d ./drivers/fsl_ftfx_flexnvm.d ./drivers/fsl_ftm.d ./drivers/fsl_gpio.d ./drivers/fsl_i2c.d ./drivers/fsl_i2c_cmsis.d ./drivers/fsl_i2c_edma.d ./drivers/fsl_llwu.d ./drivers/fsl_lptmr.d ./drivers/fsl_lpuart.d ./drivers/fsl_lpuart_cmsis.d ./drivers/fsl_lpuart_edma.d ./drivers/fsl_pdb.d ./drivers/fsl_pit.d ./drivers/fsl_pmc.d ./drivers/fsl_rcm.d ./drivers/fsl_rnga.d ./drivers/fsl_sim.d ./drivers/fsl_smc.d ./drivers/fsl_uart.d ./drivers/fsl_uart_cmsis.d ./drivers/fsl_uart_edma.d ./drivers/fsl_vref.d ./drivers/fsl_wdog.d ./board/board.d ./board/clock_config.d ./board/peripherals.d ./board/pin_mux.d ./CMSIS/system_MKV31F51212.d RTCP_Host.axf 10:44:15 Build Finished (took 524ms) 10:44:15 **** Build of configuration Release for project RTCP_Host **** make -r -j8 all Building target: RTCP_Host.axf Invoking: MCU Linker arm-none-eabi-gcc -nostdlib -L"C:\Sources\RTCP\Software\Code\Firmware\POCs\Host_MCU\RTCP_Host\libs" -Xlinker -Map="RTCP_Host.map" -Xlinker --gc-sections -Xlinker -print-memory-usage -Xlinker --sort-section=alignment -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -T "RTCP_Host_Release.ld" -o "RTCP_Host.axf" ./startup/startup_mkv31f51212.o ./source/MT25Q.o ./source/RTCP_BLE_Frame_Comm.o ./source/RTCP_BSP_ADC.o ./source/RTCP_BSP_Timers.o ./source/RTCP_CRC_16.o ./source/RTCP_Cmd_Process.o ./source/RTCP_UART_Interrupt_Handler.o ./source/main.o ./drivers/fsl_adc16.o ./drivers/fsl_clock.o ./drivers/fsl_cmp.o ./drivers/fsl_common.o ./drivers/fsl_crc.o ./drivers/fsl_dac.o ./drivers/fsl_dmamux.o ./drivers/fsl_dspi.o ./drivers/fsl_dspi_cmsis.o ./drivers/fsl_dspi_edma.o ./drivers/fsl_edma.o ./drivers/fsl_ewm.o ./drivers/fsl_flexbus.o ./drivers/fsl_ftfx_cache.o ./drivers/fsl_ftfx_controller.o ./drivers/fsl_ftfx_flash.o ./drivers/fsl_ftfx_flexnvm.o ./drivers/fsl_ftm.o ./drivers/fsl_gpio.o ./drivers/fsl_i2c.o ./drivers/fsl_i2c_cmsis.o ./drivers/fsl_i2c_edma.o ./drivers/fsl_llwu.o ./drivers/fsl_lptmr.o ./drivers/fsl_lpuart.o ./drivers/fsl_lpuart_cmsis.o ./drivers/fsl_lpuart_edma.o ./drivers/fsl_pdb.o ./drivers/fsl_pit.o ./drivers/fsl_pmc.o ./drivers/fsl_rcm.o ./drivers/fsl_rnga.o ./drivers/fsl_sim.o ./drivers/fsl_smc.o ./drivers/fsl_uart.o ./drivers/fsl_uart_cmsis.o ./drivers/fsl_uart_edma.o ./drivers/fsl_vref.o ./drivers/fsl_wdog.o ./board/board.o ./board/clock_config.o ./board/peripherals.o ./board/pin_mux.o ./CMSIS/system_MKV31F51212.o -larm_cortexM4lf_math Memory region Used Size Region Size %age Used PROGRAM_FLASH: 10768 B 464 KB 2.27% SRAM_UPPER: 9648 B 64 KB 14.72% SRAM_LOWER: 0 GB 32 KB 0.00% Finished building target: RTCP_Host.axf make --no-print-directory post-build Performing post-build steps arm-none-eabi-size "RTCP_Host.axf"; # arm-none-eabi-objcopy -v -O binary "RTCP_Host.axf" "RTCP_Host.bin" ; # checksum -p MKV31F512xxx12 -d "RTCP_Host.bin"; text data bss dec hex filename 10552 216 9432 20200 4ee8 RTCP_Host.axf 10:44:17 Build Finished (took 1s.720ms) Saving workspace
Hi Curtis,
my projects usually only have a 'Debug' build configuration, as for me a 'Debug' and 'Release' do not make much sense (Debug vs. Release? | MCU on Eclipse). I tried to reproduce what you see, and my results are a bit different. It seems that Eclipse CDT has some flaws (or I don't get it?) depending on if you call it with the project name only, or with the build target.
I have extended/documented what I see in Building Eclipse and MCUXpresso IDE Projects from the Command Line | MCU on Eclipse and as well updated the files on GitHub (mcuoneclipse/Examples/MCUXpresso/CmdLineBuild at master · ErichStyger/mcuoneclipse · GitHub). In a nutshell:
if you want to do a clean on a specific build target, you need to call it with -cleanBuil Project/Target first followed by a -build Project/Target.
I hope this helps,
Erich