我正在Eclipse中使用嵌入式C项目,交叉编译为M4 Cortex目标。我们正在使用Cmake(版本3.7.x)来递归所有项目文件并相应地构建它们。我们有一个" Main_App"和" Unit_test"。单元测试取决于来自" Main_App的多个库和源文件。"当我去构建" Unit_Test"时,链接器抱怨说它无法找到" Unit_Test.map"。
" Cmake:ld无法打开地图文件Unit_Test.map:没有这样的文件或目录"
我的CMakeLists.txt文件如下所示:
cmake_minimum_required(VERSION 3.0.0)
file(GLOB LD_FILE *gcc_nrf52.ld)
create_application(
NAME
"Unit_Test"
PLATFORM
target
INCLUDE_DIRS
inc
../../../apps/Main_App
../../../apps/Main_App/stuff
../../../apps/Main_App/more_stuff
LINKER_SCRIPT
${LD_FILE}
SOURCES
main.c
LIBRARIES
someLib1
someLib2
someLib3
)
1)为什么没有创建地图文件? 2)我的CMakeLists.txt文件不正确吗? 3)在" Unit_Test"中还有什么我遗漏的东西。 ?目录
构建控制台输出:
"cd /Users/sami/dev/Github/target_debug_eclipse_files/apps/unit_tests/stimulation_module && /usr/local/Cellar/cmake/3.7.1/bin/cmake -E cmake_link_script CMakeFiles/stim_module_unit_test.elf.dir/link.txt --verbose=1
/usr/local/bin/arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mabi=aapcs -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fno-builtin --std=gnu99 -Wall -Werror -ffunction-sections -fdata-sections -fno-strict-aliasing -fshort-enums --specs=nosys.specs -g -O1 -g -Wl,--gc-sections -Wl,--static -Wl,--cref -mthumb -mabi=aapcs -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 --specs=nano.specs -lc -L/Users/sami/dev/Github/CalaTWO-NRF52832/submodules/nrf52_sdk/components/toolchain/gcc/ -Wl,-T,/Users/sami/dev/Github/CalaTWO-NRF52832/apps/unit_tests/stimulation_module/unit_tests_gcc_nrf52.ld -Xlinker -Map=/Users/sami/dev/Github/target_debug_eclipse_files/apps/stim_module_unit_test/stim_module_unit_test.map CMakeFiles/stim_module_unit_test.elf.dir/main.c.obj -o stim_module_unit_test.elf ../../../CalaDrivers/libCalaDrivers.a ../../../MTKeystone/libMTKeystone.a ../../../submodules/nrf52_sdk/bsp/libbsp.a ../../../submodules/nrf52_sdk/components/toolchain/libtoolchain.a ../../../submodules/nrf52_sdk/components/drivers_nrf/timer/libnrf_drv_timer.a ../../../submodules/nrf52_sdk/components/libraries/scheduler/libscheduler.a ../../../submodules/nrf52_sdk/components/softdevice/libsoftdevice.a ../../../submodules/nrf52_sdk/components/ble/libble.a ../../../submodules/nrf52_sdk/components/libraries/sensorsim/libsensorsim.a ../../../submodules/nrf52_sdk/components/drivers_nrf/rng/libnrf_drv_rng.a ../../../submodules/nrf52_sdk/components/drivers_nrf/twi_master/libtwi_master.a ../../../submodules/nrf52_sdk/components/drivers_nrf/spi_master/libspi_master.a ../../../submodules/nrf52_sdk/components/drivers_nrf/pwm/libnrf_drv_pwm.a ../../../submodules/nrf52_sdk/components/libraries/fds/libfds.a ../../../submodules/nrf52_sdk/components/libraries/fstorage/libfstorage.a ../../../submodules/nrf52_sdk/components/libraries/trace/libtrace.a ../../../submodules/nrf52_sdk/components/drivers_nrf/ble_flash/libble_flash.a ../../../submodules/nrf52_sdk/components/drivers_nrf/pstorage/libpstorage.a ../../../submodules/nrf52_sdk/bsp/libbsp.a ../../../submodules/nrf52_sdk/components/libraries/scheduler/libscheduler.a ../../../submodules/nrf52_sdk/components/softdevice/libsoftdevice.a ../../../submodules/nrf52_sdk/components/libraries/button/libbutton.a ../../../submodules/nrf52_sdk/components/drivers_nrf/hal/libhal.a ../../../submodules/nrf52_sdk/components/libraries/timer/libtimer.a ../../../submodules/nrf52_sdk/components/libraries/util/libutil.a ../../../submodules/nrf52_sdk/components/drivers_nrf/common/libcommon.a ../../../submodules/nrf52_sdk/components/drivers_nrf/clock/libclock.a ../../../submodules/nrf52_sdk/components/drivers_nrf/gpiote/libnrf_drv_gpiote.a ../../../submodules/nrf52_sdk/components/drivers_nrf/delay/libdelay.a ../../../submodules/nrf52_sdk/components/libraries/uart/libuart.a ../../../submodules/nrf52_sdk/components/libraries/fifo/libfifo.a ../../../submodules/nrf52_sdk/components/drivers_nrf/uart/libnrf_drv_uart.a ../../../submodules/nrf52_sdk/bsp/libbsp.a ../../../submodules/nrf52_sdk/components/libraries/scheduler/libscheduler.a ../../../submodules/nrf52_sdk/components/softdevice/libsoftdevice.a ../../../submodules/nrf52_sdk/components/libraries/button/libbutton.a ../../../submodules/nrf52_sdk/components/drivers_nrf/hal/libhal.a ../../../submodules/nrf52_sdk/components/libraries/timer/libtimer.a ../../../submodules/nrf52_sdk/components/libraries/util/libutil.a ../../../submodules/nrf52_sdk/components/drivers_nrf/common/libcommon.a ../../../submodules/nrf52_sdk/components/drivers_nrf/clock/libclock.a ../../../submodules/nrf52_sdk/components/drivers_nrf/gpiote/libnrf_drv_gpiote.a ../../../submodules/nrf52_sdk/components/drivers_nrf/delay/libdelay.a ../../../submodules/nrf52_sdk/components/libraries/uart/libuart.a ../../../submodules/nrf52_sdk/components/libraries/fifo/libfifo.a ../../../submodules/nrf52_sdk/components/drivers_nrf/uart/libnrf_drv_uart.a ../../../submodules/nrf52_sdk/components/toolchain/libtoolchain.a ../../../submodules/nrf52_sdk/components/toolchain/libtoolchain.a
**/usr/local/Caskroom/gcc-arm-embedded/5_4-2016q3,20160926/gcc-arm-none-eabi-5_4-2016q3/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld: cannot open map file /Users/sami/dev/Github/target_debug_eclipse_files/apps/stim_module_unit_test/stim_module_unit_test.map: No such file or directory
collect2: error: ld returned 1 exit status**
make[2]: *** [apps/unit_tests/stimulation_module/stim_module_unit_test.elf] Error 1
make[1]: *** [apps/unit_tests/stimulation_module/CMakeFiles/stim_module_unit_test.elf.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 89%] Built target i2s
[ 90%] Linking C executable cala_stim_therapy.elf
cd /Users/sami/dev/Github/target_debug_eclipse_files/apps/cala_stim_therapy && /usr/local/Cellar/cmake/3.7.1/bin/cmake -E cmake_link_script CMakeFiles/cala_stim_therapy.elf.dir/link.txt --verbose=1
/usr/local/bin/arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mabi=aapcs -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fno-builtin --std=gnu99 -Wall -Werror -ffunction-sections -fdata-sections -fno-strict-aliasing -fshort-enums --specs=nosys.specs -g -O1 -g -Wl,--gc-sections -Wl,--static -Wl,--cref -mthumb -mabi=aapcs -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 --specs=nano.specs -lc -L/Users/sami/dev/Github/CalaTWO-NRF52832/submodules/nrf52_sdk/components/toolchain/gcc/ -Wl,-T,/Users/sami/dev/Github/CalaTWO-NRF52832/apps/cala_stim_therapy/cala_stim_therapy_gcc_nrf52.ld -Xlinker -Map=/Users/sami/dev/Github/target_debug_eclipse_files/apps/cala_stim_therapy/cala_stim_therapy.map CMakeFiles/cala_stim_therapy.elf.dir/ble/ble_test.c.obj CMakeFiles/cala_stim_therapy.elf.dir/console/RetargetSerial.c.obj CMakeFiles/cala_stim_therapy.elf.dir/console/Commands.c.obj CMakeFiles/cala_stim_therapy.elf.dir/resources/glyphs.c.obj CMakeFiles/cala_stim_therapy.elf.dir/resources/GlyphsLibrary.c.obj CMakeFiles/cala_stim_therapy.elf.dir/modules/TopStateMachine.c.obj CMakeFiles/cala_stim_therapy.elf.dir/modules/Power.c.obj CMakeFiles/cala_stim_therapy.elf.dir/modules/UserInterface.c.obj CMakeFiles/cala_stim_therapy.elf.dir/modules/Band.c.obj CMakeFiles/cala_stim_therapy.elf.dir/modules/Stim.c.obj CMakeFiles/cala_stim_therapy.elf.dir/modules/SystemMonitor.c.obj CMakeFiles/cala_stim_therapy.elf.dir/pharmacy/Pharmacy.c.obj CMakeFiles/cala_stim_therapy.elf.dir/main.c.obj -o cala_stim_therapy.elf ../../CalaDrivers/libCalaDrivers.a ../../MTKeystone/libMTKeystone.a ../../submodules/nrf52_sdk/bsp/libbsp.a ../../submodules/nrf52_sdk/components/toolchain/libtoolchain.a ../../submodules/nrf52_sdk/components/drivers_nrf/timer/libnrf_drv_timer.a ../../submodules/nrf52_sdk/components/libraries/scheduler/libscheduler.a ../../submodules/nrf52_sdk/components/softdevice/libsoftdevice.a ../../submodules/nrf52_sdk/components/ble/libble.a ../../submodules/nrf52_sdk/components/libraries/sensorsim/libsensorsim.a ../../submodules/nrf52_sdk/components/drivers_nrf/rng/libnrf_drv_rng.a ../../submodules/nrf52_sdk/components/drivers_nrf/twi_master/libtwi_master.a ../../submodules/nrf52_sdk/components/drivers_nrf/spi_master/libspi_master.a ../../submodules/nrf52_sdk/components/drivers_nrf/pwm/libnrf_drv_pwm.a ../../submodules/nrf52_sdk/components/libraries/fds/libfds.a ../../submodules/nrf52_sdk/components/libraries/fstorage/libfstorage.a ../../submodules/nrf52_sdk/components/libraries/trace/libtrace.a ../../submodules/nrf52_sdk/components/drivers_nrf/ble_flash/libble_flash.a ../../submodules/nrf52_sdk/components/drivers_nrf/pstorage/libpstorage.a ../../submodules/nrf52_sdk/bsp/libbsp.a ../../submodules/nrf52_sdk/components/libraries/scheduler/libscheduler.a ../../submodules/nrf52_sdk/components/softdevice/libsoftdevice.a ../../submodules/nrf52_sdk/components/libraries/button/libbutton.a ../../submodules/nrf52_sdk/components/drivers_nrf/hal/libhal.a ../../submodules/nrf52_sdk/components/libraries/timer/libtimer.a ../../submodules/nrf52_sdk/components/libraries/util/libutil.a ../../submodules/nrf52_sdk/components/drivers_nrf/common/libcommon.a ../../submodules/nrf52_sdk/components/drivers_nrf/clock/libclock.a ../../submodules/nrf52_sdk/components/drivers_nrf/gpiote/libnrf_drv_gpiote.a ../../submodules/nrf52_sdk/components/drivers_nrf/delay/libdelay.a ../../submodules/nrf52_sdk/components/libraries/uart/libuart.a ../../submodules/nrf52_sdk/components/libraries/fifo/libfifo.a ../../submodules/nrf52_sdk/components/drivers_nrf/uart/libnrf_drv_uart.a ../../submodules/nrf52_sdk/bsp/libbsp.a ../../submodules/nrf52_sdk/components/libraries/scheduler/libscheduler.a ../../submodules/nrf52_sdk/components/softdevice/libsoftdevice.a ../../submodules/nrf52_sdk/components/libraries/button/libbutton.a ../../submodules/nrf52_sdk/components/drivers_nrf/hal/libhal.a ../../submodules/nrf52_sdk/components/libraries/timer/libtimer.a ../../submodules/nrf52_sdk/components/libraries/util/libutil.a ../../submodules/nrf52_sdk/components/drivers_nrf/common/libcommon.a ../../submodules/nrf52_sdk/components/drivers_nrf/clock/libclock.a ../../submodules/nrf52_sdk/components/drivers_nrf/gpiote/libnrf_drv_gpiote.a ../../submodules/nrf52_sdk/components/drivers_nrf/delay/libdelay.a ../../submodules/nrf52_sdk/components/libraries/uart/libuart.a ../../submodules/nrf52_sdk/components/libraries/fifo/libfifo.a ../../submodules/nrf52_sdk/components/drivers_nrf/uart/libnrf_drv_uart.a ../../submodules/nrf52_sdk/components/toolchain/libtoolchain.a ../../submodules/nrf52_sdk/components/toolchain/libtoolchain.a
[ 91%] Built target led_softblink
[ 97%] Built target cala_stim_therapy.elf
make: *** [all] Error 2 "
答案 0 :(得分:0)
就我而言,我必须添加\" \"
。 CMake不会自动将"
添加到您的路径。如果您的路径(在我的情况下)包含任何空格,则需要使用"
添加一个转义序列。那是例如
"${CMAKE_EXE_LINKER_FLAGS} -Wl,-Map=\"${PROJECT_BINARY_DIR}/${PROJECT_NAME}.map\""