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

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

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

Post by 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.

Code: Select all

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)

Sometimes a pop-up occurs after a while:

Code: Select all

Error in final launch sequence
Failed to execute MI command:
load C:\\Users\\me\\workspace_mars_cpp\\Blinkkeri\\Debug\\Blinkkeri.elf
Error message from debugger back end:
Error finishing flash operation
Failed to execute MI command:
load C:\\Users\\me\\workspace_mars_cpp\\Blinkkeri\\Debug\\Blinkkeri.elf
Error message from debugger back end:
Error finishing flash operation
Error finishing flash operation
log from build:

Code: Select all

23:50:37 **** Build of configuration Debug for project test ****
make all 
Building file: ../system/src/stm32f1-stdperiph/misc.c
Invoking: Cross ARM C Compiler
arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -Wall -Wextra  -g3 -DDEBUG -DUSE_FULL_ASSERT -DTRACE -DOS_USE_TRACE_SEMIHOSTING_DEBUG -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -DHSE_VALUE=8000000 -I"../include" -I"../system/include" -I"../system/include/cmsis" -I"../system/include/stm32f1-stdperiph" -std=gnu11 -MMD -MP -MF"system/src/stm32f1-stdperiph/misc.d" -MT"system/src/stm32f1-stdperiph/misc.o" -c -o "system/src/stm32f1-stdperiph/misc.o" "../system/src/stm32f1-stdperiph/misc.c"
Finished building: ../system/src/stm32f1-stdperiph/misc.c
 
Building file: ../system/src/stm32f1-stdperiph/stm32f10x_gpio.c
Invoking: Cross ARM C Compiler
arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -Wall -Wextra  -g3 -DDEBUG -DUSE_FULL_ASSERT -DTRACE -DOS_USE_TRACE_SEMIHOSTING_DEBUG -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -DHSE_VALUE=8000000 -I"../include" -I"../system/include" -I"../system/include/cmsis" -I"../system/include/stm32f1-stdperiph" -std=gnu11 -MMD -MP -MF"system/src/stm32f1-stdperiph/stm32f10x_gpio.d" -MT"system/src/stm32f1-stdperiph/stm32f10x_gpio.o" -c -o "system/src/stm32f1-stdperiph/stm32f10x_gpio.o" "../system/src/stm32f1-stdperiph/stm32f10x_gpio.c"
Finished building: ../system/src/stm32f1-stdperiph/stm32f10x_gpio.c
 
Building file: ../system/src/stm32f1-stdperiph/stm32f10x_rcc.c
Invoking: Cross ARM C Compiler
arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -Wall -Wextra  -g3 -DDEBUG -DUSE_FULL_ASSERT -DTRACE -DOS_USE_TRACE_SEMIHOSTING_DEBUG -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -DHSE_VALUE=8000000 -I"../include" -I"../system/include" -I"../system/include/cmsis" -I"../system/include/stm32f1-stdperiph" -std=gnu11 -MMD -MP -MF"system/src/stm32f1-stdperiph/stm32f10x_rcc.d" -MT"system/src/stm32f1-stdperiph/stm32f10x_rcc.o" -c -o "system/src/stm32f1-stdperiph/stm32f10x_rcc.o" "../system/src/stm32f1-stdperiph/stm32f10x_rcc.c"
Finished building: ../system/src/stm32f1-stdperiph/stm32f10x_rcc.c
 
Building file: ../system/src/newlib/_cxx.cpp
Invoking: Cross ARM C++ Compiler
arm-none-eabi-g++ -mcpu=cortex-m3 -mthumb -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -Wall -Wextra  -g3 -DDEBUG -DUSE_FULL_ASSERT -DTRACE -DOS_USE_TRACE_SEMIHOSTING_DEBUG -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -DHSE_VALUE=8000000 -I"../include" -I"../system/include" -I"../system/include/cmsis" -I"../system/include/stm32f1-stdperiph" -std=gnu++11 -fabi-version=0 -fno-exceptions -fno-rtti -fno-use-cxa-atexit -fno-threadsafe-statics -MMD -MP -MF"system/src/newlib/_cxx.d" -MT"system/src/newlib/_cxx.o" -c -o "system/src/newlib/_cxx.o" "../system/src/newlib/_cxx.cpp"
Finished building: ../system/src/newlib/_cxx.cpp
 
Building file: ../system/src/newlib/_exit.c
Invoking: Cross ARM C Compiler
arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -Wall -Wextra  -g3 -DDEBUG -DUSE_FULL_ASSERT -DTRACE -DOS_USE_TRACE_SEMIHOSTING_DEBUG -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -DHSE_VALUE=8000000 -I"../include" -I"../system/include" -I"../system/include/cmsis" -I"../system/include/stm32f1-stdperiph" -std=gnu11 -MMD -MP -MF"system/src/newlib/_exit.d" -MT"system/src/newlib/_exit.o" -c -o "system/src/newlib/_exit.o" "../system/src/newlib/_exit.c"
Finished building: ../system/src/newlib/_exit.c
 
Building file: ../system/src/newlib/_sbrk.c
Invoking: Cross ARM C Compiler
arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -Wall -Wextra  -g3 -DDEBUG -DUSE_FULL_ASSERT -DTRACE -DOS_USE_TRACE_SEMIHOSTING_DEBUG -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -DHSE_VALUE=8000000 -I"../include" -I"../system/include" -I"../system/include/cmsis" -I"../system/include/stm32f1-stdperiph" -std=gnu11 -MMD -MP -MF"system/src/newlib/_sbrk.d" -MT"system/src/newlib/_sbrk.o" -c -o "system/src/newlib/_sbrk.o" "../system/src/newlib/_sbrk.c"
Finished building: ../system/src/newlib/_sbrk.c
 
Building file: ../system/src/newlib/_startup.c
Invoking: Cross ARM C Compiler
arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -Wall -Wextra  -g3 -DDEBUG -DUSE_FULL_ASSERT -DTRACE -DOS_USE_TRACE_SEMIHOSTING_DEBUG -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -DHSE_VALUE=8000000 -I"../include" -I"../system/include" -I"../system/include/cmsis" -I"../system/include/stm32f1-stdperiph" -std=gnu11 -MMD -MP -MF"system/src/newlib/_startup.d" -MT"system/src/newlib/_startup.o" -c -o "system/src/newlib/_startup.o" "../system/src/newlib/_startup.c"
Finished building: ../system/src/newlib/_startup.c
 
Building file: ../system/src/newlib/_syscalls.c
Invoking: Cross ARM C Compiler
arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -Wall -Wextra  -g3 -DDEBUG -DUSE_FULL_ASSERT -DTRACE -DOS_USE_TRACE_SEMIHOSTING_DEBUG -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -DHSE_VALUE=8000000 -I"../include" -I"../system/include" -I"../system/include/cmsis" -I"../system/include/stm32f1-stdperiph" -std=gnu11 -MMD -MP -MF"system/src/newlib/_syscalls.d" -MT"system/src/newlib/_syscalls.o" -c -o "system/src/newlib/_syscalls.o" "../system/src/newlib/_syscalls.c"
Finished building: ../system/src/newlib/_syscalls.c
 
Building file: ../system/src/newlib/assert.c
Invoking: Cross ARM C Compiler
arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -Wall -Wextra  -g3 -DDEBUG -DUSE_FULL_ASSERT -DTRACE -DOS_USE_TRACE_SEMIHOSTING_DEBUG -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -DHSE_VALUE=8000000 -I"../include" -I"../system/include" -I"../system/include/cmsis" -I"../system/include/stm32f1-stdperiph" -std=gnu11 -MMD -MP -MF"system/src/newlib/assert.d" -MT"system/src/newlib/assert.o" -c -o "system/src/newlib/assert.o" "../system/src/newlib/assert.c"
Finished building: ../system/src/newlib/assert.c
 
Building file: ../system/src/diag/Trace.c
Invoking: Cross ARM C Compiler
arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -Wall -Wextra  -g3 -DDEBUG -DUSE_FULL_ASSERT -DTRACE -DOS_USE_TRACE_SEMIHOSTING_DEBUG -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -DHSE_VALUE=8000000 -I"../include" -I"../system/include" -I"../system/include/cmsis" -I"../system/include/stm32f1-stdperiph" -std=gnu11 -MMD -MP -MF"system/src/diag/Trace.d" -MT"system/src/diag/Trace.o" -c -o "system/src/diag/Trace.o" "../system/src/diag/Trace.c"
Finished building: ../system/src/diag/Trace.c
 
Building file: ../system/src/diag/trace_impl.c
Invoking: Cross ARM C Compiler
arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -Wall -Wextra  -g3 -DDEBUG -DUSE_FULL_ASSERT -DTRACE -DOS_USE_TRACE_SEMIHOSTING_DEBUG -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -DHSE_VALUE=8000000 -I"../include" -I"../system/include" -I"../system/include/cmsis" -I"../system/include/stm32f1-stdperiph" -std=gnu11 -MMD -MP -MF"system/src/diag/trace_impl.d" -MT"system/src/diag/trace_impl.o" -c -o "system/src/diag/trace_impl.o" "../system/src/diag/trace_impl.c"
Finished building: ../system/src/diag/trace_impl.c
 
Building file: ../system/src/cortexm/_initialize_hardware.c
Invoking: Cross ARM C Compiler
arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -Wall -Wextra  -g3 -DDEBUG -DUSE_FULL_ASSERT -DTRACE -DOS_USE_TRACE_SEMIHOSTING_DEBUG -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -DHSE_VALUE=8000000 -I"../include" -I"../system/include" -I"../system/include/cmsis" -I"../system/include/stm32f1-stdperiph" -std=gnu11 -MMD -MP -MF"system/src/cortexm/_initialize_hardware.d" -MT"system/src/cortexm/_initialize_hardware.o" -c -o "system/src/cortexm/_initialize_hardware.o" "../system/src/cortexm/_initialize_hardware.c"
Finished building: ../system/src/cortexm/_initialize_hardware.c
 
Building file: ../system/src/cortexm/_reset_hardware.c
Invoking: Cross ARM C Compiler
arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -Wall -Wextra  -g3 -DDEBUG -DUSE_FULL_ASSERT -DTRACE -DOS_USE_TRACE_SEMIHOSTING_DEBUG -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -DHSE_VALUE=8000000 -I"../include" -I"../system/include" -I"../system/include/cmsis" -I"../system/include/stm32f1-stdperiph" -std=gnu11 -MMD -MP -MF"system/src/cortexm/_reset_hardware.d" -MT"system/src/cortexm/_reset_hardware.o" -c -o "system/src/cortexm/_reset_hardware.o" "../system/src/cortexm/_reset_hardware.c"
Finished building: ../system/src/cortexm/_reset_hardware.c
 
Building file: ../system/src/cortexm/exception_handlers.c
Invoking: Cross ARM C Compiler
arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -Wall -Wextra  -g3 -DDEBUG -DUSE_FULL_ASSERT -DTRACE -DOS_USE_TRACE_SEMIHOSTING_DEBUG -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -DHSE_VALUE=8000000 -I"../include" -I"../system/include" -I"../system/include/cmsis" -I"../system/include/stm32f1-stdperiph" -std=gnu11 -MMD -MP -MF"system/src/cortexm/exception_handlers.d" -MT"system/src/cortexm/exception_handlers.o" -c -o "system/src/cortexm/exception_handlers.o" "../system/src/cortexm/exception_handlers.c"
Finished building: ../system/src/cortexm/exception_handlers.c
 
Building file: ../system/src/cmsis/system_stm32f10x.c
Invoking: Cross ARM C Compiler
arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -Wall -Wextra  -g3 -DDEBUG -DUSE_FULL_ASSERT -DTRACE -DOS_USE_TRACE_SEMIHOSTING_DEBUG -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -DHSE_VALUE=8000000 -I"../include" -I"../system/include" -I"../system/include/cmsis" -I"../system/include/stm32f1-stdperiph" -std=gnu11 -MMD -MP -MF"system/src/cmsis/system_stm32f10x.d" -MT"system/src/cmsis/system_stm32f10x.o" -c -o "system/src/cmsis/system_stm32f10x.o" "../system/src/cmsis/system_stm32f10x.c"
Finished building: ../system/src/cmsis/system_stm32f10x.c
 
Building file: ../system/src/cmsis/vectors_stm32f10x.c
Invoking: Cross ARM C Compiler
arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -Wall -Wextra  -g3 -DDEBUG -DUSE_FULL_ASSERT -DTRACE -DOS_USE_TRACE_SEMIHOSTING_DEBUG -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -DHSE_VALUE=8000000 -I"../include" -I"../system/include" -I"../system/include/cmsis" -I"../system/include/stm32f1-stdperiph" -std=gnu11 -MMD -MP -MF"system/src/cmsis/vectors_stm32f10x.d" -MT"system/src/cmsis/vectors_stm32f10x.o" -c -o "system/src/cmsis/vectors_stm32f10x.o" "../system/src/cmsis/vectors_stm32f10x.c"
Finished building: ../system/src/cmsis/vectors_stm32f10x.c
 
Building file: ../src/BlinkLed.c
Invoking: Cross ARM C Compiler
arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -Wall -Wextra  -g3 -DDEBUG -DUSE_FULL_ASSERT -DTRACE -DOS_USE_TRACE_SEMIHOSTING_DEBUG -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -DHSE_VALUE=8000000 -I"../include" -I"../system/include" -I"../system/include/cmsis" -I"../system/include/stm32f1-stdperiph" -std=gnu11 -MMD -MP -MF"src/BlinkLed.d" -MT"src/BlinkLed.o" -c -o "src/BlinkLed.o" "../src/BlinkLed.c"
Finished building: ../src/BlinkLed.c
 
Building file: ../src/Timer.c
Invoking: Cross ARM C Compiler
arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -Wall -Wextra  -g3 -DDEBUG -DUSE_FULL_ASSERT -DTRACE -DOS_USE_TRACE_SEMIHOSTING_DEBUG -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -DHSE_VALUE=8000000 -I"../include" -I"../system/include" -I"../system/include/cmsis" -I"../system/include/stm32f1-stdperiph" -std=gnu11 -MMD -MP -MF"src/Timer.d" -MT"src/Timer.o" -c -o "src/Timer.o" "../src/Timer.c"
Finished building: ../src/Timer.c
 
Building file: ../src/_write.c
Invoking: Cross ARM C Compiler
arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -Wall -Wextra  -g3 -DDEBUG -DUSE_FULL_ASSERT -DTRACE -DOS_USE_TRACE_SEMIHOSTING_DEBUG -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -DHSE_VALUE=8000000 -I"../include" -I"../system/include" -I"../system/include/cmsis" -I"../system/include/stm32f1-stdperiph" -std=gnu11 -MMD -MP -MF"src/_write.d" -MT"src/_write.o" -c -o "src/_write.o" "../src/_write.c"
Finished building: ../src/_write.c
 
Building file: ../src/main.c
Invoking: Cross ARM C Compiler
arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -Wall -Wextra  -g3 -DDEBUG -DUSE_FULL_ASSERT -DTRACE -DOS_USE_TRACE_SEMIHOSTING_DEBUG -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -DHSE_VALUE=8000000 -I"../include" -I"../system/include" -I"../system/include/cmsis" -I"../system/include/stm32f1-stdperiph" -std=gnu11 -MMD -MP -MF"src/main.d" -MT"src/main.o" -c -o "src/main.o" "../src/main.c"
Finished building: ../src/main.c
 
Building target: test.elf
Invoking: Cross ARM C++ Linker
arm-none-eabi-g++ -mcpu=cortex-m3 -mthumb -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -Wall -Wextra  -g3 -T mem.ld -T libs.ld -T sections.ld -nostartfiles -Xlinker --gc-sections -L"../ldscripts" -Wl,-Map,"test.map" --specs=nano.specs -o "test.elf"  ./system/src/stm32f1-stdperiph/misc.o ./system/src/stm32f1-stdperiph/stm32f10x_gpio.o ./system/src/stm32f1-stdperiph/stm32f10x_rcc.o  ./system/src/newlib/_cxx.o ./system/src/newlib/_exit.o ./system/src/newlib/_sbrk.o ./system/src/newlib/_startup.o ./system/src/newlib/_syscalls.o ./system/src/newlib/assert.o  ./system/src/diag/Trace.o ./system/src/diag/trace_impl.o  ./system/src/cortexm/_initialize_hardware.o ./system/src/cortexm/_reset_hardware.o ./system/src/cortexm/exception_handlers.o  ./system/src/cmsis/system_stm32f10x.o ./system/src/cmsis/vectors_stm32f10x.o  ./src/BlinkLed.o ./src/Timer.o ./src/_write.o ./src/main.o   
Finished building target: test.elf
 
Invoking: Cross ARM GNU Create Flash Image
arm-none-eabi-objcopy -O ihex "test.elf"  "test.hex"
Finished building: test.hex
 
Invoking: Cross ARM GNU Print Size
arm-none-eabi-size --format=berkeley "test.elf"
   text	   data	    bss	    dec	    hex	filename
   5621	    176	    416	   6213	   1845	test.elf
Finished building: test.siz
 

23:50:43 Build Finished (took 6s.488ms)

Last edited by michael_l on Mon Aug 31, 2015 10:25 pm, edited 1 time in total.

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

Re: Debugging STM32F103RB Nucleo with Eclipse.. almost works

Post by 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
Posts: 337
Joined: Mon Aug 24, 2015 6:11 pm

Re: Debugging STM32F103RB Nucleo with Eclipse.. almost works

Post by 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:

Code: Select all

C:\Program Files (x86)\GNU ARM Eclipse\OpenOCD\0.9.0-201505190955\bin>openocd.exe -f ..\scripts\board\st_nucleo_f103rb.cfg
connect with telnet to openOCD at port 4444:

Code: Select all

> init
> reset init
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x080001d4 msp: 0x20005000
> halt
> flash write_image erase C:\\Users\\mika\\AppData\\Local\\Temp\\build263234916124862537.tmp\\sketch_aug29a.cpp.bin 0x08000000
auto erase enabled
target state: halted
target halted due to breakpoint, current mode: Thread
xPSR: 0x61000000 pc: 0x2000003a msp: 0x464c457c
wrote 8192 bytes from file C:\Users\mika\AppData\Local\Temp\build263234916124862537.tmp\sketch_aug29a.cpp.bin in 0.516030s (15.503 KiB/s)
>


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

Re: Debugging STM32F103RB Nucleo with Eclipse.. almost works

Post by michael_l » Sun Aug 30, 2015 9:18 am

Here's objdump from Arduino:

Code: Select all

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


Here's objdump from Eclipse GNU Arm plugin.

Code: Select all

C:\Users\mika\workspace_mars_cpp\Blinkkeri\Debug\Blinkkeri.bin:     file format elf32-littlearm
C:\Users\mika\workspace_mars_cpp\Blinkkeri\Debug\Blinkkeri.bin
architecture: arm, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED
start address 0x08000028

Program Header:
    LOAD off    0x00008000 vaddr 0x08000000 paddr 0x08000000 align 2**15
         filesz 0x00000028 memsz 0x00000028 flags rw-
    LOAD off    0x00010000 vaddr 0x20000000 paddr 0x20000000 align 2**15
         filesz 0x00000000 memsz 0x00000100 flags rw-
private flags = 5000200: [Version5 EABI] [soft-float ABI]

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .inits        00000028  08000000  08000000  00008000  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  1 .data         00000000  20000000  20000000  00008028  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  2 .data_CCMRAM  00000000  00000000  00000000  00008028  2**2
                  CONTENTS
  3 .bss          00000000  20000000  20000000  00000000  2**2
                  ALLOC
  4 .noinit       00000000  20000000  20000000  00008028  2**2
                  CONTENTS
  5 ._check_stack 00000100  20000000  20000000  00010000  2**2
                  ALLOC
SYMBOL TABLE:
08000000 l    d  .inits	00000000 .inits
20000000 l    d  .data	00000000 .data
00000000 l    d  .data_CCMRAM	00000000 .data_CCMRAM
20000000 l    d  .bss	00000000 .bss
20000000 l    d  .noinit	00000000 .noinit
20000000 l    d  ._check_stack	00000000 ._check_stack
08000028 l       .inits	00000000 __exidx_end
08000028 l       .inits	00000000 __etext
08000028 l       .inits	00000000 _etext
20004c00 l       *ABS*	00000000 __Main_Stack_Limit
00000000 l       *UND*	00000000 trace_printf
00000000 l       *UND*	00000000 SystemCoreClock
00000000 l       *UND*	00000000 RCC_APB2PeriphClockCmd
00000000 l       *UND*	00000000 GPIO_Init
08000028 l       .inits	00000000 __exidx_start
00000400 l       *ABS*	00000000 __Main_Stack_Size
00000000 l       *UND*	00000000 GPIO_SetBits
00000000 l       *UND*	00000000 _start
00000100 l       *ABS*	00000000 _Minimum_Stack_Size
00000000 l       *UND*	00000000 trace_puts
00000000 l       *UND*	00000000 GPIO_ResetBits
20005000 l       *ABS*	00000000 _estack
20005000 l       *ABS*	00000000 __stack
20000000 g       .data	00000000 __data_start__
08000028 g       .inits	00000000 __bss_regions_array_end
08000000 g       *ABS*	00000000 __vectors_start__
08000028 g       *ABS*	00000000 _sidata
20000000 g       .bss	00000000 _sbss
20000000 g       .noinit	00000000 _noinit
20000000 g       .bss	00000000 __bss_start__
20000000 g       .data	00000000 _sdata
20000000 g       .bss	00000000 _ebss
08000000 g       .inits	00000000 __data_regions_array_start
20000000 g       .data	00000000 __data_end__
20000000 g       .bss	00000000 __bss_end__
20000000 g       .noinit	00000000 _end_noinit
08000000 g       *ABS*	00000000 __vectors_start
08000018 g       .inits	00000000 __data_regions_array_end
20000000 g       .data	00000000 _edata
08000018 g       .inits	00000000 __bss_regions_array_start




Ok, it is a different program.. but. Is there anything obvious in headers that is clearly wrong in Eclipse's image ? At least 'Private flags' is different between these two

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

Re: Debugging STM32F103RB Nucleo with Eclipse.. almost works

Post by 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
Posts: 813
Joined: Mon Apr 27, 2015 11:26 am
Location: Vienna, Austria

Re: Debugging STM32F103RB Nucleo with Eclipse.. almost works

Post by 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
Posts: 337
Joined: Mon Aug 24, 2015 6:11 pm

Re: Debugging STM32F103RB Nucleo with Eclipse.. almost works

Post by 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
Posts: 337
Joined: Mon Aug 24, 2015 6:11 pm

Re: Debugging STM32F103RB Nucleo with Eclipse.. almost works

Post by 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
Posts: 337
Joined: Mon Aug 24, 2015 6:11 pm

Re: Debugging STM32F103RB Nucleo with Eclipse.. almost works

Post by 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 ?

User avatar
sheepdoll
Posts: 236
Joined: Fri May 22, 2015 12:58 am
Location: Silicon Valley Vortex
Contact:

Re: Debugging STM32F103RB Nucleo with Eclipse.. almost works

Post by 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 ?
I had some success with this myself a few months back (Using OSX). Have not had time to investigate this further.

The path in the screencap mixes both unix style and MSDOS dos style path delimiters '/\.' I think modern app apis allow this. At least on the unix side.

The other issue could be that the api is looking for a hardcoded.c file. Did you attempt to create something like

Code: Select all

wrapper.c
 include "C:\program_files\arduino\nucleo_serial_test.ino"


Come to think of that the path to the ino would be more like (from memory)
C:\my_documents\arduino\nucleo_serial_test.\nucleo_serial_test.ino

Under OSX in I enable the verbose option I can see the path to the tmp directory where the code is built and the elf file is. If the Arduio IDE is not closed I can point GDB to this. Verify without upload. All the code needed to build the sketch is in this temp directory with the .ino as a cpp file. Trick would be (and I sort of did it once) is to use the tool that converts the SW4STM32 files into a makefile. Feed this file to eclipse to build the project and create the .elf

Post Reply