Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mbed-ble-thermometer example fails to link with redBearLabBLENano board #18

Open
vshymanskyy opened this issue Dec 3, 2017 · 19 comments

Comments

@vshymanskyy
Copy link

...
Generating LD script .pioenvs/ble_nano/NRF51822.ld.link_script.ld
Linking .pioenvs/ble_nano/firmware.elf
.pioenvs/ble_nano/NRF51822.ld.link_script.ld:78 cannot move location counter backwards (from 0000000020004650 to 0000000020003800)
collect2: error: ld returned 1 exit status
*** [.pioenvs/ble_nano/firmware.elf] Error 1

The same example works with nrf51_dk.

@ivankravets
Copy link
Member

Fixed in the latest mbed OS.

@vshymanskyy
Copy link
Author

@ivankravets how do I use the the latest mbed OS?
I tried switching to development version of nordicnrf51 platform - still failing with same error.

@vshymanskyy
Copy link
Author

I use:

platform = https://github.com/platformio/platform-nordicnrf51.git
framework = mbed
board = redBearLabBLENano
build_flags = -DPIO_FRAMEWORK_MBED_RTOS_PRESENT
upload_port = /media/${env.USER}/MBED/

@ivankravets ivankravets reopened this Jan 26, 2018
@ivankravets
Copy link
Member

Which example do you use? I tested with mbed-ble-thermometer without build_flags = -DPIO_FRAMEWORK_MBED_RTOS_PRESENT

@vshymanskyy
Copy link
Author

if I remove PIO_FRAMEWORK_MBED_RTOS_PRESENT, I can build the example! but then it doesn't work at all. Let me investigate if code executes at least...

@vshymanskyy
Copy link
Author

vshymanskyy commented Jan 27, 2018

It looks code isn't even running... :(

[env:ble_nano]
platform = https://github.com/platformio/platform-nordicnrf51.git
framework = mbed
board = redBearLabBLENano
;build_flags = -DPIO_FRAMEWORK_MBED_RTOS_PRESENT
upload_port = /media/${env.USER}/MBED/

main.cpp:

#include "mbed.h"

Serial pc(USBTX, USBRX);
DigitalOut led1(LED1, 1);

int main()
{
    while(1) {
      led1 = !led1;
      wait_ms(500);
      pc.printf("toggle\n");
    }

    return 0;
}

Run by:

pio run -e ble_nano --target upload && pio device monitor

no blinking, no prints in the console...

@vshymanskyy
Copy link
Author

Also, when I specify

board = nrf51_dk
build_flags = -DPIO_FRAMEWORK_MBED_RTOS_PRESENT

then it builds OK, but i can't test it on BLE Nano (different upload method)

@vshymanskyy
Copy link
Author

seeedTinyBLE - same issue.

@ivankravets ivankravets added the bug label Feb 2, 2018
@michelle-russell
Copy link

Hi, any update on this bug? I am having similar issues on the seeedTinyBLE where a simple blinky/serial program appears to be compiling & uploading with no problems, yet no code runs.

Some more info: An mbed online compiler hex output was 355KB and the platformio output from identical code was 288KB. I tried copying the mbed version into the .pioenvs/seedTinyBLE folder to see if platformio would upload that file, and it worked perfectly. Blinking and serial data galore. So, it seems that something isn't quite right in the build stage rather than the upload stage.

@ghost
Copy link

ghost commented Jul 4, 2018

any updates on this??
Seems the same with nrf523832 ble nano 2

@vshymanskyy
Copy link
Author

@ivankravets still having issues with this. What nrf51-based device are you testing with?

@danielkucera
Copy link

I have similar problem. This code compiled in April without problems:
https://github.com/danielkucera/ble-meter-mbed

Now I first had to add

build_flags = -DPIO_FRAMEWORK_MBED_RTOS_PRESENT

after that it throws:

Generating LD script .pioenvs/bbcmicrobit/NRF51822.ld.link_script.ld
Linking .pioenvs/bbcmicrobit/firmware.elf
.pioenvs/bbcmicrobit/NRF51822.ld.link_script.ld:78 cannot move location counter backwards (from 0000000020003f68 to 0000000020003800)
collect2: error: ld returned 1 exit status
*** [.pioenvs/bbcmicrobit/firmware.elf] Error 1

I luckily made a copy of the compiled version from April (.pioenvs) so I can provide it for investigation

@ivankravets
Copy link
Member

This board does not support RTOS. See https://os.mbed.com/platforms/RedBearLab-nRF51822/ (right column). Only SDK/MBED 2

@vshymanskyy
Copy link
Author

@ivankravets I think it is a bug. See this comment: #18 (comment)
The code isn't running even without RTOS enabled

@danielkucera
Copy link

If someone is interrested, I was able to build my code with latest versions.
I have removed

build_flags = -DPIO_FRAMEWORK_MBED_RTOS_PRESENT

because my board doesn't support mbed-os (mbed 5) and copied BLE library which was required for my code by copying it from mbed features
More info #29

@ivankravets
Copy link
Member

@danielkucera what is your final platformio.ini?

@danielkucera
Copy link

@vshymanskyy
Copy link
Author

@ivankravets
I was able to build and run PIOTherm (mbed OS 5) example with my RedBearLab BLE Nano 1.5.
But I had to use nrf51_dk target.

[env:nrf51_dk]
platform = nordicnrf51
framework = mbed
board = nrf51_dk
build_flags = -DPIO_FRAMEWORK_MBED_RTOS_PRESENT

board_build.mcu = nrf51822
board_build.f_cpu = 32000000L
upload_protocol = cmsis-dap

@vshymanskyy
Copy link
Author

vshymanskyy commented Jun 17, 2019

It looks like mbed OS 5 support should be enabled for all nrf51 variants with SRAM >= 32Kb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants