Dear Milan,
Sorry to write late.
You can follow AN10995 but since there is no VTOR in this architecture you must re-map some vectors to the user space with a static variable which must be located at the bottom of the SRAM. I am not using IAR and implemented with Keil.
So; to start,
* Reserve some additional bytes in SRAM ;
//SRAM 1st 32 Byte is reserved: 0x100000 ... 0x100020 used by Vectors ( Reserved )
//SRAM 2nd 32 Byte is reserved: 0x100020 ... 0x100040 by Sw Bootloader
* Use IRQ mapping ( for example if application starts at 0x20B000UL ) Your ( if used in bootloader ) IRQ handlers must like;
void SysTick_Handler(void )
{
if( !irq_Handler_Get_Map() )
sysTickHandler(); // Bootloader Side
else
app_SysTick_Handler(); // User Side
}
volatile int irqMap __attribute__((section(".ARM.__at_0x100020")));
int irq_Handler_Get_Map( void )
{
return irqMap;
}
int irq_Handler_Set_Map( int map_Value )
{
irqMap = map_Value;
return irqMap;
}
* You can use the following Flash Memory Example;
int isp_Flash_WriteTest( void )
{
int i;
unsigned long flashOffsetAddr = 32*1024;
unsigned long dwPageNumber;
uint8_t *ReadAddress;
phStatus_t flashStatus;
//WRITE START HERE
dwPageNumber = PHHAL_FLASH_USER_PAGE_START + flashOffsetAddr / PHHAL_FLASH_PAGE_SIZE;
utilUartPrintf("Starting Flash-Write...Page: %d\n", dwPageNumber );
isp_Flash_Init();
for( i = 0; i<5; ++i )
{
memset( flashBuffer, 0xA0 + i, sizeof(flashBuffer) );
flashStatus = phhalFlash_WritePage( dwPageNumber + i, flashBuffer );
}
//READ START HERE...
ReadAddress = (unsigned char *) ( flashOffsetAddr + PHHAL_FLASH_USER_START_ADDRESS );
utilUartPrintf("Starting Flash-Read...%d\n", ReadAddress );
isp_Flash_Init();
for( i = 0; i<5; ++i )
{
ReadAddress = (unsigned char *) ( flashOffsetAddr + PHHAL_FLASH_USER_START_ADDRESS + i * PHHAL_FLASH_PAGE_SIZE );
flashStatus = phhalFlash_ReadBuffer( flashBuffer, ReadAddress, PHHAL_FLASH_PAGE_SIZE );
debugPrintHexDump("Buffer", flashBuffer, PHHAL_FLASH_PAGE_SIZE );
}
return 1;
}
Regards.