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

s130 2.0.0 ROM and RAM settings?

Hi,

I am using a 128KB-rom 16KB-ram nrf51822 and trying to run blinky from SDK 11 with softdevice.

If I load nrf51 S130 1.0.0 softdevice, and use the following in my gcc compiling setting: FLASH (rx) : ORIGIN = 0x1c000, LENGTH = 0x4000 RAM (rwx) : ORIGIN = 0x20002800, LENGTH = 0x1800 I was able to run blinky.

After I change to S130 2.0.0 softdevice, and use the following: FLASH (rx) : ORIGIN = 0x1b000, LENGTH = 0x5000 RAM (rwx) : ORIGIN = 0x20002800, LENGTH = 0x1800 blinky does not work any more. I assume the RAM setting is wrong? what should be the correct setting?

Also what is the correct ROM/RAM setting for S130 2.0.0-7.alpha? I can't get blinky to work with this SD either.

Thanks for any help!

  • Try changing the heap size to 0 in arm_startup_nrf51.s. The SDK does not use heap (malloc/free), so if your application does not either you can safely set this to zero.

    The hrs example will use just over 8KB for the SoftDevice and about 4.5KB in the application. Adding this with the heap and stack size of 2KB you will end up at about 16.5KB which is too much.

    Also see this tutorial on RAM and ROM management on the nRF.

  • @Ole

    The strange thing, is that the precompiled Hex code in the SDK does work on the 16k device (QFAAH3)

    So assuming the Hex was compiled from the same source, the difference is only the compiler

    I don't know what compiler Nordic use to make the precompiled hex, I guess its IAR or possibly Keil

    I was going to try using the demo copy of Keil but I'd need to make a Keil project, so that would be one more unknown / variable in the mix.

  • It looks like we use Keil to generate the precompiled hex files.

    I was wrong in my last comment, the 4.5KB used in the application will include the stack used, so the hrs example use less than 16KB of RAM by default. Also if the stack overlaps with the heap, you will get an error from the compiler during linking, so this is not the problem.

    The difference between Keil and GCC is that GCC will place the stack at the top of the RAM (0x20004000 for 16KB ram) while Keil will place it after the heap (at SD ram size + app ram size + heap size + stack size) if heap is used, if not it will place it after application ram (heap is removed by keil if not used).

    Can you post the memory settings in the linker script so that I can confirm that it is correct?

  • The HRS example works using the pca10028 board for my generic device (I'm testing on a Waveshare BLE400 with a QFAA based module plugged in)

    I copied ble_app_hrs_gcc_nrf51.ld to ble_app_hrs_gcc_nrf51QFAA.ld

    I changed the MEMORY section

    MEMORY
    {
      FLASH (rx) : ORIGIN = 0x1b000, LENGTH = 0x25000
      RAM (rwx) :  ORIGIN = 0x20002080, LENGTH = 0x1f80
    }
    

    I also updated the Makefile

    nrf51422_xxac_s130: LINKER_SCRIPT=ble_app_hrs_gcc_nrf51.ld
    

    to

    nrf51422_xxac_s130: LINKER_SCRIPT=ble_app_hrs_gcc_nrf51QFAA.ld
    

    So that the new linker file is used

  • Which chip revision is it? Check the build code (QFAAxx) and find the revision here.

Related