aboutsummaryrefslogtreecommitdiffstats
path: root/os/nil
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2016-02-16 09:59:21 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2016-02-16 09:59:21 +0000
commit641f2c372605cf405f0dda8536b45a78e0e5e2e2 (patch)
treef120afff37ef959b367a6023749700d5b618beff /os/nil
parent5e24a813bef8d7ac5ca79fe9079db0fc2d2bb8b2 (diff)
downloadChibiOS-641f2c372605cf405f0dda8536b45a78e0e5e2e2.tar.gz
ChibiOS-641f2c372605cf405f0dda8536b45a78e0e5e2e2.tar.bz2
ChibiOS-641f2c372605cf405f0dda8536b45a78e0e5e2e2.zip
Tree reorganization.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8899 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/nil')
-rw-r--r--os/nil/include/ch.h (renamed from os/nil/include/nil.h)0
-rw-r--r--os/nil/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk8
-rw-r--r--os/nil/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk8
-rw-r--r--os/nil/ports/ARMCMx/compilers/GCC/nilcoreasm_v6m.s124
-rw-r--r--os/nil/ports/ARMCMx/compilers/GCC/nilcoreasm_v7m.s130
-rw-r--r--os/nil/ports/ARMCMx/compilers/GCC/niltypes.h96
-rw-r--r--os/nil/ports/ARMCMx/nilcore.c54
-rw-r--r--os/nil/ports/ARMCMx/nilcore.h204
-rw-r--r--os/nil/ports/ARMCMx/nilcore_timer.h124
-rw-r--r--os/nil/ports/ARMCMx/nilcore_v6m.c147
-rw-r--r--os/nil/ports/ARMCMx/nilcore_v6m.h406
-rw-r--r--os/nil/ports/ARMCMx/nilcore_v7m.c165
-rw-r--r--os/nil/ports/ARMCMx/nilcore_v7m.h576
-rw-r--r--os/nil/ports/AVR/compilers/GCC/mk/port.mk7
-rw-r--r--os/nil/ports/AVR/compilers/GCC/niltypes.h96
-rw-r--r--os/nil/ports/AVR/nilcore.c137
-rw-r--r--os/nil/ports/AVR/nilcore.h418
-rw-r--r--os/nil/ports/AVR/nilcore_timer.h124
-rw-r--r--os/nil/ports/e200/compilers/GCC/ivor.s234
-rw-r--r--os/nil/ports/e200/compilers/GCC/mk/port_spc560bcxx.mk14
-rw-r--r--os/nil/ports/e200/compilers/GCC/mk/port_spc560bxx.mk14
-rw-r--r--os/nil/ports/e200/compilers/GCC/mk/port_spc560dxx.mk14
-rw-r--r--os/nil/ports/e200/compilers/GCC/mk/port_spc560pxx.mk14
-rw-r--r--os/nil/ports/e200/compilers/GCC/mk/port_spc563mxx.mk14
-rw-r--r--os/nil/ports/e200/compilers/GCC/mk/port_spc564axx.mk14
-rw-r--r--os/nil/ports/e200/compilers/GCC/mk/port_spc56ecxx.mk14
-rw-r--r--os/nil/ports/e200/compilers/GCC/mk/port_spc56elxx.mk14
-rw-r--r--os/nil/ports/e200/compilers/GCC/mk/port_spc57emxx.mk14
-rw-r--r--os/nil/ports/e200/compilers/GCC/niltypes.h96
-rw-r--r--os/nil/ports/e200/nilcore.c107
-rw-r--r--os/nil/ports/e200/nilcore.h555
-rw-r--r--os/nil/src/ch.c (renamed from os/nil/src/nil.c)0
-rw-r--r--os/nil/templates/chconf.h (renamed from os/nil/templates/nilconf.h)137
-rw-r--r--os/nil/templates/nilcore.c54
-rw-r--r--os/nil/templates/nilcore.h379
-rw-r--r--os/nil/templates/nilcore_timer.h120
-rw-r--r--os/nil/templates/niltypes.h96
37 files changed, 116 insertions, 4612 deletions
diff --git a/os/nil/include/nil.h b/os/nil/include/ch.h
index 168709049..168709049 100644
--- a/os/nil/include/nil.h
+++ b/os/nil/include/ch.h
diff --git a/os/nil/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk b/os/nil/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk
deleted file mode 100644
index 6fa7d52ea..000000000
--- a/os/nil/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk
+++ /dev/null
@@ -1,8 +0,0 @@
-# List of the ChibiOS/NIL ARMv6M generic port files.
-PORTSRC = $(CHIBIOS)/os/nil/ports/ARMCMx/nilcore.c \
- $(CHIBIOS)/os/nil/ports/ARMCMx/nilcore_v6m.c
-
-PORTASM = $(CHIBIOS)/os/nil/ports/ARMCMx/compilers/GCC/nilcoreasm_v6m.s
-
-PORTINC = $(CHIBIOS)/os/nil/ports/ARMCMx \
- $(CHIBIOS)/os/nil/ports/ARMCMx/compilers/GCC
diff --git a/os/nil/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk b/os/nil/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk
deleted file mode 100644
index 3e9c30125..000000000
--- a/os/nil/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk
+++ /dev/null
@@ -1,8 +0,0 @@
-# List of the ChibiOS/NIL ARMv7M generic port files.
-PORTSRC = $(CHIBIOS)/os/nil/ports/ARMCMx/nilcore.c \
- $(CHIBIOS)/os/nil/ports/ARMCMx/nilcore_v7m.c
-
-PORTASM = $(CHIBIOS)/os/nil/ports/ARMCMx/compilers/GCC/nilcoreasm_v7m.s
-
-PORTINC = $(CHIBIOS)/os/nil/ports/ARMCMx \
- $(CHIBIOS)/os/nil/ports/ARMCMx/compilers/GCC
diff --git a/os/nil/ports/ARMCMx/compilers/GCC/nilcoreasm_v6m.s b/os/nil/ports/ARMCMx/compilers/GCC/nilcoreasm_v6m.s
deleted file mode 100644
index 68862f96e..000000000
--- a/os/nil/ports/ARMCMx/compilers/GCC/nilcoreasm_v6m.s
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio.
-
- This file is part of ChibiOS.
-
- ChibiOS 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.
-
- ChibiOS 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 <http://www.gnu.org/licenses/>.
-*/
-
-/**
- * @file ARMCMx/compilers/GCC/nilcoreasm_v6m.s
- * @brief ARMv6-M architecture port low level code.
- *
- * @addtogroup ARMCMx_GCC_CORE
- * @{
- */
-
-#if !defined(FALSE) || defined(__DOXYGEN__)
-#define FALSE 0
-#endif
-
-#if !defined(TRUE) || defined(__DOXYGEN__)
-#define TRUE 1
-#endif
-
-#define _FROM_ASM_
-#include "nilconf.h"
-#include "nilcore.h"
-
-#if !defined(__DOXYGEN__)
-
- .set CONTEXT_OFFSET, 0
- .set SCB_ICSR, 0xE000ED04
- .set ICSR_PENDSVSET, 0x10000000
- .set ICSR_NMIPENDSET, 0x80000000
-
- .cpu cortex-m0
- .fpu softvfp
-
- .thumb
- .text
-
-/*--------------------------------------------------------------------------*
- * Performs a context switch between two threads.
- *--------------------------------------------------------------------------*/
- .thumb_func
- .globl _port_switch
-_port_switch:
- push {r4, r5, r6, r7, lr}
- mov r4, r8
- mov r5, r9
- mov r6, r10
- mov r7, r11
- push {r4, r5, r6, r7}
-
- mov r3, sp
- str r3, [r1, #CONTEXT_OFFSET]
- ldr r3, [r0, #CONTEXT_OFFSET]
- mov sp, r3
-
- pop {r4, r5, r6, r7}
- mov r8, r4
- mov r9, r5
- mov r10, r6
- mov r11, r7
- pop {r4, r5, r6, r7, pc}
-
-/*--------------------------------------------------------------------------*
- * Start a thread by invoking its work function.
- *
- * Threads execution starts here, the code leaves the system critical zone
- * and then jumps into the thread function passed in register R4. The
- * register R5 contains the thread parameter. The function chThdExit() is
- * called on thread function return.
- *--------------------------------------------------------------------------*/
- .thumb_func
- .globl _port_thread_start
-_port_thread_start:
- cpsie i
- mov r0, r5
- blx r4
- mov r3, #0
- bl chSysHalt
-
-/*--------------------------------------------------------------------------*
- * Post-IRQ switch code.
- *
- * Exception handlers return here for context switching.
- *--------------------------------------------------------------------------*/
- .thumb_func
- .globl _port_switch_from_isr
-_port_switch_from_isr:
- bl chSchRescheduleS
- .globl _port_exit_from_isr
-_port_exit_from_isr:
- ldr r2, .L2
- ldr r3, .L3
- str r3, [r2, #0]
-#if CORTEX_ALTERNATE_SWITCH
- cpsie i
-#endif
-.L1: b .L1
-
- .align 2
-.L2: .word SCB_ICSR
-#if CORTEX_ALTERNATE_SWITCH
-.L3: .word ICSR_PENDSVSET
-#else
-.L3: .word ICSR_NMIPENDSET
-#endif
-
-#endif /* !defined(__DOXYGEN__) */
-
-/** @} */
diff --git a/os/nil/ports/ARMCMx/compilers/GCC/nilcoreasm_v7m.s b/os/nil/ports/ARMCMx/compilers/GCC/nilcoreasm_v7m.s
deleted file mode 100644
index a98802798..000000000
--- a/os/nil/ports/ARMCMx/compilers/GCC/nilcoreasm_v7m.s
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio.
-
- This file is part of ChibiOS.
-
- ChibiOS 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.
-
- ChibiOS 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 <http://www.gnu.org/licenses/>.
-*/
-
-/**
- * @file ARMCMx/compilers/GCC/nilcoreasm_v7m.s
- * @brief ARMv7-M architecture port low level code.
- *
- * @addtogroup ARMCMx_GCC_CORE
- * @{
- */
-
-#if !defined(FALSE) || defined(__DOXYGEN__)
-#define FALSE 0
-#endif
-
-#if !defined(TRUE) || defined(__DOXYGEN__)
-#define TRUE 1
-#endif
-
-#define _FROM_ASM_
-#include "nilconf.h"
-#include "nilcore.h"
-
-#if !defined(__DOXYGEN__)
-
- .set CONTEXT_OFFSET, 0
- .set SCB_ICSR, 0xE000ED04
- .set ICSR_PENDSVSET, 0x10000000
-
- .syntax unified
- .cpu cortex-m4
-#if CORTEX_USE_FPU
- .fpu fpv4-sp-d16
-#else
- .fpu softvfp
-#endif
-
- .thumb
- .text
-
-/*--------------------------------------------------------------------------*
- * Performs a context switch between two threads.
- *--------------------------------------------------------------------------*/
- .thumb_func
- .globl _port_switch
-_port_switch:
- push {r4, r5, r6, r7, r8, r9, r10, r11, lr}
-#if CORTEX_USE_FPU
- vpush {s16-s31}
-#endif
-
- str sp, [r1, #CONTEXT_OFFSET]
-#if (CORTEX_SIMPLIFIED_PRIORITY == FALSE) && \
- ((CORTEX_MODEL == 3) || (CORTEX_MODEL == 4))
- /* Workaround for ARM errata 752419, only applied if
- condition exists for it to be triggered.*/
- ldr r3, [r0, #CONTEXT_OFFSET]
- mov sp, r3
-#else
- ldr sp, [r0, #CONTEXT_OFFSET]
-#endif
-
-#if CORTEX_USE_FPU
- vpop {s16-s31}
-#endif
- pop {r4, r5, r6, r7, r8, r9, r10, r11, pc}
-
-/*--------------------------------------------------------------------------*
- * Start a thread by invoking its work function.
- *
- * Threads execution starts here, the code leaves the system critical zone
- * and then jumps into the thread function passed in register R4. The
- * register R5 contains the thread parameter. The function chThdExit() is
- * called on thread function return.
- *--------------------------------------------------------------------------*/
- .thumb_func
- .globl _port_thread_start
-_port_thread_start:
-#if !CORTEX_SIMPLIFIED_PRIORITY
- movs r3, #0
- msr BASEPRI, r3
-#else /* CORTEX_SIMPLIFIED_PRIORITY */
- cpsie i
-#endif /* CORTEX_SIMPLIFIED_PRIORITY */
- mov r0, r5
- blx r4
- mov r3, #0
- bl chSysHalt
-
-/*--------------------------------------------------------------------------*
- * Post-IRQ switch code.
- *
- * Exception handlers return here for context switching.
- *--------------------------------------------------------------------------*/
- .thumb_func
- .globl _port_switch_from_isr
-_port_switch_from_isr:
- bl chSchRescheduleS
- .globl _port_exit_from_isr
-_port_exit_from_isr:
-#if CORTEX_SIMPLIFIED_PRIORITY
- movw r3, #:lower16:SCB_ICSR
- movt r3, #:upper16:SCB_ICSR
- mov r2, ICSR_PENDSVSET
- str r2, [r3, #0]
- cpsie i
-#else /* !CORTEX_SIMPLIFIED_PRIORITY */
- svc #0
-#endif /* !CORTEX_SIMPLIFIED_PRIORITY */
-.L1: b .L1
-
-#endif /* !defined(__DOXYGEN__) */
-
-/** @} */
diff --git a/os/nil/ports/ARMCMx/compilers/GCC/niltypes.h b/os/nil/ports/ARMCMx/compilers/GCC/niltypes.h
deleted file mode 100644
index 402110096..000000000
--- a/os/nil/ports/ARMCMx/compilers/GCC/niltypes.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio.
-
- This file is part of ChibiOS.
-
- ChibiOS 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.
-
- ChibiOS 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 <http://www.gnu.org/licenses/>.
-*/
-
-/**
- * @file ARMCMx/compilers/GCC/niltypes.h
- * @brief ARM Cortex-Mx port system types.
- *
- * @addtogroup ARMCMx_GCC_CORE
- * @{
- */
-
-#ifndef _NILTYPES_H_
-#define _NILTYPES_H_
-
-#include <stddef.h>
-#include <stdint.h>
-#include <stdbool.h>
-
-/**
- * @name Common constants
- */
-/**
- * @brief Generic 'false' boolean constant.
- */
-#if !defined(FALSE) || defined(__DOXYGEN__)
-#define FALSE 0
-#endif
-
-/**
- * @brief Generic 'true' boolean constant.
- */
-#if !defined(TRUE) || defined(__DOXYGEN__)
-#define TRUE 1
-#endif
-/** @} */
-
-typedef uint32_t syssts_t; /**< System status word. */
-typedef uint32_t rtcnt_t; /**< Realtime counter. */
-typedef uint8_t tstate_t; /**< Thread state. */
-typedef int32_t msg_t; /**< Inter-thread message. */
-typedef uint32_t eventmask_t; /**< Mask of event identifiers. */
-typedef int32_t cnt_t; /**< Generic signed counter. */
-typedef uint32_t ucnt_t; /**< Generic unsigned counter. */
-
-/**
- * @brief Type of system time.
- */
-#if (NIL_CFG_ST_RESOLUTION == 32) || defined(__DOXYGEN__)
-typedef uint32_t systime_t;
-#else
-typedef uint16_t systime_t;
-#endif
-
-/**
- * @brief ROM constant modifier.
- * @note It is set to use the "const" keyword in this port.
- */
-#define ROMCONST const
-
-/**
- * @brief Makes functions not inlineable.
- * @note If the compiler does not support such attribute then the
- * realtime counter precision could be degraded.
- */
-#define NOINLINE __attribute__((noinline))
-
-/**
- * @brief Optimized thread function declaration macro.
- */
-#define PORT_THD_FUNCTION(tname, arg) \
- __attribute__((noreturn)) void tname(void *arg)
-
-/**
- * @brief Packed variable specifier.
- */
-#define PACKED_VAR __attribute__((packed))
-
-#endif /* _NILTYPES_H_ */
-
-/** @} */
diff --git a/os/nil/ports/ARMCMx/nilcore.c b/os/nil/ports/ARMCMx/nilcore.c
deleted file mode 100644
index 7d7738029..000000000
--- a/os/nil/ports/ARMCMx/nilcore.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio.
-
- This file is part of ChibiOS.
-
- ChibiOS 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.
-
- ChibiOS 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 <http://www.gnu.org/licenses/>.
-*/
-
-/**
- * @file ARMCMx/nilcore.c
- * @brief ARM Cortex-Mx port code.
- *
- * @addtogroup ARMCMx_CORE
- * @{
- */
-
-#include "nil.h"
-
-/*===========================================================================*/
-/* Module local definitions. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module exported variables. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module local types. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module local variables. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module local functions. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module exported functions. */
-/*===========================================================================*/
-
-/** @} */
diff --git a/os/nil/ports/ARMCMx/nilcore.h b/os/nil/ports/ARMCMx/nilcore.h
deleted file mode 100644
index 21b5a0535..000000000
--- a/os/nil/ports/ARMCMx/nilcore.h
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio.
-
- This file is part of ChibiOS.
-
- ChibiOS 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.
-
- ChibiOS 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 <http://www.gnu.org/licenses/>.
-*/
-
-/**
- * @file ARMCMx/nilcore.h
- * @brief ARM Cortex-Mx port macros and structures.
- *
- * @addtogroup ARMCMx_CORE
- * @{
- */
-
-#ifndef _NILCORE_H_
-#define _NILCORE_H_
-
-/*===========================================================================*/
-/* Module constants. */
-/*===========================================================================*/
-
-/**
- * @name Architecture and Compiler
- * @{
- */
-/**
- * @brief Macro defining a generic ARM architecture.
- */
-#define PORT_ARCHITECTURE_ARM
-
-/* The following code is not processed when the file is included from an
- asm module because those intrinsic macros are not necessarily defined
- by the assembler too.*/
-#if !defined(_FROM_ASM_)
-
-/**
- * @brief Compiler name and version.
- */
-#if defined(__GNUC__) || defined(__DOXYGEN__)
-#define PORT_COMPILER_NAME "GCC " __VERSION__
-
-#elif defined(__ICCARM__)
-#define PORT_COMPILER_NAME "IAR"
-
-#elif defined(__CC_ARM)
-#define PORT_COMPILER_NAME "RVCT"
-
-#else
-#error "unsupported compiler"
-#endif
-
-#endif /* !defined(_FROM_ASM_) */
-
-/** @} */
-
-/* Inclusion of the Cortex-Mx implementation specific parameters.*/
-#include "cmparams.h"
-
-/*===========================================================================*/
-/* Module pre-compile time settings. */
-/*===========================================================================*/
-
-/**
- * @brief Enables an alternative timer implementation.
- * @details Usually the port uses a timer interface defined in the file
- * @p nilcore_timer.h, if this option is enabled then the file
- * @p nilcore_timer_alt.h is included instead.
- */
-#if !defined(PORT_USE_ALT_TIMER)
-#define PORT_USE_ALT_TIMER FALSE
-#endif
-
-/*===========================================================================*/
-/* Derived constants and error checks. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module data structures and types. */
-/*===========================================================================*/
-
-/* The following code is not processed when the file is included from an
- asm module.*/
-#if !defined(_FROM_ASM_)
-
-/**
- * @brief Type of a generic ARM register.
- */
-typedef void *regarm_t;
-
-/**
- * @brief Type of stack and memory alignment enforcement.
- * @note In this architecture the stack alignment is enforced to 64 bits,
- * 32 bits alignment is supported by hardware but deprecated by ARM,
- * the implementation choice is to not offer the option.
- */
-typedef uint64_t stkalign_t;
-
-/* The following declarations are there just for Doxygen documentation, the
- real declarations are inside the sub-headers being specific for the
- sub-architectures.*/
-#if defined(__DOXYGEN__)
-/**
- * @brief Interrupt saved context.
- * @details This structure represents the stack frame saved during a
- * preemption-capable interrupt handler.
- * @note It is implemented to match the Cortex-Mx exception context.
- */
-struct port_extctx {};
-
-/**
- * @brief System saved context.
- * @details This structure represents the inner stack frame during a context
- * switch.
- */
-struct port_intctx {};
-#endif /* defined(__DOXYGEN__) */
-
-#endif /* !defined(_FROM_ASM_) */
-
-/*===========================================================================*/
-/* Module macros. */
-/*===========================================================================*/
-
-/**
- * @brief Total priority levels.
- */
-#define CORTEX_PRIORITY_LEVELS (1U << CORTEX_PRIORITY_BITS)
-
-/**
- * @brief Minimum priority level.
- * @details This minimum priority level is calculated from the number of
- * priority bits supported by the specific Cortex-Mx implementation.
- */
-#define CORTEX_MINIMUM_PRIORITY (CORTEX_PRIORITY_LEVELS - 1)
-
-/**
- * @brief Maximum priority level.
- * @details The maximum allowed priority level is always zero.
- */
-#define CORTEX_MAXIMUM_PRIORITY 0U
-
-/**
- * @brief Priority level to priority mask conversion macro.
- */
-#define CORTEX_PRIO_MASK(n) \
- ((n) << (8U - (unsigned)CORTEX_PRIORITY_BITS))
-
-/**
- * @brief Priority level verification macro.
- */
-#define PORT_IRQ_IS_VALID_PRIORITY(n) \
- (((n) >= 0U) && ((n) < CORTEX_PRIORITY_LEVELS))
-
-/**
- * @brief Priority level verification macro.
- */
-#define PORT_IRQ_IS_VALID_KERNEL_PRIORITY(n) \
- (((n) >= CORTEX_MAX_KERNEL_PRIORITY) && ((n) < CORTEX_PRIORITY_LEVELS))
-
-/*===========================================================================*/
-/* External declarations. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module inline functions. */
-/*===========================================================================*/
-
-/* Includes the sub-architecture-specific part.*/
-#if (CORTEX_MODEL == 0) || (CORTEX_MODEL == 1)
-#include "nilcore_v6m.h"
-#elif (CORTEX_MODEL == 3) || (CORTEX_MODEL == 4) || (CORTEX_MODEL == 7)
-#include "nilcore_v7m.h"
-#else
-#error "unknown Cortex-M variant"
-#endif
-
-#if !defined(_FROM_ASM_)
-
-#if NIL_CFG_ST_TIMEDELTA > 0
-#if PORT_USE_ALT_TIMER == FALSE
-#include "nilcore_timer.h"
-#else /* PORT_USE_ALT_TIMER != FALSE */
-#include "nilcore_timer_alt.h"
-#endif /* PORT_USE_ALT_TIMER != FALSE */
-#endif /* NIL_CFG_ST_TIMEDELTA > 0 */
-
-#endif /* !defined(_FROM_ASM_) */
-
-#endif /* _NILCORE_H_ */
-
-/** @} */
diff --git a/os/nil/ports/ARMCMx/nilcore_timer.h b/os/nil/ports/ARMCMx/nilcore_timer.h
deleted file mode 100644
index 2c7c98cf6..000000000
--- a/os/nil/ports/ARMCMx/nilcore_timer.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio.
-
- This file is part of ChibiOS.
-
- ChibiOS 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.
-
- ChibiOS 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 <http://www.gnu.org/licenses/>.
-*/
-
-/**
- * @file ARMCMx/nilcore_timer.h
- * @brief System timer header file.
- *
- * @addtogroup ARMCMx_TIMER
- * @{
- */
-
-#ifndef _NILCORE_TIMER_H_
-#define _NILCORE_TIMER_H_
-
-/* This is the only header in the HAL designed to be include-able alone.*/
-#include "st.h"
-
-/*===========================================================================*/
-/* Module constants. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module pre-compile time settings. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Derived constants and error checks. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module data structures and types. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module macros. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* External declarations. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module inline functions. */
-/*===========================================================================*/
-
-/**
- * @brief Starts the alarm.
- * @note Makes sure that no spurious alarms are triggered after
- * this call.
- *
- * @param[in] time the time to be set for the first alarm
- *
- * @notapi
- */
-static inline void port_timer_start_alarm(systime_t time) {
-
- stStartAlarm(time);
-}
-
-/**
- * @brief Stops the alarm interrupt.
- *
- * @notapi
- */
-static inline void port_timer_stop_alarm(void) {
-
- stStopAlarm();
-}
-
-/**
- * @brief Sets the alarm time.
- *
- * @param[in] time the time to be set for the next alarm
- *
- * @notapi
- */
-static inline void port_timer_set_alarm(systime_t time) {
-
- stSetAlarm(time);
-}
-
-/**
- * @brief Returns the system time.
- *
- * @return The system time.
- *
- * @notapi
- */
-static inline systime_t port_timer_get_time(void) {
-
- return stGetCounter();
-}
-
-/**
- * @brief Returns the current alarm time.
- *
- * @return The currently set alarm time.
- *
- * @notapi
- */
-static inline systime_t port_timer_get_alarm(void) {
-
- return stGetAlarm();
-}
-
-#endif /* _NILCORE_TIMER_H_ */
-
-/** @} */
diff --git a/os/nil/ports/ARMCMx/nilcore_v6m.c b/os/nil/ports/ARMCMx/nilcore_v6m.c
deleted file mode 100644
index 791062db3..000000000
--- a/os/nil/ports/ARMCMx/nilcore_v6m.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio.
-
- This file is part of ChibiOS.
-
- ChibiOS 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.
-
- ChibiOS 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 <http://www.gnu.org/licenses/>.
-*/
-
-/**
- * @file nilcore_v6m.c
- * @brief ARMv6-M architecture port code.
- *
- * @addtogroup ARMCMx_V6M_CORE
- * @{
- */
-
-#include "nil.h"
-
-/*===========================================================================*/
-/* Module local definitions. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module exported variables. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module local types. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module local variables. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module local functions. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module interrupt handlers. */
-/*===========================================================================*/
-
-#if (CORTEX_ALTERNATE_SWITCH == FALSE) || defined(__DOXYGEN__)
-/**
- * @brief NMI vector.
- * @details The NMI vector is used for exception mode re-entering after a
- * context switch.
- */
-/*lint -save -e9075 [8.4] All symbols are invoked from asm context.*/
-void NMI_Handler(void) {
-/*lint -restore*/
-
- /* The port_extctx structure is pointed by the PSP register.*/
- struct port_extctx *ctxp = (struct port_extctx *)__get_PSP();
-
- /* Discarding the current exception context and positioning the stack to
- point to the real one.*/
- ctxp++;
-
- /* Writing back the modified PSP value.*/
- __set_PSP((uint32_t)ctxp);
-
- /* Restoring the normal interrupts status.*/
- port_unlock_from_isr();
-}
-#endif /* !CORTEX_ALTERNATE_SWITCH */
-
-#if (CORTEX_ALTERNATE_SWITCH == TRUE) || defined(__DOXYGEN__)
-/**
- * @brief PendSV vector.
- * @details The PendSV vector is used for exception mode re-entering after a
- * context switch.
- */
-/*lint -save -e9075 [8.4] All symbols are invoked from asm context.*/
-void PendSV_Handler(void) {
-/*lint -restore*/
-
- /* The port_extctx structure is pointed by the PSP register.*/
- struct port_extctx *ctxp = (struct port_extctx *)__get_PSP();
-
- /* Discarding the current exception context and positioning the stack to
- point to the real one.*/
- ctxp++;
-
- /* Writing back the modified PSP value.*/
- __set_PSP((uint32_t)ctxp);
-}
-#endif /* CORTEX_ALTERNATE_SWITCH */
-
-/*===========================================================================*/
-/* Module exported functions. */
-/*===========================================================================*/
-
-/**
- * @brief IRQ epilogue code.
- *
- * @param[in] lr value of the @p LR register on ISR entry
- */
-void _port_irq_epilogue(regarm_t lr) {
-
- if (lr != (regarm_t)0xFFFFFFF1U) {
- struct port_extctx *ctxp;
-
- port_lock_from_isr();
-
- /* The extctx structure is pointed by the PSP register.*/
- ctxp = (struct port_extctx *)__get_PSP();
-
- /* Adding an artificial exception return context, there is no need to
- populate it fully.*/
- ctxp--;
-
- /* Writing back the modified PSP value.*/
- __set_PSP((uint32_t)ctxp);
-
- /* Setting up a fake XPSR register value.*/
- ctxp->xpsr = (regarm_t)0x01000000;
-
- /* The exit sequence is different depending on if a preemption is
- required or not.*/
- if (chSchIsRescRequiredI()) {
- /* Preemption is required we need to enforce a context switch.*/
- ctxp->pc = (regarm_t)_port_switch_from_isr;
- }
- else {
- /* Preemption not required, we just need to exit the exception
- atomically.*/
- ctxp->pc = (regarm_t)_port_exit_from_isr;
- }
-
- /* Note, returning without unlocking is intentional, this is done in
- order to keep the rest of the context switch atomic.*/
- }
-}
-
-/** @} */
diff --git a/os/nil/ports/ARMCMx/nilcore_v6m.h b/os/nil/ports/ARMCMx/nilcore_v6m.h
deleted file mode 100644
index 3a500d2b0..000000000
--- a/os/nil/ports/ARMCMx/nilcore_v6m.h
+++ /dev/null
@@ -1,406 +0,0 @@
-/*
- ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio.
-
- This file is part of ChibiOS.
-
- ChibiOS 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.
-
- ChibiOS 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 <http://www.gnu.org/licenses/>.
-*/
-
-/**
- * @file chcore_v6m.h
- * @brief ARMv6-M architecture port macros and structures.
- *
- * @addtogroup ARMCMx_V6M_CORE
- * @{
- */
-
-#ifndef _CHCORE_V6M_H_
-#define _CHCORE_V6M_H_
-
-/*===========================================================================*/
-/* Module constants. */
-/*===========================================================================*/
-
-/**
- * @brief This port does not support a realtime counter.
- */
-#define PORT_SUPPORTS_RT FALSE
-
-/**
- * @brief PendSV priority level.
- * @note This priority is enforced to be equal to @p 0,
- * this handler always has the highest priority that cannot preempt
- * the kernel.
- */
-#define CORTEX_PRIORITY_PENDSV 0
-
-/*===========================================================================*/
-/* Module pre-compile time settings. */
-/*===========================================================================*/
-
-/**
- * @brief Stack size for the system idle thread.
- * @details This size depends on the idle thread implementation, usually
- * the idle thread should take no more space than those reserved
- * by @p PORT_INT_REQUIRED_STACK.
- * @note In this port it is set to 16 because the idle thread does have
- * a stack frame when compiling without optimizations. You may
- * reduce this value to zero when compiling with optimizations.
- */
-#if !defined(PORT_IDLE_THREAD_STACK_SIZE)
-#define PORT_IDLE_THREAD_STACK_SIZE 16
-#endif
-
-/**
- * @brief Per-thread stack overhead for interrupts servicing.
- * @details This constant is used in the calculation of the correct working
- * area size.
- * @note In this port this value is conservatively set to 32 because the
- * function @p chSchDoReschedule() can have a stack frame, especially
- * with compiler optimizations disabled. The value can be reduced
- * when compiler optimizations are enabled.
- */
-#if !defined(PORT_INT_REQUIRED_STACK)
-#define PORT_INT_REQUIRED_STACK 32
-#endif
-
-/**
- * @brief Enables the use of the WFI instruction in the idle thread loop.
- */
-#if !defined(CORTEX_ENABLE_WFI_IDLE)
-#define CORTEX_ENABLE_WFI_IDLE FALSE
-#endif
-
-/**
- * @brief Alternate preemption method.
- * @details Activating this option will make the Kernel use the PendSV
- * handler for preemption instead of the NMI handler.
- */
-#ifndef CORTEX_ALTERNATE_SWITCH
-#define CORTEX_ALTERNATE_SWITCH FALSE
-#endif
-
-/*===========================================================================*/
-/* Derived constants and error checks. */
-/*===========================================================================*/
-
-/**
- * @name Architecture and Compiler
- * @{
- */
-#if ((CORTEX_MODEL == 0) && !defined(__CORE_CM0PLUS_H_DEPENDANT)) || \
- defined(__DOXYGEN__)
-/**
- * @brief Macro defining the specific ARM architecture.
- */
-#define PORT_ARCHITECTURE_ARM_v6M
-
-/**
- * @brief Name of the implemented architecture.
- */
-#define PORT_ARCHITECTURE_NAME "ARMv6-M"
-
-/**
- * @brief Name of the architecture variant.
- */
-#define PORT_CORE_VARIANT_NAME "Cortex-M0"
-
-#elif (CORTEX_MODEL == 0) && defined(__CORE_CM0PLUS_H_DEPENDANT)
-#define PORT_ARCHITECTURE_ARM_v6M
-#define PORT_ARCHITECTURE_NAME "ARMv6-M"
-#define PORT_CORE_VARIANT_NAME "Cortex-M0+"
-#endif
-
-/**
- * @brief Port-specific information string.
- */
-#if (CORTEX_ALTERNATE_SWITCH == FALSE) || defined(__DOXYGEN__)
-#define PORT_INFO "Preemption through NMI"
-#else
-#define PORT_INFO "Preemption through PendSV"
-#endif
-/** @} */
-
-/**
- * @brief Maximum usable priority for normal ISRs.
- */
-#if (CORTEX_ALTERNATE_SWITCH == TRUE) || defined(__DOXYGEN__)
-#define CORTEX_MAX_KERNEL_PRIORITY 1
-#else
-#define CORTEX_MAX_KERNEL_PRIORITY 0
-#endif
-
-/*===========================================================================*/
-/* Module data structures and types. */
-/*===========================================================================*/
-
-#if !defined(_FROM_ASM_)
-
- /* The documentation of the following declarations is in chconf.h in order
- to not have duplicated structure names into the documentation.*/
-#if !defined(__DOXYGEN__)
-struct port_extctx {
- regarm_t r0;
- regarm_t r1;
- regarm_t r2;
- regarm_t r3;
- regarm_t r12;
- regarm_t lr_thd;
- regarm_t pc;
- regarm_t xpsr;
-};
-
-struct port_intctx {
- regarm_t r8;
- regarm_t r9;
- regarm_t r10;
- regarm_t r11;
- regarm_t r4;
- regarm_t r5;
- regarm_t r6;
- regarm_t r7;
- regarm_t lr;
-};
-#endif /* !defined(__DOXYGEN__) */
-
-/*===========================================================================*/
-/* Module macros. */
-/*===========================================================================*/
-
-/**
- * @brief Platform dependent thread stack setup.
- * @details This code usually setup the context switching frame represented
- * by an @p port_intctx structure.
- */
-#define PORT_SETUP_CONTEXT(tp, wend, pf, arg) { \
- (tp)->ctxp = (struct port_intctx *)((uint8_t *)(wend) - \
- sizeof(struct port_intctx)); \
- (tp)->ctxp->r4 = (regarm_t)(pf); \
- (tp)->ctxp->r5 = (regarm_t)(arg); \
- (tp)->ctxp->lr = (regarm_t)_port_thread_start; \
-}
-
-/**
- * @brief Computes the thread working area global size.
- * @note There is no need to perform alignments in this macro.
- */
-#define PORT_WA_SIZE(n) (sizeof(struct port_intctx) + \
- sizeof(struct port_extctx) + \
- ((size_t)(n)) + ((size_t)(PORT_INT_REQUIRED_STACK)))
-
-/**
- * @brief IRQ prologue code.
- * @details This macro must be inserted at the start of all IRQ handlers
- * enabled to invoke system APIs.
- */
-#if defined(__GNUC__) || defined(__DOXYGEN__)
-#define PORT_IRQ_PROLOGUE() \
- regarm_t _saved_lr = (regarm_t)__builtin_return_address(0)
-#elif defined(__ICCARM__)
-#define PORT_IRQ_PROLOGUE() \
- regarm_t _saved_lr = (regarm_t)__get_LR()
-#elif defined(__CC_ARM)
-#define PORT_IRQ_PROLOGUE() \
- regarm_t _saved_lr = (regarm_t)__return_address()
-#endif
-
-/**
- * @brief IRQ epilogue code.
- * @details This macro must be inserted at the end of all IRQ handlers
- * enabled to invoke system APIs.
- */
-#define PORT_IRQ_EPILOGUE() _port_irq_epilogue(_saved_lr)
-
-/**
- * @brief IRQ handler function declaration.
- * @note @p id can be a function name or a vector number depending on the
- * port implementation.
- */
-#define PORT_IRQ_HANDLER(id) void id(void)
-
-/**
- * @brief Fast IRQ handler function declaration.
- * @note @p id can be a function name or a vector number depending on the
- * port implementation.
- */
-#define PORT_FAST_IRQ_HANDLER(id) void id(void)
-
-/**
- * @brief Performs a context switch between two threads.
- * @details This is the most critical code in any port, this function
- * is responsible for the context switch between 2 threads.
- * @note The implementation of this code affects <b>directly</b> the context
- * switch performance so optimize here as much as you can.
- *
- * @param[in] ntp the thread to be switched in
- * @param[in] otp the thread to be switched out
- */
-#if (NIL_CFG_ENABLE_STACK_CHECK == FALSE) || defined(__DOXYGEN__)
-#define port_switch(ntp, otp) _port_switch(ntp, otp)
-#else
-#define port_switch(ntp, otp) { \
- struct port_intctx *r13 = (struct port_intctx *)__get_PSP(); \
- if ((stkalign_t *)(r13 - 1) < (otp)->stklim) { \
- chSysHalt("stack overflow"); \
- } \
- _port_switch(ntp, otp); \
-}
-#endif
-
-/*===========================================================================*/
-/* External declarations. */
-/*===========================================================================*/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
- void _port_irq_epilogue(regarm_t lr);
- void _port_switch_from_isr(void);
- void _port_exit_from_isr(void);
- void _port_switch(thread_t *ntp, thread_t *otp);
- void _port_thread_start(void);
-#ifdef __cplusplus
-}
-#endif
-
-/*===========================================================================*/
-/* Module inline functions. */
-/*===========================================================================*/
-
-/**
- * @brief Port-related initialization code.
- */
-static inline void port_init(void) {
-
- NVIC_SetPriority(PendSV_IRQn, CORTEX_PRIORITY_PENDSV);
-}
-
-/**
- * @brief Returns a word encoding the current interrupts status.
- *
- * @return The interrupts status.
- */
-static inline syssts_t port_get_irq_status(void) {
-
- return (syssts_t)__get_PRIMASK();
-}
-
-/**
- * @brief Checks the interrupt status.
- *
- * @param[in] sts the interrupt status word
- *
- * @return The interrupt status.
- * @retvel false the word specified a disabled interrupts status.
- * @retvel true the word specified an enabled interrupts status.
- */
-static inline bool port_irq_enabled(syssts_t sts) {
-
- return (sts & (syssts_t)1) == (syssts_t)0;
-}
-
-/**
- * @brief Determines the current execution context.
- *
- * @return The execution context.
- * @retval false not running in ISR mode.
- * @retval true running in ISR mode.
- */
-static inline bool port_is_isr_context(void) {
-
- return (bool)((__get_IPSR() & 0x1FFU) != 0U);
-}
-
-/**
- * @brief Kernel-lock action.
- * @details In this port this function disables interrupts globally.
- */
-static inline void port_lock(void) {
-
- __disable_irq();
-}
-
-/**
- * @brief Kernel-unlock action.
- * @details In this port this function enables interrupts globally.
- */
-static inline void port_unlock(void) {
-
- __enable_irq();
-}
-
-/**
- * @brief Kernel-lock action from an interrupt handler.
- * @details In this port this function disables interrupts globally.
- * @note Same as @p port_lock() in this port.
- */
-static inline void port_lock_from_isr(void) {
-
- port_lock();
-}
-
-/**
- * @brief Kernel-unlock action from an interrupt handler.
- * @details In this port this function enables interrupts globally.
- * @note Same as @p port_lock() in this port.
- */
-static inline void port_unlock_from_isr(void) {
-
- port_unlock();
-}
-
-/**
- * @brief Disables all the interrupt sources.
- */
-static inline void port_disable(void) {
-
- __disable_irq();
-}
-
-/**
- * @brief Disables the interrupt sources below kernel-level priority.
- */
-static inline void port_suspend(void) {
-
- __disable_irq();
-}
-
-/**
- * @brief Enables all the interrupt sources.
- */
-static inline void port_enable(void) {
-
- __enable_irq();
-}
-
-/**
- * @brief Enters an architecture-dependent IRQ-waiting mode.
- * @details The function is meant to return when an interrupt becomes pending.
- * The simplest implementation is an empty function or macro but this
- * would not take advantage of architecture-specific power saving
- * modes.
- * @note Implemented as an inlined @p WFI instruction.
- */
-static inline void port_wait_for_interrupt(void) {
-
-#if CORTEX_ENABLE_WFI_IDLE == TRUE
- __WFI();
-#endif
-}
-
-#endif /* _FROM_ASM_ */
-
-#endif /* _CHCORE_V6M_H_ */
-
-/** @} */
diff --git a/os/nil/ports/ARMCMx/nilcore_v7m.c b/os/nil/ports/ARMCMx/nilcore_v7m.c
deleted file mode 100644
index c381fc3ef..000000000
--- a/os/nil/ports/ARMCMx/nilcore_v7m.c
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio.
-
- This file is part of ChibiOS.
-
- ChibiOS 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.
-
- ChibiOS 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 <http://www.gnu.org/licenses/>.
-*/
-
-/**
- * @file nilcore_v7m.c
- * @brief ARMv7-M architecture port code.
- *
- * @addtogroup ARMCMx_V7M_CORE
- * @{
- */
-
-#include "nil.h"
-
-/*===========================================================================*/
-/* Module local definitions. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module exported variables. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module local types. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module local variables. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module local functions. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module interrupt handlers. */
-/*===========================================================================*/
-
-#if (CORTEX_SIMPLIFIED_PRIORITY == FALSE) || defined(__DOXYGEN__)
-/**
- * @brief SVC vector.
- * @details The SVC vector is used for exception mode re-entering after a
- * context switch.
- * @note The PendSV vector is only used in advanced kernel mode.
- */
-/*lint -save -e9075 [8.4] All symbols are invoked from asm context.*/
-void SVC_Handler(void) {
-/*lint -restore*/
- struct port_extctx *ctxp;
-
-#if CORTEX_USE_FPU == TRUE
- /* Enforcing unstacking of the FP part of the context.*/
- FPU->FPCCR &= ~FPU_FPCCR_LSPACT_Msk;
-#endif
-
- /* The port_extctx structure is pointed by the PSP register.*/
- ctxp = (struct port_extctx *)__get_PSP();
-
- /* Discarding the current exception context and positioning the stack to
- point to the real one.*/
- ctxp++;
-
- /* Restoring real position of the original stack frame.*/
- __set_PSP((uint32_t)ctxp);
-
- /* Restoring the normal interrupts status.*/
- port_unlock_from_isr();
-}
-#endif /* CORTEX_SIMPLIFIED_PRIORITY == FALSE */
-
-#if (CORTEX_SIMPLIFIED_PRIORITY == TRUE) || defined(__DOXYGEN__)
-/**
- * @brief PendSV vector.
- * @details The PendSV vector is used for exception mode re-entering after a
- * context switch.
- * @note The PendSV vector is only used in compact kernel mode.
- */
-/*lint -save -e9075 [8.4] All symbols are invoked from asm context.*/
-void PendSV_Handler(void) {
-/*lint -restore*/
- struct port_extctx *ctxp;
-
-#if CORTEX_USE_FPU == TRUE
- /* Enforcing unstacking of the FP part of the context.*/
- FPU->FPCCR &= ~FPU_FPCCR_LSPACT_Msk;
-#endif
-
- /* The port_extctx structure is pointed by the PSP register.*/
- ctxp = (struct port_extctx *)__get_PSP();
-
- /* Discarding the current exception context and positioning the stack to
- point to the real one.*/
- ctxp++;
-
- /* Writing back the modified PSP value.*/
- __set_PSP((uint32_t)ctxp);
-}
-#endif /* CORTEX_SIMPLIFIED_PRIORITY == TRUE */
-
-/*===========================================================================*/
-/* Module exported functions. */
-/*===========================================================================*/
-
-/**
- * @brief Exception exit redirection to _port_switch_from_isr().
- */
-void _port_irq_epilogue(void) {
-
- port_lock_from_isr();
- if ((SCB->ICSR & SCB_ICSR_RETTOBASE_Msk) != 0U) {
- struct port_extctx *ctxp;
-
-#if CORTEX_USE_FPU == TRUE
- /* Enforcing a lazy FPU state save by accessing the FPCSR register.*/
- (void) __get_FPSCR();
-#endif
-
- /* The port_extctx structure is pointed by the PSP register.*/
- ctxp = (struct port_extctx *)__get_PSP();
-
- /* Adding an artificial exception return context, there is no need to
- populate it fully.*/
- ctxp--;
-
- /* Setting up a fake XPSR register value.*/
- ctxp->xpsr = (regarm_t)0x01000000;
-
- /* Writing back the modified PSP value.*/
- __set_PSP((uint32_t)ctxp);
-
- /* The exit sequence is different depending on if a preemption is
- required or not.*/
- if (chSchIsRescRequiredI()) {
- /* Preemption is required we need to enforce a context switch.*/
- ctxp->pc = (regarm_t)_port_switch_from_isr;
- }
- else {
- /* Preemption not required, we just need to exit the exception
- atomically.*/
- ctxp->pc = (regarm_t)_port_exit_from_isr;
- }
-
- /* Note, returning without unlocking is intentional, this is done in
- order to keep the rest of the context switch atomic.*/
- return;
- }
- port_unlock_from_isr();
-}
-
-/** @} */
diff --git a/os/nil/ports/ARMCMx/nilcore_v7m.h b/os/nil/ports/ARMCMx/nilcore_v7m.h
deleted file mode 100644
index c9ffe87b8..000000000
--- a/os/nil/ports/ARMCMx/nilcore_v7m.h
+++ /dev/null
@@ -1,576 +0,0 @@
-/*
- ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio.
-
- This file is part of ChibiOS.
-
- ChibiOS 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.
-
- ChibiOS 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 <http://www.gnu.org/licenses/>.
-*/
-
-/**
- * @file chcore_v7m.h
- * @brief ARMv7-M architecture port macros and structures.
- *
- * @addtogroup ARMCMx_V7M_CORE
- * @{
- */
-
-#ifndef _NILCORE_V7M_H_
-#define _NILCORE_V7M_H_
-
-/*===========================================================================*/
-/* Module constants. */
-/*===========================================================================*/
-
-/**
- * @brief This port supports a realtime counter.
- */
-#define PORT_SUPPORTS_RT TRUE
-
-/**
- * @brief Disabled value for BASEPRI register.
- */
-#define CORTEX_BASEPRI_DISABLED 0U
-
-/*===========================================================================*/
-/* Module pre-compile time settings. */
-/*===========================================================================*/
-
-/**
- * @brief Stack size for the system idle thread.
- * @details This size depends on the idle thread implementation, usually
- * the idle thread should take no more space than those reserved
- * by @p PORT_INT_REQUIRED_STACK.
- * @note In this port it is set to 16 because the idle thread does have
- * a stack frame when compiling without optimizations. You may
- * reduce this value to zero when compiling with optimizations.
- */
-#if !defined(PORT_IDLE_THREAD_STACK_SIZE) || defined(__DOXYGEN__)
-#define PORT_IDLE_THREAD_STACK_SIZE 16
-#endif
-
-/**
- * @brief Per-thread stack overhead for interrupts servicing.
- * @details This constant is used in the calculation of the correct working
- * area size.
- * @note In this port this value is conservatively set to 32 because the
- * function @p chSchDoReschedule() can have a stack frame, especially
- * with compiler optimizations disabled. The value can be reduced
- * when compiler optimizations are enabled.
- */
-#if !defined(PORT_INT_REQUIRED_STACK) || defined(__DOXYGEN__)
-#define PORT_INT_REQUIRED_STACK 32
-#endif
-
-/**
- * @brief Enables the use of the WFI instruction in the idle thread loop.
- */
-#if !defined(CORTEX_ENABLE_WFI_IDLE)
-#define CORTEX_ENABLE_WFI_IDLE FALSE
-#endif
-
-/**
- * @brief FPU support in context switch.
- * @details Activating this option activates the FPU support in the kernel.
- */
-#if !defined(CORTEX_USE_FPU)
-#define CORTEX_USE_FPU CORTEX_HAS_FPU
-#elif (CORTEX_USE_FPU == TRUE) && (CORTEX_HAS_FPU == FALSE)
-/* This setting requires an FPU presence check in case it is externally
- redefined.*/
-#error "the selected core does not have an FPU"
-#endif
-
-/**
- * @brief Simplified priority handling flag.
- * @details Activating this option makes the Kernel work in compact mode.
- * In compact mode interrupts are disabled globally instead of
- * raising the priority mask to some intermediate level.
- */
-#if !defined(CORTEX_SIMPLIFIED_PRIORITY)
-#define CORTEX_SIMPLIFIED_PRIORITY FALSE
-#endif
-
-/**
- * @brief SVCALL handler priority.
- * @note The default SVCALL handler priority is defaulted to
- * @p CORTEX_MAXIMUM_PRIORITY+1, this reserves the
- * @p CORTEX_MAXIMUM_PRIORITY priority level as fast interrupts
- * priority level.
- */
-#if !defined(CORTEX_PRIORITY_SVCALL)
-#define CORTEX_PRIORITY_SVCALL (CORTEX_MAXIMUM_PRIORITY + 1U)
-#elif !PORT_IRQ_IS_VALID_PRIORITY(CORTEX_PRIORITY_SVCALL)
-/* If it is externally redefined then better perform a validity check on it.*/
-#error "invalid priority level specified for CORTEX_PRIORITY_SVCALL"
-#endif
-
-/**
- * @brief NVIC VTOR initialization expression.
- */
-#if !defined(CORTEX_VTOR_INIT) || defined(__DOXYGEN__)
-#define CORTEX_VTOR_INIT 0x00000000U
-#endif
-
-/**
- * @brief NVIC PRIGROUP initialization expression.
- * @details The default assigns all available priority bits as preemption
- * priority with no sub-priority.
- */
-#if !defined(CORTEX_PRIGROUP_INIT) || defined(__DOXYGEN__)
-#define CORTEX_PRIGROUP_INIT (7 - CORTEX_PRIORITY_BITS)
-#endif
-
-/*===========================================================================*/
-/* Derived constants and error checks. */
-/*===========================================================================*/
-
-/**
- * @name Architecture and Compiler
- * @{
- */
-#if (CORTEX_MODEL == 3) || defined(__DOXYGEN__)
-/**
- * @brief Macro defining the specific ARM architecture.
- */
-#define PORT_ARCHITECTURE_ARM_v7M
-
-/**
- * @brief Name of the implemented architecture.
- */
-#define PORT_ARCHITECTURE_NAME "ARMv7-M"
-
-/**
- * @brief Name of the architecture variant.
- */
-#define PORT_CORE_VARIANT_NAME "Cortex-M3"
-
-#elif (CORTEX_MODEL == 4)
-#define PORT_ARCHITECTURE_ARM_v7ME
-#define PORT_ARCHITECTURE_NAME "ARMv7E-M"
-#if CORTEX_USE_FPU
-#define PORT_CORE_VARIANT_NAME "Cortex-M4F"
-#else
-#define PORT_CORE_VARIANT_NAME "Cortex-M4"
-#endif
-
-#elif (CORTEX_MODEL == 7)
-#define PORT_ARCHITECTURE_ARM_v7ME
-#define PORT_ARCHITECTURE_NAME "ARMv7E-M"
-#if CORTEX_USE_FPU
-#define PORT_CORE_VARIANT_NAME "Cortex-M7F"
-#else
-#define PORT_CORE_VARIANT_NAME "Cortex-M7"
-#endif
-#endif
-
-/**
- * @brief Port-specific information string.
- */
-#if (CORTEX_SIMPLIFIED_PRIORITY == FALSE) || defined(__DOXYGEN__)
-#define PORT_INFO "Advanced kernel mode"
-#else
-#define PORT_INFO "Compact kernel mode"
-#endif
-/** @} */
-
-#if (CORTEX_SIMPLIFIED_PRIORITY == FALSE) || defined(__DOXYGEN__)
-/**
- * @brief Maximum usable priority for normal ISRs.
- */
-#define CORTEX_MAX_KERNEL_PRIORITY (CORTEX_PRIORITY_SVCALL + 1U)
-
-/**
- * @brief BASEPRI level within kernel lock.
- */
-#define CORTEX_BASEPRI_KERNEL \
- CORTEX_PRIO_MASK(CORTEX_MAX_KERNEL_PRIORITY)
-#else
-
-#define CORTEX_MAX_KERNEL_PRIORITY 0U
-#endif
-
-/**
- * @brief PendSV priority level.
- * @note This priority is enforced to be equal to
- * @p CORTEX_MAX_KERNEL_PRIORITY, this handler always have the
- * highest priority that cannot preempt the kernel.
- */
-#define CORTEX_PRIORITY_PENDSV CORTEX_MAX_KERNEL_PRIORITY
-
-/*===========================================================================*/
-/* Module data structures and types. */
-/*===========================================================================*/
-
-/* The following code is not processed when the file is included from an
- asm module.*/
-#if !defined(_FROM_ASM_)
-
-/* The documentation of the following declarations is in chconf.h in order
- to not have duplicated structure names into the documentation.*/
-#if !defined(__DOXYGEN__)
-struct port_extctx {
- regarm_t r0;
- regarm_t r1;
- regarm_t r2;
- regarm_t r3;
- regarm_t r12;
- regarm_t lr_thd;
- regarm_t pc;
- regarm_t xpsr;
-#if CORTEX_USE_FPU
- regarm_t s0;
- regarm_t s1;
- regarm_t s2;
- regarm_t s3;
- regarm_t s4;
- regarm_t s5;
- regarm_t s6;
- regarm_t s7;
- regarm_t s8;
- regarm_t s9;
- regarm_t s10;
- regarm_t s11;
- regarm_t s12;
- regarm_t s13;
- regarm_t s14;
- regarm_t s15;
- regarm_t fpscr;
- regarm_t reserved;
-#endif /* CORTEX_USE_FPU */
-};
-
-struct port_intctx {
-#if CORTEX_USE_FPU
- regarm_t s16;
- regarm_t s17;
- regarm_t s18;
- regarm_t s19;
- regarm_t s20;
- regarm_t s21;
- regarm_t s22;
- regarm_t s23;
- regarm_t s24;
- regarm_t s25;
- regarm_t s26;
- regarm_t s27;
- regarm_t s28;
- regarm_t s29;
- regarm_t s30;
- regarm_t s31;
-#endif /* CORTEX_USE_FPU */
- regarm_t r4;
- regarm_t r5;
- regarm_t r6;
- regarm_t r7;
- regarm_t r8;
- regarm_t r9;
- regarm_t r10;
- regarm_t r11;
- regarm_t lr;
-};
-#endif /* !defined(__DOXYGEN__) */
-
-/*===========================================================================*/
-/* Module macros. */
-/*===========================================================================*/
-
-/**
- * @brief Platform dependent part of the @p chThdCreateI() API.
- * @details This code usually setup the context switching frame represented
- * by an @p port_intctx structure.
- */
-#define PORT_SETUP_CONTEXT(tp, wend, pf, arg) { \
- (tp)->ctxp = (struct port_intctx *)((uint8_t *)(wend) - \
- sizeof(struct port_intctx)); \
- (tp)->ctxp->r4 = (regarm_t)(pf); \
- (tp)->ctxp->r5 = (regarm_t)(arg); \
- (tp)->ctxp->lr = (regarm_t)_port_thread_start; \
-}
-
-/**
- * @brief Computes the thread working area global size.
- * @note There is no need to perform alignments in this macro.
- */
-#define PORT_WA_SIZE(n) (sizeof(struct port_intctx) + \
- sizeof(struct port_extctx) + \
- ((size_t)(n)) + ((size_t)(PORT_INT_REQUIRED_STACK)))
-
-/**
- * @brief IRQ prologue code.
- * @details This macro must be inserted at the start of all IRQ handlers
- * enabled to invoke system APIs.
- */
-#define PORT_IRQ_PROLOGUE()
-
-/**
- * @brief IRQ epilogue code.
- * @details This macro must be inserted at the end of all IRQ handlers
- * enabled to invoke system APIs.
- */
-#define PORT_IRQ_EPILOGUE() _port_irq_epilogue()
-
-/**
- * @brief IRQ handler function declaration.
- * @note @p id can be a function name or a vector number depending on the
- * port implementation.
- */
-#define PORT_IRQ_HANDLER(id) void id(void)
-
-/**
- * @brief Fast IRQ handler function declaration.
- * @note @p id can be a function name or a vector number depending on the
- * port implementation.
- */
-#define PORT_FAST_IRQ_HANDLER(id) void id(void)
-
-/**
- * @brief Performs a context switch between two threads.
- * @details This is the most critical code in any port, this function
- * is responsible for the context switch between 2 threads.
- * @note The implementation of this code affects <b>directly</b> the context
- * switch performance so optimize here as much as you can.
- *
- * @param[in] ntp the thread to be switched in
- * @param[in] otp the thread to be switched out
- */
-#if (NIL_CFG_ENABLE_STACK_CHECK == FALSE) || defined(__DOXYGEN__)
-#define port_switch(ntp, otp) _port_switch(ntp, otp)
-#else
-#define port_switch(ntp, otp) { \
- struct port_intctx *r13 = (struct port_intctx *)__get_PSP(); \
- if ((stkalign_t *)(r13 - 1) < (otp)->stklim) { \
- chSysHalt("stack overflow"); \
- } \
- _port_switch(ntp, otp); \
-}
-#endif
-
-/*===========================================================================*/
-/* External declarations. */
-/*===========================================================================*/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
- void _port_irq_epilogue(void);
- void _port_switch(thread_t *ntp, thread_t *otp);
- void _port_thread_start(void);
- void _port_switch_from_isr(void);
- void _port_exit_from_isr(void);
-#ifdef __cplusplus
-}
-#endif
-
-/*===========================================================================*/
-/* Module inline functions. */
-/*===========================================================================*/
-
-/**
- * @brief Port-related initialization code.
- */
-static inline void port_init(void) {
-
- /* Initialization of the vector table and priority related settings.*/
- SCB->VTOR = CORTEX_VTOR_INIT;
-
- /* Initializing priority grouping.*/
- NVIC_SetPriorityGrouping(CORTEX_PRIGROUP_INIT);
-
- /* DWT cycle counter enable.*/
- CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;
-#if CORTEX_MODEL == 7
- DWT->LAR = 0xC5ACCE55U;
-#endif
- DWT->CTRL |= DWT_CTRL_CYCCNTENA_Msk;
-
- /* Initialization of the system vectors used by the port.*/
-#if CORTEX_SIMPLIFIED_PRIORITY == FALSE
- NVIC_SetPriority(SVCall_IRQn, CORTEX_PRIORITY_SVCALL);
-#endif
- NVIC_SetPriority(PendSV_IRQn, CORTEX_PRIORITY_PENDSV);
-}
-
-/**
- * @brief Returns a word encoding the current interrupts status.
- *
- * @return The interrupts status.
- */
-static inline syssts_t port_get_irq_status(void) {
- syssts_t sts;
-
-#if CORTEX_SIMPLIFIED_PRIORITY == FALSE
- sts = (syssts_t)__get_BASEPRI();
-#else /* CORTEX_SIMPLIFIED_PRIORITY */
- sts = (syssts_t)__get_PRIMASK();
-#endif /* CORTEX_SIMPLIFIED_PRIORITY */
- return sts;
-}
-
-/**
- * @brief Checks the interrupt status.
- *
- * @param[in] sts the interrupt status word
- *
- * @return The interrupt status.
- * @retvel false the word specified a disabled interrupts status.
- * @retvel true the word specified an enabled interrupts status.
- */
-static inline bool port_irq_enabled(syssts_t sts) {
-
-#if CORTEX_SIMPLIFIED_PRIORITY == FALSE
- return sts == (syssts_t)CORTEX_BASEPRI_DISABLED;
-#else /* CORTEX_SIMPLIFIED_PRIORITY */
- return (sts & (syssts_t)1) == (syssts_t)0;
-#endif /* CORTEX_SIMPLIFIED_PRIORITY */
-}
-
-/**
- * @brief Determines the current execution context.
- *
- * @return The execution context.
- * @retval false not running in ISR mode.
- * @retval true running in ISR mode.
- */
-static inline bool port_is_isr_context(void) {
-
- return (bool)((__get_IPSR() & 0x1FFU) != 0U);
-}
-
-/**
- * @brief Kernel-lock action.
- * @details In this port this function raises the base priority to kernel
- * level.
- */
-static inline void port_lock(void) {
-
-#if CORTEX_SIMPLIFIED_PRIORITY == FALSE
-#if defined(__CM7_REV)
-#if __CM7_REV == 0
- __disable_irq();
-#endif
-#endif
- __set_BASEPRI(CORTEX_BASEPRI_KERNEL);
-#if defined(__CM7_REV)
-#if __CM7_REV == 0
- __enable_irq();
-#endif
-#endif
-#else /* CORTEX_SIMPLIFIED_PRIORITY */
- __disable_irq();
-#endif /* CORTEX_SIMPLIFIED_PRIORITY */
-}
-
-/**
- * @brief Kernel-unlock action.
- * @details In this port this function lowers the base priority to user
- * level.
- */
-static inline void port_unlock(void) {
-
-#if CORTEX_SIMPLIFIED_PRIORITY == FALSE
- __set_BASEPRI(CORTEX_BASEPRI_DISABLED);
-#else /* CORTEX_SIMPLIFIED_PRIORITY */
- __enable_irq();
-#endif /* CORTEX_SIMPLIFIED_PRIORITY */
-}
-
-/**
- * @brief Kernel-lock action from an interrupt handler.
- * @details In this port this function raises the base priority to kernel
- * level.
- * @note Same as @p port_lock() in this port.
- */
-static inline void port_lock_from_isr(void) {
-
- port_lock();
-}
-
-/**
- * @brief Kernel-unlock action from an interrupt handler.
- * @details In this port this function lowers the base priority to user
- * level.
- * @note Same as @p port_unlock() in this port.
- */
-static inline void port_unlock_from_isr(void) {
-
- port_unlock();
-}
-
-/**
- * @brief Disables all the interrupt sources.
- * @note In this port it disables all the interrupt sources by raising
- * the priority mask to level 0.
- */
-static inline void port_disable(void) {
-
- __disable_irq();
-}
-
-/**
- * @brief Disables the interrupt sources below kernel-level priority.
- * @note Interrupt sources above kernel level remains enabled.
- * @note In this port it raises/lowers the base priority to kernel level.
- */
-static inline void port_suspend(void) {
-
-#if (CORTEX_SIMPLIFIED_PRIORITY == FALSE) || defined(__DOXYGEN__)
- __set_BASEPRI(CORTEX_BASEPRI_KERNEL);
- __enable_irq();
-#else
- __disable_irq();
-#endif
-}
-
-/**
- * @brief Enables all the interrupt sources.
- * @note In this port it lowers the base priority to user level.
- */
-static inline void port_enable(void) {
-
-#if (CORTEX_SIMPLIFIED_PRIORITY == FALSE) || defined(__DOXYGEN__)
- __set_BASEPRI(CORTEX_BASEPRI_DISABLED);
-#endif
- __enable_irq();
-}
-
-/**
- * @brief Enters an architecture-dependent IRQ-waiting mode.
- * @details The function is meant to return when an interrupt becomes pending.
- * The simplest implementation is an empty function or macro but this
- * would not take advantage of architecture-specific power saving
- * modes.
- * @note Implemented as an inlined @p WFI instruction.
- */
-static inline void port_wait_for_interrupt(void) {
-
-#if CORTEX_ENABLE_WFI_IDLE == TRUE
- __WFI();
-#endif
-}
-
-/**
- * @brief Returns the current value of the realtime counter.
- *
- * @return The realtime counter value.
- */
-static inline rtcnt_t port_rt_get_counter_value(void) {
-
- return DWT->CYCCNT;
-}
-
-#endif /* !defined(_FROM_ASM_) */
-
-#endif /* _NILCORE_V7M_H_ */
-
-/** @} */
diff --git a/os/nil/ports/AVR/compilers/GCC/mk/port.mk b/os/nil/ports/AVR/compilers/GCC/mk/port.mk
deleted file mode 100644
index 0eaec1a5f..000000000
--- a/os/nil/ports/AVR/compilers/GCC/mk/port.mk
+++ /dev/null
@@ -1,7 +0,0 @@
-# List of the ChibiOS/RT AVR port files.
-PORTSRC = ${CHIBIOS}/os/nil/ports/AVR/nilcore.c
-
-PORTASM =
-
-PORTINC = ${CHIBIOS}/os/nil/ports/AVR \
- ${CHIBIOS}/os/nil/ports/AVR/compilers/GCC
diff --git a/os/nil/ports/AVR/compilers/GCC/niltypes.h b/os/nil/ports/AVR/compilers/GCC/niltypes.h
deleted file mode 100644
index 3e2e941fa..000000000
--- a/os/nil/ports/AVR/compilers/GCC/niltypes.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio.
-
- This file is part of ChibiOS.
-
- ChibiOS 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.
-
- ChibiOS 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 <http://www.gnu.org/licenses/>.
-*/
-
-/**
- * @file AVR/compilers/GCC/niltypes.h
- * @brief AVR port system types.
- *
- * @addtogroup AVR_CORE
- * @{
- */
-
-#ifndef _NILTYPES_H_
-#define _NILTYPES_H_
-
-#include <stddef.h>
-#include <stdint.h>
-#include <stdbool.h>
-
-/**
- * @name Common constants
- */
-/**
- * @brief Generic 'false' boolean constant.
- */
-#if !defined(FALSE) || defined(__DOXYGEN__)
-#define FALSE 0
-#endif
-
-/**
- * @brief Generic 'true' boolean constant.
- */
-#if !defined(TRUE) || defined(__DOXYGEN__)
-#define TRUE (!FALSE)
-#endif
-/** @} */
-
-typedef uint8_t syssts_t; /**< System status word. */
-typedef uint16_t rtcnt_t; /**< Realtime counter. */
-typedef uint8_t tstate_t; /**< Thread state. */
-typedef int16_t msg_t; /**< Inter-thread message. */
-typedef uint8_t eventmask_t; /**< Mask of event identifiers. */
-typedef int8_t cnt_t; /**< Generic signed counter. */
-typedef uint8_t ucnt_t; /**< Generic unsigned counter. */
-
-/**
- * @brief Type of system time.
- */
-#if (NIL_CFG_ST_RESOLUTION == 32) || defined(__DOXYGEN__)
-typedef uint32_t systime_t;
-#else
-typedef uint16_t systime_t;
-#endif
-
-/**
- * @brief ROM constant modifier.
- * @note It is set to use the "const" keyword in this port.
- */
-#define ROMCONST const
-
-/**
- * @brief Makes functions not inlineable.
- * @note If the compiler does not support such attribute then the
- * realtime counter precision could be degraded.
- */
-#define NOINLINE __attribute__((noinline))
-
-/**
- * @brief Optimized thread function declaration macro.
- */
-#define PORT_THD_FUNCTION(tname, arg) \
- __attribute__((noreturn)) void tname(void *arg)
-
-/**
- * @brief Packed variable specifier.
- */
-#define PACKED_VAR __attribute__((packed))
-
-#endif /* _NILTYPES_H_ */
-
-/** @} */
diff --git a/os/nil/ports/AVR/nilcore.c b/os/nil/ports/AVR/nilcore.c
deleted file mode 100644
index 83fe441df..000000000
--- a/os/nil/ports/AVR/nilcore.c
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio.
-
- This file is part of ChibiOS.
-
- ChibiOS 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.
-
- ChibiOS 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 <http://www.gnu.org/licenses/>.
-*/
-
-/**
- * @file AVR/nilcore.c
- * @brief AVR port code.
- *
- * @addtogroup AVR_CORE
- * @{
- */
-
-#include "nil.h"
-
-/*===========================================================================*/
-/* Module local definitions. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module exported variables. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module local types. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module local variables. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module local functions. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module exported functions. */
-/*===========================================================================*/
-
-/**
- * @brief Performs a context switch between two threads.
- * @details This is the most critical code in any port, this function
- * is responsible for the context switch between 2 threads.
- * @note The implementation of this code affects <b>directly</b> the context
- * switch performance so optimize here as much as you can.
- * @note The function is declared as a weak symbol, it is possible to
- * redefine it in your application code.
- *
- * @param[in] ntp the thread to be switched in
- * @param[in] otp the thread to be switched out
- */
-#if !defined(__DOXYGEN__)
-__attribute__((naked, weak))
-#endif
-void _port_switch(thread_t *ntp, thread_t *otp) {
-
- asm volatile ("push r2");
- asm volatile ("push r3");
- asm volatile ("push r4");
- asm volatile ("push r5");
- asm volatile ("push r6");
- asm volatile ("push r7");
- asm volatile ("push r8");
- asm volatile ("push r9");
- asm volatile ("push r10");
- asm volatile ("push r11");
- asm volatile ("push r12");
- asm volatile ("push r13");
- asm volatile ("push r14");
- asm volatile ("push r15");
- asm volatile ("push r16");
- asm volatile ("push r17");
- asm volatile ("push r28");
- asm volatile ("push r29");
-
- asm volatile ("movw r30, r22");
- asm volatile ("in r0, 0x3d");
- asm volatile ("std Z+0, r0");
- asm volatile ("in r0, 0x3e");
- asm volatile ("std Z+1, r0");
-
- asm volatile ("movw r30, r24");
- asm volatile ("ldd r0, Z+0");
- asm volatile ("out 0x3d, r0");
- asm volatile ("ldd r0, Z+1");
- asm volatile ("out 0x3e, r0");
-
- asm volatile ("pop r29");
- asm volatile ("pop r28");
- asm volatile ("pop r17");
- asm volatile ("pop r16");
- asm volatile ("pop r15");
- asm volatile ("pop r14");
- asm volatile ("pop r13");
- asm volatile ("pop r12");
- asm volatile ("pop r11");
- asm volatile ("pop r10");
- asm volatile ("pop r9");
- asm volatile ("pop r8");
- asm volatile ("pop r7");
- asm volatile ("pop r6");
- asm volatile ("pop r5");
- asm volatile ("pop r4");
- asm volatile ("pop r3");
- asm volatile ("pop r2");
- asm volatile ("ret");
-}
-
-/**
- * @brief Start a thread by invoking its work function.
- * @details If the work function returns @p chThdExit() is automatically
- * invoked.
- */
-void _port_thread_start(void) {
-
- chSysUnlock();
- asm volatile ("movw r24, r4");
- asm volatile ("movw r30, r2");
- asm volatile ("icall");
- chSysHalt(0);
-}
-
-/** @} */
diff --git a/os/nil/ports/AVR/nilcore.h b/os/nil/ports/AVR/nilcore.h
deleted file mode 100644
index 4d3122c22..000000000
--- a/os/nil/ports/AVR/nilcore.h
+++ /dev/null
@@ -1,418 +0,0 @@
-/*
- ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio.
-
- This file is part of ChibiOS.
-
- ChibiOS 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.
-
- ChibiOS 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 <http://www.gnu.org/licenses/>.
-*/
-
-/**
- * @file AVR/nilcore.h
- * @brief AVR port macros and structures.
- *
- * @addtogroup AVR_CORE
- * @{
- */
-
-#ifndef _NILCORE_H_
-#define _NILCORE_H_
-
-#include <avr/io.h>
-#include <avr/interrupt.h>
-
-/*===========================================================================*/
-/* Module constants. */
-/*===========================================================================*/
-
-/**
- * @name Architecture and Compiler
- * @{
- */
-/**
- * @brief Macro defining the port architecture.
- */
-#define PORT_ARCHITECTURE_AVR
-
-/**
- * @brief Name of the implemented architecture.
- */
-#define PORT_ARCHITECTURE_NAME "AVR"
-
-/**
- * @brief Name of the architecture variant.
- */
-#define PORT_CORE_VARIANT_NAME "MegaAVR"
-
-/**
- * @brief Compiler name and version.
- */
-#if defined(__GNUC__) || defined(__DOXYGEN__)
-#define PORT_COMPILER_NAME "GCC " __VERSION__
-
-#else
-#error "unsupported compiler"
-#endif
-
-/**
- * @brief Port-specific information string.
- */
-#define PORT_INFO "16 bits code addressing"
-
-/**
- * @brief This port supports a realtime counter.
- */
-#define PORT_SUPPORTS_RT FALSE
-/** @} */
-
-/*===========================================================================*/
-/* Module pre-compile time settings. */
-/*===========================================================================*/
-
-/**
- * @brief Stack size for the system idle thread.
- * @details This size depends on the idle thread implementation, usually
- * the idle thread should take no more space than those reserved
- * by @p PORT_INT_REQUIRED_STACK.
- * @note In this port it is set to 8.
- */
-#if !defined(PORT_IDLE_THREAD_STACK_SIZE) || defined(__DOXYGEN__)
-#define PORT_IDLE_THREAD_STACK_SIZE 8
-#endif
-
-/**
- * @brief Per-thread stack overhead for interrupts servicing.
- * @details This constant is used in the calculation of the correct working
- * area size.
- * @note In this port the default is 32 bytes per thread.
- */
-#if !defined(PORT_INT_REQUIRED_STACK) || defined(__DOXYGEN__)
-#define PORT_INT_REQUIRED_STACK 32
-#endif
-
-/**
- * @brief Enables an alternative timer implementation.
- * @details Usually the port uses a timer interface defined in the file
- * @p nilcore_timer.h, if this option is enabled then the file
- * @p nilcore_timer_alt.h is included instead.
- */
-#if !defined(PORT_USE_ALT_TIMER)
-#define PORT_USE_ALT_TIMER FALSE
-#endif
-
-/*===========================================================================*/
-/* Derived constants and error checks. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module data structures and types. */
-/*===========================================================================*/
-
-/* The following code is not processed when the file is included from an
- asm module.*/
-#if !defined(_FROM_ASM_)
-
-/**
- * @brief Type of stack and memory alignment enforcement.
- */
-typedef uint8_t stkalign_t;
-
-/**
- * @brief System saved context.
- * @details This structure represents the inner stack frame during a context
- * switching.
- */
-struct port_intctx {
- uint8_t _next;
- uint8_t r29;
- uint8_t r28;
- uint8_t r17;
- uint8_t r16;
- uint8_t r15;
- uint8_t r14;
- uint8_t r13;
- uint8_t r12;
- uint8_t r11;
- uint8_t r10;
- uint8_t r9;
- uint8_t r8;
- uint8_t r7;
- uint8_t r6;
- uint8_t r5;
- uint8_t r4;
- uint8_t r3;
- uint8_t r2;
-#ifdef __AVR_3_BYTE_PC__
- uint8_t pcx;
-#endif
- uint8_t pcl;
- uint8_t pch;
-};
-
-#endif /* !defined(_FROM_ASM_) */
-
-/*===========================================================================*/
-/* Module macros. */
-/*===========================================================================*/
-
-/**
- * @brief Platform dependent thread stack setup.
- * @details This code usually setup the context switching frame represented
- * by an @p port_intctx structure.
- */
-#ifdef __AVR_3_BYTE_PC__
-#define PORT_SETUP_CONTEXT(tp, wend, pf, arg) { \
- (tp)->ctxp = (struct port_intctx*)(((uint8_t *)(wend)) - \
- sizeof(struct port_intctx)); \
- (tp)->ctxp->r2 = (int)pf; \
- (tp)->ctxp->r3 = (int)pf >> 8; \
- (tp)->ctxp->r4 = (int)arg; \
- (tp)->ctxp->r5 = (int)arg >> 8; \
- (tp)->ctxp->pcx = (int)0; \
- (tp)->ctxp->pcl = (int)_port_thread_start >> 8; \
- (tp)->ctxp->pch = (int)_port_thread_start; \
-}
-#else /* __AVR_3_BYTE_PC__ */
-#define PORT_SETUP_CONTEXT(tp, wend, pf, arg) { \
- (tp)->ctxp = (struct port_intctx*)(((uint8_t *)(wend)) - \
- sizeof(struct port_intctx)); \
- (tp)->ctxp->r2 = (int)pf; \
- (tp)->ctxp->r3 = (int)pf >> 8; \
- (tp)->ctxp->r4 = (int)arg; \
- (tp)->ctxp->r5 = (int)arg >> 8; \
- (tp)->ctxp->pcl = (int)_port_thread_start >> 8; \
- (tp)->ctxp->pch = (int)_port_thread_start; \
-}
-#endif /* __AVR_3_BYTE_PC__ */
-/**
- * @brief Computes the thread working area global size.
- * @note There is no need to perform alignments in this macro.
- */
-#define PORT_WA_SIZE(n) ((sizeof(struct port_intctx) - 1) + \
- (n) + (PORT_INT_REQUIRED_STACK))
-
-/**
- * @brief IRQ prologue code.
- * @details This macro must be inserted at the start of all IRQ handlers
- * enabled to invoke system APIs.
- * @note This code tricks the compiler to save all the specified registers
- * by "touching" them.
- */
-#define PORT_IRQ_PROLOGUE() { \
- asm ("" : : : "r18", "r19", "r20", "r21", "r22", "r23", "r24", \
- "r25", "r26", "r27", "r30", "r31"); \
-}
-
-/**
- * @brief IRQ epilogue code.
- * @details This macro must be inserted at the end of all IRQ handlers
- * enabled to invoke system APIs.
- */
-#define PORT_IRQ_EPILOGUE() chSchRescheduleS()
-
-/**
- * @brief IRQ handler function declaration.
- * @note @p id can be a function name or a vector number depending on the
- * port implementation.
- */
-#define PORT_IRQ_HANDLER(id) ISR(id)
-
-/**
- * @brief Fast IRQ handler function declaration.
- * @note @p id can be a function name or a vector number depending on the
- * port implementation.
- */
-#define PORT_FAST_IRQ_HANDLER(id) ISR(id)
-
-/**
- * @brief Performs a context switch between two threads.
- * @details This is the most critical code in any port, this function
- * is responsible for the context switch between 2 threads.
- * @note The implementation of this code affects <b>directly</b> the context
- * switch performance so optimize here as much as you can.
- *
- * @param[in] ntp the thread to be switched in
- * @param[in] otp the thread to be switched out
- */
-#define port_switch(ntp, otp) _port_switch(ntp, otp)
-
-/*===========================================================================*/
-/* External declarations. */
-/*===========================================================================*/
-
-/* The following code is not processed when the file is included from an
- asm module.*/
-#if !defined(_FROM_ASM_)
-
-#ifdef __cplusplus
-extern "C" {
-#endif
- void _port_irq_epilogue(void);
- void _port_switch(thread_t *ntp, thread_t *otp);
- void _port_thread_start(void);
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* !defined(_FROM_ASM_) */
-
-/*===========================================================================*/
-/* Module inline functions. */
-/*===========================================================================*/
-
-/* The following code is not processed when the file is included from an
- asm module.*/
-#if !defined(_FROM_ASM_)
-
-/**
- * @brief Port-related initialization code.
- */
-static inline void port_init(void) {
-
-}
-
-/**
- * @brief Returns a word encoding the current interrupts status.
- *
- * @return The interrupts status.
- */
-static inline syssts_t port_get_irq_status(void) {
-
- return 0;
-}
-
-/**
- * @brief Checks the interrupt status.
- *
- * @param[in] sts the interrupt status word
- *
- * @return The interrupt status.
- * @retvel false the word specified a disabled interrupts status.
- * @retvel true the word specified an enabled interrupts status.
- */
-static inline bool port_irq_enabled(syssts_t sts) {
-
- return false;
-}
-
-/**
- * @brief Determines the current execution context.
- *
- * @return The execution context.
- * @retval false not running in ISR mode.
- * @retval true running in ISR mode.
- */
-static inline bool port_is_isr_context(void) {
-
- return false;
-}
-
-/**
- * @brief Kernel-lock action.
- */
-static inline void port_lock(void) {
-
- asm volatile ("cli" : : : "memory");
-}
-
-/**
- * @brief Kernel-unlock action.
- */
-static inline void port_unlock(void) {
-
- asm volatile ("sei" : : : "memory");
-}
-
-/**
- * @brief Kernel-lock action from an interrupt handler.
- * @note This function is empty in this port.
- */
-static inline void port_lock_from_isr(void) {
-
-}
-
-/**
- * @brief Kernel-unlock action from an interrupt handler.
- * @note This function is empty in this port.
- */
-static inline void port_unlock_from_isr(void) {
-
-}
-
-/**
- * @brief Disables all the interrupt sources.
- */
-static inline void port_disable(void) {
-
- asm volatile ("cli" : : : "memory");
-}
-
-/**
- * @brief Disables the interrupt sources below kernel-level priority.
- */
-static inline void port_suspend(void) {
-
- asm volatile ("cli" : : : "memory");
-}
-
-/**
- * @brief Enables all the interrupt sources.
- */
-static inline void port_enable(void) {
-
- asm volatile ("sei" : : : "memory");
-}
-
-/**
- * @brief Enters an architecture-dependent IRQ-waiting mode.
- * @details The function is meant to return when an interrupt becomes pending.
- * The simplest implementation is an empty function or macro but this
- * would not take advantage of architecture-specific power saving
- * modes.
- */
-static inline void port_wait_for_interrupt(void) {
-
- asm volatile ("sleep" : : : "memory");
-}
-
-/**
- * @brief Returns the current value of the realtime counter.
- *
- * @return The realtime counter value.
- */
-static inline rtcnt_t port_rt_get_counter_value(void) {
-
- return 0;
-}
-
-#endif /* !defined(_FROM_ASM_) */
-
-/*===========================================================================*/
-/* Module late inclusions. */
-/*===========================================================================*/
-
-#if !defined(_FROM_ASM_)
-
-#if NIL_CFG_ST_TIMEDELTA > 0
-#if !PORT_USE_ALT_TIMER
-#include "nilcore_timer.h"
-#else /* PORT_USE_ALT_TIMER */
-#include "nilcore_timer_alt.h"
-#endif /* PORT_USE_ALT_TIMER */
-#endif /* NIL_CFG_ST_TIMEDELTA > 0 */
-
-#endif /* !defined(_FROM_ASM_) */
-
-#endif /* _NILCORE_H_ */
-
-/** @} */
diff --git a/os/nil/ports/AVR/nilcore_timer.h b/os/nil/ports/AVR/nilcore_timer.h
deleted file mode 100644
index fc00cf50f..000000000
--- a/os/nil/ports/AVR/nilcore_timer.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio.
-
- This file is part of ChibiOS.
-
- ChibiOS 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.
-
- ChibiOS 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 <http://www.gnu.org/licenses/>.
-*/
-
-/**
- * @file AVR/nilcore_timer.h
- * @brief System timer header file.
- *
- * @addtogroup AVR_TIMER
- * @{
- */
-
-#ifndef _NILCORE_TIMER_H_
-#define _NILCORE_TIMER_H_
-
-/* This is the only header in the HAL designed to be include-able alone.*/
-#include "st.h"
-
-/*===========================================================================*/
-/* Module constants. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module pre-compile time settings. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Derived constants and error checks. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module data structures and types. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module macros. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* External declarations. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module inline functions. */
-/*===========================================================================*/
-
-/**
- * @brief Starts the alarm.
- * @note Makes sure that no spurious alarms are triggered after
- * this call.
- *
- * @param[in] time the time to be set for the first alarm
- *
- * @notapi
- */
-static inline void port_timer_start_alarm(systime_t time) {
-
- stStartAlarm(time);
-}
-
-/**
- * @brief Stops the alarm interrupt.
- *
- * @notapi
- */
-static inline void port_timer_stop_alarm(void) {
-
- stStopAlarm();
-}
-
-/**
- * @brief Sets the alarm time.
- *
- * @param[in] time the time to be set for the next alarm
- *
- * @notapi
- */
-static inline void port_timer_set_alarm(systime_t time) {
-
- stSetAlarm(time);
-}
-
-/**
- * @brief Returns the system time.
- *
- * @return The system time.
- *
- * @notapi
- */
-static inline systime_t port_timer_get_time(void) {
-
- return stGetCounter();
-}
-
-/**
- * @brief Returns the current alarm time.
- *
- * @return The currently set alarm time.
- *
- * @notapi
- */
-static inline systime_t port_timer_get_alarm(void) {
-
- return stGetAlarm();
-}
-
-#endif /* _NILCORE_TIMER_H_ */
-
-/** @} */
diff --git a/os/nil/ports/e200/compilers/GCC/ivor.s b/os/nil/ports/e200/compilers/GCC/ivor.s
deleted file mode 100644
index 8bd687c0a..000000000
--- a/os/nil/ports/e200/compilers/GCC/ivor.s
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio.
-
- This file is part of ChibiOS.
-
- ChibiOS 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.
-
- ChibiOS 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 <http://www.gnu.org/licenses/>.
-*/
-
-/**
- * @file ivor.s
- * @brief Kernel ISRs.
- *
- * @addtogroup PPC_GCC_CORE
- * @{
- */
-
-#if !defined(FALSE) || defined(__DOXYGEN__)
-#define FALSE 0
-#endif
-
-#if !defined(TRUE) || defined(__DOXYGEN__)
-#define TRUE 1
-#endif
-
-/*
- * Imports the PPC configuration headers.
- */
-#define _FROM_ASM_
-#include "nilconf.h"
-#include "nilcore.h"
-
-#if !defined(__DOXYGEN__)
-
- .section .handlers, "ax"
-
-#if PPC_SUPPORTS_DECREMENTER
- /*
- * _IVOR10 handler (Book-E decrementer).
- */
- .align 4
- .globl _IVOR10
- .type _IVOR10, @function
-_IVOR10:
- /* Saving the external context (port_extctx structure).*/
- stwu %sp, -80(%sp)
-#if PPC_USE_VLE && PPC_SUPPORTS_VLE_MULTI
- e_stmvsrrw 8(%sp) /* Saves PC, MSR. */
- e_stmvsprw 16(%sp) /* Saves CR, LR, CTR, XER. */
- e_stmvgprw 32(%sp) /* Saves GPR0, GPR3...GPR12. */
-#else /* !(PPC_USE_VLE && PPC_SUPPORTS_VLE_MULTI) */
- stw %r0, 32(%sp) /* Saves GPR0. */
- mfSRR0 %r0
- stw %r0, 8(%sp) /* Saves PC. */
- mfSRR1 %r0
- stw %r0, 12(%sp) /* Saves MSR. */
- mfCR %r0
- stw %r0, 16(%sp) /* Saves CR. */
- mfLR %r0
- stw %r0, 20(%sp) /* Saves LR. */
- mfCTR %r0
- stw %r0, 24(%sp) /* Saves CTR. */
- mfXER %r0
- stw %r0, 28(%sp) /* Saves XER. */
- stw %r3, 36(%sp) /* Saves GPR3...GPR12. */
- stw %r4, 40(%sp)
- stw %r5, 44(%sp)
- stw %r6, 48(%sp)
- stw %r7, 52(%sp)
- stw %r8, 56(%sp)
- stw %r9, 60(%sp)
- stw %r10, 64(%sp)
- stw %r11, 68(%sp)
- stw %r12, 72(%sp)
-#endif /* !(PPC_USE_VLE && PPC_SUPPORTS_VLE_MULTI) */
-
- /* Increasing the SPGR0 register.*/
- mfspr %r0, 272
- eaddi %r0, %r0, 1
- mtspr 272, %r0
-
- /* Reset DIE bit in TSR register.*/
- lis %r3, 0x0800 /* DIS bit mask. */
- mtspr 336, %r3 /* TSR register. */
-
- /* Restoring pre-IRQ MSR register value.*/
- mfSRR1 %r0
-#if !PPC_USE_IRQ_PREEMPTION
- /* No preemption, keeping EE disabled.*/
- se_bclri %r0, 16 /* EE = bit 16. */
-#endif
- mtMSR %r0
-
- /* System tick handler invocation.*/
- bl chSysTimerHandlerI
-
-#if PPC_USE_IRQ_PREEMPTION
- /* Prevents preemption again.*/
- wrteei 0
-#endif
-
- /* Jumps to the common IVOR epilogue code.*/
- b _ivor_exit
-#endif /* PPC_SUPPORTS_DECREMENTER */
-
- /*
- * _IVOR4 handler (Book-E external interrupt).
- */
- .align 4
- .globl _IVOR4
- .type _IVOR4, @function
-_IVOR4:
- /* Saving the external context (port_extctx structure).*/
- stwu %sp, -80(%sp)
-#if PPC_USE_VLE && PPC_SUPPORTS_VLE_MULTI
- e_stmvsrrw 8(%sp) /* Saves PC, MSR. */
- e_stmvsprw 16(%sp) /* Saves CR, LR, CTR, XER. */
- e_stmvgprw 32(%sp) /* Saves GPR0, GPR3...GPR12. */
-#else /* !(PPC_USE_VLE && PPC_SUPPORTS_VLE_MULTI) */
- stw %r0, 32(%sp) /* Saves GPR0. */
- mfSRR0 %r0
- stw %r0, 8(%sp) /* Saves PC. */
- mfSRR1 %r0
- stw %r0, 12(%sp) /* Saves MSR. */
- mfCR %r0
- stw %r0, 16(%sp) /* Saves CR. */
- mfLR %r0
- stw %r0, 20(%sp) /* Saves LR. */
- mfCTR %r0
- stw %r0, 24(%sp) /* Saves CTR. */
- mfXER %r0
- stw %r0, 28(%sp) /* Saves XER. */
- stw %r3, 36(%sp) /* Saves GPR3...GPR12. */
- stw %r4, 40(%sp)
- stw %r5, 44(%sp)
- stw %r6, 48(%sp)
- stw %r7, 52(%sp)
- stw %r8, 56(%sp)
- stw %r9, 60(%sp)
- stw %r10, 64(%sp)
- stw %r11, 68(%sp)
- stw %r12, 72(%sp)
-#endif /* !(PPC_USE_VLE && PPC_SUPPORTS_VLE_MULTI) */
-
- /* Increasing the SPGR0 register.*/
- mfspr %r0, 272
- eaddi %r0, %r0, 1
- mtspr 272, %r0
-
- /* Software vector address from the INTC register.*/
- lis %r3, INTC_IACKR_ADDR@h
- ori %r3, %r3, INTC_IACKR_ADDR@l
- lwz %r3, 0(%r3) /* IACKR register value. */
- lwz %r3, 0(%r3)
- mtCTR %r3 /* Software handler address. */
-
- /* Restoring pre-IRQ MSR register value.*/
- mfSRR1 %r0
-#if !PPC_USE_IRQ_PREEMPTION
- /* No preemption, keeping EE disabled.*/
- se_bclri %r0, 16 /* EE = bit 16. */
-#endif
- mtMSR %r0
-
- /* Exectes the software handler.*/
- bctrl
-
-#if PPC_USE_IRQ_PREEMPTION
- /* Prevents preemption again.*/
- wrteei 0
-#endif
-
- /* Informs the INTC that the interrupt has been served.*/
- mbar 0
- lis %r3, INTC_EOIR_ADDR@h
- ori %r3, %r3, INTC_EOIR_ADDR@l
- stw %r3, 0(%r3) /* Writing any value should do. */
-
- /* Common IVOR epilogue code, context restore.*/
- .globl _ivor_exit
-_ivor_exit:
- /* Decreasing the SPGR0 register.*/
- mfspr %r0, 272
- eaddi %r0, %r0, -1
- mtspr 272, %r0
-
- bl chSchRescheduleS
-
- /* Restoring the external context.*/
-#if PPC_USE_VLE && PPC_SUPPORTS_VLE_MULTI
- e_lmvgprw 32(%sp) /* Restores GPR0, GPR3...GPR12. */
- e_lmvsprw 16(%sp) /* Restores CR, LR, CTR, XER. */
- e_lmvsrrw 8(%sp) /* Restores PC, MSR. */
-#else /*!(PPC_USE_VLE && PPC_SUPPORTS_VLE_MULTI) */
- lwz %r3, 36(%sp) /* Restores GPR3...GPR12. */
- lwz %r4, 40(%sp)
- lwz %r5, 44(%sp)
- lwz %r6, 48(%sp)
- lwz %r7, 52(%sp)
- lwz %r8, 56(%sp)
- lwz %r9, 60(%sp)
- lwz %r10, 64(%sp)
- lwz %r11, 68(%sp)
- lwz %r12, 72(%sp)
- lwz %r0, 8(%sp)
- mtSRR0 %r0 /* Restores PC. */
- lwz %r0, 12(%sp)
- mtSRR1 %r0 /* Restores MSR. */
- lwz %r0, 16(%sp)
- mtCR %r0 /* Restores CR. */
- lwz %r0, 20(%sp)
- mtLR %r0 /* Restores LR. */
- lwz %r0, 24(%sp)
- mtCTR %r0 /* Restores CTR. */
- lwz %r0, 28(%sp)
- mtXER %r0 /* Restores XER. */
- lwz %r0, 32(%sp) /* Restores GPR0. */
-#endif /* !(PPC_USE_VLE && PPC_SUPPORTS_VLE_MULTI) */
- addi %sp, %sp, 80 /* Back to the previous frame. */
- rfi
-
-#endif /* !defined(__DOXYGEN__) */
-
-/** @} */
diff --git a/os/nil/ports/e200/compilers/GCC/mk/port_spc560bcxx.mk b/os/nil/ports/e200/compilers/GCC/mk/port_spc560bcxx.mk
deleted file mode 100644
index 050076219..000000000
--- a/os/nil/ports/e200/compilers/GCC/mk/port_spc560bcxx.mk
+++ /dev/null
@@ -1,14 +0,0 @@
-# List of the ChibiOS/NIL e200z0 SPC560BCxx port files.
-PORTSRC = ${CHIBIOS}/os/nil/ports/e200/nilcore.c
-
-PORTASM = $(CHIBIOS)/os/common/ports/e200/devices/SPC560BCxx/boot.s \
- $(CHIBIOS)/os/common/ports/e200/compilers/GCC/vectors.s \
- $(CHIBIOS)/os/common/ports/e200/compilers/GCC/crt0.s \
- $(CHIBIOS)/os/nil/ports/e200/compilers/GCC/ivor.s
-
-PORTINC = ${CHIBIOS}/os/common/ports/e200/compilers/GCC \
- ${CHIBIOS}/os/common/ports/e200/devices/SPC560BCxx \
- ${CHIBIOS}/os/nil/ports/e200 \
- ${CHIBIOS}/os/nil/ports/e200/compilers/GCC
-
-PORTLD = ${CHIBIOS}/os/common/ports/e200/compilers/GCC/ld
diff --git a/os/nil/ports/e200/compilers/GCC/mk/port_spc560bxx.mk b/os/nil/ports/e200/compilers/GCC/mk/port_spc560bxx.mk
deleted file mode 100644
index 6089f4743..000000000
--- a/os/nil/ports/e200/compilers/GCC/mk/port_spc560bxx.mk
+++ /dev/null
@@ -1,14 +0,0 @@
-# List of the ChibiOS/NIL e200z0 SPC560Bxx port files.
-PORTSRC = ${CHIBIOS}/os/nil/ports/e200/nilcore.c
-
-PORTASM = $(CHIBIOS)/os/common/ports/e200/devices/SPC560Bxx/boot.s \
- $(CHIBIOS)/os/common/ports/e200/compilers/GCC/vectors.s \
- $(CHIBIOS)/os/common/ports/e200/compilers/GCC/crt0.s \
- $(CHIBIOS)/os/nil/ports/e200/compilers/GCC/ivor.s
-
-PORTINC = ${CHIBIOS}/os/common/ports/e200/compilers/GCC \
- ${CHIBIOS}/os/common/ports/e200/devices/SPC560Bxx \
- ${CHIBIOS}/os/nil/ports/e200 \
- ${CHIBIOS}/os/nil/ports/e200/compilers/GCC
-
-PORTLD = ${CHIBIOS}/os/common/ports/e200/compilers/GCC/ld
diff --git a/os/nil/ports/e200/compilers/GCC/mk/port_spc560dxx.mk b/os/nil/ports/e200/compilers/GCC/mk/port_spc560dxx.mk
deleted file mode 100644
index 91176f87b..000000000
--- a/os/nil/ports/e200/compilers/GCC/mk/port_spc560dxx.mk
+++ /dev/null
@@ -1,14 +0,0 @@
-# List of the ChibiOS/NIL e200z0 SPC560Dxx port files.
-PORTSRC = ${CHIBIOS}/os/nil/ports/e200/nilcore.c
-
-PORTASM = $(CHIBIOS)/os/common/ports/e200/devices/SPC560Dxx/boot.s \
- $(CHIBIOS)/os/common/ports/e200/compilers/GCC/vectors.s \
- $(CHIBIOS)/os/common/ports/e200/compilers/GCC/crt0.s \
- $(CHIBIOS)/os/nil/ports/e200/compilers/GCC/ivor.s
-
-PORTINC = ${CHIBIOS}/os/common/ports/e200/compilers/GCC \
- ${CHIBIOS}/os/common/ports/e200/devices/SPC560Dxx \
- ${CHIBIOS}/os/nil/ports/e200 \
- ${CHIBIOS}/os/nil/ports/e200/compilers/GCC
-
-PORTLD = ${CHIBIOS}/os/common/ports/e200/compilers/GCC/ld
diff --git a/os/nil/ports/e200/compilers/GCC/mk/port_spc560pxx.mk b/os/nil/ports/e200/compilers/GCC/mk/port_spc560pxx.mk
deleted file mode 100644
index 9342310aa..000000000
--- a/os/nil/ports/e200/compilers/GCC/mk/port_spc560pxx.mk
+++ /dev/null
@@ -1,14 +0,0 @@
-# List of the ChibiOS/NIL e200z0 SPC560Pxx port files.
-PORTSRC = ${CHIBIOS}/os/nil/ports/e200/nilcore.c
-
-PORTASM = $(CHIBIOS)/os/common/ports/e200/devices/SPC560Pxx/boot.s \
- $(CHIBIOS)/os/common/ports/e200/compilers/GCC/vectors.s \
- $(CHIBIOS)/os/common/ports/e200/compilers/GCC/crt0.s \
- $(CHIBIOS)/os/nil/ports/e200/compilers/GCC/ivor.s
-
-PORTINC = ${CHIBIOS}/os/common/ports/e200/compilers/GCC \
- ${CHIBIOS}/os/common/ports/e200/devices/SPC560Pxx \
- ${CHIBIOS}/os/nil/ports/e200 \
- ${CHIBIOS}/os/nil/ports/e200/compilers/GCC
-
-PORTLD = ${CHIBIOS}/os/common/ports/e200/compilers/GCC/ld
diff --git a/os/nil/ports/e200/compilers/GCC/mk/port_spc563mxx.mk b/os/nil/ports/e200/compilers/GCC/mk/port_spc563mxx.mk
deleted file mode 100644
index febbf22a8..000000000
--- a/os/nil/ports/e200/compilers/GCC/mk/port_spc563mxx.mk
+++ /dev/null
@@ -1,14 +0,0 @@
-# List of the ChibiOS/NIL e200z3 SPC563Mxx port files.
-PORTSRC = ${CHIBIOS}/os/nil/ports/e200/nilcore.c
-
-PORTASM = $(CHIBIOS)/os/common/ports/e200/devices/SPC563Mxx/boot.s \
- $(CHIBIOS)/os/common/ports/e200/compilers/GCC/vectors.s \
- $(CHIBIOS)/os/common/ports/e200/compilers/GCC/crt0.s \
- $(CHIBIOS)/os/nil/ports/e200/compilers/GCC/ivor.s
-
-PORTINC = ${CHIBIOS}/os/common/ports/e200/compilers/GCC \
- ${CHIBIOS}/os/common/ports/e200/devices/SPC563Mxx \
- ${CHIBIOS}/os/nil/ports/e200 \
- ${CHIBIOS}/os/nil/ports/e200/compilers/GCC
-
-PORTLD = ${CHIBIOS}/os/common/ports/e200/compilers/GCC/ld
diff --git a/os/nil/ports/e200/compilers/GCC/mk/port_spc564axx.mk b/os/nil/ports/e200/compilers/GCC/mk/port_spc564axx.mk
deleted file mode 100644
index 31b25c692..000000000
--- a/os/nil/ports/e200/compilers/GCC/mk/port_spc564axx.mk
+++ /dev/null
@@ -1,14 +0,0 @@
-# List of the ChibiOS/NIL e200z4 SPC564Axx port files.
-PORTSRC = ${CHIBIOS}/os/nil/ports/e200/nilcore.c
-
-PORTASM = $(CHIBIOS)/os/common/ports/e200/devices/SPC564Axx/boot.s \
- $(CHIBIOS)/os/common/ports/e200/compilers/GCC/vectors.s \
- $(CHIBIOS)/os/common/ports/e200/compilers/GCC/crt0.s \
- $(CHIBIOS)/os/nil/ports/e200/compilers/GCC/ivor.s
-
-PORTINC = ${CHIBIOS}/os/common/ports/e200/compilers/GCC \
- ${CHIBIOS}/os/common/ports/e200/devices/SPC564Axx \
- ${CHIBIOS}/os/nil/ports/e200 \
- ${CHIBIOS}/os/nil/ports/e200/compilers/GCC
-
-PORTLD = ${CHIBIOS}/os/common/ports/e200/compilers/GCC/ld
diff --git a/os/nil/ports/e200/compilers/GCC/mk/port_spc56ecxx.mk b/os/nil/ports/e200/compilers/GCC/mk/port_spc56ecxx.mk
deleted file mode 100644
index 84ada33e1..000000000
--- a/os/nil/ports/e200/compilers/GCC/mk/port_spc56ecxx.mk
+++ /dev/null
@@ -1,14 +0,0 @@
-# List of the ChibiOS/NIL e200z4 SPC56ECxx port files.
-PORTSRC = ${CHIBIOS}/os/nil/ports/e200/nilcore.c
-
-PORTASM = $(CHIBIOS)/os/common/ports/e200/devices/SPC56ECxx/boot.s \
- $(CHIBIOS)/os/common/ports/e200/compilers/GCC/vectors.s \
- $(CHIBIOS)/os/common/ports/e200/compilers/GCC/crt0.s \
- $(CHIBIOS)/os/nil/ports/e200/compilers/GCC/ivor.s
-
-PORTINC = ${CHIBIOS}/os/common/ports/e200/compilers/GCC \
- ${CHIBIOS}/os/common/ports/e200/devices/SPC56ECxx \
- ${CHIBIOS}/os/nil/ports/e200 \
- ${CHIBIOS}/os/nil/ports/e200/compilers/GCC
-
-PORTLD = ${CHIBIOS}/os/common/ports/e200/compilers/GCC/ld
diff --git a/os/nil/ports/e200/compilers/GCC/mk/port_spc56elxx.mk b/os/nil/ports/e200/compilers/GCC/mk/port_spc56elxx.mk
deleted file mode 100644
index a913240e3..000000000
--- a/os/nil/ports/e200/compilers/GCC/mk/port_spc56elxx.mk
+++ /dev/null
@@ -1,14 +0,0 @@
-# List of the ChibiOS/NIL e200z4 SPC56ELxx port files.
-PORTSRC = ${CHIBIOS}/os/nil/ports/e200/nilcore.c
-
-PORTASM = $(CHIBIOS)/os/common/ports/e200/devices/SPC56ELxx/boot.s \
- $(CHIBIOS)/os/common/ports/e200/compilers/GCC/vectors.s \
- $(CHIBIOS)/os/common/ports/e200/compilers/GCC/crt0.s \
- $(CHIBIOS)/os/nil/ports/e200/compilers/GCC/ivor.s
-
-PORTINC = ${CHIBIOS}/os/common/ports/e200/compilers/GCC \
- ${CHIBIOS}/os/common/ports/e200/devices/SPC56ELxx \
- ${CHIBIOS}/os/nil/ports/e200 \
- ${CHIBIOS}/os/nil/ports/e200/compilers/GCC
-
-PORTLD = ${CHIBIOS}/os/common/ports/e200/compilers/GCC/ld
diff --git a/os/nil/ports/e200/compilers/GCC/mk/port_spc57emxx.mk b/os/nil/ports/e200/compilers/GCC/mk/port_spc57emxx.mk
deleted file mode 100644
index 669d371ea..000000000
--- a/os/nil/ports/e200/compilers/GCC/mk/port_spc57emxx.mk
+++ /dev/null
@@ -1,14 +0,0 @@
-# List of the ChibiOS/NIL e200z4 SPC57EMxx port files.
-PORTSRC = ${CHIBIOS}/os/nil/ports/e200/nilcore.c
-
-PORTASM = $(CHIBIOS)/os/common/ports/e200/devices/SPC57EMxx/boot.s \
- $(CHIBIOS)/os/common/ports/e200/compilers/GCC/vectors.s \
- $(CHIBIOS)/os/common/ports/e200/compilers/GCC/crt0.s \
- $(CHIBIOS)/os/nil/ports/e200/compilers/GCC/ivor.s
-
-PORTINC = ${CHIBIOS}/os/common/ports/e200/compilers/GCC \
- ${CHIBIOS}/os/common/ports/e200/devices/SPC57EMxx \
- ${CHIBIOS}/os/nil/ports/e200 \
- ${CHIBIOS}/os/nil/ports/e200/compilers/GCC
-
-PORTLD = ${CHIBIOS}/os/common/ports/e200/compilers/GCC/ld
diff --git a/os/nil/ports/e200/compilers/GCC/niltypes.h b/os/nil/ports/e200/compilers/GCC/niltypes.h
deleted file mode 100644
index 587beb26e..000000000
--- a/os/nil/ports/e200/compilers/GCC/niltypes.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio.
-
- This file is part of ChibiOS.
-
- ChibiOS 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.
-
- ChibiOS 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 <http://www.gnu.org/licenses/>.
-*/
-
-/**
- * @file e200/compilers/GCC/niltypes.h
- * @brief Power e200 port system types.
- *
- * @addtogroup PPC_GCC_CORE
- * @{
- */
-
-#ifndef _NILTYPES_H_
-#define _NILTYPES_H_
-
-#include <stddef.h>
-#include <stdint.h>
-#include <stdbool.h>
-
-/**
- * @name Common constants
- */
-/**
- * @brief Generic 'false' boolean constant.
- */
-#if !defined(FALSE) || defined(__DOXYGEN__)
-#define FALSE 0
-#endif
-
-/**
- * @brief Generic 'true' boolean constant.
- */
-#if !defined(TRUE) || defined(__DOXYGEN__)
-#define TRUE (!FALSE)
-#endif
-/** @} */
-
-typedef uint32_t syssts_t; /**< System status word. */
-typedef uint32_t rtcnt_t; /**< Realtime counter. */
-typedef uint8_t tstate_t; /**< Thread state. */
-typedef int32_t msg_t; /**< Inter-thread message. */
-typedef uint32_t eventmask_t; /**< Mask of event identifiers. */
-typedef int32_t cnt_t; /**< Generic signed counter. */
-typedef uint32_t ucnt_t; /**< Generic unsigned counter. */
-
-/**
- * @brief Type of system time.
- */
-#if (NIL_CFG_ST_RESOLUTION == 32) || defined(__DOXYGEN__)
-typedef uint32_t systime_t;
-#else
-typedef uint16_t systime_t;
-#endif
-
-/**
- * @brief ROM constant modifier.
- * @note It is set to use the "const" keyword in this port.
- */
-#define ROMCONST const
-
-/**
- * @brief Makes functions not inlineable.
- * @note If the compiler does not support such attribute then the
- * realtime counter precision could be degraded.
- */
-#define NOINLINE __attribute__((noinline))
-
-/**
- * @brief Optimized thread function declaration macro.
- */
-#define PORT_THD_FUNCTION(tname, arg) \
- __attribute__((noreturn)) void tname(void *arg)
-
-/**
- * @brief Packed variable specifier.
- */
-#define PACKED_VAR __attribute__((packed))
-
-#endif /* _NILTYPES_H_ */
-
-/** @} */
diff --git a/os/nil/ports/e200/nilcore.c b/os/nil/ports/e200/nilcore.c
deleted file mode 100644
index 4e4510bab..000000000
--- a/os/nil/ports/e200/nilcore.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio.
-
- This file is part of ChibiOS.
-
- ChibiOS 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.
-
- ChibiOS 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 <http://www.gnu.org/licenses/>.
-*/
-
-/**
- * @file templates/nilcore.c
- * @brief Port code.
- *
- * @addtogroup NIL_CORE
- * @{
- */
-
-#include "nil.h"
-
-/*===========================================================================*/
-/* Module local definitions. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module exported variables. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module local types. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module local variables. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module local functions. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module exported functions. */
-/*===========================================================================*/
-
-/**
- * @brief Performs a context switch between two threads.
- * @details This is the most critical code in any port, this function
- * is responsible for the context switch between 2 threads.
- * @note The implementation of this code affects <b>directly</b> the context
- * switch performance so optimize here as much as you can.
- */
-#if !defined(__DOXYGEN__)
-__attribute__((naked))
-#endif
-void port_dummy1(void) {
-
- asm (".global _port_switch");
- asm ("_port_switch:");
- asm ("subi %sp, %sp, 80"); /* Size of the intctx structure. */
- asm ("mflr %r0");
- asm ("stw %r0, 84(%sp)"); /* LR into the caller frame. */
- asm ("mfcr %r0");
- asm ("stw %r0, 0(%sp)"); /* CR. */
- asm ("stmw %r14, 4(%sp)"); /* GPR14...GPR31. */
-
- asm ("stw %sp, 0(%r4)"); /* Store swapped-out stack. */
- asm ("lwz %sp, 0(%r3)"); /* Load swapped-in stack. */
-
- asm ("lmw %r14, 4(%sp)"); /* GPR14...GPR31. */
- asm ("lwz %r0, 0(%sp)"); /* CR. */
- asm ("mtcr %r0");
- asm ("lwz %r0, 84(%sp)"); /* LR from the caller frame. */
- asm ("mtlr %r0");
- asm ("addi %sp, %sp, 80"); /* Size of the intctx structure. */
- asm ("blr");
-}
-
-/**
- * @brief Start a thread by invoking its work function.
- * @details If the work function returns @p chThdExit() is automatically
- * invoked.
- */
-#if !defined(__DOXYGEN__)
-__attribute__((naked))
-#endif
-void port_dummy2(void) {
-
- asm (".global _port_thread_start");
- asm ("_port_thread_start:");
- chSysUnlock();
- asm ("mr %r3, %r31"); /* Thread parameter. */
- asm ("mtctr %r30");
- asm ("bctrl"); /* Invoke thread function. */
- asm ("li %r0, 0");
- asm ("bl chSysHalt"); /* Thread termination on exit. */
-}
-
-/** @} */
diff --git a/os/nil/ports/e200/nilcore.h b/os/nil/ports/e200/nilcore.h
deleted file mode 100644
index ac5a32433..000000000
--- a/os/nil/ports/e200/nilcore.h
+++ /dev/null
@@ -1,555 +0,0 @@
-/*
- ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio.
-
- This file is part of ChibiOS.
-
- ChibiOS 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.
-
- ChibiOS 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 <http://www.gnu.org/licenses/>.
-*/
-
-/**
- * @file templates/nilcore.h
- * @brief Port macros and structures.
- *
- * @addtogroup NIL_CORE
- * @{
- */
-
-#ifndef _NILCORE_H_
-#define _NILCORE_H_
-
-#include "intc.h"
-
-/*===========================================================================*/
-/* Module constants. */
-/*===========================================================================*/
-
-/**
- * @name Architecture and Compiler
- * @{
- */
-/**
- * @brief Macro defining an PPC architecture.
- */
-#define PORT_ARCHITECTURE_PPC
-
-/**
- * @brief Macro defining the specific PPC architecture.
- */
-#define PORT_ARCHITECTURE_PPC_E200
-
-/**
- * @brief Name of the implemented architecture.
- */
-#define PORT_ARCHITECTURE_NAME "Power Architecture"
-
-/**
- * @brief Compiler name and version.
- */
-#if defined(__GNUC__) || defined(__DOXYGEN__)
-#define PORT_COMPILER_NAME "GCC " __VERSION__
-
-#else
-#error "unsupported compiler"
-#endif
-
-/**
- * @brief This port supports a realtime counter.
- */
-#define PORT_SUPPORTS_RT FALSE
-/** @} */
-
-/**
- * @name E200 core variants
- * @{
- */
-#define PPC_VARIANT_e200z0 200
-#define PPC_VARIANT_e200z2 202
-#define PPC_VARIANT_e200z3 203
-#define PPC_VARIANT_e200z4 204
-/** @} */
-
-/* Inclusion of the PPC implementation specific parameters.*/
-#include "ppcparams.h"
-#include "vectors.h"
-
-/*===========================================================================*/
-/* Module pre-compile time settings. */
-/*===========================================================================*/
-
-/**
- * @brief Per-thread stack overhead for interrupts servicing.
- * @details This constant is used in the calculation of the correct working
- * area size.
- */
-#if !defined(PORT_INT_REQUIRED_STACK) || defined(__DOXYGEN__)
-#define PORT_INT_REQUIRED_STACK 256
-#endif
-
-/**
- * @brief Enables an alternative timer implementation.
- * @details Usually the port uses a timer interface defined in the file
- * @p nilcore_timer.h, if this option is enabled then the file
- * @p nilcore_timer_alt.h is included instead.
- */
-#if !defined(PORT_USE_ALT_TIMER) || defined(__DOXYGEN__)
-#define PORT_USE_ALT_TIMER FALSE
-#endif
-
-/**
- * @brief Use VLE instruction set.
- * @note This parameter is usually set in the Makefile.
- */
-#if !defined(PPC_USE_VLE) || defined(__DOXYGEN__)
-#define PPC_USE_VLE TRUE
-#endif
-
-/**
- * @brief Enables the use of the @p WFI instruction.
- */
-#if !defined(PPC_ENABLE_WFI_IDLE) || defined(__DOXYGEN__)
-#define PPC_ENABLE_WFI_IDLE FALSE
-#endif
-
-/*===========================================================================*/
-/* Derived constants and error checks. */
-/*===========================================================================*/
-
-#if PPC_USE_VLE && !PPC_SUPPORTS_VLE
-#error "the selected MCU does not support VLE instructions set"
-#endif
-
-#if !PPC_USE_VLE && !PPC_SUPPORTS_BOOKE
-#error "the selected MCU does not support BookE instructions set"
-#endif
-
-/**
- * @brief Name of the architecture variant.
- */
-#if (PPC_VARIANT == PPC_VARIANT_e200z0) || defined(__DOXYGEN__)
-#define PORT_CORE_VARIANT_NAME "e200z0"
-#elif PPC_VARIANT == PPC_VARIANT_e200z2
-#define PORT_CORE_VARIANT_NAME "e200z2"
-#elif PPC_VARIANT == PPC_VARIANT_e200z3
-#define PORT_CORE_VARIANT_NAME "e200z3"
-#elif PPC_VARIANT == PPC_VARIANT_e200z4
-#define PORT_CORE_VARIANT_NAME "e200z4"
-#else
-#error "unknown or unsupported PowerPC variant specified"
-#endif
-
-/**
- * @brief Port-specific information string.
- */
-#if PPC_USE_VLE
-#define PORT_INFO "VLE mode"
-#else
-#define PORT_INFO "Book-E mode"
-#endif
-
-/*===========================================================================*/
-/* Module data structures and types. */
-/*===========================================================================*/
-
-/* The following code is not processed when the file is included from an
- asm module.*/
-#if !defined(_FROM_ASM_)
-
-/**
- * @brief Type of stack and memory alignment enforcement.
- */
-typedef uint64_t stkalign_t;
-
-/**
- * @brief Generic PPC register.
- */
-typedef void *regppc_t;
-
-/**
- * @brief Mandatory part of a stack frame.
- */
-struct port_eabi_frame {
- uint32_t slink; /**< Stack back link. */
- uint32_t shole; /**< Stack hole for LR storage. */
-};
-
-/**
- * @brief Interrupt saved context.
- * @details This structure represents the stack frame saved during a
- * preemption-capable interrupt handler.
- * @note R2 and R13 are not saved because those are assumed to be immutable
- * during the system life cycle.
- */
-struct port_extctx {
- struct port_eabi_frame frame;
- /* Start of the e_stmvsrrw frame (offset 8).*/
- regppc_t pc;
- regppc_t msr;
- /* Start of the e_stmvsprw frame (offset 16).*/
- regppc_t cr;
- regppc_t lr;
- regppc_t ctr;
- regppc_t xer;
- /* Start of the e_stmvgprw frame (offset 32).*/
- regppc_t r0;
- regppc_t r3;
- regppc_t r4;
- regppc_t r5;
- regppc_t r6;
- regppc_t r7;
- regppc_t r8;
- regppc_t r9;
- regppc_t r10;
- regppc_t r11;
- regppc_t r12;
- regppc_t padding;
- };
-
-/**
- * @brief System saved context.
- * @details This structure represents the inner stack frame during a context
- * switching.
- * @note R2 and R13 are not saved because those are assumed to be immutable
- * during the system life cycle.
- * @note LR is stored in the caller context so it is not present in this
- * structure.
- */
-struct port_intctx {
- regppc_t cr; /* Part of it is not volatile... */
- regppc_t r14;
- regppc_t r15;
- regppc_t r16;
- regppc_t r17;
- regppc_t r18;
- regppc_t r19;
- regppc_t r20;
- regppc_t r21;
- regppc_t r22;
- regppc_t r23;
- regppc_t r24;
- regppc_t r25;
- regppc_t r26;
- regppc_t r27;
- regppc_t r28;
- regppc_t r29;
- regppc_t r30;
- regppc_t r31;
- regppc_t padding;
-};
-
-#endif /* !defined(_FROM_ASM_) */
-
-/*===========================================================================*/
-/* Module macros. */
-/*===========================================================================*/
-
-/**
- * @brief Platform dependent thread stack setup.
- * @details This code usually setup the context switching frame represented
- * by an @p port_intctx structure.
- */
-#define PORT_SETUP_CONTEXT(tp, wend, pf, arg) { \
- uint8_t *sp = (uint8_t *)(wend) - \
- sizeof(struct port_eabi_frame); \
- ((struct port_eabi_frame *)sp)->slink = 0; \
- ((struct port_eabi_frame *)sp)->shole = (uint32_t)_port_thread_start; \
- (tp)->ctxp = (struct port_intctx *)(sp - sizeof(struct port_intctx)); \
- (tp)->ctxp->r31 = (regppc_t)(arg); \
- (tp)->ctxp->r30 = (regppc_t)(pf); \
-}
-
-/**
- * @brief Computes the thread working area global size.
- * @note There is no need to perform alignments in this macro.
- */
-#define PORT_WA_SIZE(n) (sizeof(struct port_intctx) + \
- sizeof(struct port_extctx) + \
- (n) + (PORT_INT_REQUIRED_STACK))
-
-/**
- * @brief IRQ prologue code.
- * @details This macro must be inserted at the start of all IRQ handlers
- * enabled to invoke system APIs.
- */
-#define PORT_IRQ_PROLOGUE()
-
-/**
- * @brief IRQ epilogue code.
- * @details This macro must be inserted at the end of all IRQ handlers
- * enabled to invoke system APIs.
- */
-#define PORT_IRQ_EPILOGUE()
-
-/**
- * @brief IRQ handler function declaration.
- * @note @p id can be a function name or a vector number depending on the
- * port implementation.
- */
-#define PORT_IRQ_HANDLER(id) void id(void)
-
-/**
- * @brief Fast IRQ handler function declaration.
- * @note @p id can be a function name or a vector number depending on the
- * port implementation.
- */
-#define PORT_FAST_IRQ_HANDLER(id) void id(void)
-
-/**
- * @brief Priority level verification macro.
- */
-#define PORT_IRQ_IS_VALID_PRIORITY(n) \
- (((n) >= 0U) && ((n) < INTC_PRIORITY_LEVELS))
-
-/**
- * @brief Priority level verification macro.
- */
-#define PORT_IRQ_IS_VALID_KERNEL_PRIORITY(n) \
- (((n) >= 0U) && ((n) < INTC_PRIORITY_LEVELS))
-
-/**
- * @brief Performs a context switch between two threads.
- * @details This is the most critical code in any port, this function
- * is responsible for the context switch between 2 threads.
- * @note The implementation of this code affects <b>directly</b> the context
- * switch performance so optimize here as much as you can.
- *
- * @param[in] ntp the thread to be switched in
- * @param[in] otp the thread to be switched out
- */
-#if !NIL_CFG_ENABLE_STACK_CHECK || defined(__DOXYGEN__)
-#define port_switch(ntp, otp) _port_switch(ntp, otp)
-#else
-#define port_switch(ntp, otp) { \
- register struct port_intctx *sp asm ("%r1"); \
- if ((stkalign_t *)(sp - 1) < otp->stklim) \
- chSysHalt("stack overflow"); \
- _port_switch(ntp, otp); \
-}
-#endif
-
-/**
- * @brief Writes to a special register.
- *
- * @param[in] spr special register number
- * @param[in] val value to be written, must be an automatic variable
- */
-#define port_write_spr(spr, val) \
- asm volatile ("mtspr %[p0], %[p1]" : : [p0] "n" (spr), [p1] "r" (val))
-
-/**
- * @brief Writes to a special register.
- *
- * @param[in] spr special register number
- * @param[in] val returned value, must be an automatic variable
- */
-#define port_read_spr(spr, val) \
- asm volatile ("mfspr %[p0], %[p1]" : [p0] "=r" (val) : [p1] "n" (spr))
-
-/*===========================================================================*/
-/* External declarations. */
-/*===========================================================================*/
-
-/* The following code is not processed when the file is included from an
- asm module.*/
-#if !defined(_FROM_ASM_)
-
-#ifdef __cplusplus
-extern "C" {
-#endif
- void _port_switch(thread_t *ntp, thread_t *otp);
- void _port_thread_start(void);
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* !defined(_FROM_ASM_) */
-
-/*===========================================================================*/
-/* Module inline functions. */
-/*===========================================================================*/
-
-/* The following code is not processed when the file is included from an
- asm module.*/
-#if !defined(_FROM_ASM_)
-
-/**
- * @brief Port-related initialization code.
- */
-static inline void port_init(void) {
- uint32_t n;
- unsigned i;
-
- /* Initializing the SPRG0 register to zero, it is required for interrupts
- handling.*/
- n = 0;
- port_write_spr(272, n);
-
-#if PPC_SUPPORTS_IVORS
- /* The CPU supports IVOR registers, the kernel requires IVOR4 and IVOR10
- and the initialization is performed here.*/
- asm volatile ("li %%r3, _IVOR4@l \t\n"
- "mtIVOR4 %%r3 \t\n"
- "li %%r3, _IVOR10@l \t\n"
- "mtIVOR10 %%r3" : : : "r3", "memory");
-#endif
-
- /* INTC initialization, software vector mode, 4 bytes vectors, starting
- at priority 0.*/
- INTC_BCR = 0;
- for (i = 0; i < PPC_CORE_NUMBER; i++) {
- INTC_CPR(i) = 0;
- INTC_IACKR(i) = (uint32_t)_vectors;
- }
-}
-
-/**
- * @brief Returns a word encoding the current interrupts status.
- *
- * @return The interrupts status.
- */
-static inline syssts_t port_get_irq_status(void) {
- uint32_t sts;
-
- asm volatile ("mfmsr %[p0]" : [p0] "=r" (sts) :);
- return sts;
-}
-
-/**
- * @brief Checks the interrupt status.
- *
- * @param[in] sts the interrupt status word
- *
- * @return The interrupt status.
- * @retvel false the word specified a disabled interrupts status.
- * @retvel true the word specified an enabled interrupts status.
- */
-static inline bool port_irq_enabled(syssts_t sts) {
-
- return (bool)((sts & (1 << 15)) != 0);
-}
-
-/**
- * @brief Determines the current execution context.
- *
- * @return The execution context.
- * @retval false not running in ISR mode.
- * @retval true running in ISR mode.
- */
-static inline bool port_is_isr_context(void) {
- uint32_t sprg0;
-
- /* The SPRG0 register is increased before entering interrupt handlers and
- decreased at the end.*/
- port_read_spr(272, sprg0);
- return (bool)(sprg0 > 0);
-}
-
-/**
- * @brief Kernel-lock action.
- */
-static inline void port_lock(void) {
-
- asm volatile ("wrteei 0" : : : "memory");
-}
-
-/**
- * @brief Kernel-unlock action.
- */
-static inline void port_unlock(void) {
-
- asm volatile("wrteei 1" : : : "memory");
-}
-
-/**
- * @brief Kernel-lock action from an interrupt handler.
- */
-static inline void port_lock_from_isr(void) {
-
-}
-
-/**
- * @brief Kernel-unlock action from an interrupt handler.
- */
-static inline void port_unlock_from_isr(void) {
-
-}
-
-/**
- * @brief Disables all the interrupt sources.
- */
-static inline void port_disable(void) {
-
- asm volatile ("wrteei 0" : : : "memory");
-}
-
-/**
- * @brief Disables the interrupt sources below kernel-level priority.
- */
-static inline void port_suspend(void) {
-
- asm volatile ("wrteei 0" : : : "memory");
-}
-
-/**
- * @brief Enables all the interrupt sources.
- */
-static inline void port_enable(void) {
-
- asm volatile ("wrteei 1" : : : "memory");
-}
-
-/**
- * @brief Enters an architecture-dependent IRQ-waiting mode.
- * @details The function is meant to return when an interrupt becomes pending.
- * The simplest implementation is an empty function or macro but this
- * would not take advantage of architecture-specific power saving
- * modes.
- */
-static inline void port_wait_for_interrupt(void) {
-
-#if PPC_ENABLE_WFI_IDLE
- asm volatile ("wait" : : : "memory");
-#endif
-}
-
-/**
- * @brief Returns the current value of the realtime counter.
- *
- * @return The realtime counter value.
- */
-static inline rtcnt_t port_rt_get_counter_value(void) {
-
- return 0;
-}
-
-#endif /* !defined(_FROM_ASM_) */
-
-/*===========================================================================*/
-/* Module late inclusions. */
-/*===========================================================================*/
-
-#if !defined(_FROM_ASM_)
-
-#if NIL_CFG_ST_TIMEDELTA > 0
-#if !PORT_USE_ALT_TIMER
-#include "nilcore_timer.h"
-#else /* PORT_USE_ALT_TIMER */
-#include "nilcore_timer_alt.h"
-#endif /* PORT_USE_ALT_TIMER */
-#endif /* NIL_CFG_ST_TIMEDELTA > 0 */
-
-#endif /* !defined(_FROM_ASM_) */
-
-#endif /* _NILCORE_H_ */
-
-/** @} */
diff --git a/os/nil/src/nil.c b/os/nil/src/ch.c
index 0db75db37..0db75db37 100644
--- a/os/nil/src/nil.c
+++ b/os/nil/src/ch.c
diff --git a/os/nil/templates/nilconf.h b/os/nil/templates/chconf.h
index c89fd61aa..234705f7e 100644
--- a/os/nil/templates/nilconf.h
+++ b/os/nil/templates/chconf.h
@@ -15,18 +15,20 @@
*/
/**
- * @file nilconf.h
+ * @file chconf.h
* @brief Configuration file template.
* @details A copy of this file must be placed in each project directory, it
* contains the application specific kernel settings.
*
- * @addtogroup NIL_CONFIG
+ * @addtogroup config
* @details Kernel related settings and hooks.
* @{
*/
-#ifndef _NILCONF_H_
-#define _NILCONF_H_
+#ifndef _CHCONF_H_
+#define _CHCONF_H_
+
+#define _CHIBIOS_NIL_CONF_
/*===========================================================================*/
/**
@@ -40,7 +42,7 @@
* @note This number is not inclusive of the idle thread which is
* Implicitly handled.
*/
-#define NIL_CFG_NUM_THREADS 1
+#define CH_CFG_NUM_THREADS 3
/** @} */
@@ -55,15 +57,15 @@
* @brief System time counter resolution.
* @note Allowed values are 16 or 32 bits.
*/
-#define NIL_CFG_ST_RESOLUTION 32
+#define CH_CFG_ST_RESOLUTION 32
/**
* @brief System tick frequency.
- * @note This value together with the @p NIL_CFG_ST_RESOLUTION
+ * @note This value together with the @p CH_CFG_ST_RESOLUTION
* option defines the maximum amount of time allowed for
* timeouts.
*/
-#define NIL_CFG_ST_FREQUENCY 50000
+#define CH_CFG_ST_FREQUENCY 1000
/**
* @brief Time delta constant for the tick-less mode.
@@ -73,7 +75,7 @@
* The value one is not valid, timeouts are rounded up to
* this value.
*/
-#define NIL_CFG_ST_TIMEDELTA 2
+#define CH_CFG_ST_TIMEDELTA 0
/** @} */
@@ -85,12 +87,79 @@
/*===========================================================================*/
/**
+ * @brief Semaphores APIs.
+ * @details If enabled then the Semaphores APIs are included in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#define CH_CFG_USE_SEMAPHORES TRUE
+
+/**
+ * @brief Mutexes APIs.
+ * @details If enabled then the mutexes APIs are included in the kernel.
+ *
+ * @note Feature not currently implemented.
+ * @note The default is @p FALSE.
+ */
+#define CH_CFG_USE_MUTEXES FALSE
+
+/**
* @brief Events Flags APIs.
* @details If enabled then the event flags APIs are included in the kernel.
*
* @note The default is @p TRUE.
*/
-#define NIL_CFG_USE_EVENTS TRUE
+#define CH_CFG_USE_EVENTS TRUE
+
+/**
+ * @brief Mailboxes APIs.
+ * @details If enabled then the asynchronous messages (mailboxes) APIs are
+ * included in the kernel.
+ *
+ * @note The default is @p TRUE.
+ * @note Requires @p CH_CFG_USE_SEMAPHORES.
+ */
+#define CH_CFG_USE_MAILBOXES TRUE
+
+/**
+ * @brief Core Memory Manager APIs.
+ * @details If enabled then the core memory manager APIs are included
+ * in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#define CH_CFG_USE_MEMCORE TRUE
+
+/**
+ * @brief Heap Allocator APIs.
+ * @details If enabled then the memory heap allocator APIs are included
+ * in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#define CH_CFG_USE_HEAP TRUE
+
+/**
+ * @brief Memory Pools Allocator APIs.
+ * @details If enabled then the memory pools allocator APIs are included
+ * in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#define CH_CFG_USE_MEMPOOLS TRUE
+
+/**
+ * @brief Managed RAM size.
+ * @details Size of the RAM area to be managed by the OS. If set to zero
+ * then the whole available RAM is used. The core memory is made
+ * available to the heap allocator and/or can be used directly through
+ * the simplified core memory allocator.
+ *
+ * @note In order to let the OS manage the whole RAM the linker script must
+ * provide the @p __heap_base__ and @p __heap_end__ symbols.
+ * @note Requires @p CH_CFG_USE_MEMCORE.
+ */
+#define CH_CFG_MEMCORE_SIZE 0
/** @} */
@@ -102,14 +171,40 @@
/*===========================================================================*/
/**
+ * @brief Debug option, kernel statistics.
+ *
+ * @note Feature not currently implemented.
+ * @note The default is @p FALSE.
+ */
+#define CH_DBG_STATISTICS FALSE
+
+/**
+ * @brief Debug option, system state check.
+ *
+ * @note The default is @p FALSE.
+ */
+#define CH_DBG_SYSTEM_STATE_CHECK TRUE
+
+/**
+ * @brief Debug option, parameters checks.
+ *
+ * @note The default is @p FALSE.
+ */
+#define CH_DBG_ENABLE_CHECKS TRUE
+
+/**
* @brief System assertions.
+ *
+ * @note The default is @p FALSE.
*/
-#define NIL_CFG_ENABLE_ASSERTS FALSE
+#define CH_DBG_ENABLE_ASSERTS TRUE
/**
* @brief Stack check.
+ *
+ * @note The default is @p FALSE.
*/
-#define NIL_CFG_ENABLE_STACK_CHECK FALSE
+#define CH_DBG_ENABLE_STACK_CHECK TRUE
/** @} */
@@ -123,8 +218,8 @@
/**
* @brief System initialization hook.
*/
-#if !defined(NIL_CFG_SYSTEM_INIT_HOOK) || defined(__DOXYGEN__)
-#define NIL_CFG_SYSTEM_INIT_HOOK() { \
+#if !defined(CH_CFG_SYSTEM_INIT_HOOK) || defined(__DOXYGEN__)
+#define CH_CFG_SYSTEM_INIT_HOOK() { \
}
#endif
@@ -132,13 +227,13 @@
* @brief Threads descriptor structure extension.
* @details User fields added to the end of the @p thread_t structure.
*/
-#define NIL_CFG_THREAD_EXT_FIELDS \
+#define CH_CFG_THREAD_EXT_FIELDS \
/* Add threads custom fields here.*/
/**
* @brief Threads initialization hook.
*/
-#define NIL_CFG_THREAD_EXT_INIT_HOOK(tr) { \
+#define CH_CFG_THREAD_EXT_INIT_HOOK(tr) { \
/* Add custom threads initialization code here.*/ \
}
@@ -148,7 +243,7 @@
* should be invoked from here.
* @note This macro can be used to activate a power saving mode.
*/
-#define NIL_CFG_IDLE_ENTER_HOOK() { \
+#define CH_CFG_IDLE_ENTER_HOOK() { \
}
/**
@@ -157,14 +252,14 @@
* should be invoked from here.
* @note This macro can be used to deactivate a power saving mode.
*/
-#define NIL_CFG_IDLE_LEAVE_HOOK() { \
+#define CH_CFG_IDLE_LEAVE_HOOK() { \
}
/**
* @brief System halt hook.
*/
-#if !defined(NIL_CFG_SYSTEM_HALT_HOOK) || defined(__DOXYGEN__)
-#define NIL_CFG_SYSTEM_HALT_HOOK(reason) { \
+#if !defined(CH_CFG_SYSTEM_HALT_HOOK) || defined(__DOXYGEN__)
+#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
}
#endif
@@ -174,6 +269,6 @@
/* Port-specific settings (override port settings defaulted in nilcore.h). */
/*===========================================================================*/
-#endif /* _NILCONF_H_ */
+#endif /* _CHCONF_H_ */
/** @} */
diff --git a/os/nil/templates/nilcore.c b/os/nil/templates/nilcore.c
deleted file mode 100644
index 7bbb020fa..000000000
--- a/os/nil/templates/nilcore.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio.
-
- This file is part of ChibiOS.
-
- ChibiOS 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.
-
- ChibiOS 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 <http://www.gnu.org/licenses/>.
-*/
-
-/**
- * @file templates/nilcore.c
- * @brief Port code.
- *
- * @addtogroup NIL_CORE
- * @{
- */
-
-#include "nil.h"
-
-/*===========================================================================*/
-/* Module local definitions. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module exported variables. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module local types. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module local variables. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module local functions. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module exported functions. */
-/*===========================================================================*/
-
-/** @} */
diff --git a/os/nil/templates/nilcore.h b/os/nil/templates/nilcore.h
deleted file mode 100644
index 1aad42ddc..000000000
--- a/os/nil/templates/nilcore.h
+++ /dev/null
@@ -1,379 +0,0 @@
-/*
- ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio.
-
- This file is part of ChibiOS.
-
- ChibiOS 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.
-
- ChibiOS 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 <http://www.gnu.org/licenses/>.
-*/
-
-/**
- * @file templates/nilcore.h
- * @brief Port macros and structures.
- *
- * @addtogroup NIL_CORE
- * @{
- */
-
-#ifndef _NILCORE_H_
-#define _NILCORE_H_
-
-/*===========================================================================*/
-/* Module constants. */
-/*===========================================================================*/
-
-/**
- * @name Architecture and Compiler
- * @{
- */
-/**
- * @brief Macro defining the port architecture.
- */
-#define PORT_ARCHITECTURE_XXX
-
-/**
- * @brief Name of the implemented architecture.
- */
-#define PORT_ARCHITECTURE_NAME "XXX"
-
-/**
- * @brief Name of the architecture variant.
- */
-#define PORT_CORE_VARIANT_NAME "XXXX-Y"
-
-/**
- * @brief Compiler name and version.
- */
-#if defined(__GNUC__) || defined(__DOXYGEN__)
-#define PORT_COMPILER_NAME "GCC " __VERSION__
-
-#else
-#error "unsupported compiler"
-#endif
-
-/**
- * @brief Port-specific information string.
- */
-#define PORT_INFO "port description"
-
-/**
- * @brief This port supports a realtime counter.
- */
-#define PORT_SUPPORTS_RT FALSE
-/** @} */
-
-/*===========================================================================*/
-/* Module pre-compile time settings. */
-/*===========================================================================*/
-
-/**
- * @brief Per-thread stack overhead for interrupts servicing.
- * @details This constant is used in the calculation of the correct working
- * area size.
- */
-#if !defined(PORT_INT_REQUIRED_STACK) || defined(__DOXYGEN__)
-#define PORT_INT_REQUIRED_STACK 32
-#endif
-
-/**
- * @brief Enables an alternative timer implementation.
- * @details Usually the port uses a timer interface defined in the file
- * @p nilcore_timer.h, if this option is enabled then the file
- * @p nilcore_timer_alt.h is included instead.
- */
-#if !defined(PORT_USE_ALT_TIMER)
-#define PORT_USE_ALT_TIMER FALSE
-#endif
-
-/*===========================================================================*/
-/* Derived constants and error checks. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module data structures and types. */
-/*===========================================================================*/
-
-/* The following code is not processed when the file is included from an
- asm module.*/
-#if !defined(_FROM_ASM_)
-
-/**
- * @brief Type of stack and memory alignment enforcement.
- */
-typedef uint64_t stkalign_t;
-
-/**
- * @brief Interrupt saved context.
- * @details This structure represents the stack frame saved during a
- * preemption-capable interrupt handler.
- */
-struct port_extctx {
- uint32_t reg1;
- uint32_t reg2;
-};
-
-/**
- * @brief System saved context.
- * @details This structure represents the inner stack frame during a context
- * switch.
- */
-struct port_intctx {
- uint32_t reg3;
- uint32_t reg4;
-};
-
-#endif /* !defined(_FROM_ASM_) */
-
-/*===========================================================================*/
-/* Module macros. */
-/*===========================================================================*/
-
-/**
- * @brief Platform dependent thread stack setup.
- * @details This code usually setup the context switching frame represented
- * by an @p port_intctx structure.
- */
-#define PORT_SETUP_CONTEXT(tp, wend, pf, arg) do { \
- (void)(tp); \
- (void)(wend); \
- (void)(pf); \
- (void)(arg); \
-} while (false)
-
-/**
- * @brief Computes the thread working area global size.
- * @note There is no need to perform alignments in this macro.
- */
-#define PORT_WA_SIZE(n) (sizeof(struct port_intctx) + \
- sizeof(struct port_extctx) + \
- (size_t)(n) + \
- (size_t)(PORT_INT_REQUIRED_STACK))
-
-/**
- * @brief Priority level verification macro.
- */
-#define PORT_IRQ_IS_VALID_PRIORITY(n) false
-
-/**
- * @brief Priority level verification macro.
- */
-#define PORT_IRQ_IS_VALID_KERNEL_PRIORITY(n) false
-
-/**
- * @brief IRQ prologue code.
- * @details This macro must be inserted at the start of all IRQ handlers
- * enabled to invoke system APIs.
- */
-#define PORT_IRQ_PROLOGUE()
-
-/**
- * @brief IRQ epilogue code.
- * @details This macro must be inserted at the end of all IRQ handlers
- * enabled to invoke system APIs.
- */
-#define PORT_IRQ_EPILOGUE() _port_irq_epilogue()
-
-/**
- * @brief IRQ handler function declaration.
- * @note @p id can be a function name or a vector number depending on the
- * port implementation.
- */
-#define PORT_IRQ_HANDLER(id) void id(void)
-
-/**
- * @brief Fast IRQ handler function declaration.
- * @note @p id can be a function name or a vector number depending on the
- * port implementation.
- */
-#define PORT_FAST_IRQ_HANDLER(id) void id(void)
-
-/**
- * @brief Performs a context switch between two threads.
- * @details This is the most critical code in any port, this function
- * is responsible for the context switch between 2 threads.
- * @note The implementation of this code affects <b>directly</b> the context
- * switch performance so optimize here as much as you can.
- *
- * @param[in] ntp the thread to be switched in
- * @param[in] otp the thread to be switched out
- */
-#define port_switch(ntp, otp) do { \
- (void)ntp; \
- (void)otp; \
- /*_port_switch(ntp, otp)*/ \
-} while (false)
-
-/*===========================================================================*/
-/* External declarations. */
-/*===========================================================================*/
-
-/* The following code is not processed when the file is included from an
- asm module.*/
-#if !defined(_FROM_ASM_)
-
-#ifdef __cplusplus
-extern "C" {
-#endif
- void _port_irq_epilogue(void);
- void _port_switch(thread_t *ntp, thread_t *otp);
- void _port_thread_start(void);
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* !defined(_FROM_ASM_) */
-
-/*===========================================================================*/
-/* Module inline functions. */
-/*===========================================================================*/
-
-/* The following code is not processed when the file is included from an
- asm module.*/
-#if !defined(_FROM_ASM_)
-
-/**
- * @brief Port-related initialization code.
- */
-static inline void port_init(void) {
-
-}
-
-/**
- * @brief Returns a word encoding the current interrupts status.
- *
- * @return The interrupts status.
- */
-static inline syssts_t port_get_irq_status(void) {
-
- return (syssts_t)0;
-}
-
-/**
- * @brief Checks the interrupt status.
- *
- * @param[in] sts the interrupt status word
- *
- * @return The interrupt status.
- * @retval false the word specified a disabled interrupts status.
- * @retval true the word specified an enabled interrupts status.
- */
-static inline bool port_irq_enabled(syssts_t sts) {
-
- (void)sts;
-
- return false;
-}
-
-/**
- * @brief Determines the current execution context.
- *
- * @return The execution context.
- * @retval false not running in ISR mode.
- * @retval true running in ISR mode.
- */
-static inline bool port_is_isr_context(void) {
-
- return false;
-}
-
-/**
- * @brief Kernel-lock action.
- */
-static inline void port_lock(void) {
-
-}
-
-/**
- * @brief Kernel-unlock action.
- */
-static inline void port_unlock(void) {
-
-}
-
-/**
- * @brief Kernel-lock action from an interrupt handler.
- */
-static inline void port_lock_from_isr(void) {
-
-}
-
-/**
- * @brief Kernel-unlock action from an interrupt handler.
- */
-static inline void port_unlock_from_isr(void) {
-
-}
-
-/**
- * @brief Disables all the interrupt sources.
- */
-static inline void port_disable(void) {
-
-}
-
-/**
- * @brief Disables the interrupt sources below kernel-level priority.
- */
-static inline void port_suspend(void) {
-
-}
-
-/**
- * @brief Enables all the interrupt sources.
- */
-static inline void port_enable(void) {
-
-}
-
-/**
- * @brief Enters an architecture-dependent IRQ-waiting mode.
- * @details The function is meant to return when an interrupt becomes pending.
- * The simplest implementation is an empty function or macro but this
- * would not take advantage of architecture-specific power saving
- * modes.
- */
-static inline void port_wait_for_interrupt(void) {
-
-}
-
-/**
- * @brief Returns the current value of the realtime counter.
- *
- * @return The realtime counter value.
- */
-static inline rtcnt_t port_rt_get_counter_value(void) {
-
- return (rtcnt_t)0;
-}
-
-#endif /* !defined(_FROM_ASM_) */
-
-/*===========================================================================*/
-/* Module late inclusions. */
-/*===========================================================================*/
-
-#if !defined(_FROM_ASM_)
-
-#if NIL_CFG_ST_TIMEDELTA > 0
-#if PORT_USE_ALT_TIMER == FALSE
-#include "nilcore_timer.h"
-#else
-#include "nilcore_timer_alt.h"
-#endif
-#endif /* NIL_CFG_ST_TIMEDELTA > 0 */
-
-#endif /* !defined(_FROM_ASM_) */
-
-#endif /* _NILCORE_H_ */
-
-/** @} */
diff --git a/os/nil/templates/nilcore_timer.h b/os/nil/templates/nilcore_timer.h
deleted file mode 100644
index 6eab4dd40..000000000
--- a/os/nil/templates/nilcore_timer.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio.
-
- This file is part of ChibiOS.
-
- ChibiOS 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.
-
- ChibiOS 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 <http://www.gnu.org/licenses/>.
-*/
-
-/**
- * @file templates/nilcore_timer.h
- * @brief System timer header file.
- *
- * @addtogroup NIL_TIMER
- * @{
- */
-
-#ifndef _NILCORE_TIMER_H_
-#define _NILCORE_TIMER_H_
-
-/*===========================================================================*/
-/* Module constants. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module pre-compile time settings. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Derived constants and error checks. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module data structures and types. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module macros. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* External declarations. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module inline functions. */
-/*===========================================================================*/
-
-/**
- * @brief Starts the alarm.
- * @note Makes sure that no spurious alarms are triggered after
- * this call.
- *
- * @param[in] abstime the time to be set for the first alarm
- *
- * @notapi
- */
-static inline void port_timer_start_alarm(systime_t abstime) {
-
- (void)abstime;
-}
-
-/**
- * @brief Stops the alarm interrupt.
- *
- * @notapi
- */
-static inline void port_timer_stop_alarm(void) {
-
-}
-
-/**
- * @brief Sets the alarm time.
- *
- * @param[in] abstime the time to be set for the next alarm
- *
- * @notapi
- */
-static inline void port_timer_set_alarm(systime_t abstime) {
-
- (void)abstime;
-}
-
-/**
- * @brief Returns the system time.
- *
- * @return The system time.
- *
- * @notapi
- */
-static inline systime_t port_timer_get_time(void) {
-
- return (systime_t)0;
-}
-
-/**
- * @brief Returns the current alarm time.
- *
- * @return The currently set alarm time.
- *
- * @notapi
- */
-static inline systime_t port_timer_get_alarm(void) {
-
- return (systime_t)0;
-}
-
-#endif /* _NILCORE_TIMER_H_ */
-
-/** @} */
diff --git a/os/nil/templates/niltypes.h b/os/nil/templates/niltypes.h
deleted file mode 100644
index 16043831b..000000000
--- a/os/nil/templates/niltypes.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio.
-
- This file is part of ChibiOS.
-
- ChibiOS 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.
-
- ChibiOS 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 <http://www.gnu.org/licenses/>.
-*/
-
-/**
- * @file templates/niltypes.h
- * @brief Port system types.
- *
- * @addtogroup NIL_TYPES
- * @{
- */
-
-#ifndef _NILTYPES_H_
-#define _NILTYPES_H_
-
-#include <stddef.h>
-#include <stdint.h>
-#include <stdbool.h>
-
-/**
- * @name Common constants
- */
-/**
- * @brief Generic 'false' boolean constant.
- */
-#if !defined(FALSE) || defined(__DOXYGEN__)
-#define FALSE 0
-#endif
-
-/**
- * @brief Generic 'true' boolean constant.
- */
-#if !defined(TRUE) || defined(__DOXYGEN__)
-#define TRUE 1
-#endif
-/** @} */
-
-typedef uint32_t syssts_t; /**< System status word. */
-typedef uint32_t rtcnt_t; /**< Realtime counter. */
-typedef uint8_t tstate_t; /**< Thread state. */
-typedef int32_t msg_t; /**< Inter-thread message. */
-typedef uint32_t eventmask_t; /**< Mask of event identifiers. */
-typedef int32_t cnt_t; /**< Generic signed counter. */
-typedef uint32_t ucnt_t; /**< Generic unsigned counter. */
-
-/**
- * @brief Type of system time.
- */
-#if (NIL_CFG_ST_RESOLUTION == 32) || defined(__DOXYGEN__)
-typedef uint32_t systime_t;
-#else
-typedef uint16_t systime_t;
-#endif
-
-/**
- * @brief ROM constant modifier.
- * @note It is set to use the "const" keyword in this port.
- */
-#define ROMCONST const
-
-/**
- * @brief Makes functions not inlineable.
- * @note If the compiler does not support such attribute then the
- * realtime counter precision could be degraded.
- */
-#define NOINLINE __attribute__((noinline))
-
-/**
- * @brief Optimized thread function declaration macro.
- */
-#define PORT_THD_FUNCTION(tname, arg) \
- __attribute__((noreturn)) void tname(void *arg)
-
-/**
- * @brief Packed variable specifier.
- */
-#define PACKED_VAR __attribute__((packed))
-
-#endif /* _NILTYPES_H_ */
-
-/** @} */