This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Can't get ble_app_uart working on nRF51822 with GCC

I'm having trouble building the ble_app_uart example in: SDK11/examples/ble_peripheral

My build environment is: Ubuntu 15.04 SDK 11.0 GCC S130 PCA10000 nRF51822_xxaa - Rev 2 silicon

I can load and run the pre-built hex file: ble_app_uart_s130_pca10028.hex using JLinkExe. I can also successfully make the armgcc example.

My application doesn't run like the pre-built example when I do the following:

make make_flash_softdevice make flash

I have tried copying the PCA10028 folder and renaming it to PCA10000. I have edited Makefile and changed any references for PCA10028 and nrf51422_xxac to PCA10000 and nrf51822_xxaa respectively. I have tried various changes to the FLASH and RAM sections of ble_app_uart_gcc_nrf51.ld. However, I am not exactly sure what these should be as no combination seems to work.

I have tried using mergehex, but this doesn't work either.

I think my problem is related to the FLASH and RAM settings.

Can anyone point me in the right direction to resolving this issue.

Thanks Lee

  • I use Keil 5 and the application code for the project builds just fine. By the way, the free version of Keil 5 works fine with these examples. I think the problem is you refer to the ble_app_uart_s130_pca10028.hex as the app, but these are actually images of the entire flash space. So it includes the softdevice and application as one hex. The target in keil should be the 51822 and should be making the 51822_xxx...hex file which is just the app. Then the easiest route is to use nRFgo Studio, erase the whole thing and load only the correct softdevice and separately load the application code on top of it. After that you should be able to use the flash tools in GCC to load only the application code while you debug and code. If you have further problems, you are correct the flash, ram and target processor settings are vitally important. But I wouldn't just start renaming the pre-compile stuff to PCA10000. Nordic makes heavy use of board support headers and c files and you may just complicate things as you try to figure it out.

  • Hi. Thanks for replying.

    My development environment is Linux so I'm not able to use Keil or any of the development tools that Nordic offer - hence why I'm using GCC.

    You are correct, ble_app_uart_s130_pca10028.hex is the softdevice and ble_app_uart. This is why I have also tried to use mergehex. I suspect that the app section of ble_app_uart_s130_pca10028.hex was compiled and build using Keil. I haven't spent too much time comparing build the .hex files as I'm building using GCC and they will almost certainly be different.

    I'm replacing the references to PCA10028 and nrf51422_xxac to PCA10000 and nrf51822_xxaa so that the BSP files use the correct header files for my target. That said, the pre-built hex file is for a PCA10028 (nrf51422_xxac) so doesn't seem to make too much difference.

  • I wouldn't bother trying to merge it just load the softdevice s130_nrf51_2.0.0_softdevice.hex separately. Look for it under components/softdevice/s130/hex in the SDK folder. Then if the compiler is set up correctly, the app will build with it's starting address correct for S130 and you can just load it by itself.

  • I've tried that also using:

    make (to build ble_app_uart)

    make flash_softdevice (to program the soft device hex file onto the nrf51822)

    make flash (to program the ble_app_uart hex file onto the nrf51822)

    I think that my FLASH and RAM settings are not correct and can't find a definitive answer to what they should be for my PCA10000.

    The example for the PCA10028 is:

    FLASH (rx) : ORIGIN = 0x1b000, LENGTH = 0x25000 RAM (rwx) : ORIGIN = 0x20002080, LENGTH = 0x5f80

    I've tried others settings found by searching this forum and others, but am still unsure what the correct FLASH and RAM settings should be.

  • I happen to have a PCA10000, so I built it in keil and loaded the 2.0.0.0 S130 softdevice and the application hex that was in the build folder. I assume this is some sort of serial over BLE device. I didn't change anything at all in the project I left all the bsp and processor stuff unchanged. So it thought it was building for 51422 but the board actually has a 51822 on it. Though, if memory serves me well, these two are mostly the same except for packaging and ram/flash options.

    Anyway, after loading the files, the red led blinks now and then. I connected to the com port with putty and it says "scan started". So, I think it works.

    The target settings in keil are: irom1 start 0x1b000 size 0x25000, iram1 start 0x20001ebo and size 0x6150

Related