AnsweredAssumed Answered

icc section memory allocation issues trigger exception 26 or 24

Question asked by willrobot on Nov 1, 2011
Latest reply on Nov 13, 2011 by willrobot

Hi,

 

I'm trying to convert the VDSP code CFFT_Rad4_NS_NBRev from analog device dsp lib to bare metal for bf561 running in core B with icc suport.

 

once compile when I run it using the test_FFT() function in theicc_task_init function, I've got an exception message:

 

 

COREB: bfin set SICB MASK1: c00a8000                                           
COREB: bfin set SICB MASK1: c00a8000                                           
COREB: bfin set IAR5: 43333333                                                 
COREB: bfin set IAR5: 53333333                                                 
COREB: bfin set evt12: 3c02564                                                 
COREB: bfin imask core: 2df                                                    
COREB: execption 24 addr 3c03472                                               
COREB: execption 26 addr 3c03472                                               
COREB: execption 24 addr 3c03472                                               
COREB: execption 26 addr 3c03472                                               
COREB: execption 24 addr 3c03472  

 

I've try to split the memory section to improve it in bf561.lds:

 

MEM_ICC : ORIGIN = 0x3C00000, LENGTH = 0x100000
MEM_FREERTOS : ORIGIN = 0x3D00000, LENGTH = 0x300000

 

or I tried as well

MEM_ICC : ORIGIN = 0x3C00000, LENGTH = 0x300000

MEM_FREERTOS : ORIGIN = 0x3F00000, LENGTH = 0x100000

 

 

depending where I put part of the code in the section data_heap  declared in coreb_test_ad1836_driver.lds I've got differtent results

.data_heap       :
  {
    *(.data_heap)
  } >MEM_FREERTOS =0

 

note that FreeRTOS is not activated and the program was running before adding the FFT code.

 

so trying to do things like:

 

//segment("mydata1") complex_fract16 in[1024];                                 
//segment("mydata2") complex_fract16 output[1024];                             
//segment("mydata3") complex_fract16 w[1024];                                  

 

//#define DataBankA ((void*)0xFF400000)                                        
//#define DataBankB ((void*)0xFF500000)                                        
//#define ScratchPad ((void*)0xFF700000)                                       

 

  //complex_fract16* in = DataBankA;                                           
__attribute__ ((__section__(".data_heap")))

 

struct complex_fract16 in[64];

 

__attribute__ ((__section__(".data_heap")))
//complex_fract16* output = DataBankB;                                         
struct complex_fract16 output[64];

 

__attribute__ ((__section__(".data_heap")))
//complex_fract16* w = ScratchPad;                                             
struct complex_fract16 w[64];

 

in CFFT_Rad4_data.h

 

and

 

//.section l1.data;                                                            
.section .data_heap
.align 4;                                                                      
_Ret_Add:       .int 0;                                                        
_Save_R7:       .int 0;                                                        

 

//.section l1.text;                                                            
.global _Compute_Cycle_Count;                                                  
.align 8;                                                                      
_Compute_Cycle_Count:
    P0.L = _Ret_Add;                                                       
        P0.H = _Ret_Add;   

 

in cycle_count.asm depending on where I put the __attribute__ ((__section__(".data_heap"))) and which memory space I allocate to it I've got the exception triggered at different place.

 

for instance:

 

COREB: for loop count w 42                                                     
COREB: for loop count w 43                                                     
COREB: for loop count w 44                                                     
COREB: for loop count w 45                                                     
COREB: before compute cycle count                                              
COREB: execption 2c addr 0                                                     
COREB: execption 2c addr 0                                                     
COREB: execption 2c addr 0                                                     
COREB: execption 2c addr 0                                                     
COREB: execption 2c addr 0                

 

or :

 

COREB: for loop count in 30                                                    
COREB: for loop count in 31                                                    
COREB: for loop count in 32                                                    
COREB: for loop count in 33                                                    
COREB: execption 24 addr 3c026d8                                               
COREB: execption 26 addr 3c026d8                                               
COREB: execption 26 addr 3c026d8                                               
COREB: execption 26 addr 3c026d8                                               
COREB: execption 26 addr 3c026d8                                               
COREB: execption 26 addr 3c026d8                                               
COREB: execption 26 addr 3c026d8       

 

or:

 

COREB: for loop count in 34                                                       
COREB: for loop count in 35                                                       
COREB: for loop count in 36                                                       
COREB: for loop count in 37                                                       
COREB: for loop count in 38                                                       
COREB: execption 26 addr 3c026d8                                               
COREB: execption 26 addr 3c026d8                                               
COREB: execption 26 addr 3c026d8                                               
COREB: execption 26 addr 3c026d8                                               
COREB: execption 26 addr 3c026d8       

 

or :

 

 

COREB: for loop count in 58                                                       
COREB: for loop count in 59                                                       
COREB: for loop count in 60                                                       
COREB: for loop count in 61                                                       
COREB: for loop count in 62                                                       
COREB: for loop count in 63                                                       
COREB: execption 2c addr 0                                                     
COREB: execption 2c addr 0                                                     
COREB: execption 2c addr 0                                                     
COREB: execption 2c addr 0                                                     
COREB: execption 2c addr 0                                                     
COREB: execption 2c addr 0                                                     
COREB: execption 2c addr 0           

 

addr 3c026d8 correspond to:

for(i = 0; i < n; i++)
    {
        coreb_msg("for loop count in %d\n",i);
       (in[i].re) = const_data1;
       (in[i].im) = zero_in;
    }

 

for(i = 0; i < 3*n/4-2; i++)
    {
         coreb_msg("for loop count w %d\n",i);
       (w[i].re) = twid64[2*i];
       (w[i].im) = twid64[2*i + 1];
    }

coreb_msg("before compute cycle count \n");
    cycle_count[0] = Compute_Cycle_Count(in, output, n, w);
                            //This function inturn calls CFFT_Rad4_NS_NBRev()  
    coreb_msg("error calculation\n");
    error1 = output[0].re - const_data1;

 

at the best it stop at cycle_count[0] = Compute_Cycle_Count(in, output, n, w); where I tried with gdb to debug but when I use next after the coreb_msg("before compute cycle count \n"); comment, gdb freeze and even ctrl c does't work.

 

I'm trying to understand the mapping structure of icc, I try to leave from 3c00000 to 3d00000 allocate to it but I cannot find something coherant in the bugs I've got.

 

looking at the objdump memory mapping I have :

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         0000438c  03c00000  03c00000  00001000  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  1 .data_icc     00000004  03c0438c  03c0438c  0000538c  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  2 .data_heap    00000360  03d00000  03d00000  00008000  2**3
                  CONTENTS, ALLOC, LOAD, DATA
  3 .rodata       000004a4  03c04390  03c04390  00005390  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  4 .data         00001944  03c04834  03c04834  00005834  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  5 .bss          0000529c  03c06178  03c06178  00007178  2**2
                  ALLOC
  6 .comment      00000122  00000000  00000000  00008360  2**0
                  CONTENTS, READONLY
  7 .debug_aranges 000001e0  00000000  00000000  00008488  2**3
                  CONTENTS, READONLY, DEBUGGING
  8 .debug_pubnames 000009dc  00000000  00000000  00008668  2**0
                  CONTENTS, READONLY, DEBUGGING
  9 .debug_info   00004096  00000000  00000000  00009044  2**0

CONTENTS, READONLY, DEBUGGING
10 .debug_abbrev 00001092  00000000  00000000  0000d0da  2**0
                  CONTENTS, READONLY, DEBUGGING
11 .debug_line   000029e3  00000000  00000000  0000e16c  2**0
                  CONTENTS, READONLY, DEBUGGING
12 .debug_frame  00000ab4  00000000  00000000  00010b50  2**2
                  CONTENTS, READONLY, DEBUGGING
13 .debug_str    00001935  00000000  00000000  00011604  2**0
                  CONTENTS, READONLY, DEBUGGING
14 .debug_loc    00002e9c  00000000  00000000  00012f39  2**0
                  CONTENTS, READONLY, DEBUGGING

15 .debug_ranges 000005b0  00000000  00000000  00015dd5  2**0
                  CONTENTS, READONLY, DEBUGGING

 

Is there is a better way to viasualise the memory mapping? How can I see the memory modification (or memory map) at run time for easier debugging?

 

 

Thanks

 

William

Outcomes