Move files.
This commit is contained in:
parent
096ff72bd9
commit
2668b17f52
4 changed files with 0 additions and 119 deletions
59
Makefile
59
Makefile
|
@ -1,59 +0,0 @@
|
|||
PROJECT_ELF=uart.elf
|
||||
PROJECT_MOT=$(PROJECT_ELF:.elf=.mot)
|
||||
PROJECT_MAP=$(PROJECT_ELF:.elf=.map)
|
||||
PROJECT_LST=$(PROJECT_ELF:.elf=.lst)
|
||||
|
||||
# Find latest installed GNURL78 toolchain. If your toolchain is already in PATH, just comment next line.
|
||||
TOOL_PATH:=$(shell find /usr/share -maxdepth 1 -type d -iname "gnurl78*" | sort | tail -n 1)/bin
|
||||
|
||||
PREFIX:=$(TOOL_PATH)/rl78-elf
|
||||
|
||||
LD = $(PREFIX)-gcc
|
||||
CC = $(PREFIX)-gcc
|
||||
AS = $(PREFIX)-gcc
|
||||
OBJCOPY = $(PREFIX)-objcopy
|
||||
OBJDUMP = $(PREFIX)-objdump
|
||||
SIZE = $(PREFIX)-size
|
||||
|
||||
COMMON_PATH = ../common
|
||||
PROJECT_PATH = .
|
||||
|
||||
PROJECT_LNK = $(COMMON_PATH)/rl78-R5F100SL.ld
|
||||
|
||||
CFLAGS = -Wall -Wextra -Os -ggdb -ffunction-sections -fdata-sections -I$(PROJECT_PATH) -I$(COMMON_PATH) -mmul=g13
|
||||
LDFLAGS = -Wl,--gc-sections -Wl,-Map=$(PROJECT_MAP) -T $(PROJECT_LNK) -nostartfiles
|
||||
|
||||
SOURCES = \
|
||||
$(PROJECT_PATH)/main.c \
|
||||
$(PROJECT_PATH)/uart0.c \
|
||||
$(END)
|
||||
|
||||
OBJS = $(SOURCES:.c=.o) $(COMMON_PATH)/crt0.o
|
||||
|
||||
.PHONY: all
|
||||
|
||||
all: $(PROJECT_MOT) $(PROJECT_LST)
|
||||
$(SIZE) $(PROJECT_ELF)
|
||||
|
||||
rom: $(PROJECT_MOT)
|
||||
|
||||
$(PROJECT_MOT): $(PROJECT_ELF)
|
||||
$(OBJCOPY) -O srec $^ $@
|
||||
|
||||
$(PROJECT_LST): $(PROJECT_ELF)
|
||||
$(OBJDUMP) -DS $^ > $@
|
||||
|
||||
$(PROJECT_ELF): $(OBJS)
|
||||
$(LD) $(LDFLAGS) -o $@ $^
|
||||
|
||||
flash: $(PROJECT_MOT)
|
||||
rl78flash -m2 -b500000 -vvwri /dev/ttyUSB0 $^
|
||||
|
||||
erase:
|
||||
rl78flash -m2 -b500000 -vveri /dev/ttyUSB0
|
||||
|
||||
terminal:
|
||||
rl78flash -rt9600 /dev/ttyUSB0
|
||||
|
||||
clean:
|
||||
-rm -f $(OBJS) $(PROJECT_ELF) $(PROJECT_MOT) $(PROJECT_MAP) $(PROJECT_LST)
|
60
main.c
60
main.c
|
@ -1,60 +0,0 @@
|
|||
#include "QB-R5F100SL-TB.h"
|
||||
#include "uart0.h"
|
||||
|
||||
volatile unsigned char ticks = 0;
|
||||
volatile unsigned char flag_1hz = 0;
|
||||
|
||||
__attribute__((interrupt))
|
||||
void
|
||||
wdti_handler(void)
|
||||
{
|
||||
}
|
||||
__attribute__((interrupt))
|
||||
void
|
||||
it_handler(void)
|
||||
{
|
||||
++ticks;
|
||||
LED1 ^= 1;
|
||||
if(0 == (0x07 & ticks)) {
|
||||
flag_1hz = 1;
|
||||
}
|
||||
}
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
asm ("di");
|
||||
/* Setup LEDs */
|
||||
LED1 = 1;
|
||||
LED2 = 1;
|
||||
LED1_PIN = 0;
|
||||
LED2_PIN = 0;
|
||||
/* Setup clocks */
|
||||
CMC.cmc = 0x11U; /* Enable XT1, disable X1 */
|
||||
CSC.csc = 0x80U; /* Start XT1 and HOCO, stop X1 */
|
||||
CKC.ckc = 0x00U;
|
||||
/* Delay 1 second */
|
||||
register unsigned long int i;
|
||||
for(i = 0x000FFFFFUL; i; --i) {
|
||||
asm ("nop");
|
||||
}
|
||||
OSMC.osmc = 0x00; /* Supply fsub to peripherals, including Interval Timer */
|
||||
uart0_init();
|
||||
/* Setup 12-bit interval timer */
|
||||
RTCEN = 1; /* Enable 12-bit interval timer and RTC */
|
||||
ITMK = 1; /* Disable IT interrupt */
|
||||
ITPR0 = 0; /* Set interrupt priority - highest */
|
||||
ITPR1 = 0;
|
||||
ITMC.itmc = 0x8FFFU; /* Set maximum period 4096/32768Hz = 1/8 s, and start timer */
|
||||
ITIF = 0; /* Clear interrupt request flag */
|
||||
ITMK = 0; /* Enable IT interrupt */
|
||||
asm ("ei"); /* Enable interrupts */
|
||||
for(;;) {
|
||||
if(flag_1hz) {
|
||||
LED2 = 0;
|
||||
flag_1hz = 0;
|
||||
uart0_puts("Hello, RL78! [:");
|
||||
LED2 = 1;
|
||||
}
|
||||
asm ("halt");
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue