cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to write outside mapped memory at address 0xcdcf6965 when PC is 0x8000074

lazar
Associate
Posted on January 24, 2016 at 22:25

Dear all,

I'm using the Kickstarter edition of IAR embedded workbench to test some code in simulation mode. I want to simulate a FIR filter with Q15 data.

Here is the code, a little bit messy:

#include ''stm32f30x.h''

#include ''stm32f3_discovery.h''

#include ''arm_math.h''

#define SamplesNumber 512   // Number of samples to process

// Bandpass filter stuff

#define filterTaps  29

#define blockSize   32

q15_t filterCoefficients[filterTaps] = {-26, -4, -6, -76, -282, -660, -1149, -1554, -1594, -1017, 256, 2045, 3921, 5348, 5881, 5348, 3921, 2045, 256, -1017, -1594, -1554, -1149, -660, -282, -76, -6, -4, -26};

int i, j;   // used for loops

q15_t ppg_signed_signal[SamplesNumber/4] = {7345, 13700, 11827, 11475, 14788, 16132, 16962, 17476, 19332, 20420, 20996, 21188, 21380, 21732, 18084, 9924, 7684, 9284, 11780, 13764, 16868, 16772, 16740, 16256, 15780, 17348, 18500, 19620, 19748, 19780, 21316, 20868, 21604, 18468, 10436, 6372, 10304, 9604, 12964, 15812, 16068, 15930, 15332, 16132, 17956, 18404, 19588, 19812, 21700, 21092, 21572, 21636, 23332, 22724, 19743, 13252, 8004, 8644, 11044, 13636, 15556, 16772, 16420, 16292, 16548, 16900, 17508, 18756, 19396, 20324, 20644, 20388, 21284, 21572, 21892, 22852, 23332, 20516, 12516, 7780, 8644, 11684, 13828, 15780, 17636, 17188, 16132, 16676, 17604, 18660, 19780, 19972, 21316, 21540, 21860, 22052, 22852, 23780, 24260, 23140, 18276, 11908, 10756, 13316, 16772, 19396, 20644, 20996, 19908, 19428, 19546, 21412, 22084, 23044, 23812, 24388, 24388, 23067, 25124, 25572, 25764, 21732, 14500, 12708, 14660, 17572, 21188, 21860}; // signed ppg signal

q15_t ppg_output[SamplesNumber/4];

static q15_t firState[blockSize + filterTaps - 1]; 

void main (void) {

  

  arm_fir_instance_q15 S;  // filter instance

  q15_t *input_ppg, *output_ppg;  // input and output of the filter

  input_ppg = &ppg_signed_signal[0];

  

  // Init filter

  arm_fir_init_q15(&S, filterTaps, &filterCoefficients[0], &firState[0], blockSize);

  

  

  

  // process data by filter

  for(i=0; i<4; i++) {

    arm_fir_q15(&S, input_ppg + (i * blockSize), output_ppg + (i * blockSize), blockSize);

  }

//  STM_EVAL_LEDInit(LED3);

  while(1) {

//    STM_EVAL_LEDOn(LED3);

  }

  

  

}

Here are the error messages I receive at the line, where

arm_fir_q15

 function is executed. There error messages are not lead due to a code reaches 32KB:

Sun Jan 24, 2016 22:17:01: User error: Memory access error: Trying to write outside mapped memory at address 0xcdcf6965 when PC is 0x8000074. Check your memory configuration. 

Sun Jan 24, 2016 22:17:01: Unable to execute: driver error. After the error occurred, the program counter (PC) was 0x8000074. 

This is the linker configuration file:

/*###ICF### Section handled by ICF editor, don't touch! ****/

/*-Editor annotation file-*/

/* IcfEditorFile=''$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml'' */

/*-Specials-*/

define symbol __ICFEDIT_intvec_start__ = 0x08000000;

/*-Memory Regions-*/

define symbol __ICFEDIT_region_ROM_start__ = 0x08000000;

define symbol __ICFEDIT_region_ROM_end__   = 0x0803FFFF;

define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;

define symbol __ICFEDIT_region_RAM_end__   = 0x20007FFF;

/*-Sizes-*/

define symbol __ICFEDIT_size_cstack__ = 0x0400;

define symbol __ICFEDIT_size_heap__   = 0x0200;

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

define symbol __CCMRAM_start__ = 0x10000000;

define symbol __CCMRAM_end__   = 0x10001FFF;

define memory mem with size = 4G;

define region ROM_region    = mem:[from __ICFEDIT_region_ROM_start__   to __ICFEDIT_region_ROM_end__];

define region RAM_region    = mem:[from __ICFEDIT_region_RAM_start__   to __ICFEDIT_region_RAM_end__];

define region CCMRAM_region = mem:[from __CCMRAM_start__   to __CCMRAM_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 };

place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };

place in ROM_region   { readonly };

place in RAM_region   { readwrite,

                        block CSTACK, block HEAP };

place in CCMRAM_region{ section .ccmram };

I need some help, I couldn't find any mistake, but there should be some. The example in the DSP lib looks pretty much the same. Here I only use Q15, instead of floating point.

1 REPLY 1
Posted on January 25, 2016 at 00:38

Hard to say, you'd have to dig into the registers and context surrounding the fault.

I'd probably start by expanding the initial stack allocation.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..