IDE with Eclipse with Jantje's plugin

Development environment specific, Arduino, Eclipse, VS2013,Em::Blocks etc
ag123
Posts: 693
Joined: Thu Jul 21, 2016 4:24 pm

Re: IDE with Eclipse with Jantje's plugin

Post by ag123 » Sun Apr 09, 2017 12:23 pm

I think gcc pulled in the standard libs, but if i specify -nostdlibs i get compile errors that some functions are not resolved. No worries would slowly figure out the dependencies

fixed: original fat blinky

Code: Select all

arm-none-eabi-objcopy -O binary "STM32F103duino-blinky.elf"  "STM32F103duino-blinky.bin"
Finished building: STM32F103duino-blinky.bin
 
Invoking: Cross ARM GNU Print Size
arm-none-eabi-size --format=berkeley "STM32F103duino-blinky.elf"
   text	   data	    bss	    dec	    hex	filename
  50788	   1200	   1016	  53004	   cf0c	STM32F103duino-blinky.elf
fixing:
in c++ compile add parameters:
-fno-rtti (no rtti)
-fno-exceptions (no exceptions)
-fno-use-cxa-atexit (no _cxa_atexit())
-fno-threadsafe-statics (no thread-safe statics)

in ld linker add parameters:
-nostdlib (no standard libraries)
-Xlinker --gc-sections (remove unused sections)
--specs=nano.specs (use newlib-nano)
^^^ some of these are actually in platform.txt should have examined them closely :lol:

oops

Code: Select all

Invoking: Cross ARM C++ Linker
arm-none-eabi-g++ -mcpu=cortex-m3 -mthumb -Os -fmessage-length=0 ...
/opt4/opt/arduino-1.8.2/dot_arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/arm-none-eabi/lib/armv7-m/libc.a(lib_a-init.o): In function `__libc_init_array':
init.c:(.text.__libc_init_array+0x20): undefined reference to `_init'
collect2: error: ld returned 1 exit status
STM32F103duino-blinky/STM32F1/variants/maple_mini/wirish/start_c.c

Code: Select all

...
void __attribute__((noreturn)) start_c(void) {
...
    /* Run initializers. */
    __libc_init_array();
lets look up __libc_init_array()
https://github.com/eblot/newlib/blob/ma ... isc/init.c

Code: Select all

/* Iterate over all the init routines.  */
void
__libc_init_array (void)
{
  size_t count;
  size_t i;

  count = __preinit_array_end - __preinit_array_start;
  for (i = 0; i < count; i++)
    __preinit_array_start[i] ();

  _init ();

  count = __init_array_end - __init_array_start;
  for (i = 0; i < count; i++)
    __init_array_start[i] ();
}
surprisingly _init() is not part of newlib standard library

edit STM32F103duino-blinky/STM32F1/variants/maple_mini/wirish/start_c.c
add function:

Code: Select all

extern void _init (void); //declaration

void _init () {}
^^^ apparently somehow Arduino IDE must have inserted this somewhere, but for working in eclipse 'manually' this probably needs to be inserted in a c/c++ file

result:

Code: Select all

Finished building: STM32F103duino-blinky.bin
 
Invoking: Cross ARM GNU Print Size
arm-none-eabi-size --format=berkeley "STM32F103duino-blinky.elf"
   text	   data	    bss	    dec	    hex	filename
  13284	   1088	    952	  15324	   3bdc	STM32F103duino-blinky.elf
Finished building: STM32F103duino-blinky.siz

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

Re: IDE with Eclipse with Jantje's plugin

Post by michael_l » Tue Apr 11, 2017 8:36 pm

Got the J-Link EDU today and it is working okay with Eclipse and GNU ARM Eclipse plugins.

Pito: are you using commandline GDB or the GUI version ? I tried the GUI but it did not work automatically. With commandline version it connects okay.

I am not 100% sure but it seems this plugin does not upload the binary in target.

EDIT: What compile flags are the best for debugging ? I'm getting quite a log of 'optimized out' texts in Eclipse.

Image

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

Re: IDE with Eclipse with Jantje's plugin

Post by Pito » Tue Apr 11, 2017 9:13 pm

I tried both CL and GUI but both do not connect automatically here (Sloeber). I will doublecheck.
It uploads the bin to the target here and it runs/debugs it (bare metal, no bootloader).
Mind you need more than 2 SWD wires with Jlink - see my above guide with Jtag connector pins used. Try with JFlash first..
-g flag does the debug here.
Device name should be "STM32F103CB" with MapleM.
You need Packs with STM32F103CB installed to see peripherals in debug (see my above guide).

Today I messed with the bootloader version - it does not work yet here.. The code start set to 0x8002000 here (in the Debug configuration -> Source). It compiles from 8002000 (doublechecked in elf) but upon the upload to target it overwrites the bootloader and the stuff is dead. So it seems it always uploads to 8000000 :?
Pukao Hats Cleaning Services Ltd.

ag123
Posts: 693
Joined: Thu Jul 21, 2016 4:24 pm

Re: IDE with Eclipse with Jantje's plugin

Post by ag123 » Wed Apr 12, 2017 3:03 am

i posted this in a different forum gnu-arm-eclipse
https://www.element14.com/community/thr ... ion-offset

apparently, there are 2 steps:
1) the ld script needs to have the start of flash offset set e.g.0x8005000 (this is mostly done, but be sure the correct ld script is used)
2) then in the case of gnu-arm-eclipse, on the startup page i need to set the executable offset similarly

an alternative way in which i tested which works as well is that i installed the binary on the board first, then in the case of gnu arm eclipse i uncheck "load executable"

i'd suggest doing it the 'command line' way is not too bad after all, in linux i used a script to launch openocd. then in gnu-arm-eclipse i uncheck the option to start openocd but leave gdb part intact. in that way it gnu-arm-eclipse is able to connect the debug to the openocd session that i launched separately. but there are cases doing it this way didn't seem to halt the mcu, i'm still testing this out. i'd think it could help in the segger jlink case as well

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

Re: IDE with Eclipse with Jantje's plugin

Post by michael_l » Wed Apr 12, 2017 6:37 am

I'm building with platformio. I am using stm32duino-bootloader. I had to change platformio building process a bit so that it changes correct linker script into use. More about that in 'platformio' thread.

I installed GNU Arm eclipse plugin package manually because update site gave errors.

Ozone works very well and seems to be a feature-rich debugger.

zmemw16
Posts: 1289
Joined: Wed Jul 08, 2015 2:09 pm
Location: St Annes, Lancs,UK

Re: IDE with Eclipse with Jantje's plugin

Post by zmemw16 » Wed Apr 12, 2017 7:00 am

oh great, now eclipse has gone up a version, i knew that; nice to know though.
however gnuarmeclipse install page says neon.3 is the latest tested.

does anyone know if eclipse with gnuarmeclipse, sloeber, ac6 systemworkbench etc have problems co-existing ?
i usually get mutterings about workspace being written with a different version, also something on missing resources (ac6).
all seem to have dot-eclipse and dot-p2 hidden directories as well.

stephen

<EDIT>
discovered that oxygen and gnuarmeclipse has a problem. the f407 project blinky fails to compile with 7 erros time.sleep argument issue.
unpacked the neon.3 and imported the above project, clean compile
different eclipse same gnuarmeclipse
</EDIT>
Last edited by zmemw16 on Wed Apr 12, 2017 9:33 am, edited 1 time in total.

stevestrong
Posts: 1442
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: IDE with Eclipse with Jantje's plugin

Post by stevestrong » Wed Apr 12, 2017 7:22 am

I know that Neon 1 had massive problems - this is the version I also tested and it was very unstable. This is the reason why I abandoned to use Eclipse that time.

Now, Neon 3 looks much more stable, I had no issues so far (using it like michael_I with PlatformIO). Debugging is also stable.
I'm in love again :)

zmemw16
Posts: 1289
Joined: Wed Jul 08, 2015 2:09 pm
Location: St Annes, Lancs,UK

Re: IDE with Eclipse with Jantje's plugin

Post by zmemw16 » Wed Apr 12, 2017 7:35 am

That install page mentions that the earlier incantations of neon had issues and says Neon.3 is good to go.
i'd list my eclipse skills as nursery-kindergarten :D

stephen

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

Re: IDE with Eclipse with Jantje's plugin

Post by Pito » Wed Apr 12, 2017 7:42 am

ag123 wrote:apparently, there are 2 steps:
1) the ld script needs to have the start of flash offset set e.g.0x8005000 (this is mostly done, but be sure the correct ld script is used)
2) then in the case of gnu-arm-eclipse, on the startup page i need to set the executable offset similarly
1) Why 8005000? That is 8002000 with the bootloader, isn't it?
2) It uses our ld script in
..\Arduino_STM32\STM32F1\variants\maple_mini\ld..
I did not find any ld scripts which came with Sloeber.. Mind we talk here Sloeber (aka "IDE with Eclipse with Jantje's plugin") not the vanilla Eclipse install.

PS: @ag123
FLASH (rx) : ORIGIN = 0x08005000, LENGTH = 123K <<< this line is edited to give the correct offset
Btw, the 123K is not correct in that case..
Pukao Hats Cleaning Services Ltd.

ag123
Posts: 693
Joined: Thu Jul 21, 2016 4:24 pm

Re: IDE with Eclipse with Jantje's plugin

Post by ag123 » Wed Apr 12, 2017 9:22 am

@pito
yup 0x8002000 if it is for stm32duino bootloader, 0x8005000 if it is for (old) maple bootloader (some of those boards on ebay pretty much shipped the stock maple bootloader)
yup it would be 108k with the stock maple bootloader and 120k with stm32duino bootloader, the stm32duino bootloader is really good, small and high performance :lol:

the ld scripts are part of the variants in each variant of Arduino_STM32/STM32F1/variants
https://github.com/rogerclarkmelbourne/ ... 1/variants
i.e. the stm32duino arduino implementation itself not the ide

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests