From 2668b17f52801c66bb3a87062468a05ac27a111b Mon Sep 17 00:00:00 2001 From: Maxim Salov Date: Sat, 4 Jan 2014 17:27:24 -0500 Subject: [PATCH] Move files. --- Makefile | 59 ------------------------------------ uart0.c => cpu/rl78/uart0.c | 0 uart0.h => cpu/rl78/uart0.h | 0 main.c | 60 ------------------------------------- 4 files changed, 119 deletions(-) delete mode 100644 Makefile rename uart0.c => cpu/rl78/uart0.c (100%) rename uart0.h => cpu/rl78/uart0.h (100%) delete mode 100644 main.c diff --git a/Makefile b/Makefile deleted file mode 100644 index 3b183d6e8..000000000 --- a/Makefile +++ /dev/null @@ -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) diff --git a/uart0.c b/cpu/rl78/uart0.c similarity index 100% rename from uart0.c rename to cpu/rl78/uart0.c diff --git a/uart0.h b/cpu/rl78/uart0.h similarity index 100% rename from uart0.h rename to cpu/rl78/uart0.h diff --git a/main.c b/main.c deleted file mode 100644 index 4d7ea8c4a..000000000 --- a/main.c +++ /dev/null @@ -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"); - } -}