4 #pragma section CODE=IRAM,attr=CODE
14 unsigned char error = 0;
15 unsigned char global_error = 0;
16 unsigned int i, baseaddr;
17 unsigned int toflash[] = {0x9b00,
27 PORTEN = 0x3; /* enable I/O Ports */
28 /* This feature is not supported by MB91V460A */
29 /* For all other devices the I/O Ports must be enabled*/
35 /* Initialize UART4 */
38 /* Output Welcome Message */
40 Puts4("\n\n********** Welcome to FUJITSU FLASH Programming Demo **********\n");
45 for (; i <0x30; i+=4) {
46 error = FLASH_SectorErase(baseaddr + i);
48 Puts4(error == 1 ? "[success] " : "[failed] ");
49 Puthex4(baseaddr + i, 6);
53 Puts4("\nCurrent Content of FLASH at 0xf4000 ... 0xf401F:\n");
56 Puts4("0x"); Puthex4( *(unsigned char *)(0xf4000 + i), 2); Puts4(" ");
58 if( (i % 0x10) == 0 ) Puts4("\n");
67 error = FLASH_WriteHalfWord(baseaddr + (2*i), toflash[i]);
68 Puts4(error == 1 ? "[sucess] " : "[failed] ");
70 Puthex4(toflash[i], 4);
72 Puthex4(baseaddr + (2*i), 6);
75 /* Output Ready Meassage */
76 if( global_error != 0 )
78 Puts4("\n********* FLASH Programming Demo failed **********\n");
82 Puts4("\n********* FLASH Programming Demo done **********\n");