cancel
Showing results for 
Search instead for 
Did you mean: 

[Novice]Having problem with basic project

dikhnot
Associate II
Posted on October 14, 2015 at 14:51

Good day everyone.

I try to run example from Eclipse (blinking led) onSTM32F051R8T6. But nothing heppend. Could anyone give me advice? Thanks. This is server log:

Last login: Tue Oct 13 23:23:12 on ttys000
localhost:~ admin$ /Users/admin/Embed\ Tools/stlink/st-util ; exit;
2015-10-13T23:31:19 INFO src/stlink-common.c: Loading device parameters....
2015-10-13T23:31:19 INFO src/stlink-common.c: Device connected is: F0 device, id 0x20006440
2015-10-13T23:31:19 INFO src/stlink-common.c: SRAM size: 0x2000 bytes (8 KiB), Flash: 0x10000 bytes (64 KiB) in pages of 1024 bytes
2015-10-13T23:31:19 INFO gdbserver/gdb-server.c: Chip ID is 00000440, Core ID is 0bb114
2015-10-13T23:31:19 INFO gdbserver/gdb-server.c: Target voltage is 2893 mV.
2015-10-13T23:31:19 INFO gdbserver/gdb-server.c: Listening at *:4..
2015-10-13T23:31:32 ERROR gdbserver/gdb-server.c: [FP_CTRL] = 0x00000041 expecting 0x00000261
2015-10-13T23:31:32 INFO gdbserver/gdb-server.c: GDB connected.
2015-10-13T23:31:32 INFO src/stlink-common.c: Attempting to write 1024 (0x400) bytes to stm32 address: 134217728 (0x8000000)
Flash page at addr: 0x08000000 erased
2015-10-13T23:31:32 INFO src/stlink-common.c: Finished erasing 1 pages of 1024 (0x400) bytes
2015-10-13T23:31:32 INFO src/stlink-common.c: Starting Flash write for VL/F0/F3 core id
2015-10-13T23:31:32 INFO src/stlink-common.c: Successfully loaded flash loader in sram
2015-10-13T23:31:32 INFO src/stlink-common.c: Starting verification of write complete
2015-10-13T23:31:32 INFO src/stlink-common.c: Flash written and verified! jolly good!
2015-10-13T23:31:32 INFO src/stlink-common.c: Attempting to write 1024 (0x400) bytes to stm32 address: 134218752 (0x8000400)
Flash page at addr: 0x08000400 erased
2015-10-13T23:31:32 INFO src/stlink-common.c: Finished erasing 1 pages of 1024 (0x400) bytes
2015-10-13T23:31:32 INFO src/stlink-common.c: Starting Flash write for VL/F0/F3 core id
2015-10-13T23:31:32 INFO src/stlink-common.c: Successfully loaded flash loader in sram
2015-10-13T23:31:32 INFO src/stlink-common.c: Starting verification of write complete
2015-10-13T23:31:32 INFO src/stlink-common.c: Flash written and verified! jolly good!
2015-10-13T23:31:32 INFO src/stlink-common.c: Attempting to write 1024 (0x400) bytes to stm32 address: 134219776 (0x8000800)
Flash page at addr: 0x08000800 erased
2015-10-13T23:31:32 INFO src/stlink-common.c: Finished erasing 1 pages of 1024 (0x400) bytes
2015-10-13T23:31:32 INFO src/stlink-common.c: Starting Flash write for VL/F0/F3 core id
2015-10-13T23:31:32 INFO src/stlink-common.c: Successfully loaded flash loader in sram
2015-10-13T23:31:32 INFO src/stlink-common.c: Starting verification of write complete
2015-10-13T23:31:32 INFO src/stlink-common.c: Flash written and verified! jolly good!
2015-10-13T23:31:32 INFO src/stlink-common.c: Attempting to write 1024 (0x400) bytes to stm32 address: 134220800 (0x8000c00)
Flash page at addr: 0x08000c00 erased
2015-10-13T23:31:32 INFO src/stlink-common.c: Finished erasing 1 pages of 1024 (0x400) bytes
2015-10-13T23:31:32 INFO src/stlink-common.c: Starting Flash write for VL/F0/F3 core id
2015-10-13T23:31:32 INFO src/stlink-common.c: Successfully loaded flash loader in sram
2015-10-13T23:31:32 INFO src/stlink-common.c: Starting verification of write complete
2015-10-13T23:31:32 INFO src/stlink-common.c: Flash written and verified! jolly good!
2015-10-13T23:31:32 INFO src/stlink-common.c: Attempting to write 1024 (0x400) bytes to stm32 address: 134221824 (0x8001000)
Flash page at addr: 0x08001000 erased
2015-10-13T23:31:32 INFO src/stlink-common.c: Finished erasing 1 pages of 1024 (0x400) bytes
2015-10-13T23:31:32 INFO src/stlink-common.c: Starting Flash write for VL/F0/F3 core id
2015-10-13T23:31:32 INFO src/stlink-common.c: Successfully loaded flash loader in sram
2015-10-13T23:31:32 INFO src/stlink-common.c: Starting verification of write complete
2015-10-13T23:31:32 INFO src/stlink-common.c: Flash written and verified! jolly good!

6 REPLIES 6
Posted on October 14, 2015 at 16:50

Ok, so you're showing me a flashing log, but I'm hearing that the code doesn't blink the LED. Would that be a correct interpretation?

So look more critically at your code, and the code in SystemInit() (system_stm32f0xx.c) that is called before main(). Check the clocks, crystal and PLL settings match YOUR hardware.

Make sure BOOT0 is pulled LOW

Can you use your debugger to step the code? Does that indicate it's running? Can't see any code here, so can't comment on that.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
dikhnot
Associate II
Posted on October 14, 2015 at 18:02

OK, thanks. I will check it! 

It was because I started with ''inbuilt'' in Eclipse example project (I believe it has no errors)

dikhnot
Associate II
Posted on October 14, 2015 at 19:19

I've inspected the board, and SB2 (BOOT0) is inbuilt component, it cannot be modified.

Then I debug it stops with next message in Console (of Eclipse)

Program received signal SIGTRAP, Trace/breakpoint trap.
0x0800048a in call_host (arg=0x4, reason=4) at ../system/include/arm/semihosting.h:80
80 asm volatile (

and this semihosting.h has next code (about line 80):

call_host (int reason, void* arg)
{
int value;
asm volatile (
'' mov r0, %[rsn] 
''
'' mov r1, %[arg] 
''
#if defined(OS_DEBUG_SEMIHOSTING_FAULTS)
'' '' AngelSWITestFault '' 
''
#else
'' '' AngelSWIInsn '' %[swi] 
''
#endif
'' mov %[val], r0''
: [val] ''=r'' (value) /* Outputs */
: [rsn] ''r'' (reason), [arg] ''r'' (arg), [swi] ''i'' (AngelSWI) /* Inputs */
: ''r0'', ''r1'', ''r2'', ''r3'', ''ip'', ''lr'', ''memory'', ''cc''
// Clobbers r0 and r1, and lr if in supervisor mode
);
// Accordingly to page 13-77 of ARM DUI 0040D other registers
// can also be clobbered. Some memory positions may also be
// changed by a system call, so they should not be kept in
// registers. Note: we are assuming the manual is right and
// Angel is respecting the APCS.
return value;
}

Is it help to recognize what can cause the problem? I run example project with blinking led on STM32F4 without problems (of course for other chip), but with thisSTM32F051R8T6 it isn't working.
alexanderjonas
Associate II
Posted on March 24, 2016 at 16:35

Hello,

I also get the Message

Program received signal SIGTRAP, Trace/breakpoint trap.
0x0800048a in call_host (arg=0x4, reason=4) at ../system/include/arm/semihosting.h:80
80 asm volatile (

when I try to debug my program with ODB and ST-Link. I am using Linux Mint and GCC ARM Toolchain.
Posted on March 24, 2016 at 20:49

Ok, again everything but the code you're actually compiling/running.

Might these errors suggest you are using printf(), fopen() or something expecting some hosting on the board? Do you have any of your own syscalls or newlib code supporting your board, and which USARTs etc that STDIO might be using.

Does the code exit(), abort() or drop out of main()?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
alexanderjonas
Associate II
Posted on March 31, 2016 at 21:38

Hey, I have exactly the same problem. I also get the

''Program received signal SIGINT, Interrupt. [...] asm volatile'' error message. I am reading my ADC in Dual Mode using the DMA. So the ADC produces an interrupt when it is ready and I can read out the registers. I declared my ADC Buffer with __IO, which makes it volatile. Maybe there is a problem with that? I also use the GCC GNU ARM toolchain and OpenOCD GDB in Eclipse.