Include arch specific header and implementation by ARCH.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka
2019-12-03 13:09:25 +09:00
parent de301bf025
commit 913266d6e4
12 changed files with 29 additions and 11 deletions

View File

@@ -1,3 +1,18 @@
2019-12-03 NIIBE Yutaka <gniibe@fsij.org>
* example-cdc/Makefile (ARCH): Define.
* example-cdc-gnu-linux/Makefile (ARCH): Ditto.
* example-fraucheky/Makefile (ARCH): Ditto.
* example-fs-bb48/Makefile (ARCH): Ditto.
* example-fsm-55/Makefile (ARCH): Ditto.
* example-led/Makefile (ARCH): Ditto.
* example-primer2/Makefile (ARCH): Ditto.
* example-usart/Makefile (ARCH): Ditto.
* example-usb-serial/Makefile (ARCH): Ditto.
* chopstx.c: Include files by ARCH_HEADER and ARCH_IMPL.
* rules.mk (DEFS): Define ARCH_HEADER and ARCH_IMPL by ARCH.
2019-11-25 NIIBE Yutaka <gniibe@fsij.org>
* chopstx-gnu-linux.c (chx_idle): Synchronous IDLE.

View File

@@ -73,11 +73,7 @@ chx_fatal (uint32_t err_code)
}
/* Include the definition of thread context structure. */
#ifdef GNU_LINUX_EMULATION
#include "chopstx-gnu-linux.h"
#else
#include "chopstx-cortex-m.h"
#endif
#include ARCH_HEADER
/* ALLOW_SLEEP for the idle thread. */
int chx_allow_sleep;
@@ -304,11 +300,7 @@ static struct chx_thread *chx_running_preempted (struct chx_thread *tp_next);
* Here comes architecture specific code.
*/
#ifdef GNU_LINUX_EMULATION
#include "chopstx-gnu-linux.c"
#else
#include "chopstx-cortex-m.c"
#endif
#include ARCH_IMPL
static void
chx_set_timer (struct chx_thread *tp, uint32_t ticks)

View File

@@ -8,6 +8,7 @@ CHOPSTX = ..
LDSCRIPT=
CSRC = sample.c usb-cdc.c command.c
ARCH=gnu-linux
CHIP=gnu-linux
USE_SYS = yes
USE_USB = yes

View File

@@ -6,6 +6,7 @@ CHOPSTX = ..
LDSCRIPT= sample.ld.m4
CSRC = sample.c usb-cdc.c
ARCH=cortex-m
CHIP=stm32l4
USE_SYS = yes

View File

@@ -8,6 +8,7 @@ FRAUCHEKY = ../../fraucheky
LDSCRIPT=
CSRC = main.c
ARCH=gnu-linux
CHIP=gnu-linux
USE_SYS = yes
USE_USB = yes

View File

@@ -7,6 +7,7 @@ PROJECT = sample
CHOPSTX = ..
LDSCRIPT= sample.ld
CSRC = sample.c usb-cdc.c command.c touch.c
ARCH=cortex-m
CHIP=mkl27z
USE_SYS = yes

View File

@@ -7,6 +7,7 @@ LDSCRIPT= hacker-emblem.ld
CSRC = reset.c hh.c
ARCH=cortex-m
CHIP=stm32f0
# Hacker Emblem and "Happy Hacking!" demonstration

View File

@@ -15,6 +15,7 @@ LDSCRIPT= sample.ld.m4
### LDSCRIPT= sample.ld.m3
CSRC = sample.c
ARCH=cortex-m
CHIP=stm32l4
USE_SYS = yes

View File

@@ -8,6 +8,7 @@ LDSCRIPT= lcd.ld
CSRC = primer2-switches.c primer2-ts.c lcd.c main.c \
neug.c sha256.c
ARCH=cortex-m
CHIP=stm32f103
USE_SYS = yes
USE_USB = yes

View File

@@ -15,6 +15,7 @@ LDSCRIPT= sample.ld.m4
### LDSCRIPT= sample.ld.m3
CSRC = sample.c
ARCH=cortex-m
CHIP=stm32l4
USE_SYS = yes
USE_USART = yes

View File

@@ -6,6 +6,7 @@ CHOPSTX = ..
LDSCRIPT= sample.ld
CSRC = sample.c usb-cdc.c
ARCH=cortex-m
CHIP=stm32f103
USE_SYS = yes

View File

@@ -65,10 +65,12 @@ ifeq ($(EMULATION),)
MCFLAGS = -mcpu=$(MCU)
LDFLAGS = $(MCFLAGS) -nostartfiles -T$(LDSCRIPT) \
-Wl,-Map=$(BUILDDIR)/$(PROJECT).map,--cref,--no-warn-mismatch,--gc-sections
DEFS += -DARCH_HEADER='"chopstx-$(ARCH).h"' -DARCH_IMPL='"chopstx-$(ARCH).c"'
else
MCFLAGS =
LDFLAGS =
DEFS += -D_GNU_SOURCE
DEFS += -D_GNU_SOURCE -DARCH_HEADER='"chopstx-gnu-linux.h"' \
-DARCH_IMPL='"chopstx-gnu-linux.c"'
endif
CFLAGS = $(MCFLAGS) $(OPT) $(CWARN) -Wa,-alms=$(BUILDDIR)/$(notdir $(<:.c=.lst)) $(DEFS)