Fujitsu F2MC-FR Series Application Note page 23

32-bit microcontroller
Hide thumbs Also See for F2MC-FR Series:
Table of Contents

Advertisement

Once the above preconditions are met then the actual relocation would be carried out in the
following steps for MB91460 Series:
1. Copy the starting address of CAN0 ISR to relocated CAN0 vector in RAM (as reserved in
preconditions
step 2 above).
2. Copy the starting address of UART0 Receive ISR to relocated UART0 Receive vector in
RAM (as reserved in preconditions
3. Store the original TBR settings.
4. Configure the TBR to the new value value.
5. Call the function which erases the sector of Main Flash.
6. Restore the original TBR value.
The below code demonstrates the actual relocation of vector table.
/* THIS SAMPLE CODE IS PROVIDED AS IS AND IS SUBJECT TO ALTERATIONS. FUJITSU */
/* MICROELECTRONICS ACCEPTS NO RESPONSIBILITY OR LIABILITY FOR ANY ERRORS OR */
/* ELIGIBILITY FOR ANY PURPOSES.
/*
/*---------------------------------------------------------------------------*/
unsigned int
tbr;
void
Main(void)
{
InitIrqLevels();
__set_il(7);
__EI();
PORTEN = 0x3;
. . .
CAN0_ptr = CAN0_ISR;
UART0_ptr =
__DI();
__asm(" STM0 (R7,R6) ");
__asm(" MOV TBR, R7 ");
__asm(" LDI #_tbr, R6 ");
__asm(" ST R7, @R6 ");
__asm(" LDI #32000h, R7
__asm(" MOV R7, TBR ");
__asm(" LDM0 (R7,R6) ");
__EI();
EraseSector(0x09);
__DI();
__asm(" STM0 (R6) ");
__asm(" LDI #_tbr, R6 ");
__asm(" LD @R6, R6 ");
__asm(" MOV R6, TBR ");
__asm(" LDM0 (R6) ");
__EI();
. . .
© Fujitsu Microelectronics Europe GmbH
INTERRUPTS
Chapter 3 Interrupt Recommendations and Examples
step 2 above).
(C) Fujitsu Microelectronics Europe GmbH
/* First initialize all Interrupt Levels */
/* Set global Interrupt Level to 7
/* Enable Interrupt globally
/* Enable I/O Ports */
/* Store CAN0 ISR address to relocated vector */
UART0_Rx_ISR;/* Store UART0Rx ISR address to relocated
vector */
/* Disable interrupts */
/* Store R7 & R6 */
/* Save original TBR */
");/* Configure TBR to point to vector table in */
/* RAM at the base address 0x00032000 */
/* Restore R7 & R6 */
/* enable interrupts */
/* Erase Flash sector 0x09 */
/* Disable interrupts */
/* Store R6 */
/* Load tbr address to R6 */
/* Restore original TBR value */
/* Restore R6 */
/* Enable interrupts */
- 23 -
*/
*/
*/
*/
MCU-AN-300055-E-V10

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mb91460

Table of Contents