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

How to execute my app from RAM ?

Hi

I want to execute my app from the RAM to test if i'll get a considerable decrease in the current consumption.

I'm using : "s130_nrf51822_0.9.0-1.alpha" &"nrf51822QFAC"

I tried to follow this thread but it dosen't work (getting a hard default) .

My Questions :

  1. What is the IRAM configuration should i do ? When i use that config in the capture1 it's working if i don't add the main.c to be excuted from RAM as it's mentioned in the thread.
  2. Should i add only the main.c to be excuted from RAM, or it depends on the app ?
  3. When i add main.c to be excuted to RAM, i have to sleect IRAM2 (as in capture2) or IRAM1 ?

Thanks

image description

image description

  • FormerMember
    0 FormerMember

    First, I would recommend you to use the latest version of the S130, S130 v.2.0.0.

    The reason for the hardfault is most likely that the IRAM start address is too small. As you can see in the RAM map below, RAM address 0x2000000 is used by the MBR.

    image description

    The APP_RAM_BASE address is where you application can start. The procedure for finding the APP_RAM_BASE is described in the migration document that comes with the softdevice: image description

    Update 01.04.16:

    I would think that you will have to add all the files that you want to run from RAM into "properties". However, if you for example have 50 kB of code, you cannot put all the code in RAM, but instead the code that you think is executed often. The reason that you save power when running code from RAM is that you don't have to power flash that often.

    IRAM 1 and IRAM 2 refer to regions in the RAM. As you can see in the above figure, the application, heap, and call stack use RAM 1. If there is something else that you want to allocate RAM to, like for example running code from RAM, you can use use IRAM2 to that.

  • Hi kristin,

    Fisrt, thank for the clarification, i'll try to understand it well , test it and give a feedback. Can you please reply my second question in the description? Which is : Should i add only the main.c to be excuted from RAM, or it depends on the app ?

    And another question :

    IRAM1 and IRAM2 in the Keil configuration refer to what ? Region 0 and region 1?? can i choose only one IRAM ?

  • FormerMember
    0 FormerMember in reply to FormerMember

    I have updated the answer to answer your questions.

  • Thanks for the clarification, that's helpful

    Ok i did this configuration ( IRAM1 only is configured : @0x20002E00 size =0x2E00 and the main.c is excuted :IRAM1 [0x20002E00-0x20005BFF] ) and its working...the only thing i did is that i give enough space for softdevice like its mentioned in the relase note .(10kb +1.5kb for call stack)

    Before i was thinking it's not wokrking because i couldn't debug. But as it's executed from RAM i can't debug it ( do you confirm that ? )

    i will do tests of power consumption, and give a feedback

  • I didn't get a gain in current...the same current conumption .

Related