IDE with Eclipse with Jantje's plugin

Development environment specific, Arduino, Eclipse, VS2013,Em::Blocks etc
stevestrong
Posts: 1813
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: IDE with Eclipse with Jantje's plugin

Post by stevestrong » Sat Oct 08, 2016 4:06 pm

Just for your info, I wrote a Wiki page regarding how to use Arduino with Eclipse:
http://wiki.stm32duino.com/index.php?ti ... th_Eclipse

Any comment/suggestion is welcome.

User avatar
Rick Kimball
Posts: 1056
Joined: Tue Apr 28, 2015 1:26 am
Location: Eastern NC, US
Contact:

Re: IDE with Eclipse with Jantje's plugin

Post by Rick Kimball » Sat Oct 08, 2016 4:32 pm

One gcc parameter I found useful when using *.ino files, is the -include flag
$ arm-none-eabi-g++ ... all regular args, then ... -include "Arduino.h"
This flag allows you to use .ino files without modification. I'm not sure how that would interact with the Arduino plugin as I haven't tried it.

From https://gcc.gnu.org/onlinedocs/gcc/Prep ... or-Options
-include file
Process file as if #include "file" appeared as the first line of the primary source file. However, the first directory searched for file is the preprocessor's working directory instead of the directory containing the main source file. If not found there, it is searched for in the remainder of the #include "..." search chain as normal.
If multiple -include options are given, the files are included in the order they appear on the command line.
-rick
-rick

User avatar
Pito
Posts: 1627
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

Re: IDE with Eclipse with Jantje's plugin

Post by Pito » Fri Mar 31, 2017 1:20 pm

I've installed the V4 of Sloeber (Win7 64b), and set according to wiki (plus Added the paths to my existing arduino stm32 eabi chain)..
I can select Maple Mini and try with a simple sketch.

Code: Select all

#include "Arduino.h"

//The setup function is called once at startup of the sketch
void setup()
{
// Add your initialization code here
	Serial.begin(9600);
}

// The loop function is called in an endless loop
void loop()
{
//Add your repeated code here
	Serial.println("Hello World");
}
I get

Code: Select all

15:17:48 **** Incremental Build of configuration Release for project Test1 ****
"C:\\PrgFiles\\sloeber\\arduinoPlugin\\tools\\make\\make" all 
'Building file: ../.ino.cpp'
'Starting C++ compile'
"/bin/arm-none-eabi-g++" -c -g -Os -Wall -Wextra -DDEBUG_LEVEL=DEBUG_ALL -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -DBOARD_maple_mini -DVECT_TAB_ADDR=0x8002000 -DERROR_LED_PORT=GPIOB -DERROR_LED_PIN=1 -mcpu=cortex-m3 -DF_CPU=72000000L -DARDUINO=10609 -DARDUINO_MAPLE_MINI -DARDUINO_ARCH_STM32F1   -DMCU_STM32F103CB -DSERIAL_USB -mthumb -march=armv7-m -D__STM32F1__ -DMCU_STM32F103CB -DSERIAL_USB -mthumb -march=armv7-m -D__STM32F1__ "-IC:\Users\pito\MyCode\Arduino\hardware\Arduino_STM32SerBuff\STM32F1\system/libmaple" "-IC:\Users\pito\MyCode\Arduino\hardware\Arduino_STM32SerBuff\STM32F1\system/libmaple/include" "-IC:\Users\pito\MyCode\Arduino\hardware\Arduino_STM32SerBuff\STM32F1\system/libmaple/stm32f1/include"                              "-IC:\Users\pito\MyCode\Arduino\hardware\Arduino_STM32SerBuff\STM32F1\system/libmaple/usb/stm32f1" "-IC:\Users\pito\MyCode\Arduino\hardware\Arduino_STM32SerBuff\STM32F1\system/libmaple/usb/usb_lib"   -I"C:\Users\pito\MyCode\Arduino\hardware\Arduino_STM32SerBuff\STM32F1\cores\maple" -I"C:\Users\pito\MyCode\Arduino\hardware\Arduino_STM32SerBuff\STM32F1\variants\maple_mini" -MMD -MP -MF".ino.cpp.d" -MT".ino.cpp.o" -D__IN_ECLIPSE__=1 -x c++ "../.ino.cpp"  -o  ".ino.cpp.o"
The system cannot find the path specified.
subdir.mk:24: recipe for target '.ino.cpp.o' failed
make: *** [.ino.cpp.o] Error 1

15:17:48 Build Finished (took 280ms)
The subdir.mk shows an error

Code: Select all

# Each subdirectory must supply rules for building sources it contributes
.ino.cpp.o: ../.ino.cpp
	@echo 'Building file: $<'                                                 <<<<<<<<< Here
	@echo 'Starting C++ compile'
Any hint? Maybe a / \ issue?

PS: it seems in V4 you must not include Arduino.h at the beginning as the automatically generated .ino.cpp already includes one:

Code: Select all

#ifdef __IN_ECLIPSE__
//This is a automatic generated file
//Please do not modify this file
//If you touch this file your change will be overwritten during the next build
//This file has been generated on 2017-03-31 15:50:52

#include "Arduino.h"
void setup() ;
void loop() ;

#include "Test1.ino"


#endif
Pukao Hats Cleaning Services Ltd.

edogaldo
Posts: 284
Joined: Fri Jun 03, 2016 8:19 am

Re: IDE with Eclipse with Jantje's plugin

Post by edogaldo » Fri Mar 31, 2017 2:27 pm

Does it make sense:
Pito wrote:"/bin/arm-none-eabi-g++"
under Windows?!
It's neither a relative path, nor an absolute path..

User avatar
Pito
Posts: 1627
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

Re: IDE with Eclipse with Jantje's plugin

Post by Pito » Fri Mar 31, 2017 3:01 pm

No idea where it comes from, I'll check..
In subdir.mk:

Code: Select all

# Each subdirectory must supply rules for building sources it contributes
.ino.cpp.o: ../.ino.cpp
	@echo 'Building file: $<'
	@echo 'Starting C++ compile'
	"/bin/arm-none-eabi-g++" -c -g -Os -Wall....  ..   ...o=%.d)" -MT"$@" -D__IN_ECLIPSE__=1 -x c++ "$<"  -o  "$@"
	@echo 'Finished building: $<'
	@echo ' '
Pukao Hats Cleaning Services Ltd.

edogaldo
Posts: 284
Joined: Fri Jun 03, 2016 8:19 am

Re: IDE with Eclipse with Jantje's plugin

Post by edogaldo » Fri Mar 31, 2017 3:10 pm

Pito wrote:No idea where it comes from, I'll check..
In subdir.mk:

Code: Select all

# Each subdirectory must supply rules for building sources it contributes
.ino.cpp.o: ../.ino.cpp
	@echo 'Building file: $<'
	@echo 'Starting C++ compile'
	"/bin/arm-none-eabi-g++" -c -g -Os -Wall....  ..   ...o=%.d)" -MT"$@" -D__IN_ECLIPSE__=1 -x c++ "$<"  -o  "$@"
	@echo 'Finished building: $<'
	@echo ' '
Try adding the arm-none-eabi in your path and and remove the "/bin/", when playing with makefiles I got the same problem when the toolchain path was not properly set...

User avatar
Pito
Posts: 1627
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

Re: IDE with Eclipse with Jantje's plugin

Post by Pito » Fri Mar 31, 2017 3:33 pm

Ok, I've found an another thread which messes with it
http://www.stm32duino.com/viewtopic.php?f=41&t=1790
so I have installed the SAM M3 compiler via Sloeber's manager and removed the links to my original eabi I set somewhere in Eclipse (and pointing to /arduino15/.. M3 toolchain used with Arduino IDE). So it seems unless you install eabi within Sloeber you get "/bin/arm-none-eabi-g++" only..

Code: Select all

17:37:43 **** Incremental Build of configuration Release for project Test1 ****
"C:\\PrgFiles\\sloeber\\arduinoPlugin\\tools\\make\\make" all 
'Building file: ../.ino.cpp'
'Starting C++ compile'
"C:\PrgFiles\sloeber\/arduinoPlugin/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-g++" -c -g -Os ....... -x c++ "../.ino.cpp"  -o  ".ino.cpp.o"
'Finished building: ../.ino.cpp'
' '
Now it compiles at least (the "/bin/..." is set internally and points to the toolchain installed into eclipse):

Code: Select all

C:/Users/pito/MyCode/Sloeber/Test1/Release/Test1.elf  :
section             size        addr
.text               9824   134225920
.ARM.exidx             8   134235744
.data               1984   536870912
.rodata              996   134237736
.bss                 800   536872896
.debug_aranges      3056           0
.debug_info        94145           0
.debug_abbrev      18793           0
.debug_line        29645           0
.debug_frame        7172           0
.debug_str         24605           0
.debug_loc         27161           0
.ARM.attributes       41           0
.debug_ranges       4816           0
.comment             112           0
Total             223158


'Finished building target: Test1'
' '
Different to wiki it seems to me you must not include Arduino.h at the beginning of the sketch and to add "*.ino" for c++ (it is already there as "user defined").
Last edited by Pito on Fri Mar 31, 2017 10:59 pm, edited 2 times in total.
Pukao Hats Cleaning Services Ltd.

User avatar
Pito
Posts: 1627
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

Re: IDE with Eclipse with Jantje's plugin

Post by Pito » Fri Mar 31, 2017 3:49 pm

And it uploads perfectly (MMini clone):

Code: Select all

Starting upload
using arduino loader
Starting reset using DTR toggle process
Toggling DTR
Continuing to use COM14
Ending reset


LaunchingC:/Users/pito/MyCode/Arduino/hardware/Arduino_STM32SerBuff/tools/win/maple_upload.bat COM14 2 1EAF:0003 C:\Users\pito\MyCode\Sloeber\Test1/Release/Test1.bin 
Output:
maple_loader v0.1
Resetting to bootloader via DTR pulse
Searching for DFU device [1EAF:0003]...
Found it!

Opening USB Device 0x1eaf:0x0003...
Found Runtime: [0x1eaf:0x0003] devnum=1, cfg=0, intf=0, alt=2, name="STM32duino bootloader v1.0  Upload to Flash 0x8002000"
Setting Configuration 1...
Claiming USB DFU Interface...
Setting Alternate Setting ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
Transfer Size = 0x0400
bytes_per_hash=256
Starting download: [##################################################] finished!
state(8) = dfuMANIFEST-WAIT-RESET, status(0) = No error condition is present
Done!
Resetting USB to switch back to runtime mode
C:/Users/pito/MyCode/Arduino/hardware/Arduino_STM32SerBuff/tools/win/maple_upload.bat finished
upload done
Pukao Hats Cleaning Services Ltd.

victor_pv
Posts: 1739
Joined: Mon Apr 27, 2015 12:12 pm

Re: IDE with Eclipse with Jantje's plugin

Post by victor_pv » Fri Mar 31, 2017 4:12 pm

Pito wrote:And it uploads perfectly (MMini clone):

Code: Select all

Starting upload
using arduino loader
Starting reset using DTR toggle process
Toggling DTR
Continuing to use COM14
Ending reset


LaunchingC:/Users/pito/MyCode/Arduino/hardware/Arduino_STM32SerBuff/tools/win/maple_upload.bat COM14 2 1EAF:0003 C:\Users\pito\MyCode\Sloeber\Test1/Release/Test1.bin 
Output:
maple_loader v0.1
Resetting to bootloader via DTR pulse
Searching for DFU device [1EAF:0003]...
Found it!

Opening USB Device 0x1eaf:0x0003...
Found Runtime: [0x1eaf:0x0003] devnum=1, cfg=0, intf=0, alt=2, name="STM32duino bootloader v1.0  Upload to Flash 0x8002000"
Setting Configuration 1...
Claiming USB DFU Interface...
Setting Alternate Setting ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
Transfer Size = 0x0400
bytes_per_hash=256
Starting download: [##################################################] finished!
state(8) = dfuMANIFEST-WAIT-RESET, status(0) = No error condition is present
Done!
Resetting USB to switch back to runtime mode
C:/Users/pito/MyCode/Arduino/hardware/Arduino_STM32SerBuff/tools/win/maple_upload.bat finished
upload done
There was some bug that caused issues with the uploads, but should be resolved in the latest version according to Jantje.
It would happen to me when creating a new project with some of the generic boards. If it happens, change the board to an Arduino one, apply, then to Maple Mini, apply, then to the Generic one. I have to download and test the latest version, but another user tested and confirmed it was solved.

Another minor nuisance is with including libraries. It has a list with checkboxes for that, but I was finding sometimes would not pick the right one. I resorted to just copying the libraries in the project file as Ray has many times recommended before for Arduino IDE, and include from there, so I know for sure what version is taking.

User avatar
Pito
Posts: 1627
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

Re: IDE with Eclipse with Jantje's plugin

Post by Pito » Fri Mar 31, 2017 5:19 pm

Getting this error, when cleaning the project:

Code: Select all

19:16:59 **** Clean-only build of configuration Release for project Test1 ****
"C:\\PrgFiles\\sloeber\\arduinoPlugin\\tools\\make\\make" clean 
del   .\core\start_c.c.d .\core\syscalls.c.d  .\core\util_hooks.c.d  .\core\usb_core.c.d ......... .\core\wirish_shift.cpp.d .\core\wirish_time.cpp.d 
Invalid switch - "Users".
makefile:100: recipe for target 'clean' failed
make: [clean] Error 1 (ignored)
' '

19:16:59 Build Finished (took 120ms)
The stuff with libraries is weird. It has got problems to include from libs outside Arduino_STM32 - for example I added the include path from myfolder/libraries/SdFat and it does not include, it tried to find something suitable such it includes "SD" (from Arduino_STM32) instead..
When I moved SdFat into the Arduino_STM's F1 libs it includes the stuff it seems..
BTW the sloeber stuff is not free, it costs $5 per month :)
Pukao Hats Cleaning Services Ltd.

Post Reply