IDE with Eclipse with Jantje's plugin

Development environment specific, Arduino, Eclipse, VS2013,Em::Blocks etc
Post Reply
michael_l
Posts: 337
Joined: Mon Aug 24, 2015 6:11 pm

Re: IDE with Eclipse with Jantje's plugin

Post by michael_l » Wed Apr 05, 2017 6:18 am

Sorry, I don't the answer for you current problem...

I'll probably setup Jlink first to work with GNU Arm Eclipse plugins and then try Arduino IDE plugin. Just for the reference. I wonder if Does Ozone works with J-Link EDU ? It seems like a nice IDE for debugging but not sure if it offers anything more that Eclipse IDE.

I read that GNU Arm Eclipse J-Link plugin is re-written and it uses plugin model instead of GDB Hardware Debugging plug-in. Here's more info http://gnuarmeclipse.github.io/debug/jlink/. Does Arduino IDE plugin use this plugin system ?

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

Re: IDE with Eclipse with Jantje's plugin and Jlink

Post by Pito » Wed Apr 05, 2017 6:22 am

The Sloeber uses the GNU GDB Jlink plugin, it seems. I referenced the GNU GDB Jlink plugin above already. I had to tweak a little bit the setting to get it work.

The Ozone worked with my Jlink and ZET6.
The Ozone works with the basic jlink so it will with EDU, I guess (victor uses it).

The __libc_init_array() issue above - the compiled and Jflashed bare metal code works on MapleM, but while debugging I get the sigtrap.

When I comment out the __libc_init_array() the debugger steps fine through main() into the sketch, however I get sigtrap at Serial.begin() as the libc has not been init.

@victor: could you try with EDU?

PS:

My current experience with the Sloeber and Jlink plugin:

=======================================================================

0. Prerequisites: Jlink debugger (any black or gray box :) ) and Segger's Jlink sw pack installed and working with your hw fine (!)
https://www.segger.com/downloads/jlink
J-Flash works identically as the ST-Link utility, so you may verify..

This is the front view at the Jlink box.
Jlink header.JPG
Jlink header.JPG (22.89 KiB) Viewed 462 times
Except the SWDIO and SWDCLK and GND you must connect VCC(1) to 3.3V (it does not power the chip but detects the chip's voltage only)!
Your board must be powered.
I connected the RESET(15) too..

1. Install the latest Sloeber IDE from:
https://oss.sonatype.org/content/reposi ... -SNAPSHOT/

2. Update Sloeber and install Segger's Jlink plugin, GNU GDB and Packs support plugins (and others..) via "Install new software" into the Sloeber from:
http://eclipse.baeyens.it/update/V4/nightly

3. Install Packages for STM32F103 (or others when needed):
http://gnuarmeclipse.github.io/plugins/packs-manager/
EDIT: I have to install the Packs Manager from http://gnuarmeclipse.sourceforge.net/updates-test in order to get STM32F407 added
EDIT: While installing latest MCU packages install the latest (ie 2.11.0 for F407).

4. Configure the project and debug environment (select STM32F103 in Setting>Devices):
http://gnuarmeclipse.github.io/debug/jlink/
Note: the guide tells you you have to start JLinkGDBServerCL.exe, here it works with JLinkGDBServer.exe

5. Here I have to start the jlink gdb server manually as External tool first (add the "Jlink GDB Server" into "External tools configuration"). When the Jlink GDB Server apps starts, just click ok. Only after that I click on my debug_project under the Bug Icon.. (what is the trick to get it running according to the books??).
The "Start Jlink GDB server locally" is disabled here (Debug configuration).

6. When the package for stm32f103 is installed in Sloeber you may mess with peripherals as the package includes the F103 .SVD file with registers' and peripheral's defs for you:
http://gnuarmeclipse.github.io/debug/pe ... registers/

Outstanding issues:
==============================================
1. How to start the Jlink GDB server and then the GNU GDB from the debug session
2. Why __lib_init_array() shoots the sigint
..
Sloeber4 Jlink GDB.jpg
Sloeber4 Jlink GDB.jpg (194.19 KiB) Viewed 481 times
Last edited by Pito on Tue Apr 25, 2017 3:57 pm, edited 1 time in total.
Pukao Hats Cleaning Services Ltd.

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

Re: IDE with Eclipse with Jantje's plugin and Jlink

Post by victor_pv » Wed Apr 05, 2017 1:34 pm

Pito wrote:The Sloeber uses the GNU GDB Jlink plugin, it seems. I referenced the GNU GDB Jlink plugin above already. I had to tweak a little bit the setting to get it work.

The Ozone worked with my Jlink and ZET6.
The Ozone works with the basic jlink so it will with EDU, I guess (victor uses it).

The __libc_init_array() issue above - the compiled and Jflashed bare metal code works on MapleM, but while debugging I get the sigtrap.

When I comment out the __libc_init_array() the debugger steps fine through main() into the sketch, however I get sigtrap at Serial.begin() as the libc has not been init.

@victor: could you try with EDU?

PS:

My current experience with the Sloeber and Jlink plugin:

=======================================================================

0. Prerequisites: Jlink debugger (any black or gray box :) ) and Segger's Jlink sw pack installed and working with your hw fine (!)
https://www.segger.com/downloads/jlink
J-Flash works identically as the ST-Link utility, so you may verify..

This is the front view at the Jlink box.
Jlink header.JPG
Except the SWDIO and SWDCLK and GND you must connect VCC(1) to 3.3V (it does not power the chip but detects the chip's voltage only)!
Your board must be powered.
I connected the RESET(15) too..

1. Install the latest Sloeber IDE from:
https://oss.sonatype.org/content/reposi ... -SNAPSHOT/

2. Update Sloeber and install Segger's Jlink plugin, GNU GDB and Packs support plugin (and others..) via "Install new software" into the Sloeber from:
http://eclipse.baeyens.it/update/V4/nightly

3. Install Packages for STM32F103 (or others when needed):
http://gnuarmeclipse.github.io/plugins/packs-manager/

4. Configure the project and debug environment (select STM32F103 in Setting>Devices):
http://gnuarmeclipse.github.io/debug/jlink/
Note: the guide tells you you have to start JLinkGDBServerCL.exe, here it works with JLinkGDBServer.exe

5. Here I have to start the jlink gdb server manually as External tool first (add the "Jlink GDB Server" into "External tools configuration"). When the Jlink GDB Server apps starts, just click ok. Only after that I click on my debug_project under the Bug Icon.. (what is the trick to get it running according to the books??).
The "Start Jlink GDB server locally" is disabled here (Debug configuration).

6. When the package for stm32f103 is installed in Sloeber you may mess with peripherals as the package includes the F103 .SVD file with registers' and peripheral's defs for you:
http://gnuarmeclipse.github.io/debug/pe ... registers/

Outstanding issues:
==============================================
1. How to start the Jlink GDB server and then the GNU GDB from the debug session
2. Why __lib_init_array() shoots the sigint
..Sloeber4 Jlink GDB.jpg

Re. j-link EDU, yes Ozone works with it. When you first open it it gives you a warning that when using it with EDU, you are supposed to use it for educational or non-profit uses, which is basically the license you can use j-link EDU for anyway.
It also works with stlink converted to j-link. I dont remember if that one gives the warning, possibly.
Since I'm not using it for profit, I'm all good :)

Now with the lib_c issue. I had a similar issue when I started writing the i2s library. Turns out I had a bug in my code. Sadly I don't remember what was it :(
But I do remember it was related to the fact that the i2s library creates a pointer to the i2s object instance for callback purposes.
I think it was one of this possibilities:
  • I was setting pins in the i2s creator method (moving to the begin() method that's called later than the constructor solved it)
    Or I was setting the value to the class pointer in the creator method (more likely this one, again moving that line to begin() solved it)
    Or something else in the constructor referencing some object, and I had to move it to begin()
I do remember for sure it was something I was doing in the constructor, which was not appropriate since what I was referencing had no value yet when the constructor was running. I found it precisely with Ozone, setting breakpoints at different places and looking at variable values.

michael_l
Posts: 337
Joined: Mon Aug 24, 2015 6:11 pm

Re: IDE with Eclipse with Jantje's plugin

Post by michael_l » Wed Apr 05, 2017 6:54 pm

Thanks victor_pv . By the way have you tried Segger's SystemView ? I'm working on a FreeRTOS project with many tasks currently so I'm going to try it too as it support FreeRTOS also.

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 » Wed Apr 05, 2017 7:35 pm

Now with the lib_c issue. I had a similar issue when I started writing the i2s library. Turns out I had a bug in my code. Sadly I don't remember what was it :(
The call to __libc_init_array() is called from start_c.c and called before main(). How it could be related to your I2S code?
Pukao Hats Cleaning Services Ltd.

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

Re: IDE with Eclipse with Jantje's plugin

Post by victor_pv » Wed Apr 05, 2017 7:44 pm

Pito wrote:
Now with the lib_c issue. I had a similar issue when I started writing the i2s library. Turns out I had a bug in my code. Sadly I don't remember what was it :(
The call to __libc_init_array() is called from start_c.c and called before main(). How it could be related to your I2S code?
My problem was something with the i2s constructor. The libc_init_array initializes objects and variables, and some in my constructor was causing a crash around there. Sadly I don't remember the details, I noticed I was doing something that I shouldn't and corrected and forgot it. I need to check if I have the very first version of my code to see what I had in my i2s constructor.
Also, it's all cloudy, but I think the crash was not happening in libc_init_array, but after it finished executing and goes to the next thing. I should have written it all down, but I didn't expect anyone else to have the same trouble. I found it thru step by step debugging with ozone. Set breakpoints in different places until I caught it, and was happening before main, around libc_init_array.
If you have any c++ object in your code, set breakpoints at the constructors, and before exiting them make sure everything looks as it should in terms of variables for that constructor. I remember in mine, I have a pointer called something like i2s2_this, and takes the value of the i2s2 object, with i2s2_this = *this. I think that's what crashed my code, and I moved it to begin(), but could have been some other stuff I had there related to the pins for the spi ports.

If the initial version of my code, I can compare all that I moved to begin()

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

Re: IDE with Eclipse with Jantje's plugin

Post by victor_pv » Wed Apr 05, 2017 7:46 pm

michael_l wrote:Thanks victor_pv . By the way have you tried Segger's SystemView ? I'm working on a FreeRTOS project with many tasks currently so I'm going to try it too as it support FreeRTOS also.
Michael I haven't used SystemView. If you use it successfully post a thread with any advice. What version of FreeRTOS are you using?

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 » Wed Apr 05, 2017 7:51 pm

If you have any c++ object in your code,
My code is a "Hello World" with Serial.begin(), Serial.println(). So most probably there is in the arduino libs..
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 » Wed Apr 05, 2017 8:23 pm

I've been debugging following code:

Code: Select all

int i = 0;
void setup()
{ i = 100000;}
void loop()
{ i++; }
With the call to __libc_init_array() it crashes as above.
With the call commented out it goes to loop() and increments properly when stepping through the loop..
Weird..
Otherwise it works nice, I start to like it ;)
Last edited by Pito on Wed Apr 05, 2017 8:52 pm, edited 1 time in total.
Pukao Hats Cleaning Services Ltd.

michael_l
Posts: 337
Joined: Mon Aug 24, 2015 6:11 pm

Re: IDE with Eclipse with Jantje's plugin

Post by michael_l » Wed Apr 05, 2017 8:39 pm

victor_pv wrote:
michael_l wrote:Thanks victor_pv . By the way have you tried Segger's SystemView ? I'm working on a FreeRTOS project with many tasks currently so I'm going to try it too as it support FreeRTOS also.
Michael I haven't used SystemView. If you use it successfully post a thread with any advice. What version of FreeRTOS are you using?
Using the one you made for STMF103. That is 8.2.1. It has worked very well.

Post Reply