This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

flash_query throws an exception (Redboot_ROM version)


Hello,

I've gotten Redboot for the IXD425 working with the cvs sources. I've gone ahead and added the intel npe support. As part of the npe support, I've enabled the strata flash support. The package builds fine, but when it attempts to query the flash for properties it throws an exception.

The flash_query function is correctly located in RAM - .attribute__ ((section (".2ram.flash_query")));


#define CNT 20*1000*10 // Approx 20ms


int
flash_query(unsigned char *data) __attribute__ ((section (".2ram.flash_query")));
int
flash_query(unsigned char *data)
{
volatile flash_t *ROM;
int i, cnt;


   // Get base address and map addresses to virtual addresses
   ROM = FLASH_P2V( CYGNUM_FLASH_BASE );
#ifdef CYGOPT_FLASH_IS_BOOTBLOCK
   // BootBlock flash does not support full Read_Query - we have do a
   // table oriented thing above, after getting just two bytes of results:
   ROM[0] = FLASH_Read_ID;
   i = 2;
#else
   // StrataFlash supports the full Read_Query op:
   ROM[0] = FLASH_Read_Query;
   i = sizeof(struct FLASH_query);
#endif // Not CYGOPT_FLASH_IS_BOOTBLOCK

   for (cnt = CNT;  cnt > 0;  cnt--) ;
   for ( /* i */;  i > 0;  i--, ++ROM) {
       // It is very deliberate that data is chars NOT flash_t:
       // The info comes out in bytes regardless of device.
       *data++ = (unsigned char) CYGHWR_FLASH_READ_QUERY(ROM);
#ifndef CYGOPT_FLASH_IS_BOOTBLOCK
# if  8 == CYGNUM_FLASH_WIDTH
// strata flash with 'byte-enable' contains the configuration data
// at even addresses
++ROM;
# endif
#endif
   }
   ROM[0] = FLASH_Reset;

   return 0;
}

The equivalent assembly is here, we invariably fault at 0x00009318


00009310 <flash_query>: 9310: e3a02098 mov r2, #152 ; 0x98 9314: e3a01205 mov r1, #1342177280 ; 0x50000000 9318: e3a03bc3 mov r3, #199680 ; 0x30c00 931c: e1c120b0 strh r2, [r1] 9320: e3a02034 mov r2, #52 ; 0x34 9324: e2833d05 add r3, r3, #320 ; 0x140 9328: e2433001 sub r3, r3, #1 ; 0x1 932c: e3530000 cmp r3, #0 ; 0x0 9330: cafffffc bgt 9328 <flash_query+0x18> 9334: e3520000 cmp r2, #0 ; 0x0 9338: da000004 ble 9350 <flash_query+0x40> 933c: e0d130b2 ldrh r3, [r1], #2 9340: e2422001 sub r2, r2, #1 ; 0x1 9344: e3520000 cmp r2, #0 ; 0x0 9348: e4c03001 strb r3, [r0], #1 934c: cafffffa bgt 933c <flash_query+0x2c> 9350: e3a030ff mov r3, #255 ; 0xff 9354: e1c130b0 strh r3, [r1] 9358: e3a00000 mov r0, #0 ; 0x0 935c: e12fff1e bx lr

When I don't enable the STRATA_FLASH package everything works beautifully. The code is exactly what is in the CVS sources. Can anyone tell me why this happens? Has anyone seen this and any thoughts on how I can resolve?

Also I'm curious to understand how portions of the image are relocated into RAM - presumably prior to cyg_start sections that are marked appropriately are copied into RAM - can someone shed light on how this happens?

Thanks

Krishna


-- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]