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
26 REPLIES 26
Posted on June 22, 2018 at 08:42

Hi Jay,

Thanks for screenshot. I think you have a BLUENRG-2 project, or? Can you build working SW for BLUENRG-1?

Here my linker options:

-mthumb -T'..\BlueNRG1.ld' -specs=nosys.specs -nostartfiles -nodefaultlibs -static -L..\..\..\..\..\..\Library\Bluetooth_LE\library -L'..' -Wl,-cref,-u,-Xlinker,--defsym=ST_LINKER_OPTION=1 '-Wl,-Map=${BuildArtifactFileBaseName}.map' -Wl,--gc-sections -Wl,--defsym=malloc_getpagesize_P=0x80 -Wl,--start-group -lc -lm -Wl,--end-group

-mcpu is not included.

Is this the reason why the SW does not start/crash on BLUENRG-1?

Regards,

Robert

Posted on June 22, 2018 at 09:42

Robert, Jay,

Just for reference, below you may find my setting for linker.

I successfully built and run BLE_SensorDemo for BlueNRG-1. It worked on idb007v1 board.

Please note, that without that cortex-m0 settings linker uses incorrect libc library.

-mthumb -T'..\BlueNRG1.ld' -specs=nosys.specs -nostartfiles -nodefaultlibs -static -L..\..\..\..\..\..\Library\Bluetooth_LE\library -L'..' -Wl,-cref,-u,-Xlinker,--defsym=ST_LINKER_OPTION=1 -mcpu=cortex-m0 '-Wl,-Map=${BuildArtifactFileBaseName}.map' -Wl,--gc-sections -Wl,--defsym=malloc_getpagesize_P=0x80 -Wl,--start-group -lc -lm -Wl,--end-group

By the way, what version of Atollic do you use?

Regards,

Piotr
Posted on June 22, 2018 at 09:47

Just one more note. We should compare setting that are in console window during the build, beacause this is what is passed to GCC. Other settings (from grey setting window) may differ from that because Atollic can alter it or extend.

So, my linker line from console is:

arm-atollic-eabi-gcc -o Release.elf Hal\clock.o Hal\context_switch.o Hal\osal.o Hal\sleep.o Library\BlueNRG1_adc.o Library\BlueNRG1_dma.o Library\BlueNRG1_flash.o Library\BlueNRG1_gpio.o Library\BlueNRG1_i2c.o Library\BlueNRG1_mft.o Library\BlueNRG1_pka.o Library\BlueNRG1_rng.o Library\BlueNRG1_rtc.o Library\BlueNRG1_spi.o Library\BlueNRG1_sysCtrl.o Library\BlueNRG1_uart.o Library\BlueNRG1_wdg.o Library\misc.o SDK_Eval_BlueNRG1\LPS25HB.o SDK_Eval_BlueNRG1\LSM6DS3.o SDK_Eval_BlueNRG1\SDK_EVAL_Button.o SDK_Eval_BlueNRG1\SDK_EVAL_Com.o SDK_Eval_BlueNRG1\SDK_EVAL_Config.o SDK_Eval_BlueNRG1\SDK_EVAL_I2C.o SDK_Eval_BlueNRG1\SDK_EVAL_Led.o SDK_Eval_BlueNRG1\SDK_EVAL_SPI.o Startup\system_bluenrg1.o User\BlueNRG1_it.o User\SensorDemo_main.o User\gatt_db.o User\sensor.o -lbluenrg1_stack -lsmall_printf_atollic -mthumb -T..\BlueNRG1.ld -specs=nosys.specs -nostartfiles -nodefaultlibs -static -L..\..\..\..\..\..\Library\Bluetooth_LE\library -L.. -Wl,-cref,-u,-Xlinker,--defsym=ST_LINKER_OPTION=1 -mcpu=cortex-m0 -Wl,-Map=Release.map -Wl,--gc-sections -Wl,--defsym=malloc_getpagesize_P=0x80 -Wl,--start-group -lc -lm -Wl,--end-group 

Regards,

Piotr
Posted on June 22, 2018 at 10:27

It works! Thanks a lot!

My mistake: I added -mcpu option with a comma -> Error

-Wl,-cref,-u,-Xlinker,--defsym=ST_LINKER_OPTION=1,-mcpu=cortex-m0

without comma (only space) -> OK

-Wl,-cref,-u,-Xlinker,--defsym=ST_LINKER_OPTION=1 -mcpu=cortex-m0

Now I can build running SW with TrueStudio 9.0.0

Thanks a lot!

Regards,

Robert

thoe
Associate

Thanks for sharing this solution @Piotr Romaniuk​ , @Robert Scholz​ , works for me.

(The problem still exists in BlueNRG-1_2 DK 3.0.0.)

DCarl
Associate

Thank you all for presenting this issue in detail!

I agree that even with BlueNRG-1_2 DK 3.0.0. and TrueStudio 9.0.1 none of the dev kit BLE examples will run even though they appear to build and load without error.

Using the -mcpu=cortex-m0 option as described above instantly fixes the problem. In my case I added it to the Assembler and Linker tool options. the -mcpu=cortex-m0 optoion was already in the Compiler options for the BlueMS App compatible example.

I do not think I would have ever figured this out on my own. Thank you again!

Dilbert K
Senior

Thanks for great info...

I got passed the "crashing issue" but using STlink-V2 + TrueStudio 9.0,1 + BlueMS App still could not run using debugger.

Is there a way to update the STLink "Connection Settings" in TrueStudio ?

e.g. SWD : Frequency and Mode : Connect with Pre-Reset

I loaded the hex file build using update options with "BlueNRG-1 ST-Link Utility",

the code does run as I can connect to BLE.