IDE with Eclipse with Jantje's plugin

Development environment specific, Arduino, Eclipse, VS2013,Em::Blocks etc
Post Reply
victor_pv
Posts: 1644
Joined: Mon Apr 27, 2015 12:12 pm

Re: IDE with Eclipse with Jantje's plugin

Post by victor_pv » Thu Apr 06, 2017 2:31 am

Pito,

I checked my latest i2s library, and I still left in the constructor the part that assigns a variable the value of "*this", and I can't find a very initial version of the code when it crashed, so I dont remember what else was that I had to take out of the constructor.

Now what you are describing as crashing is way simpler than my code, I don't see how that would have to crash unless it's something else altogether in your case. Are you using the 4.8.3 compiler?

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

Re: IDE with Eclipse with Jantje's plugin

Post by victor_pv » Thu Apr 06, 2017 2:33 am

michael_l wrote:
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.
Did you try the 9.0.0 I recently posted? It has worked well so far for me, but someone posted issues with the mutexes. I haven't be able to test the mutex yet.
If you try it and you use mutexes, let me know.
I have been using it with Eclipse and the Arduino plugin, but have not tested the 9.0.0 with the Arduino IDE.

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

Re: IDE with Eclipse with Jantje's plugin

Post by Pito » Thu Apr 06, 2017 10:16 am

@victor: We still discussing only Sloeber here (Eclipse with Jantje's plugin) so I am using only the stuff as described in my short guide above, with Jlink debugger.
The Sloeber is as-is and using the same compiler as we use (compiled for bare metal F103CB):

Code: Select all

12:05:04 **** Incremental Build of configuration Debug for project Test3 ****
"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 -Wall -Wextra -DDEBUG_LEVEL=DEBUG_ALL -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -DBOARD_generic_stm32f103c -DVECT_TAB_ADDR=0x8000000 -DERROR_LED_PORT=GPIOB -DERROR_LED_PIN=1 -mcpu=cortex-m3 -DF_CPU=72000000L -DARDUINO=10609 -DARDUINO_GENERIC_STM32F103C -DARDUINO_ARCH_STM32F1  -DMCU_STM32F103CB -mthumb -march=armv7-m -D__STM32F1__ -DMCU_STM32F103CB -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\generic_stm32f103c" -MMD -MP -MF".ino.cpp.d" -MT".ino.cpp.o" -D__IN_ECLIPSE__=1 -x c++ "..\.ino.cpp"  -o  ".ino.cpp.o"
'Finished building: ..\.ino.cpp'
' '
'Starting combiner'
"C:\PrgFiles\sloeber\/arduinoPlugin/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-g++" -Os -Wl,--gc-sections -mcpu=cortex-m3 "-TC:/Users/pito/MyCode/Arduino/hardware/Arduino_STM32SerBuff/STM32F1/variants/generic_stm32f103c/ld/jtag.ld" "-Wl,-Map,C:\Users\pito\MyCode\Sloeber\Test3/Debug/Test3.map" "-LC:/Users/pito/MyCode/Arduino/hardware/Arduino_STM32SerBuff/STM32F1/variants/generic_stm32f103c/ld" -o "C:\Users\pito\MyCode\Sloeber\Test3/Debug/Test3.elf" "-LC:\Users\pito\MyCode\Sloeber\Test3/Debug" -lm -lgcc -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols -Wl,--start-group    .\.ino.cpp.o   C:\Users\pito\MyCode\Sloeber\Test3\Debug\arduino.ar    C:/Users/pito/MyCode/Sloeber/Test3/Debug/arduino.ar  -Wl,--end-group
'Finished building: Test3.elf'
' '
'Create eeprom image'
"C:\PrgFiles\sloeber\/arduinoPlugin/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-objcopy" -O binary  "C:/Users/pito/MyCode/Sloeber/Test3/Debug/Test3.elf" "C:/Users/pito/MyCode/Sloeber/Test3/Debug/Test3.bin"
'Finished building: Test3.hex'
' '
'Building target: Test3'
'Printing size:'
"C:\PrgFiles\sloeber\/arduinoPlugin/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-size" -A "C:/Users/pito/MyCode/Sloeber/Test3/Debug/Test3.elf"
C:/Users/pito/MyCode/Sloeber/Test3/Debug/Test3.elf  :
section             size        addr
.text               8116   134217728
.text.align            4   134225844
.ARM.exidx             8   134225848
.data               1896   536870912
.rodata              852   134227752
.bss                 272   536872808
.debug_aranges      2824           0
.debug_info        83737           0
.debug_abbrev      16854           0
.debug_line        27463           0
.debug_frame        6620           0
.debug_str         23558           0
.debug_loc         25777           0
.ARM.attributes       41           0
.debug_ranges       4544           0
.comment             112           0
Total             202678


'Finished building target: Test3'
' '

12:05:04 Build Finished (took 821ms)
while compiling

Code: Select all

int i = 0;
int x = 0;
void setup()
{
i = 100000;
}
void loop()
{
	i++;
	if ((i%100000) == 0) {
		x++;
	}
}
with __libc_init_array() commented out. This "works" in debugger and I can step through an play with debugger fine.

The includes come from our stm32duino stuff - /Arduino_STM32SerBuff/STM32F1/ I am using with Arduino IDE. So the "start_c.c" is ours.

There is the __libc_init_array() call in our start_c.c (..\Arduino_STM32SerBuff\STM32F1\variants\generic_stm32f103c\wirish).

With __libc_init_array() not commented out the debugger shoots sigtrap while stepping through __libc_init_array() call.

Note: As Jantje is not using stm32duino nor Jlink we have to fix the issue here rather than discuss at the arduino site..
libc_init_array() issue.JPG
libc_init_array() issue.JPG (115.6 KiB) Viewed 253 times
sigtrap from __libc_init_array() call.JPG
sigtrap from __libc_init_array() call.JPG (94.56 KiB) Viewed 253 times
Last edited by Pito on Thu Apr 06, 2017 12:22 pm, edited 2 times in total.
Pukao Hats Cleaning Services Ltd.

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

Re: IDE with Eclipse with Jantje's plugin

Post by Pito » Thu Apr 06, 2017 12:03 pm

With help of this great debugger I found out the issue, it seems..
While set breakpoint at the __libc_init_array() at its memory start location I stepped through it and after a while :roll: I found this which crashes the debugger:

Code: Select all

void boardInit(void) {
#ifndef CONFIG_MAPLE_MINI_NO_DISABLE_DEBUG
    disableDebugPorts();
#endif
}
....
void disableDebugPorts(void) {
    afio_cfg_debug_ports(AFIO_DEBUG_NONE);
}
....
/**
 * @brief Enable or disable the JTAG and SW debug ports.
 * @param config Desired debug port configuration
 * @see afio_debug_cfg
 */
static inline void afio_cfg_debug_ports(afio_debug_cfg config) {
    __io uint32 *mapr = &AFIO_BASE->MAPR;
    *mapr = (*mapr & ~AFIO_MAPR_SWJ_CFG) | config;      <<<<<<<<<<< HERE ##########
}
So it seems we disable SWD with the configuration..
While commenting that line out I can step through the sketch fine.
There is an issue with setting the profile for the:
Arduino Bare Metal 103CB.JPG
Arduino Bare Metal 103CB.JPG (52.49 KiB) Viewed 248 times
Debug Sloeber Jlink.JPG
Debug Sloeber Jlink.JPG (136.82 KiB) Viewed 244 times
Pukao Hats Cleaning Services Ltd.

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

Re: IDE with Eclipse with Jantje's plugin

Post by stevestrong » Thu Apr 06, 2017 12:28 pm

I think you should maybe change the upload method from serial to other, or check the boards.txt.
Although it should work since SWD debug is not disabled for serial upload. Maybe the define is not working somehow...

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

Re: IDE with Eclipse with Jantje's plugin

Post by Pito » Thu Apr 06, 2017 12:41 pm

I took the Serial to avoid the building for the bootloader or using USB serial.
The flag differs a little bit in your link (Serial vs STlink) for example:

Code: Select all

genericSTM32F103C.menu.upload_method.serialMethod=Serial
genericSTM32F103C.menu.upload_method.serialMethod.upload.protocol=maple_serial
genericSTM32F103C.menu.upload_method.serialMethod.upload.tool=serial_upload
genericSTM32F103C.menu.upload_method.serialMethod.build.upload_flags=-DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG

genericSTM32F103C.menu.upload_method.STLinkMethod=STLink
genericSTM32F103C.menu.upload_method.STLinkMethod.upload.protocol=STLink
genericSTM32F103C.menu.upload_method.STLinkMethod.upload.tool=stlink_upload
genericSTM32F103C.menu.upload_method.STLinkMethod.build.upload_flags=-DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1 -DSERIAL_USB -DGENERIC_BOOTLOADER
The STLink profile sets DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1, it needs SWD, but also adds USB..
In Serial method the SWD is disabled as I can see it quite well while debugging via SWD (Jlink works via SWD here) :)
So how a Bare Metal (no bootloader, no USB, enabled SWD) shall look like then?
Pukao Hats Cleaning Services Ltd.

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

Re: IDE with Eclipse with Jantje's plugin

Post by stevestrong » Thu Apr 06, 2017 2:35 pm

It looks like it should be OK to use serial.
Hm.
Maybe you should just add "=1" to the end of line 210 in boards.txt, to achieve this:

Code: Select all

genericSTM32F103C.menu.upload_method.serialMethod.build.upload_flags=-DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1

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

Re: IDE with Eclipse with Jantje's plugin

Post by michael_l » Thu Apr 06, 2017 3:40 pm

What about optimization flag -Os as you seem to have now. Does it matter in this case?

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

Re: IDE with Eclipse with Jantje's plugin

Post by Pito » Thu Apr 06, 2017 3:49 pm

:evil:
First, in my boards config (older version?) the line with the flag was missing in Serial method. I added the line. The inclusion of the change is not easy, however..
There is an issue with cleaning the working folder via Project > Clean (sometimes it does not clean so it does not rebuild), so it must be done manually (in Sloeber). The Sloaber takes over the new flag settings from boards when the folder is cleaned and then you select the Serial method in Project > Properties > Arduino > Serial > Apply > Ok. :?
Then when you go into Debug it rebuilds the entire code stuff, and then debug works. Currently with ..DEBUG=1.
:)

Now, it shows an "error" bug icon (but it compiles and debugs fine)

Code: Select all

The type 'HardwareSerial' must implement the inherited pure virtual method 'Print::write'
in board.cpp

Code: Select all

#ifdef SERIAL_USB
	DEFINE_HWSERIAL(Serial1, 1);

	DEFINE_HWSERIAL(Serial2, 2);

	DEFINE_HWSERIAL(Serial3, 3);
#else
	DEFINE_HWSERIAL(Serial, 1);

	DEFINE_HWSERIAL(Serial1, 2);

	DEFINE_HWSERIAL(Serial2, 3);
#endif
in upper or lower selections based on whether the upload method uses SERIAL_USB switch or not, and in
HardwareSerial.cpp (Member declaration not found)

Code: Select all

size_t HardwareSerial::write(unsigned char ch) {
Last edited by Pito on Thu Apr 06, 2017 4:18 pm, edited 2 times in total.
Pukao Hats Cleaning Services Ltd.

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

Re: IDE with Eclipse with Jantje's plugin

Post by stevestrong » Thu Apr 06, 2017 4:00 pm

Pito wrote:Now, it shows an "error" bug icon (but it compiles and debugs fine)
yeah, does funny error bugs in Eclipse, ... i never managed to get rid of them, I hate it!

Post Reply