Spark Logic

Debugging Arduino sketch with STM32 Nucleo in Eclipse .. works !

michael_l Sat Aug 29, 2015 7:17 pm

I have followed this site http://gnuarmeclipse.livius.net/blog/install/ to install GNU arm toolchain, build tools, etc. Compiling works okay, binary is created. I’m using toolchain: gcc-arm-none-eabi-4_9-2015q2-20150609-win32
Debugging does not work. I am quite new to STM32, OpenOCD etc so I might do something wrong.

Based on this log I’m asking what could be wrong ? LD1 flashes red/green and nothing happens after this. It seems to be sort of stuck.

GNU ARM Eclipse 32-bits Open On-Chip Debugger 0.9.0-00073-gdd34716-dirty (2015-05-19-09:56)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 1000 kHz
adapter_nsrst_delay: 100
none separate
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Started by GNU ARM Eclipse
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : clock speed 950 kHz
Info : STLINK v2 JTAG v24 API v2 SWIM v11 VID 0x0483 PID 0x374B
Info : using stlink api v2
Info : Target voltage: 3.243243
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : accepting 'gdb' connection on tcp/3333
Info : device id = 0x20036410
Warn : STM32 flash size failed, probe inaccurate - assuming 128k flash
Info : flash size = 128kbytes
undefined debug reason 7 - target needs reset
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0xfffffffe msp: 0xfffffffc
semihosting is enabled
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0xfffffffe msp: 0xfffffffc, semihosting
target state: halted
target halted due to breakpoint, current mode: Thread
xPSR: 0x61000000 pc: 0x2000003a msp: 0xfffffffc, semihosting
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 00000000 pc: 0x20000000 msp: 0x08000028, semihosting
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 00000000 pc: 0x20000000 msp: 0x08000028, semihosting
===== arm v7m registers
(0) r0 (/32): 0x00000020
(1) r1 (/32): 0x00000000
(2) r2 (/32): 0x2000003C
(3) r3 (/32): 0x2000083C
(4) r4 (/32): 0x08000028
(5) r5 (/32): 0x2000006C
(6) r6 (/32): 0x00000020
(7) r7 (/32): 0x00000014
(8) r8 (/32): 0x00000000
(9) r9 (/32): 0x00000000
(10) r10 (/32): 0x00000000
(11) r11 (/32): 0x00000000
(12) r12 (/32): 0x00000000
(13) sp (/32): 0x08000028
(14) lr (/32): 0xFFFFFFFF
(15) pc (/32): 0x20000000
(16) xPSR (/32): 0x00000000
(17) msp (/32): 0x08000028
(18) psp (/32): 0x00000000
(19) primask (/1): 0x00
(20) basepri (/8): 0x00
(21) faultmask (/1): 0x00
(22) control (/2): 0x00
===== Cortex-M DWT registers
(23) dwt_ctrl (/32)
(24) dwt_cyccnt (/32)
(25) dwt_0_comp (/32)
(26) dwt_0_mask (/4)
(27) dwt_0_function (/32)
(28) dwt_1_comp (/32)
(29) dwt_1_mask (/4)
(30) dwt_1_function (/32)
(31) dwt_2_comp (/32)
(32) dwt_2_mask (/4)
(33) dwt_2_function (/32)
(34) dwt_3_comp (/32)
(35) dwt_3_mask (/4)
(36) dwt_3_function (/32)

Replies

michael_l Sat Aug 29, 2015 9:01 pm

There seems to be some problem with the build itself. I flashed the outputted file with STM32 ST-Link utility and it does not seem to work. I’m using Blink example. So that needs to be fixed first.

michael_l Sun Aug 30, 2015 9:04 am

Using OpenOCD 0.9.0 and flashing an image from Arduino STM32 build I was able to flash it to my nucleo board. And it works too! I would like to say thanks for all the guys who have worked to get Arduino IDE working with STM32. This means building in Eclipse does something wrong and the image does not work. To be honest this was a bit of a disappointment for me I was expecting it to work. In Eclipse have used correct Template (STM32F10x) but obviously something goes wrong in the building. On the other hand it might be possible to manually start debugging session: First build flash image (debug) in Arduino IDE and then use Eclipse as IDE. It does sound clumsy. I am looking for solution to get proper image build in Eclipse.

I have connected SB16 and SB50. So I’m thinking does Eclipse GNU ARM plugin not expect that. Maybe there is some build flag involved that needs to be changed. The build uses flag: -DHSE_VALUE=8000000 . I wonder if that is correct?

Here’s log from telnet connection to OpenOCD.

First start OpenOCD:

C:\Program Files (x86)\GNU ARM Eclipse\OpenOCD\0.9.0-201505190955\bin>openocd.exe -f ..\scripts\board\st_nucleo_f103rb.cfg

michael_l Sun Aug 30, 2015 9:18 am

Here’s objdump from Arduino:

C:\Users\mika\AppData\Local\Temp\build263234916124862537.tmp\sketch_aug29a.cpp.elf: file format elf32-littlearm
C:\Users\mika\AppData\Local\Temp\build263234916124862537.tmp\sketch_aug29a.cpp.elf
architecture: arm, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED
start address 0x080001d5

Program Header:
0x70000001 off 0x00009408 vaddr 0x08001408 paddr 0x08001408 align 2**2
filesz 0x00000008 memsz 0x00000008 flags r--
LOAD off 0x00008000 vaddr 0x08000000 paddr 0x08000000 align 2**15
filesz 0x00001404 memsz 0x00001408 flags rwx
LOAD off 0x00009408 vaddr 0x08001408 paddr 0x08001408 align 2**15
filesz 0x00000008 memsz 0x00000008 flags r--
LOAD off 0x00010000 vaddr 0x20000000 paddr 0x08001410 align 2**15
filesz 0x00000910 memsz 0x00000910 flags rw-
LOAD off 0x00011d20 vaddr 0x08001d20 paddr 0x08001d20 align 2**15
filesz 0x000000f4 memsz 0x000000f4 flags r--
LOAD off 0x00018910 vaddr 0x20000910 paddr 0x20000910 align 2**15
filesz 0x00000000 memsz 0x00000098 flags rw-
private flags = 5000002: [Version5 EABI] [has entry point]

Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00001404 08000000 08000000 00008000 2**4
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .text.align 00000004 08001404 08001404 00009404 2**0
ALLOC, CODE
2 .ARM.exidx 00000008 08001408 08001408 00009408 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
3 .data 00000910 20000000 08001410 00010000 2**3
CONTENTS, ALLOC, LOAD, DATA
4 .rodata 000000f4 08001d20 08001d20 00011d20 2**3
CONTENTS, ALLOC, LOAD, READONLY, DATA
5 .bss 00000098 20000910 20000910 00018910 2**2
ALLOC
6 .debug_aranges 00000778 00000000 00000000 00011e18 2**3
CONTENTS, READONLY, DEBUGGING
7 .debug_info 00010602 00000000 00000000 00012590 2**0
CONTENTS, READONLY, DEBUGGING
8 .debug_abbrev 00003619 00000000 00000000 00022b92 2**0
CONTENTS, READONLY, DEBUGGING
9 .debug_line 00005708 00000000 00000000 000261ab 2**0
CONTENTS, READONLY, DEBUGGING
10 .debug_frame 0000114c 00000000 00000000 0002b8b4 2**2
CONTENTS, READONLY, DEBUGGING
11 .debug_str 00004306 00000000 00000000 0002ca00 2**0
CONTENTS, READONLY, DEBUGGING
12 .debug_loc 00003a56 00000000 00000000 00030d06 2**0
CONTENTS, READONLY, DEBUGGING
13 .ARM.attributes 00000029 00000000 00000000 0003475c 2**0
CONTENTS, READONLY
14 .debug_ranges 00000a28 00000000 00000000 00034785 2**0
CONTENTS, READONLY, DEBUGGING
15 .comment 00000070 00000000 00000000 000351ad 2**0
CONTENTS, READONLY
SYMBOL TABLE:
08000000 l d .text 00000000 .text
08001404 l d .text.align 00000000 .text.align
08001408 l d .ARM.exidx 00000000 .ARM.exidx
20000000 l d .data 00000000 .data
08001d20 l d .rodata 00000000 .rodata
20000910 l d .bss 00000000 .bss
00000000 l d .debug_aranges 00000000 .debug_aranges
00000000 l d .debug_info 00000000 .debug_info
00000000 l d .debug_abbrev 00000000 .debug_abbrev
00000000 l d .debug_line 00000000 .debug_line
00000000 l d .debug_frame 00000000 .debug_frame
00000000 l d .debug_str 00000000 .debug_str
00000000 l d .debug_loc 00000000 .debug_loc
00000000 l d .ARM.attributes 00000000 .ARM.attributes
00000000 l d .debug_ranges 00000000 .debug_ranges
00000000 l d .comment 00000000 .comment
00000000 l df *ABS* 00000000 crtstuff.c
080013d8 l O .text 00000000 __EH_FRAME_BEGIN__
080000ec l F .text 00000000 __do_global_dtors_aux
20000910 l .bss 00000000 completed.7857
08001400 l O .text 00000000 __do_global_dtors_aux_fini_array_entry
08000110 l F .text 00000000 frame_dummy
20000914 l .bss 00000000 object.7862
080013e8 l O .text 00000000 __frame_dummy_init_array_entry
00000000 l df *ABS* 00000000 sketch_aug29a.cpp
00000000 l df *ABS* 00000000 C:\Users\mika\AppData\Local\Temp\build263234916124862537.tmp\start.S.o
00000000 l df *ABS* 00000000 start_c.c
00000000 l df *ABS* 00000000 syscalls.c
00000000 l df *ABS* 00000000 board.cpp
0800027c l F .text 000001b0 _GLOBAL__sub_I__Z9boardInitv
00000000 l df *ABS* 00000000 boards.cpp
0800042c l F .text 0000001c _ZL18adc_default_configPK7adc_dev
08000448 l F .text 0000009e _ZL20timer_default_configP9timer_dev
00000000 l df *ABS* 00000000 boards_setup.cpp
200002e8 l O .data 00000004 _ZN6wirish4privL8pll_dataE
00000000 l df *ABS* 00000000 exc.S.o
080005e4 l F .text 00000000 __default_exc
0800061c l .text 00000000 NVIC_CCR
08000620 l .text 00000000 SYSTICK_CSR
08000610 l .text 00000000 CPSR_MASK
08000618 l .text 00000000 TARGET_PC
08000614 l .text 00000000 EXC_RETURN
00000000 l df *ABS* 00000000 isrs.S.o
00000000 l df *ABS* 00000000 adc.c
00000000 l df *ABS* 00000000 adc_f1.c
200002f8 l O .data 00000008 adc1
20000300 l O .data 00000008 adc2
00000000 l df *ABS* 00000000 flash.c
00000000 l df *ABS* 00000000 gpio_f1.c
00000000 l df *ABS* 00000000 nvic.c
00000000 l df *ABS* 00000000 rcc.c
00000000 l df *ABS* 00000000 rcc_f1.c
20000330 l O .data 0000000c enable_regs.4397
2000033c l O .data 00000008 reset_regs.4401
08001d6c l O .rodata 00000014 masks.4406
00000000 l df *ABS* 00000000 systick.c
20000978 l O .bss 00000004 systick_user_callback
00000000 l df *ABS* 00000000 timer.c
08000968 l F .text 0000003a timer_oc_set_mode
20000344 l O .data 00000008 timer3
20000368 l O .data 00000008 timer4
2000039c l O .data 00000008 timer1
200003c4 l O .data 00000008 timer2
00000000 l df *ABS* 00000000 usart_f1.c
08000cf8 l F .text 00000044 rb_push_insert
200003f4 l O .data 00000050 usart1
20000444 l O .data 00000050 usart2
20000494 l O .data 00000050 usart3
2000097c l O .bss 0000000c usart1_rb
20000988 l O .bss 0000000c usart2_rb
20000994 l O .bss 0000000c usart3_rb
00000000 l df *ABS* 00000000 usart_private.c
00000000 l df *ABS* 00000000 util.c
00000000 l df *ABS* 00000000 HardwareSerial.cpp
00000000 l df *ABS* 00000000 main.cpp
00000000 l df *ABS* 00000000 Print.cpp
00000000 l df *ABS* 00000000 wirish_digital_f1.cpp
00000000 l df *ABS* 00000000 wirish_digital.cpp
00000000 l df *ABS* 00000000 wirish_time.cpp
00000000 l df *ABS* 00000000 gpio.c
00000000 l df *ABS* 00000000 usart.c
00000000 l df *ABS* 00000000 exit.c
00000000 l df *ABS* 00000000 init.c
00000000 l df *ABS* 00000000 __call_atexit.c
080011f0 l F .text 00000014 register_fini
00000000 l df *ABS* 00000000 atexit.c
00000000 l df *ABS* 00000000 fini.c
00000000 l df *ABS* 00000000 __atexit.c
00000000 l df *ABS* 00000000 c:/users/mika/appdata/roaming/arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/../lib/gcc/arm-none-eabi/4.8.3/armv7-m/crti.o
00000000 l df *ABS* 00000000 c:/users/mika/appdata/roaming/arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/../lib/gcc/arm-none-eabi/4.8.3/armv7-m/crtn.o
00000000 l df *ABS* 00000000 impure.c
200004e8 l O .data 00000428 impure_data
00000000 l df *ABS* 00000000 cxxabi-compat.cpp
00000000 l df *ABS* 00000000 libgcc2.c
00000000 l df *ABS* 00000000 libgcc2.c
00000000 l df *ABS* 00000000 bpabi.c
00000000 l df *ABS* 00000000 libgcc2.c
00000000 l df *ABS* 00000000 libgcc2.c
00000000 l df *ABS* 00000000 errno.c
00000000 l df *ABS* 00000000 memset.c
00000000 l df *ABS* 00000000
00000000 l *UND* 00000000 __irq_sdio
00000000 l *UND* 00000000 __irq_fsmc
00000000 l *UND* 00000000 __irq_tim6
08001410 l .ARM.exidx 00000000 __exidx_end
00000000 l *UND* 00000000 __irq_uart5
00000000 l *UND* 00000000 __irq_adc3
00000000 l *UND* 00000000 __irq_dma2_channel2
00000000 l *UND* 00000000 __irq_tim8_brk
08001408 l .text.align 00000000 __exidx_start
00000000 l *UND* 00000000 __irq_tim8_up
200009a8 l .bss 00000000 _lm_heap_start
00000000 l *UND* 00000000 __irq_uart4
00000000 l *UND* 00000000 __irq_dma2_channel4_5
00000000 l *UND* 00000000 software_init_hook
00000000 l *UND* 00000000 boardUsedPins
00000000 l *UND* 00000000 hardware_init_hook
00000000 l *UND* 00000000 __irq_tim8_trg_com
00000000 l *UND* 00000000 __irq_tim5
00000000 l *UND* 00000000 __irq_tim8_cc
00000000 l *UND* 00000000 __stack
00000000 l *UND* 00000000 __irq_dma2_channel3
00000000 l *UND* 00000000 __irq_tim7
00000000 l *UND* 00000000 __irq_spi3
00000000 l *UND* 00000000 __irq_dma2_channel1
28006d20 l .rodata 00000000 _lm_heap_end
00000000 l *UND* 00000000 __lm_enable_error_usart
080005d8 g F .text 00000000 __exc_memmanage
08000630 w F .text 00000000 __stm32reservedexception9
20000320 g O .data 00000008 gpioc
08000000 g O .text 000000ec __stm32_vector_table
08000718 g F .text 00000030 gpio_init_all
08000dd8 g F .text 0000001c __irq_usart2
08000654 g F .text 00000030 adc_set_sample_rate
08000630 w F .text 00000000 __irq_dma1_channel3
20000000 g .data 00000000 __data_start__
08000630 w F .text 00000000 __irq_i2c2_er
080008e8 g F .text 00000034 rcc_reset_dev
08000630 w F .text 00000000 __irq_i2c1_er
080009a4 g F .text 00000030 timer_foreach
08001020 g F .text 00000018 _ZN5Print7printlnEv
08001d64 g O .rodata 00000004 GPIOC
08000e10 g F .text 00000024 _usart_clock_freq
08000630 w F .text 00000000 __irq_usb_lp_can_rx0
200002ec w O .data 00000001 _ZN6wirish4priv9w_adc_smpE
080006cc g F .text 00000036 adc_enable_single_swstart
08000ee6 g F .text 00000018 _ZN14HardwareSerial4peekEv
200003ec g O .data 00000004 USART2
08000b54 g F .text 00000054 __irq_tim1_cc
08001408 g .text.align 00000000 __text_end__
08000886 g F .text 00000018 rcc_is_clk_ready
08000630 w F .text 00000000 __irq_dma1_channel6
20000948 g O .bss 00000018 Serial1
08000000 g .text 00000000 __text_start__
08000748 g F .text 00000050 gpio_set_mode
08000140 g F .text 00000038 _Z5setupv
08001d80 g O .rodata 0000005c rcc_dev_table
08001164 g F .text 0000001a usart_tx
08000ba8 g F .text 00000070 __irq_tim2
0800091c g F .text 00000020 rcc_set_prescaler
08000ec0 g F .text 00000026 _ZN14HardwareSerial9availableEv
08000630 w F .text 00000000 __exc_debug_monitor
08000630 w F .text 00000000 __irq_dma1_channel1
080006b0 g F .text 0000001c adc_foreach
08000f08 g F .text 0000001e _ZN14HardwareSerial5writeEh
08000830 g F .text 00000020 rcc_switch_sysclk
080010e4 g F .text 00000018 _Z5delaym
0800104c g F .text 0000006c _Z7pinModeh13WiringPinMode
08001150 g F .text 00000014 usart_enable
08000630 w F .text 00000000 __exc_svc
08001404 g .text 00000000 __fini_array_end
08000178 g F .text 0000005c _Z4loopv
00000000 w *UND* 00000000 malloc
08000d7e g F .text 0000003c usart_set_baud_rate
08000798 g F .text 00000012 afio_init
20000910 g .bss 00000000 __bss_start__
08000630 w F .text 00000000 __irq_dma1_channel4
08000630 w F .text 00000000 __irq_adc
08000684 g F .text 00000024 adc_calibrate
080007f4 g F .text 00000030 nvic_init
08000c88 g F .text 00000070 __irq_tim4
08000646 g F .text 0000000e adc_set_extsel
08000704 g F .text 00000014 flash_set_latency
08000630 w F .text 00000000 __irq_dma1_channel7
08000fd2 g F .text 0000001c _ZN5Print5writeEPKc
08000fbc g F .text 00000006 _ZN14HardwareSerial5beginEm
08000630 w F .text 00000000 __irq_exti0
080005e0 g F .text 00000000 __exc_usagefault
080005a4 w F .text 00000002 _ZN6wirish4priv15board_reset_pllEv
080010b8 g F .text 0000002c _Z12digitalWritehh
08000630 w F .text 00000000 __irq_can_rx1
20000390 g O .data 00000004 TIMER2
200002ee w O .data 00000002 _ZN6wirish4priv9w_adc_preE
08001e0c g O .rodata 00000004 _global_impure_ptr
080011a0 g F .text 00000050 __libc_init_array
0800024c g F .text 00000030 _Z9boardInitv
080005cc w F .text 00000004 _ZN6wirish4priv11series_initEv
080001e4 g F .text 00000064 start_c
080013d8 g F .text 00000000 _init
08000630 w F .text 00000000 __irq_spi2
08001300 g F .text 00000030 __libc_fini_array
080006a8 g F .text 00000008 adc_set_prescaler
0800086a g F .text 0000001c rcc_turn_off_clk
080009d4 g F .text 00000014 timer_init
08000efe g F .text 0000000a _ZN14HardwareSerial5flushEv
08000630 w F .text 00000000 __irq_can_sce
00000000 w *UND* 00000000 __deregister_frame_info
08001038 g F .text 00000014 _ZN5Print7printlnEPKc
200003f0 g O .data 00000004 USART3
200009a0 g O .bss 00000004 systick_uptime_millis
08000630 w F .text 00000000 __irq_exti2
080008a0 g F .text 00000018 rcc_configure_pll
20000930 g O .bss 00000018 Serial
080009e8 g F .text 00000030 timer_has_cc_channel
0800094c g F .text 0000001c __exc_systick
20000910 g .data 00000000 __data_end__
08001de0 g O .rodata 00000024 _ZTV14HardwareSerial
20000310 g O .data 00000008 gpioa
2000038c g O .data 00000004 TIMER1
200009a8 g .bss 00000000 __bss_end__
0800100c g F .text 0000000a _ZN5Print5printEc
08000af4 g F .text 00000028 __irq_tim1_up
08001e10 g .rodata 00000000 _lm_rom_img_cfgp
080005a6 w F .text 00000020 _ZN6wirish4priv28board_setup_clock_prescalersEv
08001204 g F .text 000000f0 __call_exitprocs
08000630 w F .text 00000000 __irq_exti3
08000f44 g F .text 00000078 _ZN14HardwareSerial5beginEmh
08000850 g F .text 0000001a rcc_turn_on_clk
080007cc g F .text 00000028 nvic_irq_set_priority
08000e80 g F .text 00000014 __error
08000630 w F .text 00000000 __irq_exti9_5
080005dc g F .text 00000000 __exc_busfault
20000398 g O .data 00000004 TIMER4
08001330 g F .text 000000a8 __register_exitproc
0800093c g F .text 00000010 systick_init
08000630 w F .text 00000000 __irq_pvd
08000630 w F .text 00000000 __irq_tamper
08000630 g F .text 00000000 __default_handler
08000630 w F .text 00000000 __irq_wwdg
08000630 w F .text 00000000 __stm32reservedexception10
08000630 w F .text 00000000 __irq_flash
08000f28 g F .text 0000001c _ZN14HardwareSerialC2EP9usart_devhh
080005c6 w F .text 00000004 _ZN6wirish4priv16board_setup_gpioEv
08001400 g .text 00000000 __fini_array_start
2000030c g O .data 00000004 ADC2
08000630 w F .text 00000000 __irq_i2c2_ev
08001110 g F .text 00000040 usart_init
08000a18 g F .text 0000001e timer_detach_interrupt
20000008 g O .data 000002e0 PIN_MAP
2000092c g O .bss 00000001 flip
08000fc6 g F .text 0000000c main
20005000 g *ABS* 00000000 __msp_init
20000394 g O .data 00000004 TIMER3
08000fee g F .text 0000001e _ZN5Print5writeEPKvm
080013f4 g .text 00000000 __init_array_end
08000e34 g F .text 0000004c throb
08000d3c g F .text 00000042 usart_config_gpios_async
08000acc g F .text 00000028 __irq_tim1_brk
08001016 g F .text 0000000a _ZN5Print5printEPKc
080001d4 g F .text 00000000 __exc_reset
08001d5c g O .rodata 00000004 GPIOA
00000000 w *UND* 00000000 __libc_fini
08000630 w F .text 00000000 __irq_dma1_channel2
00000000 w *UND* 00000000 __lm_error
08000dbc g F .text 0000001c __irq_usart1
08000630 w F .text 00000000 __irq_dma1_channel5
08000630 w F .text 00000000 __stm32reservedexception13
080005d4 g F .text 00000000 __exc_hardfault
080013f4 g F .text 00000000 _fini
08000630 w F .text 00000000 __irq_rtc
080012f4 g F .text 0000000c atexit
080008b8 g F .text 00000030 rcc_clk_enable
08000630 w F .text 00000000 __irq_spi1
08000b1c g F .text 00000038 __irq_tim1_trg_com
08000632 g F .text 00000014 adc_init
080005ca w F .text 00000002 _ZN6wirish4priv15board_setup_usbEv
080013e4 g .text 00000000 __preinit_array_end
08000630 w F .text 00000000 __stm32reservedexception7
08000630 w F .text 00000000 __irq_usb_hp_can_tx
200002f0 w O .data 00000008 _ZN6wirish4priv15w_board_pll_cfgE
08000824 g F .text 0000000c rcc_dev_clk
08000630 w F .text 00000000 __irq_exti15_10
08000630 w F .text 00000000 __irq_exti4
080005d0 g F .text 00000000 __exc_nmi
20000328 g O .data 00000008 gpiod
08000630 w F .text 00000000 __irq_rtcalarm
200009a8 g .bss 00000000 _end
200003e8 g O .data 00000004 USART1
08001d68 g O .rodata 00000004 GPIOD
08000630 w F .text 00000000 __stm32reservedexception8
08001180 g F .text 00000020 exit
08000e94 g F .text 0000002c _ZN14HardwareSerial4readEv
080004e8 g F .text 000000bc _Z4initv
08000a36 g F .text 00000094 timer_set_mode
080013e4 g .text 00000000 __init_array_start
080007ac g F .text 00000020 afio_remap
08000630 w F .text 00000000 __exc_pendsv
08000630 w F .text 00000000 __irq_i2c1_ev
08000248 w F .text 00000002 _exit
08001d60 g O .rodata 00000004 GPIOB
08000630 w F .text 00000000 __irq_usbwakeup
080001d4 g F .text 00000000 __start__
08000630 w F .text 00000000 __irq_exti1
08000630 w F .text 00000000 __irq_rcc
20000318 g O .data 00000008 gpiob
08000c18 g F .text 00000070 __irq_tim3
080010fc g F .text 00000014 gpio_init
08000df4 g F .text 0000001c __irq_usart3
00000000 w *UND* 00000000 _Jv_RegisterClasses
080013e4 g .text 00000000 __preinit_array_start
08000fc2 g F .text 00000004 _Z7premainv
00000000 w *UND* 00000000 __register_frame_info
08000f28 g F .text 0000001c _ZN14HardwareSerialC1EP9usart_devhh
20000308 g O .data 00000004 ADC1
00000000 w *UND* 00000000 free
20000960 g O .bss 00000018 Serial2

michael_l Sun Aug 30, 2015 9:50 am

Ok, it works!

I just created a new project (STM32F10x C/C++ Project) and debugging started to work ! Something magical has happened :)

Now the next thing would be to try to get Arduino .ino files compiled so that debugging is possible.

madias Sun Aug 30, 2015 10:48 am

Well, done!
Because this is more eclipse related than nucleo I would suggest to Roger to move it into the “IDE’s” section of this forum?

michael_l Sun Aug 30, 2015 11:05 am

Yes, that’s a good idea. Belongs to IDE section. Thanks.

Since compiling Arduino .ino files in Eclipse seems to involve quite a lot of work I’ve thought to compile sketches in Arduino and debug in Eclipse. Does that sound reasonable ?

I already found the “intermediate” files that Arduino IDE creates but I didn’t find symbol file for use with GDB. Is there an easy way to enable creating that in Arduino?

EDIT: seems Arduino compilier already uses -g flag. Fair enough. :)

michael_l Sun Aug 30, 2015 2:11 pm

Ok. Looks like I got debugging a project that was originally compiled in Arduino IDE working in Eclipse under Win32 that is. Eclipse IDE is quite good for debugging IMHO.

Here’s a few shots. I have to play with this a bit more to see how good it is but looks promising. Next thing is to do some tricks to get for example core library sources into project path to enable breakpoints there (not necessarily needed). For example C:\Users\me\Documents\Arduino\hardware\Arduino_STM32\STM32F1\cores\maple\libmaple contains a lot of interesting stuff that I’d like to debug – mainly just for fun :)

Image

Image

Image

michael_l Sun Aug 30, 2015 8:04 pm

Debugger works reliably but I’m having hard time to have Eclipse find the actual Arduino source file (.ino). It finds easily everything else that is in build.tmp folder created by Arduino

Currently I’m stuck at this:

Image

ANy help is appreciated. The directory it is referring to seems a bit weird ?

sheepdoll Sun Aug 30, 2015 9:10 pm

michael_l wrote:

ANy help is appreciated. The directory it is referring to seems a bit weird ?

RogerClark Sun Aug 30, 2015 9:19 pm

I had the same issue when attempting to use DDD under cygwin .

However this was when compiling using the IDE i.e a Windows program and then running DDD, a unix program, inside a cygwin shell.

Its odd the Eclipse has this issue when you have not used any other programs in the build process.

One quick hack could be to process the file that contains these paths and replace the slash with the appropriate one. I think this is in the .elf file.

However when I tried to do this run running DDD, it read the back slashes as escape chars, so it still didn’t work. And I could not find an easy way to process the elf file to replace / with \\ and \ with \\, without breaking the structure of the .elf binary file.

However you may have more success if you just need to convert forward slashes to back slashes

michael_l Sun Aug 30, 2015 11:01 pm

sheepdoll wrote:michael_l wrote:

ANy help is appreciated. The directory it is referring to seems a bit weird ?

michael_l Sun Aug 30, 2015 11:02 pm

RogerClark wrote:I had the same issue when attempting to use DDD under cygwin .

However this was when compiling using the IDE i.e a Windows program and then running DDD, a unix program, inside a cygwin shell.

Its odd the Eclipse has this issue when you have not used any other programs in the build process.

One quick hack could be to process the file that contains these paths and replace the slash with the appropriate one. I think this is in the .elf file.

However when I tried to do this run running DDD, it read the back slashes as escape chars, so it still didn’t work. And I could not find an easy way to process the elf file to replace / with \\ and \ with \\, without breaking the structure of the .elf binary file.

However you may have more success if you just need to convert forward slashes to back slashes

RogerClark Sun Aug 30, 2015 11:15 pm

Ummm.

From what I recall the Arduino IDE compiles a binary that is then converted to a bin.

Perhaps Eclipse does it a different way.

michael_l Mon Aug 31, 2015 5:46 am

RogerClark wrote:Ummm.

From what I recall the Arduino IDE compiles a binary that is then converted to a bin.

Perhaps Eclipse does it a different way.

RogerClark Mon Aug 31, 2015 5:54 am

Ah.

I didn’t realise you are trying to do that.

We’ve already investigated something very similar.

There is something called the Eclipse CDT Standalone Debugger, which we were hoping to use, but I posted to the Eclipse forum, and they said the debugger doesnt work on Windows.
Actually I think someone else from this forum also posted to the Eclipse forum, and I know the Eclipse team, were investigating how to get it to work, but that was at least a month ago.

You may be better of posting to the Eclipse forum

Take a look at this thread, as I think some things you tried, may have already been tried by other people

http://www.stm32duino.com/viewtopic.php … =cdt#p1149

michael_l Mon Aug 31, 2015 6:10 am

RogerClark wrote:Ah.

I didn’t realise you are trying to do that.

We’ve already investigated something very similar.

There is something called the Eclipse CDT Standalone Debugger, which we were hoping to use, but I posted to the Eclipse forum, and they said the debugger doesnt work on Windows.
Actually I think someone else from this forum also posted to the Eclipse forum, and I know the Eclipse team, were investigating how to get it to work, but that was at least a month ago.

You may be better of posting to the Eclipse forum

Take a look at this thread, as I think some things you tried, may have already been tried by other people

http://www.stm32duino.com/viewtopic.php … =cdt#p1149

RogerClark Mon Aug 31, 2015 6:15 am

OK

I had to log into their forum to find it

https://www.eclipse.org/forums/index.ph … th=1006944&

I hijacked an existing thread on the same subject, and also “Stuart” from this forum posted independently to the same thread.

The post to the thread mentions a patch

https://dev.eclipse.org/mhonarc/lists/c … 29420.html

However I’m not sure if that means you have to patch your Eclipse installation of whether its been merged into their core, in which case if you have a recent copy of Eclipse, perhaps its supposed to work now.

michael_l Mon Aug 31, 2015 6:24 am

RogerClark wrote:OK

I had to log into their forum to find it

https://www.eclipse.org/forums/index.ph … th=1006944&

I hijacked an existing thread on the same subject, and also “Stuart” from this forum posted independently to the same thread.

The post to the thread mentions a patch

https://dev.eclipse.org/mhonarc/lists/c … 29420.html

However I’m not sure if that means you have to patch your Eclipse installation of whether its been merged into their core, in which case if you have a recent copy of Eclipse, perhaps its supposed to work now.

RogerClark Mon Aug 31, 2015 6:28 am

Thanks! I’ll read those threads. I’m using Eclipse IDE C/C++ with GNU Arm plugins and build tools. Downloaded from here http://www.eclipse.org/downloads/packag … opers/mars a few days ago.

Its possible Eclipse has a bug that they are not aware of.

michael_l Mon Aug 31, 2015 6:52 am

RogerClark wrote:Thanks! I’ll read those threads. I’m using Eclipse IDE C/C++ with GNU Arm plugins and build tools. Downloaded from here http://www.eclipse.org/downloads/packag … opers/mars a few days ago.

Its possible Eclipse has a bug that they are not aware of.

Sign in to reply