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

SVC and fault handling not passed to application

First step of trying to integrate S132 to a small OS is failing completely.

When I use SVC the system ends up in hanging in hard fault.

The SoD handler ends up trying to read branch address from location 0xa891be2c - which causes the hardfault. (The hardfault handler itself has the same problem)

The SoD it not enabled - for now I have just moved the OS to 0x1f000/0x20002128.

Am I supposed to do any initialization for this?

The invalid memory location comes from the SVC handler reading @0x20000000 - why? I would have expected that passing handler is done to fixed vector table address at 0x1f000?

Parents
  • The softdevice is version 3.0.0 (from SDK 12.1.0).

    Here is my linker script - it has extra defines for being able to lock memory for a scheduled process:
    
        /*###ICF### Section handled by ICF editor, don't touch! ****/
    /*-Editor annotation file-*/
    /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_1.xml" */
    /*-Specials-*/
    define symbol __ICFEDIT_intvec_start__ = 0x0001f000;
    /*-Memory Regions-*/
    define symbol __ICFEDIT_region_IROM1_start__ = 0x0001f000;
    define symbol __ICFEDIT_region_IROM1_end__   = 0x0007FFFF;
    define symbol __ICFEDIT_region_IROM2_start__ = 0x0;
    define symbol __ICFEDIT_region_IROM2_end__   = 0x0;
    define symbol __ICFEDIT_region_EROM1_start__ = 0x0;
    define symbol __ICFEDIT_region_EROM1_end__   = 0x0;
    define symbol __ICFEDIT_region_EROM2_start__ = 0x0;
    define symbol __ICFEDIT_region_EROM2_end__   = 0x0;
    define symbol __ICFEDIT_region_EROM3_start__ = 0x0;
    define symbol __ICFEDIT_region_EROM3_end__   = 0x0;
    define symbol __ICFEDIT_region_IRAM1_start__ = 0x20002128;
    define symbol __ICFEDIT_region_IRAM1_end__   = 0x2000FFFF;
    define symbol __ICFEDIT_region_IRAM2_start__ = 0x0;
    define symbol __ICFEDIT_region_IRAM2_end__   = 0x0;
    define symbol __ICFEDIT_region_ERAM1_start__ = 0x0;
    define symbol __ICFEDIT_region_ERAM1_end__   = 0x0;
    define symbol __ICFEDIT_region_ERAM2_start__ = 0x0;
    define symbol __ICFEDIT_region_ERAM2_end__   = 0x0;
    define symbol __ICFEDIT_region_ERAM3_start__ = 0x0;
    define symbol __ICFEDIT_region_ERAM3_end__   = 0x0;
    /*-Sizes-*/
    define symbol __ICFEDIT_size_cstack__ = 0x800;
    define symbol __ICFEDIT_size_heap__   = 0x200;
    /**** End of ICF editor section. ###ICF###*/
    
    define memory mem with size = 4G;
    define region IROM_region   =   mem:[from __ICFEDIT_region_IROM1_start__ to __ICFEDIT_region_IROM1_end__]
                                  | mem:[from __ICFEDIT_region_IROM2_start__ to __ICFEDIT_region_IROM2_end__];
    define region EROM_region   =   mem:[from __ICFEDIT_region_EROM1_start__ to __ICFEDIT_region_EROM1_end__]
                                  | mem:[from __ICFEDIT_region_EROM2_start__ to __ICFEDIT_region_EROM2_end__]
                                  | mem:[from __ICFEDIT_region_EROM3_start__ to __ICFEDIT_region_EROM3_end__];
    define region IRAM_region   =   mem:[from __ICFEDIT_region_IRAM1_start__ to __ICFEDIT_region_IRAM1_end__]
                                  | mem:[from __ICFEDIT_region_IRAM2_start__ to __ICFEDIT_region_IRAM2_end__];
    define region ERAM_region   =   mem:[from __ICFEDIT_region_ERAM1_start__ to __ICFEDIT_region_ERAM1_end__]
                                  | mem:[from __ICFEDIT_region_ERAM2_start__ to __ICFEDIT_region_ERAM2_end__]
                                  | mem:[from __ICFEDIT_region_ERAM3_start__ to __ICFEDIT_region_ERAM3_end__];
    
    
    define block CSTACK    with alignment = 8, size = __ICFEDIT_size_cstack__   { };
    define block HEAP      with alignment = 8, size = __ICFEDIT_size_heap__     { };
    
    initialize by copy { readwrite };
    do not initialize  { section .noinit };
    
    // Code item definitions for memory protection
    // ITEM: bsp_os
    define block bsp_os_code with alignment = 0x2000, size = 0x2000 { 	section .bsp_os_code,
    																section .bsp_os_rodata,
    																section .bsp_utils_code,
    																section .bsp_utils_rodata,
    																object strlen.o,
    																object ABImemset.o, 
    																object ABImemcpy_unaligned.o,
    																object strcpy_unaligned.o
    															};															
    															
    define block bsp_os_data_upro with alignment = 0x200, size = 0x0200 { section .bsp_os_data, section .bsp_os_bss };
    define block bsp_os_data_uprw with alignment = 0x400, size = 0x0400 { section .bsp_utils_data, section .bsp_utils_bss, section .bsp_uprw_data };
    
    // ITEM: services_test
    define block services_test_code with alignment = 0x0200, size = 0x0200 { section .services_test_code, section .services_test_rodata  };
    define block services_test_data with alignment = 0x0100, size = 0x0100 { section .services_test_data, section .services_test_bss };
    define block services_test2_code with alignment = 0x0100, size = 0x0100 { section .services_test2_code, section .services_test2_rodata  };
    define block services_test2_data with alignment = 0x0100, size = 0x0100 { section .services_test2_data, section .services_test2_bss };
    
    // ITEM: services_communication
    define block services_communication_code with alignment = 0x0200, size = 0x0200 { section .services_communication_code, section .services_communication_rodata  };
    define block services_communication_data with alignment = 0x0100, size = 0x0100 { section .services_communication_data, section .services_communication_bss };
    
    place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
    
    place in IROM_region  { readonly,
    						block bsp_os_code,
    						block services_test_code, 
    						block services_test2_code,
    						block services_communication_code
    						};
    						
    place in EROM_region  { readonly section application_specific_ro };
    place in IRAM_region  { readwrite,
    						block CSTACK,
    						block HEAP,
    						block bsp_os_data_upro,
    						block bsp_os_data_uprw,
    						block services_test_data,
    						block services_test2_data,
    						block services_communication_data
    						};
    						
    place in ERAM_region  { readwrite section application_specific_rw };
    
Reply
  • The softdevice is version 3.0.0 (from SDK 12.1.0).

    Here is my linker script - it has extra defines for being able to lock memory for a scheduled process:
    
        /*###ICF### Section handled by ICF editor, don't touch! ****/
    /*-Editor annotation file-*/
    /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_1.xml" */
    /*-Specials-*/
    define symbol __ICFEDIT_intvec_start__ = 0x0001f000;
    /*-Memory Regions-*/
    define symbol __ICFEDIT_region_IROM1_start__ = 0x0001f000;
    define symbol __ICFEDIT_region_IROM1_end__   = 0x0007FFFF;
    define symbol __ICFEDIT_region_IROM2_start__ = 0x0;
    define symbol __ICFEDIT_region_IROM2_end__   = 0x0;
    define symbol __ICFEDIT_region_EROM1_start__ = 0x0;
    define symbol __ICFEDIT_region_EROM1_end__   = 0x0;
    define symbol __ICFEDIT_region_EROM2_start__ = 0x0;
    define symbol __ICFEDIT_region_EROM2_end__   = 0x0;
    define symbol __ICFEDIT_region_EROM3_start__ = 0x0;
    define symbol __ICFEDIT_region_EROM3_end__   = 0x0;
    define symbol __ICFEDIT_region_IRAM1_start__ = 0x20002128;
    define symbol __ICFEDIT_region_IRAM1_end__   = 0x2000FFFF;
    define symbol __ICFEDIT_region_IRAM2_start__ = 0x0;
    define symbol __ICFEDIT_region_IRAM2_end__   = 0x0;
    define symbol __ICFEDIT_region_ERAM1_start__ = 0x0;
    define symbol __ICFEDIT_region_ERAM1_end__   = 0x0;
    define symbol __ICFEDIT_region_ERAM2_start__ = 0x0;
    define symbol __ICFEDIT_region_ERAM2_end__   = 0x0;
    define symbol __ICFEDIT_region_ERAM3_start__ = 0x0;
    define symbol __ICFEDIT_region_ERAM3_end__   = 0x0;
    /*-Sizes-*/
    define symbol __ICFEDIT_size_cstack__ = 0x800;
    define symbol __ICFEDIT_size_heap__   = 0x200;
    /**** End of ICF editor section. ###ICF###*/
    
    define memory mem with size = 4G;
    define region IROM_region   =   mem:[from __ICFEDIT_region_IROM1_start__ to __ICFEDIT_region_IROM1_end__]
                                  | mem:[from __ICFEDIT_region_IROM2_start__ to __ICFEDIT_region_IROM2_end__];
    define region EROM_region   =   mem:[from __ICFEDIT_region_EROM1_start__ to __ICFEDIT_region_EROM1_end__]
                                  | mem:[from __ICFEDIT_region_EROM2_start__ to __ICFEDIT_region_EROM2_end__]
                                  | mem:[from __ICFEDIT_region_EROM3_start__ to __ICFEDIT_region_EROM3_end__];
    define region IRAM_region   =   mem:[from __ICFEDIT_region_IRAM1_start__ to __ICFEDIT_region_IRAM1_end__]
                                  | mem:[from __ICFEDIT_region_IRAM2_start__ to __ICFEDIT_region_IRAM2_end__];
    define region ERAM_region   =   mem:[from __ICFEDIT_region_ERAM1_start__ to __ICFEDIT_region_ERAM1_end__]
                                  | mem:[from __ICFEDIT_region_ERAM2_start__ to __ICFEDIT_region_ERAM2_end__]
                                  | mem:[from __ICFEDIT_region_ERAM3_start__ to __ICFEDIT_region_ERAM3_end__];
    
    
    define block CSTACK    with alignment = 8, size = __ICFEDIT_size_cstack__   { };
    define block HEAP      with alignment = 8, size = __ICFEDIT_size_heap__     { };
    
    initialize by copy { readwrite };
    do not initialize  { section .noinit };
    
    // Code item definitions for memory protection
    // ITEM: bsp_os
    define block bsp_os_code with alignment = 0x2000, size = 0x2000 { 	section .bsp_os_code,
    																section .bsp_os_rodata,
    																section .bsp_utils_code,
    																section .bsp_utils_rodata,
    																object strlen.o,
    																object ABImemset.o, 
    																object ABImemcpy_unaligned.o,
    																object strcpy_unaligned.o
    															};															
    															
    define block bsp_os_data_upro with alignment = 0x200, size = 0x0200 { section .bsp_os_data, section .bsp_os_bss };
    define block bsp_os_data_uprw with alignment = 0x400, size = 0x0400 { section .bsp_utils_data, section .bsp_utils_bss, section .bsp_uprw_data };
    
    // ITEM: services_test
    define block services_test_code with alignment = 0x0200, size = 0x0200 { section .services_test_code, section .services_test_rodata  };
    define block services_test_data with alignment = 0x0100, size = 0x0100 { section .services_test_data, section .services_test_bss };
    define block services_test2_code with alignment = 0x0100, size = 0x0100 { section .services_test2_code, section .services_test2_rodata  };
    define block services_test2_data with alignment = 0x0100, size = 0x0100 { section .services_test2_data, section .services_test2_bss };
    
    // ITEM: services_communication
    define block services_communication_code with alignment = 0x0200, size = 0x0200 { section .services_communication_code, section .services_communication_rodata  };
    define block services_communication_data with alignment = 0x0100, size = 0x0100 { section .services_communication_data, section .services_communication_bss };
    
    place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
    
    place in IROM_region  { readonly,
    						block bsp_os_code,
    						block services_test_code, 
    						block services_test2_code,
    						block services_communication_code
    						};
    						
    place in EROM_region  { readonly section application_specific_ro };
    place in IRAM_region  { readwrite,
    						block CSTACK,
    						block HEAP,
    						block bsp_os_data_upro,
    						block bsp_os_data_uprw,
    						block services_test_data,
    						block services_test2_data,
    						block services_communication_data
    						};
    						
    place in ERAM_region  { readwrite section application_specific_rw };
    
Children
No Data
Related