From 858a9f5d01266dad8152c188da2609d3589184c7 Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Mon, 18 Nov 2019 08:25:56 +0900 Subject: [PATCH] Have a entry-gnu-linux.c. Signed-off-by: NIIBE Yutaka --- ChangeLog | 6 ++++++ entry-gnu-linux.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ entry.c | 15 --------------- rules.mk | 8 +++++++- 4 files changed, 58 insertions(+), 16 deletions(-) create mode 100644 entry-gnu-linux.c diff --git a/ChangeLog b/ChangeLog index 696682d..1760ec4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2019-11-18 NIIBE Yutaka + + * rules.mk (CSRC): Change the rule of entry*.c. + * entry.c: It's only for Cortex-M, now. + * entry-gnu-linux.c: New file. + 2019-11-18 NIIBE Yutaka * entry.c: Use chopstx-cortex-m.h. diff --git a/entry-gnu-linux.c b/entry-gnu-linux.c new file mode 100644 index 0000000..b4e7d29 --- /dev/null +++ b/entry-gnu-linux.c @@ -0,0 +1,45 @@ +/* + * entry.c - Entry routine. + * + * Copyright (C) 2017, 2019 + * Flying Stone Technology + * Author: NIIBE Yutaka + * + * This file is a part of Chopstx, a thread library for embedded. + * + * Chopstx is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Chopstx is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * As additional permission under GNU GPL version 3 section 7, you may + * distribute non-source form of the Program without the copy of the + * GNU GPL normally required by section 4, provided you inform the + * recipients of GNU GPL by a written offer. + * + */ + +#include +#include +#include + +int emulated_main (int, const char **); +void chx_init (struct chx_thread *); +void chx_systick_init (void); +extern struct chx_thread main_thread; + +int +main (int argc, const char *argv[]) +{ + chx_init (&main_thread); + chx_systick_init (); + emulated_main (argc, argv); +} diff --git a/entry.c b/entry.c index b8f59a0..5260416 100644 --- a/entry.c +++ b/entry.c @@ -33,20 +33,6 @@ #include "board.h" -#ifdef GNU_LINUX_EMULATION -int emulated_main (int, const char **); -void chx_init (struct chx_thread *); -void chx_systick_init (void); -extern struct chx_thread main_thread; - -int -main (int argc, const char *argv[]) -{ - chx_init (&main_thread); - chx_systick_init (); - emulated_main (argc, argv); -} -#else #if defined(USE_SYS3) || defined(USE_SYS_CLOCK_GPIO_SETTING) #define REQUIRE_CLOCK_GPIO_SETTING_IN_SYS #include "sys.h" @@ -258,4 +244,3 @@ handler vector_table[] __attribute__ ((section(".startup.vectors"))) = { chx_handle_intr, chx_handle_intr, chx_handle_intr, chx_handle_intr, #endif }; -#endif diff --git a/rules.mk b/rules.mk index fc811c0..1174c60 100644 --- a/rules.mk +++ b/rules.mk @@ -1,6 +1,12 @@ # Chopstx make rules. -CSRC += $(CHOPSTX)/entry.c $(CHOPSTX)/chopstx.c +ifeq ($(EMULATION),) +CSRC += $(CHOPSTX)/entry.c +else +CSRC += $(CHOPSTX)/entry-gnu-linux.c +endif + +CSRC += $(CHOPSTX)/chopstx.c ifneq ($(USE_EVENTFLAG),) CSRC += $(CHOPSTX)/eventflag.c