dude, i think the don't even have a tab key in japan.
LDFLAGS += -sc IRAM/Code=ID_RAM
LDFLAGS += -sc CODE+@INIT+@IRAM+CONST=ROM_AREA
LDFLAGS += -sc CODE_START/Code=0x000F4000
LDFLAGS += -sc IRAM/Code=ID_RAM
LDFLAGS += -sc CODE+@INIT+@IRAM+CONST=ROM_AREA
LDFLAGS += -sc CODE_START/Code=0x000F4000
-LDFLAGS += -sc INTVECT/Const=0x000FFC00
LDFLAGS += -check_locate -pl 60 -pw 132 -Xals
LDFLAGS += -Xalr -na -w 1 -Xdof -Xset_rora -cwno -a $(CPUT)
LDFLAGS += -check_locate -pl 60 -pw 132 -Xals
LDFLAGS += -Xalr -na -w 1 -Xdof -Xset_rora -cwno -a $(CPUT)
void main(void)
{
unsigned char error = 0;
void main(void)
{
unsigned char error = 0;
- unsigned char global_error = 0;
unsigned int i, baseaddr;
unsigned int i, baseaddr;
- unsigned int toflash[] = {0x9b00,
- 0x0d4e,
- 0xcff1,
- 0x1601,
- 0x9b05,
- 0x04c7,
- 0xc106,
- 0x1656,
- 0xe0fb}; //len = 9
+ unsigned int toflash[] = {0x9b00, 0x0d4e, 0xcff1, 0x1601, 0x9b05, 0x04c7, 0xc106, 0x1656, 0xe0fb}; //len = 9
- PORTEN = 0x3; /* enable I/O Ports */
- /* This feature is not supported by MB91V460A */
- /* For all other devices the I/O Ports must be enabled*/
+ PORTEN = 0x3; /* enable I/O Ports */
DDR14 = 0xFF;
PDR14 = 0xff;
DDR14 = 0xFF;
PDR14 = 0xff;
- /* Output Welcome Message */
- Puts4(" \n\n");
- Puts4("\n\n********** Welcome to FUJITSU FLASH Programming Demo **********\n");
-
#if 1
i = 0;
baseaddr = 0xf4000;
#if 1
i = 0;
baseaddr = 0xf4000;
Puts4("\nerased: ");
Puts4(error == 1 ? "[success] " : "[failed] ");
Puthex4(baseaddr + i, 6);
Puts4("\nerased: ");
Puts4(error == 1 ? "[success] " : "[failed] ");
Puthex4(baseaddr + i, 6);
i = 0;
baseaddr = 0xf4000;
for(; i<9; i++) {
i = 0;
baseaddr = 0xf4000;
for(; i<9; i++) {
Puts4("\nwrite: ");
error = FLASH_WriteHalfWord(baseaddr + (2*i), toflash[i]);
Puts4(error == 1 ? "[sucess] " : "[failed] ");
Puts4("\nwrite: ");
error = FLASH_WriteHalfWord(baseaddr + (2*i), toflash[i]);
Puts4(error == 1 ? "[sucess] " : "[failed] ");
Puthex4(baseaddr + (2*i), 6);
}
Puthex4(baseaddr + (2*i), 6);
}
- /* Output Ready Meassage */
- if( global_error != 0 )
- {
- Puts4("\n********* FLASH Programming Demo failed **********\n");
- }
- else
- {
- Puts4("\n********* FLASH Programming Demo done **********\n");
+ while(1) {
+ HWWD_CL = 0;
-
- while(1)
- {
-
- HWWD_CL = 0;
- }
-/* 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. */
-/* (C) Fujitsu Microelectronics Europe GmbH */
-/*---------------------------------------------------------------------------*/
-
#include "mb91465k.h"
#pragma section CODE=IRAM,attr=CODE
#include "mb91465k.h"
#pragma section CODE=IRAM,attr=CODE
- // Initialize UART asynchronous mode
- // BGR04 = 1666; // 9600 Baud @ 16MHz
- // BGR04 = 832; // 19200 Baud @ 16MHz
- BGR04 = 416; // 38400 Baud @ 16MHz
- SCR04 = 0x17; // 8N1
- SMR04 = 0x0d; // enable SOT3, Reset, normal mode
- SSR04 = 0x00; // LSB first
- PFR19 = (PFR19 & 0xFC) | 0x03; // enable UART: SIN,SOT for async. transfer
- EPFR19 = 0x00; // enable UART
+ // Initialize UART asynchronous mode
+ BGR04 = 416; // 38400 Baud @ 16MHz
+ SCR04 = 0x17; // 8N1
+ SMR04 = 0x0d; // enable SOT3, Reset, normal mode
+ SSR04 = 0x00; // LSB first
+ PFR19 = (PFR19 & 0xFC) | 0x03; // enable UART: SIN,SOT for async. transfer
+ EPFR19 = 0x00; // enable UART
-void Putch4(unsigned char ch) /* sends a char */
+void Putch4(unsigned char ch) /* sends a char */
- while (SSR04_TDRE == 0); /* wait for transmit buffer empty */
- TDR04 = ch; /* put ch into buffer */
+ while (SSR04_TDRE == 0); /* wait for transmit buffer empty */
+ TDR04 = ch; /* put ch into buffer */
-unsigned char Getch4(void) /* waits for and returns incomming char */
+unsigned char Getch4(void) /* waits for and returns incomming char */
- volatile unsigned ch;
-
- for(;;)
- {
-
- while(SSR04_RDRF == 0) /* wait for data received */
- HWWD = 0x00;
-
- ch = RDR04;
-
- if ((SSR04 & 0xE0) != 0) /* Check for errors PE, ORE, FRE */
- {
- SCR04_CRE = 1; /* Clear error flags */
- }
- else
- return (ch); /* return char */
- }
+ volatile unsigned ch;
+ for(;;) {
+ while(SSR04_RDRF == 0) /* wait for data received */
+ HWWD = 0x00;
+ ch = RDR04;
+
+ if ((SSR04 & 0xE0) != 0) { /* Check for errors PE, ORE, FRE */
+ SCR04_CRE = 1; /* Clear error flags */
+ } else {
+ return (ch); /* return char*/
+ }
+ }
-void Puts4(const char *Name2) /* Puts a String to UART */
+void Puts4(const char *Name2)
- volatile int i,len;
-
- len = strlen(Name2);
+ volatile int i,len;
+ len = strlen(Name2);
- for (i=0; i<strlen(Name2); i++) /* go through string */
- {
- if (Name2[i] == 10)
- Putch4(13);
- Putch4(Name2[i]); /* send it out */
- }
+ for(i=0; i<strlen(Name2); i++) {
+ if(Name2[i] == 10)
+ Putch4(13);
+ Putch4(Name2[i]);
+ }
-char Echo4(void) /* Echo UART and return ch */
-{
- char ch;
-
- Puts4("UART 4 receive: "); // send text to UART
- ch = RDR04; // readout character
- Putch4(ch); // send character to UART
- if (ch==13)
- Putch4(10);
-
- return (ch);
-}
-
void Puthex4(unsigned long n, unsigned char digits)
{
void Puthex4(unsigned long n, unsigned char digits)
{
- unsigned char digit=0,div=0,i;
+ unsigned char digit=0,div=0,i;
- div=(4*(digits-1)); /* init shift divisor */
- for (i=0;i<digits;i++)
- {
- digit = ((n >> div)&0xF); /* get hex-digit value */
- Putch4(digit + ((digit < 0xA) ? '0' : 'A' - 0xA));
- div-=4; /* next digit shift */
- }
+ div=(4*(digits-1)); /* init shift divisor */
+ for (i=0;i<digits;i++) {
+ digit = ((n >> div)&0xF); /* get hex-digit value */
+ Putch4(digit + ((digit < 0xA) ? '0' : 'A' - 0xA));
+ div-=4; /* next digit shift */
+ }
}
void Putdec4(unsigned long x, int digits)
}
void Putdec4(unsigned long x, int digits)
char buf[10],sign=1;
if (digits < 0) { /* should be print of zero? */
char buf[10],sign=1;
if (digits < 0) { /* should be print of zero? */
- digits *= (-1);
- sign =1;
+ digits *= (-1);
+ sign =1;
}
buf[digits]='\0'; /* end sign of string */
}
buf[digits]='\0'; /* end sign of string */
- if ( sign )
- {
- for (i=0; buf[i]=='0'; i++) { /* no print of zero */
- if ( i<digits-1)
- buf[i] = ' ';
- }
- }
-
- Puts4(buf); /* send string */
+ if (sign) {
+ for (i=0; buf[i]=='0'; i++) { /* no print of zero */
+ if ( i<digits-1)
+ buf[i] = ' ';
+ }
+ }
+ Puts4(buf); /* send string */