Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
5 years, 9 months ago.
[GNU ARM Eclipse] Not correct export of project on Mbed OS 5 to GNU ARM Eclipse on Windows
Hello,
I have a problem with compilation of Mbed OS5 exported project (mbed-os-example-blinky_gnuarmeclipse_k66f or mbed-os-example-blinky_gnuarmeclipse_kl25) from online Mbed compiler to GNU ARM Eclipse.
I get this error:
I have the latest version of: - Windows 10 1809 - Eclipse IDE for C/C++ Developers - GNU MCU Eclipse plugin - GNU MCU Eclipse ARM Embedded GCC
When I export a similar project with Mbed OS2 (for KL25Z, for K66F that is not possible - support just Mbed OS5), then everything works correctly.
There could be a problem with maximal length on command in cmd for Windows (8191 characters - https://support.microsoft.com/en-us/help/830473/command-prompt-cmd-exe-command-line-string-limitation).
Is there some solution for this problem?
1 Answer
5 years, 9 months ago.
Your problem is related to the small length of the command line buffer in Windows. I solve this with changes in the file makefile.targets, it needs to be done once after exporting the project
Here is what should be in the modified file. Everything else in this file remains unchanged.
makefile.targets
mbedclean: find . -type f -name "*.o" -delete find . -type f -name "*.d" -delete $(RM) $(SECONDARY_FLASH)$(SECONDARY_SIZE) YOU_PROJECT_NAME.* linker-script-*.ld -@echo ' ' # Tool invocations YOU_PROJECT_NAME.elf: $(OBJS) $(USER_OBJS) @echo 'Building target: $@' @echo 'Invoking: Cross ARM C++ Linker' $(file > $@.in , $(filter %.o, $^)) arm-none-eabi-g++ -mcpu=cortex-m7 -mthumb ........ -o "YOU_PROJECT_NAME.elf" @$@.in $(USER_OBJS) @echo 'Finished building target: $@' @echo ' '
The compiler command line needs to be taken from the original makefile from the Debug, Release or Develop directory. It is necessary to replace the $(OBJS) in @$@.in
Thank for your advice.
I tried it but it doesn't solve my problem. I get still the same error.
Could you please validate my steps: 1) export Mbed 5 project from Mbed online compiler and unzip in a root of my disk 2) modify the makefile.target - https://github.com/JarekParal/frdm_k66_mbed-os-example-blinky_gnuarmeclipse_k66f/commit/408839a319074992e327ef5f801805f03579d470 3) import to the GNU ARM Eclipse IDE and build
Are these steps correct? Did I change the makefile correctly?
posted by 24 Mar 20192 Jarek Paral.
arm-none-eabi-g++ -mcpu=cortex-m7 -mthumb ........ -o "frdm_k66_mbed-os-example-blinky.elf" @$@.in $(USER_OBJS)
It is not right.
Quote:
The linker command line needs to be taken from the original makefile from the Debug, Release or Develop directory. It is necessary to replace the $(OBJS) in @$@.in
But in your case it is not enough.
Error 87 CreateProcess is an indicator for a command line that is too long.
Please copy the full command line (where CreateProcess is), show it here and we will think about what can be done
posted by 25 Mar 2019Still you can help more "clean" project organization.
1. Use the "mbed new <projectname>" and "mbed update" commands to organize a new empty project.
2. Copy to the project directory main.cpp and other necessary files (mbed_app.json and others).
3. Export the project with the command "mbed export -i GNUARMECLIPSE -m YOU_TARGET" and import it to Eclipse
In this case, the solution I described above may be sufficient.
posted by 25 Mar 2019There is the full command line: https://gist.github.com/JarekParal/b229f2abeb0b219e6c8812784e2e093e
Quote:
Still you can help more "clean" project organization.
I tried to create "clean" project organization with Mbed CLI, but it didn't help. I get the same error as in the first Gist.
posted by 25 Mar 2019In your case, the length of the command line can be greatly reduced by moving the project to the root directory with a shorter name. From "F:/frdm_k66_mbed-os-example-blinky_gnuarmeclipse_k66f/frdm_k66_mbed-os-example-blinky/" to "F:/example-blinky-k66f/", for example.
If this is not enough, you will have to create a .mbedignore file in the project directory, in which you must specify mbed-os features that are not used in the project.
Here is an example of one of my files.
Debug/* Release/* Develop/* */test/* */tests/* mbed-os/features/cellular/* mbed-os/features/cryptocell/* mbed-os/features/deprecated_warnings/* mbed-os/features/device_key/* mbed-os/features/FEATURE_BLE/* mbed-os/features/FEATURE_BOOTLOADER/* mbed-os/features/frameworks/greentea-client/* mbed-os/features/frameworks/mbed-client-cli/* mbed-os/features/frameworks/mbed-coap/* mbed-os/features/frameworks/unity/* mbed-os/features/frameworks/utest/* mbed-os/features/lorawan/* mbed-os/features/nanostack/* mbed-os/features/nfc/* mbed-os/features/storage/* mbed-os/features/unsupported/*
I tried to move the project directly to root "F:/k66" and that help with the command length problem but I get another error on which is probably due to this dots in command "arm-none-eabi-g++ -mcpu=cortex-m7 -mthumb ........ -o "k66.elf" @k66.elf.in":
https://gist.github.com/JarekParal/948fb2ab85496e0d1ace81574d96d14c
The ".mbedignore" doesn't help me.
Still, thanks Konstantin for your time and help.
posted by 26 Mar 2019The linker command line needs to be taken from the original makefile from the Debug, Release or Develop directory. It is necessary to replace the $(OBJS) in @$@.in
posted by 26 Mar 20191. Open the makefile from the directory (Debug, Release or Develop) in a text editor, depending on the configuration you are currently working with
2. Find string @echo 'Invoking: Cross ARM C++ Linker'
3. Copy the following line and paste it to the right place in the modified file makefile.targets, replacing the one that was there before
4. Replace the $(OBJS) to @$@.in almost at the end of this line
posted by 26 Mar 2019
I also tried to put the project folder to root of disk. But it didn't help.
posted by Jarek Paral 22 Mar 2019Have you tried the Mbed Studio IDE?
posted by Zoltan Hudak 22 Mar 2019Yes, I tested Mbed Studio IDE, but now it is still a little bit buggy and has less functionality then Eclipse.
posted by Jarek Paral 22 Mar 2019Yes, it's still a beta version but looks very promising. Until it gets mature I'm using QtCreator IDE with integrated Mbed CLI. No command line limitations on MS Windows.
posted by Zoltan Hudak 23 Mar 2019Thanks for advice Zoltan. Do you have available full debugger in QtCreator?
posted by Jarek Paral 23 Mar 2019Sorry Zoltan, I already found that in your QtCreator tutorial. It seems that the QtCreator is a possible solution, but the configuration and use have almost three times more complexity than the Eclipse :-(.
Still, it will be good to have correct GNU ARM Eclipse export in Mbed :), because it is still the most available and most accessible way for offline Mbed programming and debugging (after my testing other possibilities).
posted by Jarek Paral 23 Mar 2019Sure. I fully agree.
posted by Zoltan Hudak 23 Mar 2019-
posted by Konstantin Kolyoushenkov 26 Mar 2019