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

How to set memory in IAR, including How to set ram size in IAR

I know the Project options can be configured in the iar_nRF5x.icf file, but there is no option for ram size. If the RAM start and end is given, I guess that is the ram size.

Also, it is not clear why to specify the Ram size. As long as the MAP file indicates a lower RAM size needed than the total, it is OK?

Then how does one figure out the stack and heap?

define symbol ICFEDIT_intvec_start = 0x1f000;

/-Memory Regions-/ define symbol ICFEDIT_region_ROM_start = 0x1f000;

define symbol ICFEDIT_region_ROM_end = 0x7ffff;

define symbol ICFEDIT_region_RAM_start = 0x20002fff;

define symbol ICFEDIT_region_RAM_end = 0x2000ffff;

export symbol ICFEDIT_region_RAM_start;

export symbol ICFEDIT_region_RAM_end;

/-Sizes-/

define symbol ICFEDIT_size_cstack = 0x800;

define symbol ICFEDIT_size_heap = 0x200;

/**** End of ICF editor section. ###ICF###*/

Any help appreciated

Parents
  • Hi,

    Take a look at the answer here for how to configure the memory regions in IAR.


    If you're unsure if you've set the correct memory settings, then you can take a look at the The sd_ble_enable function, which is used to enable the SoftDevice. It will return the minimum start address of the application RAM region required by the SoftDevice for the given configuration in the app_ram_base variable. The value of app_ram_base will be printed on the UART/RTT if you have logging enabled. You can also open a debug session, set a breakpoint after the in softdevice_enable(ble_enable_params_t * p_ble_enable_params) function in softdevice_handler.c and examine the value of app_ram_base that way.

Reply
  • Hi,

    Take a look at the answer here for how to configure the memory regions in IAR.


    If you're unsure if you've set the correct memory settings, then you can take a look at the The sd_ble_enable function, which is used to enable the SoftDevice. It will return the minimum start address of the application RAM region required by the SoftDevice for the given configuration in the app_ram_base variable. The value of app_ram_base will be printed on the UART/RTT if you have logging enabled. You can also open a debug session, set a breakpoint after the in softdevice_enable(ble_enable_params_t * p_ble_enable_params) function in softdevice_handler.c and examine the value of app_ram_base that way.

Children
  • Sigurd,

    app_ram_base will only be what I set it to in the IAR IDE wright? If I set it to 0x20001FF0 then that is what app_ram_base displays. If I set it to 0x20002FF0 then that is what app_ram_base displays.

    So in IAR one only adjusts the RAM start and end address, not the size When I set the RAM start to 0x20001ff0, the BLE keeps on resetting, UART prints ERROR Fatal

    So I set the RAM start to 0x20002ff0, the BLE also keeps on resetting, but UART prints

    SDH:WARNING:RAM start should be adjusted to 0x20001ff0. SDH:WARNING:RAM size should be adjusted to 0xe010. :ERROR:Fatal

    I know it has something to do when I change security to NO_MITM for the CCCD of one Characteristic

    //Configuring Client Characteristic Configuration Descriptor metadata and add to char_md structure
    ble_gatts_attr_md_t cccd_md;
    memset(&cccd_md, 0, sizeof(cccd_md));
    
    //BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(&cccd_md.read_perm);
    BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(&cccd_md.write_perm);
    BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.read_perm);
    

    This works, but if I change (&cccd_md.read_perm) to MITM as well, the nRF52832 resets as soon as the service_init() is called.

    I'm still trying to figure that out.

    Thanks

Related