- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
We are using NOR Flash in our new product. I want to derive Sector Address as required for Protect/Unprotect function. The below shared code uses few macros for deriving the Sector Address. This code did not share the values of the macros used in this function. Can I get the values for macros used in this function?
SHORT_FLASH_SECTOR_ADDRESS, LARGE_SECTOR_SIZE, SMALL_SECTOR_SIZE
void flashProtectAllSectors( void )
{
Uint32 sectorAddress, saIndx;
volatile Uint16 *p; // flash pointer
// Calculate the sector offset address relative to the flash base address.
// See device datasheet Table 3. S29JL032J Sector Addresses - Top Boot Devices
for( saIndx=0; saIndx<71; saIndx++ )
{
// Note that "sectorAddress" is the sector's starting address. Values
// calculated here are as given in the aforementioned Table 3,
// column "(x8)Address Range" 000000h (SA0) through to 3FE000h (SA70)
if ( saIndx < ( ( SHORT_FLASH_SECTOR_ADDRESS & 0x3F0000 ) >> 16 ) )
{ // 32 KWords
sectorAddress = saIndx*LARGE_SECTOR_SIZE;
}
else
{ // 4K Words
sectorAddress = SHORT_FLASH_SECTOR_ADDRESS;
sectorAddress += ( saIndx - ( ( SHORT_FLASH_SECTOR_ADDRESS & 0x3F0000 ) >> 16 ) )*SMALL_SECTOR_SIZE;
}
// Device datasheet Figure 2 - In-System Sector Protect sector algorithm.
flashProtectSector( sectorAddress );
// Feedback.
printf( "Sector Protected %d \n\r", saIndx );
}// for all sectors SA0 through SA70
printf("Boot sector protect complete. Ensure 12VDC has been removed from RESET#.\n\r");
printf( "...\n\r" );
printf("\n\r");
/**NOTE NOT SHOWN --> SYSTEM PAUSED HERE TO REMOVE RESET# Vid 12VDC BEFORE PROCEEDING**/
// The 12VDC shall have been removed from RESET# at this time.
// Reset the flash (FLASH_START_ADDRESS 0x90000000)
p = ( Uint16* )FLASH_START_ADDRESS;
resetFlash(p);
} // flashProtectAllSectors
- Tags:
- S29GL064S70
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Anilsp31
Can you please let us know from where are you referring this code snippet?
Is it some code example or our Low Level Driver?
Thanks,
Ronak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Ronak,
You can search for query on this community. In one of the query driver source code is attached.
Thanks,
Anil Patil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Anil,
The said code is not a part of the Infineon NOR Flash low level driver. The macros must be defined in the user project which is not attached in the thread. Are you using the same project as the user of the thread mentioned? Can you please share us the whole code for it?
Thanks,
Ronak