2011-12-07 01:48 PM
Okay, I've learned how to move code to Bank1, and it executes properly.
After having some problems getting bank1 booting to work, we decided to instead try copying our firmware into an external Flash chip and validate it, then switch to code which is entirely in Bank1, to write from the external flash back into bank0. I first wrote and tested code to enable unused sectors in Bank1 and write/verify code; this works fine. Now I'm trying to write code from Ext Flash to bank0: //************************************************************************************************** u8 *src = (u8 *) ALT_FEPROM ; u8 *dest = (u8 *) (0) ; // Bank0 Sector 0 bytes_remaining = datum[0] ; unsigned flags = disable_IRQ(); // make sure nothing tries to execute from bank0 !! set_led_green_on() ; while (LOOP_FOREVER) { wlen = (bytes_remaining > SIZE_64K) ? SIZE_64K : bytes_remaining ; // this function is executing successfully... if (feprom_program_enable_bank0(dest, BANK0_FM) == FALSE) { break; } set_led_red_on() ; delay_250msec(4) ; u32 u32SectorAddr; // if the physical address does not belong to any of the internal flash sectors, fail. if (!bank0_bGetBankSecAddrByPhyAddr((uint) dest, &u32SectorAddr, NULL)) { break; } // 12/07/11 - here is the show-stopper... // If I call this function, which writes to two registers in the internal flash-programming interface, // the sector erase proceeds successfully, but the code never returns to here... bank0_EraseSector(u32SectorAddr); // Erase the sector //************************************************************************************************** However, as the comments reflect, the sector-erase function never returns. I used OpenOCD via the JTAG interface, to look at bank0 space after the crash, and it appears that the erase *did* occur, but the function never returns. bank0_EraseSector() contains only two writes to the STR9 CUI interface: //************************************************************************************************** static void bank0_EraseSector(vu32 FMI_Sector) { /* Write an erase set-up command to the sector */ *(vu16 *)FMI_Sector = 0x20; /* Write an erase confirm command to the sector */ *(vu16 *)FMI_Sector = 0xD0; } //************************************************************************************************** So why does this crash? What else do I need to do to make this work? I tried remapping bank1 to boot bank and bank0 to non-boot bank, using // FMI_BankRemapConfig(0, 6, 0x80000, 0) ; // this crashes the board immediately!! but that doesn't work either... Our system: STR912 512K/32K2012-06-18 01:43 AM
Hi..
just wanna to draw attention to one more thing. On this forum only in some earlier conversations i have read exactly the same problem as mine, they also couldn't write beyond 8192 bytes in secondry flash. Rest all other things were almost same as i am using. They have mentioned that this is related to CSx bit mapping and suggested to correct it, by setting this they were claiming that there program was working. I also tried for setting the CSx bit through STR91x_CFG.s and again tried for downloading the code, but i again got stuck at 0x82000 :( If you have any idea w.r.t CSx bit please help me. Is it related to this only or there is any other thing also that i am overlooking. Bye. Good day.2012-06-19 12:46 AM
can you verify sector protection disabled after you disable it?
2012-06-21 01:13 AM
2012-06-21 04:30 AM
2012-06-22 03:13 AM
2012-06-24 09:48 PM
just a clarification. have you used caps or another tool (we also use rlink) to test writing to bank0/bank1 via jtag? and successfully write to all sectors? for example in caps there is a section to enable/disable sector protections.