cancel
Showing results for 
Search instead for 
Did you mean: 

BLE_SensorDEMO built in TrueSTUDIO is not working on idb007v1

Posted on February 16, 2018 at 20:28

Hi,

I'm trying to run an example program - BLE_Sensor DEMO - built from sources.

I am using TrueSTUDIO for STM32 (v.9.0.0). The sources are from BlueNRG-1.2_DK_2.6.0 kit.

Unfortunatelly, when I download the image, the board does nothing: no led blinking, no BLE communication.

However, when I download prebuilt image (from Firmware folder in the development kit) it works fine.

What I am doing wrong?

Kind regards,

Piotr
1 ACCEPTED SOLUTION

Accepted Solutions
Posted on February 20, 2018 at 22:37

TrueSTUDIO project from ST DevKit has missing architecture option:

   -mcpu=cortex-m0

Without that linked libc contains instructions in ARM mode (but it should be only Thumb - because it is Cortex-M0).

That is why HardFault Exception occured. 

How to fix it

The option should be added in:

   Project Properties | C/C++ Build |Settings, tab Tool Settings

for each group:

  Assembler, C Compiler, C Linker

in Miscellaneouos |Other options field.

View solution in original post

26 REPLIES 26
Andrew Neil
Evangelist
Posted on February 20, 2018 at 10:26

when I download the image, the board does nothing

It's almost certainly doing something - so connect the debugger, and find out what it's doing!

Posted on February 20, 2018 at 11:03

Hi Andrew,

I did, but debugging from TrueStudio, does not work either!

Please read my question:

https://community.st.com/0D50X00009Xkht2SAB

I expected that reference design from ST should work, but not to be debugged.

My configuration constains:

- the board from ST,

- TrueSTUDIO (ST recommended as one of the IDE)

- development kit from ST (library and TrueStudio project)

- jtag/programmer from ST

Regards,

Piotr

Posted on February 20, 2018 at 11:12

OP? What does it mean?

Posted on February 20, 2018 at 11:09

romaniuk.piotr wrote:

I did, but debugging from TrueStudio, does not work either!

Please read my question:

https://community.st.com/0D50X00009Xkht2SAB

Would have been helpful to include that in the OP, then.

Posted on February 20, 2018 at 11:27

'Original Post', or 'Opening Post'

Also used as 'Original Poster', or 'Opening Poster'

Posted on February 20, 2018 at 15:21

Closer look to program execution show that it does not return to main() from BlueNRG_Stack_Initialization().

Inside the function HardFault exception is generated.

Here is a stack trace:

[...]

   main()

      

BlueNRG_Stack_Initialization

          BlueNRG_Stack_Perform_Crystal_Check

             BlueNRG_Stack_Initialize_Layers

                 PM_init

                   exception in __aeabi_fdiv()   => HardFaultHandler

pc = 10041722                HardFault Handler

msp = 0x2000.5f98

2000.5f98 36          R0 <- msp points here

2000.5f9c 0           R1

2000.5fa0 0350.0000   R2

2000.5fa4 0000.6c00   R3

2000.5fa8 0000.0018   R12

2000.5fac 1004.705f   LR - would return to PM_init

2000.5fb0 1004.08d8 in __aeabi_fdiv <--- exception location

2000.5fb4 0100.0000

2000.5fb8 2000.094c

2000.5fbc 2000.08d4

2000.5fc0 2000.094c

2000.5fc4 1004.1dc1 in BlueNRG_Stack_Initialize_Layers

2000.5fc8 2000.094c

2000.5fcc 0000.0040

2000.5fd0 0000.0001

2000.5fd4 1004.1feb in BlueNRG_Stack_Perform_Crystal_Check

2000.5fd8 2000.2604

2000.5fdc 0

2000.5fe0 0

2000.5fe4 ffff.ffff

2000.5fe8 ffff.ffff

2000.5fec 1004.1d51 in BlueNRG_Stack_Initialization

2000.5ff0 1004.b580

2000.5ff4 1004.17bb

2000.5ff8 1004.b580

2000.5ffc 1004.14fd

Posted on February 20, 2018 at 16:32

Unfortunatelly not. I still cannot debug from TrueSTUDIO IDE.

Above data is from BlueNRG-ST-Link Utility. This tool has very limitted functionality, but enough for getting ARM core register and RAM contents. 

I have taken function names from a listing generated by the linker.

Posted on February 20, 2018 at 16:00

romaniuk.piotr wrote:

                   exception in __aeabi_fdiv()   => HardFaultHandler

Sounds like something to do with Floating Point - so check your FP setup.

Trying to do hardware FP on a chip with no FP HW probably would give a Hard Fault ...

Posted on February 20, 2018 at 16:01

romaniuk.piotr wrote:

Closer look to program execution show that it does not return to main() from BlueNRG_Stack_Initialization().

Inside the function HardFault exception is generated.

Does this mean you've got the debugger to work, then?