-
Notifications
You must be signed in to change notification settings - Fork 3k

Description
Note: This is just a template, so feel free to use/remove the unnecessary things
Description
- Type: Bug
- Related issue: Correct mbed export with multiple --source params #6143 and mbed export fails with switch "--source .." mbed-cli#590
- Priority: Blocker
Bug
Target
All targets (e.g. TARGET_NUCLEO_F103RB
)
Toolchain:
GCC_ARM
Toolchain version:
7.2.1
mbed-cli version:
1.5.0
mbed-os sha:
192a8e5
Folder structure I use for my project:
├── project.cmake
├── src
│ └── main.cpp
└── submodules
├── mbed-memory-status
└── mbed-os
Expected behavior
mbed config MBED_OS_DIR submodules/mbed-os
mbed export -i make_gcc_arm -m NUCLEO_F103RB --source src --source submodules --build .
make -j
This generates the file src.elf
since it automatically names the project what I give as the first --source
. This builds successfully.
Actual behavior
mbed config MBED_OS_DIR submodules/mbed-os
mbed export -i cmake_gcc_arm -m NUCLEO_F103RB --source src --source submodules --build .
cmake .
make all
...
[100%] Linking CXX executable src
/usr/local/Cellar/gcc-arm-none-eabi-74/20171218/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld: cannot open output file src: Is a directory
collect2: error: ld returned 1 exit status
Tries to generate the file src
which results in an error in the linker since it has the same name as my src
folder with no extension. In my opinion this file should get the elf
extension, which would resolve the problem. I also expect to be able to specify the project name to the export command, which at the moment is not possible according to the mbed-cli arguments to the export tool.
Steps to reproduce
Enhancement
The workaround I found to do mostly what I want is to add a line in project.cmake
that changes the OUTPUT_NAME
of the target property to the name specified as the first --source
argument.
set_target_properties(src PROPERTIES OUTPUT_NAME "mbed-os-example")
but as said, that is merely a workaround
Reason to enhance or problem with existing solution
Build (linker) files on CMake export with multiple --source
arguments
Suggested enhancement
I suggest adding a argument to the mbed-cli (and other parts of the export) to specify the project name e.g. -p mbed-os-example
or --project mbed-os-example
that adds a line to the CMakeLists.txt
to specify the output name. Ideally the output extension for the CMake export should be changed to elf
like the make_gcc_arm
export does.