aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2016-05-30 14:39:02 +0900
committerNIIBE Yutaka <gniibe@fsij.org>2016-05-30 14:39:02 +0900
commitb90e58f763bd277b7a5285601a34818f44f2b01c (patch)
tree4535e6abc8b77d58215796c240489e7dbf499b44
parent8209f3875510d1990142a367c8bab6164c2f82cc (diff)
Move CHIP specific things to mcu/
-rw-r--r--entry.c8
-rw-r--r--example-fs-bb48/Makefile7
-rw-r--r--example-fs-bb48/command.c7
-rw-r--r--example-fs-bb48/sample.ld8
-rw-r--r--example-fs-bb48/usb_lld.h6
-rw-r--r--mcu/adc-mkl27z.c (renamed from example-fs-bb48/adc_kl27z.c)4
-rw-r--r--mcu/clk_gpio_init-mkl27z.c (renamed from mcu/clk_gpio_init-kl.c)2
-rw-r--r--mcu/mkl27z.h (renamed from mcu/kl_sim.h)0
-rw-r--r--mcu/sys-mkl27z.c (renamed from example-fs-bb48/sys.c)2
-rw-r--r--mcu/sys-mkl27z.h (renamed from example-fs-bb48/sys.h)0
-rw-r--r--mcu/usb-mkl27z.c (renamed from example-fs-bb48/usb_kl27z.c)2
-rw-r--r--rules.mk10
12 files changed, 37 insertions, 19 deletions
diff --git a/entry.c b/entry.c
index cc233ef..c4d0704 100644
--- a/entry.c
+++ b/entry.c
@@ -33,13 +33,17 @@
#ifdef HAVE_SYS_H
#define INLINE __attribute__ ((used))
-#include "sys.h"
#include "board.h"
+#ifdef MCU_KINETIS_L
+#include "mcu/sys-mkl27z.h"
+#else
+#include "mcu/sys-stm32.h"
#undef STM32F10X_MD /* Prepare for high density device, too. */
+#endif
#else
#include "board.h"
#if defined (MCU_KINETIS_L)
-#include "mcu/clk_gpio_init-kl.c"
+#include "mcu/clk_gpio_init-mkl27z.c"
#else
#include "mcu/clk_gpio_init-stm32.c"
#endif
diff --git a/example-fs-bb48/Makefile b/example-fs-bb48/Makefile
index 52782cc..06a68bd 100644
--- a/example-fs-bb48/Makefile
+++ b/example-fs-bb48/Makefile
@@ -6,7 +6,12 @@ PROJECT = sample
CHOPSTX = ..
LDSCRIPT= sample.ld
-CSRC = sample.c sys.c usb_kl27z.c usb-cdc.c adc_kl27z.c command.c
+CSRC = sample.c usb-cdc.c command.c
+CHIP=mkl27z
+
+USE_SYS = yes
+USE_USB = yes
+USE_ADC = yes
###################################
CROSS = arm-none-eabi-
diff --git a/example-fs-bb48/command.c b/example-fs-bb48/command.c
index 6556bc7..15df6dd 100644
--- a/example-fs-bb48/command.c
+++ b/example-fs-bb48/command.c
@@ -7,8 +7,13 @@
#include "adc.h"
static int adc_initialized = 0;
#endif
-#include "sys.h"
#include "board.h"
+#ifdef MCU_KINETIS_L
+#include "mcu/sys-mkl27z.h"
+#else
+#include "mcu/sys-stm32.h"
+#undef STM32F10X_MD /* Prepare for high density device, too. */
+#endif
struct command_table
{
diff --git a/example-fs-bb48/sample.ld b/example-fs-bb48/sample.ld
index 5a728a6..fa75271 100644
--- a/example-fs-bb48/sample.ld
+++ b/example-fs-bb48/sample.ld
@@ -29,10 +29,10 @@ SECTIONS
KEEP(*(.sys.version))
KEEP(*(.sys.board_info))
KEEP(*(.sys.vectors))
- build/sys.o(.text)
- build/sys.o(.text.*)
- build/sys.o(.rodata)
- build/sys.o(.rodata.*)
+ build/sys-*.o(.text)
+ build/sys-*.o(.text.*)
+ build/sys-*.o(.rodata)
+ build/sys-*.o(.rodata.*)
. = ALIGN(1024);
KEEP(*(.flash_config))
KEEP(*(.fixed_function.reset))
diff --git a/example-fs-bb48/usb_lld.h b/example-fs-bb48/usb_lld.h
index da694a6..b2ce4fb 100644
--- a/example-fs-bb48/usb_lld.h
+++ b/example-fs-bb48/usb_lld.h
@@ -10,12 +10,6 @@
#define ENDP6 ((uint8_t)6)
#define ENDP7 ((uint8_t)7)
-/* EP_TYPE[1:0] EndPoint TYPE */
-#define EP_BULK (0x0000) /* EndPoint BULK */
-#define EP_CONTROL (0x0200) /* EndPoint CONTROL */
-#define EP_ISOCHRONOUS (0x0400) /* EndPoint ISOCHRONOUS */
-#define EP_INTERRUPT (0x0600) /* EndPoint INTERRUPT */
-
enum RECIPIENT_TYPE
{
DEVICE_RECIPIENT, /* Recipient device */
diff --git a/example-fs-bb48/adc_kl27z.c b/mcu/adc-mkl27z.c
index de482bb..19f9f5b 100644
--- a/example-fs-bb48/adc_kl27z.c
+++ b/mcu/adc-mkl27z.c
@@ -1,5 +1,5 @@
/*
- * adc_kl27z.c - ADC driver for KL27Z
+ * adc-mkl27z.c - ADC driver for MKL27Z
* In this ADC driver, there are NeuG specific parts.
* It only records lower 8-bit of 16-bit data.
* You need to modify to use this as generic ADC driver.
@@ -32,7 +32,7 @@
#include <stdint.h>
#include <stdlib.h>
#include <chopstx.h>
-#include <mcu/kl_sim.h>
+#include <mcu/mkl27z.h>
struct DMAMUX {
volatile uint32_t CHCFG0;
diff --git a/mcu/clk_gpio_init-kl.c b/mcu/clk_gpio_init-mkl27z.c
index dedbac1..e36788a 100644
--- a/mcu/clk_gpio_init-kl.c
+++ b/mcu/clk_gpio_init-mkl27z.c
@@ -26,7 +26,7 @@
*
*/
-#include <mcu/kl_sim.h>
+#include <mcu/mkl27z.h>
struct MCG {
volatile uint8_t C1; /* MCG Control Register 1 */
diff --git a/mcu/kl_sim.h b/mcu/mkl27z.h
index 368ef30..368ef30 100644
--- a/mcu/kl_sim.h
+++ b/mcu/mkl27z.h
diff --git a/example-fs-bb48/sys.c b/mcu/sys-mkl27z.c
index f0a0402..e44e0c2 100644
--- a/example-fs-bb48/sys.c
+++ b/mcu/sys-mkl27z.c
@@ -51,7 +51,7 @@ stack_entry[] __attribute__ ((section(".first_page.first_words"),used)) = {
(uint32_t)reset,
};
-#include "mcu/clk_gpio_init-kl.c"
+#include "mcu/clk_gpio_init-mkl27z.c"
static void
set_led (int on)
diff --git a/example-fs-bb48/sys.h b/mcu/sys-mkl27z.h
index eed5d92..eed5d92 100644
--- a/example-fs-bb48/sys.h
+++ b/mcu/sys-mkl27z.h
diff --git a/example-fs-bb48/usb_kl27z.c b/mcu/usb-mkl27z.c
index a7b8723..385e5a8 100644
--- a/example-fs-bb48/usb_kl27z.c
+++ b/mcu/usb-mkl27z.c
@@ -1,5 +1,5 @@
/*
- * usb_kl27z.c - USB driver for KL27Z
+ * usb-mkl27z.c - USB driver for MKL27Z
*
* Copyright (C) 2016 Flying Stone Technology
* Author: NIIBE Yutaka <gniibe@fsij.org>
diff --git a/rules.mk b/rules.mk
index 86f641c..0034a4f 100644
--- a/rules.mk
+++ b/rules.mk
@@ -6,6 +6,16 @@ ifneq ($(USE_EVENTFLAG),)
CSRC += $(CHOPSTX)/eventflag.c
endif
+ifneq ($(USE_SYS),)
+CSRC += $(CHOPSTX)/mcu/sys-$(CHIP).c
+endif
+ifneq ($(USE_USB),)
+CSRC += $(CHOPSTX)/mcu/usb-$(CHIP).c
+endif
+ifneq ($(USE_ADC),)
+CSRC += $(CHOPSTX)/mcu/adc-$(CHIP).c
+endif
+
INCDIR += $(CHOPSTX)
BUILDDIR = build