From a6bb21d05b4dd7299de9a632cf55bda7c058164e Mon Sep 17 00:00:00 2001 From: Konstantin Oblaukhov Date: Sun, 7 Oct 2018 18:37:15 +0700 Subject: KINETIS tests and demos updated to ChibiOS 18.2.x. --- testhal/KINETIS/FRDM-K20D50M/I2C/Makefile | 23 +- testhal/KINETIS/FRDM-K20D50M/I2C/chconf.h | 271 ++++++++++--- .../KINETIS/FRDM-K20D50M/I2C/halconf_community.h | 173 ++++++++ testhal/KINETIS/FRDM-K20D50M/USB_SERIAL/Makefile | 30 +- testhal/KINETIS/FRDM-K20D50M/USB_SERIAL/chconf.h | 221 +++++++++- .../FRDM-K20D50M/USB_SERIAL/halconf_community.h | 173 ++++++++ testhal/KINETIS/FRDM-KL25Z/ADC/Makefile | 40 +- testhal/KINETIS/FRDM-KL25Z/ADC/chconf.h | 271 ++++++++++--- testhal/KINETIS/FRDM-KL25Z/ADC/halconf_community.h | 173 ++++++++ testhal/KINETIS/FRDM-KL25Z/GPT/Makefile | 32 +- testhal/KINETIS/FRDM-KL25Z/GPT/chconf.h | 227 +++++++++-- testhal/KINETIS/FRDM-KL25Z/GPT/halconf_community.h | 173 ++++++++ testhal/KINETIS/FRDM-KL25Z/PWM/Makefile | 32 +- testhal/KINETIS/FRDM-KL25Z/PWM/chconf.h | 217 +++++++++- testhal/KINETIS/FRDM-KL25Z/PWM/halconf_community.h | 173 ++++++++ testhal/KINETIS/FRDM-KL25Z/USB_HID/Makefile | 40 +- testhal/KINETIS/FRDM-KL25Z/USB_HID/chconf.h | 223 ++++++++++- .../KINETIS/FRDM-KL25Z/USB_HID/halconf_community.h | 50 ++- testhal/KINETIS/FRDM-KL25Z/USB_SERIAL/Makefile | 39 +- testhal/KINETIS/FRDM-KL25Z/USB_SERIAL/chconf.h | 219 +++++++++- .../FRDM-KL25Z/USB_SERIAL/halconf_community.h | 180 +++++++++ testhal/KINETIS/FRDM-KL26Z/I2C/Makefile | 31 +- testhal/KINETIS/FRDM-KL26Z/I2C/chconf.h | 271 ++++++++++--- testhal/KINETIS/FRDM-KL26Z/I2C/halconf_community.h | 173 ++++++++ testhal/KINETIS/FRDM-KL26Z/PWM/Makefile | 32 +- testhal/KINETIS/FRDM-KL26Z/PWM/chconf.h | 217 +++++++++- testhal/KINETIS/FRDM-KL26Z/PWM/halconf_community.h | 173 ++++++++ testhal/KINETIS/FRDM-KL26Z/USB_SERIAL/Makefile | 39 +- testhal/KINETIS/FRDM-KL26Z/USB_SERIAL/chconf.h | 219 +++++++++- .../FRDM-KL26Z/USB_SERIAL/halconf_community.h | 173 ++++++++ testhal/KINETIS/KL27Z/BLINK/Makefile | 32 +- testhal/KINETIS/KL27Z/BLINK/board/board.mk | 4 + testhal/KINETIS/KL27Z/BLINK/chconf.h | 215 +++++++++- testhal/KINETIS/KL27Z/BLINK/halconf_community.h | 173 ++++++++ testhal/KINETIS/MCHCK/BOOTLOADER/Makefile | 24 +- testhal/KINETIS/MCHCK/BOOTLOADER/chconf.h | 219 +++++++++- .../KINETIS/MCHCK/BOOTLOADER/halconf_community.h | 173 ++++++++ testhal/KINETIS/MCHCK/PWM/Makefile | 24 +- testhal/KINETIS/MCHCK/PWM/chconf.h | 227 +++++++++-- testhal/KINETIS/MCHCK/PWM/halconf_community.h | 173 ++++++++ testhal/KINETIS/MCHCK/USB_SERIAL/Makefile | 32 +- testhal/KINETIS/MCHCK/USB_SERIAL/chconf.h | 236 +++++++++-- .../KINETIS/MCHCK/USB_SERIAL/halconf_community.h | 173 ++++++++ testhal/KINETIS/TEENSY3_x/ADC/Makefile | 24 +- testhal/KINETIS/TEENSY3_x/ADC/chconf.h | 227 +++++++++-- testhal/KINETIS/TEENSY3_x/ADC/halconf_community.h | 173 ++++++++ testhal/KINETIS/TEENSY3_x/EEPROM_EMU/Makefile | 27 +- testhal/KINETIS/TEENSY3_x/EEPROM_EMU/chconf.h | 215 +++++++++- .../TEENSY3_x/EEPROM_EMU/halconf_community.h | 173 ++++++++ testhal/KINETIS/TEENSY3_x/EXT/Makefile | 24 +- testhal/KINETIS/TEENSY3_x/EXT/chconf.h | 227 +++++++++-- testhal/KINETIS/TEENSY3_x/EXT/halconf_community.h | 173 ++++++++ testhal/KINETIS/TEENSY3_x/GPT/Makefile | 24 +- testhal/KINETIS/TEENSY3_x/GPT/chconf.h | 227 +++++++++-- testhal/KINETIS/TEENSY3_x/GPT/halconf_community.h | 173 ++++++++ testhal/KINETIS/TEENSY3_x/PWM/Makefile | 24 +- testhal/KINETIS/TEENSY3_x/PWM/chconf.h | 223 ++++++++++- testhal/KINETIS/TEENSY3_x/PWM/halconf_community.h | 173 ++++++++ testhal/KINETIS/TEENSY3_x/SERIAL/Makefile | 24 +- testhal/KINETIS/TEENSY3_x/SERIAL/chconf.h | 227 +++++++++-- .../KINETIS/TEENSY3_x/SERIAL/halconf_community.h | 173 ++++++++ testhal/KINETIS/TEENSY3_x/USB_SERIAL/Makefile | 444 ++++++++++----------- testhal/KINETIS/TEENSY3_x/USB_SERIAL/chconf.h | 236 +++++++++-- .../TEENSY3_x/USB_SERIAL/halconf_community.h | 173 ++++++++ testhal/KINETIS/TEENSY_LC/BOOTLOADER/Makefile | 32 +- testhal/KINETIS/TEENSY_LC/BOOTLOADER/chconf.h | 219 +++++++++- .../TEENSY_LC/BOOTLOADER/halconf_community.h | 173 ++++++++ testhal/KINETIS/TEENSY_LC/EEPROM_EMU/Makefile | 34 +- testhal/KINETIS/TEENSY_LC/EEPROM_EMU/chconf.h | 219 +++++++++- .../TEENSY_LC/EEPROM_EMU/halconf_community.h | 173 ++++++++ testhal/KINETIS/TEENSY_LC/PWM/Makefile | 32 +- testhal/KINETIS/TEENSY_LC/PWM/chconf.h | 217 +++++++++- testhal/KINETIS/TEENSY_LC/PWM/halconf_community.h | 173 ++++++++ 73 files changed, 9481 insertions(+), 1188 deletions(-) create mode 100644 testhal/KINETIS/FRDM-K20D50M/I2C/halconf_community.h create mode 100644 testhal/KINETIS/FRDM-K20D50M/USB_SERIAL/halconf_community.h create mode 100644 testhal/KINETIS/FRDM-KL25Z/ADC/halconf_community.h create mode 100644 testhal/KINETIS/FRDM-KL25Z/GPT/halconf_community.h create mode 100644 testhal/KINETIS/FRDM-KL25Z/PWM/halconf_community.h create mode 100644 testhal/KINETIS/FRDM-KL25Z/USB_SERIAL/halconf_community.h create mode 100644 testhal/KINETIS/FRDM-KL26Z/I2C/halconf_community.h create mode 100644 testhal/KINETIS/FRDM-KL26Z/PWM/halconf_community.h create mode 100644 testhal/KINETIS/FRDM-KL26Z/USB_SERIAL/halconf_community.h create mode 100644 testhal/KINETIS/KL27Z/BLINK/halconf_community.h create mode 100644 testhal/KINETIS/MCHCK/BOOTLOADER/halconf_community.h create mode 100644 testhal/KINETIS/MCHCK/PWM/halconf_community.h create mode 100644 testhal/KINETIS/MCHCK/USB_SERIAL/halconf_community.h create mode 100644 testhal/KINETIS/TEENSY3_x/ADC/halconf_community.h create mode 100644 testhal/KINETIS/TEENSY3_x/EEPROM_EMU/halconf_community.h create mode 100644 testhal/KINETIS/TEENSY3_x/EXT/halconf_community.h create mode 100644 testhal/KINETIS/TEENSY3_x/GPT/halconf_community.h create mode 100644 testhal/KINETIS/TEENSY3_x/PWM/halconf_community.h create mode 100644 testhal/KINETIS/TEENSY3_x/SERIAL/halconf_community.h create mode 100644 testhal/KINETIS/TEENSY3_x/USB_SERIAL/halconf_community.h create mode 100644 testhal/KINETIS/TEENSY_LC/BOOTLOADER/halconf_community.h create mode 100644 testhal/KINETIS/TEENSY_LC/EEPROM_EMU/halconf_community.h create mode 100644 testhal/KINETIS/TEENSY_LC/PWM/halconf_community.h (limited to 'testhal/KINETIS') diff --git a/testhal/KINETIS/FRDM-K20D50M/I2C/Makefile b/testhal/KINETIS/FRDM-K20D50M/I2C/Makefile index a4de448..e2ad0c8 100644 --- a/testhal/KINETIS/FRDM-K20D50M/I2C/Makefile +++ b/testhal/KINETIS/FRDM-K20D50M/I2C/Makefile @@ -89,6 +89,8 @@ PROJECT = ch # Imported source files and paths CHIBIOS = ../../../../../ChibiOS-RT CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib +# Licensing files. +include $(CHIBIOS)/os/license/license.mk # Startup files. include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_k20x5.mk # HAL-OSAL files (optional). @@ -106,18 +108,13 @@ LDSCRIPT= $(STARTUPLD)/MK20DX128.ld # C sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CSRC = $(STARTUPSRC) \ - $(KERNSRC) \ - $(PORTSRC) \ - $(OSALSRC) \ - $(HALSRC) \ - $(PLATFORMSRC) \ - $(BOARDSRC) \ +CSRC = $(ALLCSRC) \ + $(TESTSRC) \ main.c # C++ sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CPPSRC = +CPPSRC = $(ALLCPPSRC) # C sources to be compiled in ARM mode regardless of the global setting. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler @@ -140,13 +137,11 @@ TCSRC = TCPPSRC = # List ASM source files here -ASMSRC = -ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM) +ASMSRC = $(ALLASMSRC) +ASMXSRC = $(ALLXASMSRC) -INCDIR = $(CHIBIOS)/os/license \ - $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ - $(HALINC) $(PLATFORMINC) $(BOARDINC) \ - $(CHIBIOS)/os/various +INCDIR = $(ALLINC) $(TESTINC) \ + $(TESTHAL) # # Project, sources and paths diff --git a/testhal/KINETIS/FRDM-K20D50M/I2C/chconf.h b/testhal/KINETIS/FRDM-K20D50M/I2C/chconf.h index 5f05547..1750f63 100644 --- a/testhal/KINETIS/FRDM-K20D50M/I2C/chconf.h +++ b/testhal/KINETIS/FRDM-K20D50M/I2C/chconf.h @@ -1,5 +1,5 @@ /* - ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio + ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -25,11 +25,11 @@ * @{ */ -#ifndef _CHCONF_H_ -#define _CHCONF_H_ - -#define _CHIBIOS_RT_CONF_ -#define _CHIBIOS_RT_CONF_VER_5_0_ +#ifndef CHCONF_H +#define CHCONF_H + +#define _CHIBIOS_RT_CONF_ +#define _CHIBIOS_RT_CONF_VER_5_1_ /*===========================================================================*/ /** @@ -42,14 +42,34 @@ * @brief System time counter resolution. * @note Allowed values are 16 or 32 bits. */ +#if !defined(CH_CFG_ST_RESOLUTION) #define CH_CFG_ST_RESOLUTION 32 +#endif /** * @brief System tick frequency. * @details Frequency of the system timer that drives the system ticks. This * setting also defines the system tick time unit. */ +#if !defined(CH_CFG_ST_FREQUENCY) #define CH_CFG_ST_FREQUENCY 1000 +#endif + +/** + * @brief Time intervals data size. + * @note Allowed values are 16, 32 or 64 bits. + */ +#if !defined(CH_CFG_INTERVALS_SIZE) +#define CH_CFG_INTERVALS_SIZE 32 +#endif + +/** + * @brief Time types data size. + * @note Allowed values are 16 or 32 bits. + */ +#if !defined(CH_CFG_TIME_TYPES_SIZE) +#define CH_CFG_TIME_TYPES_SIZE 32 +#endif /** * @brief Time delta constant for the tick-less mode. @@ -59,7 +79,9 @@ * The value one is not valid, timeouts are rounded up to * this value. */ +#if !defined(CH_CFG_ST_TIMEDELTA) #define CH_CFG_ST_TIMEDELTA 0 +#endif /** @} */ @@ -82,7 +104,9 @@ * @note The round robin preemption is not supported in tickless mode and * must be set to zero in that case. */ -#define CH_CFG_TIME_QUANTUM 20 +#if !defined(CH_CFG_TIME_QUANTUM) +#define CH_CFG_TIME_QUANTUM 2 +#endif /** * @brief Managed RAM size. @@ -95,7 +119,9 @@ * provide the @p __heap_base__ and @p __heap_end__ symbols. * @note Requires @p CH_CFG_USE_MEMCORE. */ +#if !defined(CH_CFG_MEMCORE_SIZE) #define CH_CFG_MEMCORE_SIZE 0 +#endif /** * @brief Idle thread automatic spawn suppression. @@ -104,7 +130,9 @@ * function becomes the idle thread and must implement an * infinite loop. */ +#if !defined(CH_CFG_NO_IDLE_THREAD) #define CH_CFG_NO_IDLE_THREAD FALSE +#endif /** @} */ @@ -123,7 +151,9 @@ * @note This is not related to the compiler optimization options. * @note The default is @p TRUE. */ +#if !defined(CH_CFG_OPTIMIZE_SPEED) #define CH_CFG_OPTIMIZE_SPEED TRUE +#endif /** @} */ @@ -141,7 +171,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_TM) #define CH_CFG_USE_TM FALSE +#endif /** * @brief Threads registry APIs. @@ -149,7 +181,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_REGISTRY) #define CH_CFG_USE_REGISTRY TRUE +#endif /** * @brief Threads synchronization APIs. @@ -158,7 +192,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_WAITEXIT) #define CH_CFG_USE_WAITEXIT TRUE +#endif /** * @brief Semaphores APIs. @@ -166,7 +202,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_SEMAPHORES) #define CH_CFG_USE_SEMAPHORES TRUE +#endif /** * @brief Semaphores queuing mode. @@ -177,7 +215,9 @@ * requirements. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ +#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY) #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE +#endif /** * @brief Mutexes APIs. @@ -185,7 +225,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MUTEXES) #define CH_CFG_USE_MUTEXES TRUE +#endif /** * @brief Enables recursive behavior on mutexes. @@ -195,7 +237,9 @@ * @note The default is @p FALSE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE) #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE +#endif /** * @brief Conditional Variables APIs. @@ -205,7 +249,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_CONDVARS) #define CH_CFG_USE_CONDVARS TRUE +#endif /** * @brief Conditional Variables APIs with timeout. @@ -215,7 +261,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_CONDVARS. */ +#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT) #define CH_CFG_USE_CONDVARS_TIMEOUT TRUE +#endif /** * @brief Events Flags APIs. @@ -223,7 +271,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_EVENTS) #define CH_CFG_USE_EVENTS TRUE +#endif /** * @brief Events Flags APIs with timeout. @@ -233,7 +283,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_EVENTS. */ +#if !defined(CH_CFG_USE_EVENTS_TIMEOUT) #define CH_CFG_USE_EVENTS_TIMEOUT TRUE +#endif /** * @brief Synchronous Messages APIs. @@ -242,7 +294,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MESSAGES) #define CH_CFG_USE_MESSAGES TRUE +#endif /** * @brief Synchronous Messages queuing mode. @@ -253,7 +307,9 @@ * requirements. * @note Requires @p CH_CFG_USE_MESSAGES. */ +#if !defined(CH_CFG_USE_MESSAGES_PRIORITY) #define CH_CFG_USE_MESSAGES_PRIORITY FALSE +#endif /** * @brief Mailboxes APIs. @@ -263,7 +319,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ +#if !defined(CH_CFG_USE_MAILBOXES) #define CH_CFG_USE_MAILBOXES TRUE +#endif /** * @brief Core Memory Manager APIs. @@ -272,7 +330,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMCORE) #define CH_CFG_USE_MEMCORE TRUE +#endif /** * @brief Heap Allocator APIs. @@ -284,7 +344,9 @@ * @p CH_CFG_USE_SEMAPHORES. * @note Mutexes are recommended. */ +#if !defined(CH_CFG_USE_HEAP) #define CH_CFG_USE_HEAP TRUE +#endif /** * @brief Memory Pools Allocator APIs. @@ -293,7 +355,20 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMPOOLS) #define CH_CFG_USE_MEMPOOLS TRUE +#endif + +/** + * @brief Objects FIFOs APIs. + * @details If enabled then the objects FIFOs APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#if !defined(CH_CFG_USE_OBJ_FIFOS) +#define CH_CFG_USE_OBJ_FIFOS TRUE +#endif /** * @brief Dynamic Threads APIs. @@ -304,7 +379,73 @@ * @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. */ +#if !defined(CH_CFG_USE_DYNAMIC) #define CH_CFG_USE_DYNAMIC TRUE +#endif + +/** @} */ + +/*===========================================================================*/ +/** + * @name Objects factory options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Objects Factory APIs. + * @details If enabled then the objects factory APIs are included in the + * kernel. + * + * @note The default is @p FALSE. + */ +#if !defined(CH_CFG_USE_FACTORY) +#define CH_CFG_USE_FACTORY TRUE +#endif + +/** + * @brief Maximum length for object names. + * @details If the specified length is zero then the name is stored by + * pointer but this could have unintended side effects. + */ +#if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH) +#define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8 +#endif + +/** + * @brief Enables the registry of generic objects. + */ +#if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY) +#define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE +#endif + +/** + * @brief Enables factory for generic buffers. + */ +#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS) +#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE +#endif + +/** + * @brief Enables factory for semaphores. + */ +#if !defined(CH_CFG_FACTORY_SEMAPHORES) +#define CH_CFG_FACTORY_SEMAPHORES TRUE +#endif + +/** + * @brief Enables factory for mailboxes. + */ +#if !defined(CH_CFG_FACTORY_MAILBOXES) +#define CH_CFG_FACTORY_MAILBOXES TRUE +#endif + +/** + * @brief Enables factory for objects FIFOs. + */ +#if !defined(CH_CFG_FACTORY_OBJ_FIFOS) +#define CH_CFG_FACTORY_OBJ_FIFOS TRUE +#endif /** @} */ @@ -320,7 +461,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_STATISTICS) #define CH_DBG_STATISTICS FALSE +#endif /** * @brief Debug option, system state check. @@ -329,7 +472,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_SYSTEM_STATE_CHECK FALSE +#if !defined(CH_DBG_SYSTEM_STATE_CHECK) +#define CH_DBG_SYSTEM_STATE_CHECK TRUE +#endif /** * @brief Debug option, parameters checks. @@ -338,7 +483,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_ENABLE_CHECKS FALSE +#if !defined(CH_DBG_ENABLE_CHECKS) +#define CH_DBG_ENABLE_CHECKS TRUE +#endif /** * @brief Debug option, consistency checks. @@ -348,16 +495,28 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_ENABLE_ASSERTS FALSE +#if !defined(CH_DBG_ENABLE_ASSERTS) +#define CH_DBG_ENABLE_ASSERTS TRUE +#endif /** * @brief Debug option, trace buffer. - * @details If enabled then the context switch circular trace buffer is - * activated. + * @details If enabled then the trace buffer is activated. * - * @note The default is @p FALSE. + * @note The default is @p CH_DBG_TRACE_MASK_DISABLED. */ -#define CH_DBG_ENABLE_TRACE FALSE +#if !defined(CH_DBG_TRACE_MASK) +#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL +#endif + +/** + * @brief Trace buffer entries. + * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is + * different from @p CH_DBG_TRACE_MASK_DISABLED. + */ +#if !defined(CH_DBG_TRACE_BUFFER_SIZE) +#define CH_DBG_TRACE_BUFFER_SIZE 128 +#endif /** * @brief Debug option, stack checks. @@ -369,7 +528,9 @@ * @note The default failure mode is to halt the system with the global * @p panic_msg variable set to @p NULL. */ -#define CH_DBG_ENABLE_STACK_CHECK FALSE +#if !defined(CH_DBG_ENABLE_STACK_CHECK) +#define CH_DBG_ENABLE_STACK_CHECK TRUE +#endif /** * @brief Debug option, stacks initialization. @@ -379,7 +540,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_FILL_THREADS FALSE +#if !defined(CH_DBG_FILL_THREADS) +#define CH_DBG_FILL_THREADS TRUE +#endif /** * @brief Debug option, threads profiling. @@ -390,7 +553,9 @@ * @note This debug option is not currently compatible with the * tickless mode. */ +#if !defined(CH_DBG_THREADS_PROFILING) #define CH_DBG_THREADS_PROFILING FALSE +#endif /** @} */ @@ -401,6 +566,22 @@ */ /*===========================================================================*/ +/** + * @brief System structure extension. + * @details User fields added to the end of the @p ch_system_t structure. + */ +#define CH_CFG_SYSTEM_EXTRA_FIELDS \ + /* Add threads custom fields here.*/ + +/** + * @brief System initialization hook. + * @details User initialization code added to the @p chSysInit() function + * just before interrupts are enabled globally. + */ +#define CH_CFG_SYSTEM_INIT_HOOK() { \ + /* Add threads initialization code here.*/ \ +} + /** * @brief Threads descriptor structure extension. * @details User fields added to the end of the @p thread_t structure. @@ -410,9 +591,9 @@ /** * @brief Threads initialization hook. - * @details User initialization code added to the @p chThdInit() API. + * @details User initialization code added to the @p _thread_init() function. * - * @note It is invoked from within @p chThdInit() and implicitly from all + * @note It is invoked from within @p _thread_init() and implicitly from all * the threads creation APIs. */ #define CH_CFG_THREAD_INIT_HOOK(tp) { \ @@ -422,10 +603,6 @@ /** * @brief Threads finalization hook. * @details User finalization code added to the @p chThdExit() API. - * - * @note It is inserted into lock zone. - * @note It is also invoked when the threads simply return in order to - * terminate. */ #define CH_CFG_THREAD_EXIT_HOOK(tp) { \ /* Add threads finalization code here.*/ \ @@ -438,20 +615,20 @@ #define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \ /* Context switch code here.*/ \ } - -/** - * @brief ISR enter hook. - */ -#define CH_CFG_IRQ_PROLOGUE_HOOK() { \ - /* IRQ prologue code here.*/ \ -} - -/** - * @brief ISR exit hook. - */ -#define CH_CFG_IRQ_EPILOGUE_HOOK() { \ - /* IRQ epilogue code here.*/ \ -} + +/** + * @brief ISR enter hook. + */ +#define CH_CFG_IRQ_PROLOGUE_HOOK() { \ + /* IRQ prologue code here.*/ \ +} + +/** + * @brief ISR exit hook. + */ +#define CH_CFG_IRQ_EPILOGUE_HOOK() { \ + /* IRQ epilogue code here.*/ \ +} /** * @brief Idle thread enter hook. @@ -460,6 +637,7 @@ * @note This macro can be used to activate a power saving mode. */ #define CH_CFG_IDLE_ENTER_HOOK() { \ + /* Idle-enter code here.*/ \ } /** @@ -469,6 +647,7 @@ * @note This macro can be used to deactivate a power saving mode. */ #define CH_CFG_IDLE_LEAVE_HOOK() { \ + /* Idle-leave code here.*/ \ } /** @@ -496,15 +675,15 @@ #define CH_CFG_SYSTEM_HALT_HOOK(reason) { \ /* System halt code here.*/ \ } - -/** - * @brief Trace hook. - * @details This hook is invoked each time a new record is written in the - * trace buffer. - */ -#define CH_CFG_TRACE_HOOK(tep) { \ - /* Trace code here.*/ \ -} + +/** + * @brief Trace hook. + * @details This hook is invoked each time a new record is written in the + * trace buffer. + */ +#define CH_CFG_TRACE_HOOK(tep) { \ + /* Trace code here.*/ \ +} /** @} */ @@ -512,6 +691,6 @@ /* Port-specific settings (override port settings defaulted in chcore.h). */ /*===========================================================================*/ -#endif /* _CHCONF_H_ */ +#endif /* CHCONF_H */ /** @} */ diff --git a/testhal/KINETIS/FRDM-K20D50M/I2C/halconf_community.h b/testhal/KINETIS/FRDM-K20D50M/I2C/halconf_community.h new file mode 100644 index 0000000..43fdbf8 --- /dev/null +++ b/testhal/KINETIS/FRDM-K20D50M/I2C/halconf_community.h @@ -0,0 +1,173 @@ +/* + ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#ifndef HALCONF_COMMUNITY_H +#define HALCONF_COMMUNITY_H + +/** + * @brief Enables the community overlay. + */ +#if !defined(HAL_USE_COMMUNITY) || defined(__DOXYGEN__) +#define HAL_USE_COMMUNITY TRUE +#endif + +/** + * @brief Enables the FSMC subsystem. + */ +#if !defined(HAL_USE_FSMC) || defined(__DOXYGEN__) +#define HAL_USE_FSMC FALSE +#endif + +/** + * @brief Enables the NAND subsystem. + */ +#if !defined(HAL_USE_NAND) || defined(__DOXYGEN__) +#define HAL_USE_NAND FALSE +#endif + +/** + * @brief Enables the 1-wire subsystem. + */ +#if !defined(HAL_USE_ONEWIRE) || defined(__DOXYGEN__) +#define HAL_USE_ONEWIRE FALSE +#endif + +/** + * @brief Enables the EICU subsystem. + */ +#if !defined(HAL_USE_EICU) || defined(__DOXYGEN__) +#define HAL_USE_EICU FALSE +#endif + +/** + * @brief Enables the CRC subsystem. + */ +#if !defined(HAL_USE_CRC) || defined(__DOXYGEN__) +#define HAL_USE_CRC FALSE +#endif + +/** + * @brief Enables the RNG subsystem. + */ +#if !defined(HAL_USE_RNG) || defined(__DOXYGEN__) +#define HAL_USE_RNG FALSE +#endif + +/** + * @brief Enables the EEPROM subsystem. + */ +#if !defined(HAL_USE_EEPROM) || defined(__DOXYGEN__) +#define HAL_USE_EEPROM FALSE +#endif + +/** + * @brief Enables the TIMCAP subsystem. + */ +#if !defined(HAL_USE_TIMCAP) || defined(__DOXYGEN__) +#define HAL_USE_TIMCAP FALSE +#endif + +/** + * @brief Enables the TIMCAP subsystem. + */ +#if !defined(HAL_USE_COMP) || defined(__DOXYGEN__) +#define HAL_USE_COMP FALSE +#endif + +/** + * @brief Enables the QEI subsystem. + */ +#if !defined(HAL_USE_QEI) || defined(__DOXYGEN__) +#define HAL_USE_QEI FALSE +#endif + +/** + * @brief Enables the USBH subsystem. + */ +#if !defined(HAL_USE_USBH) || defined(__DOXYGEN__) +#define HAL_USE_USBH FALSE +#endif + +/** + * @brief Enables the USB_MSD subsystem. + */ +#if !defined(HAL_USE_USB_MSD) || defined(__DOXYGEN__) +#define HAL_USE_USB_MSD FALSE +#endif + +/*===========================================================================*/ +/* FSMCNAND driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables the @p nandAcquireBus() and @p nanReleaseBus() APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(NAND_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define NAND_USE_MUTUAL_EXCLUSION TRUE +#endif + +/*===========================================================================*/ +/* 1-wire driver related settings. */ +/*===========================================================================*/ +/** + * @brief Enables strong pull up feature. + * @note Disabling this option saves both code and data space. + */ +#define ONEWIRE_USE_STRONG_PULLUP FALSE + +/** + * @brief Enables search ROM feature. + * @note Disabling this option saves both code and data space. + */ +#define ONEWIRE_USE_SEARCH_ROM TRUE + +/*===========================================================================*/ +/* QEI driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables discard of overlow + */ +#if !defined(QEI_USE_OVERFLOW_DISCARD) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_DISCARD FALSE +#endif + +/** + * @brief Enables min max of overlow + */ +#if !defined(QEI_USE_OVERFLOW_MINMAX) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_MINMAX FALSE +#endif + +/*===========================================================================*/ +/* EEProm driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables 24xx series I2C eeprom device driver. + * @note Disabling this option saves both code and data space. + */ +#define EEPROM_USE_EE24XX FALSE + /** + * @brief Enables 25xx series SPI eeprom device driver. + * @note Disabling this option saves both code and data space. + */ +#define EEPROM_USE_EE25XX FALSE + +#endif /* HALCONF_COMMUNITY_H */ + +/** @} */ diff --git a/testhal/KINETIS/FRDM-K20D50M/USB_SERIAL/Makefile b/testhal/KINETIS/FRDM-K20D50M/USB_SERIAL/Makefile index a5f4c68..1f34aba 100644 --- a/testhal/KINETIS/FRDM-K20D50M/USB_SERIAL/Makefile +++ b/testhal/KINETIS/FRDM-K20D50M/USB_SERIAL/Makefile @@ -30,7 +30,7 @@ endif # Enable this if you want link time optimizations (LTO) ifeq ($(USE_LTO),) - USE_LTO = no + USE_LTO = yes endif # If enabled, this option allows to compile the application in THUMB mode. @@ -88,6 +88,8 @@ PROJECT = ch # Imported source files and paths CHIBIOS = ../../../../../ChibiOS-RT CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib +# Licensing files. +include $(CHIBIOS)/os/license/license.mk # Startup files. include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_k20x5.mk # HAL-OSAL files (optional). @@ -99,7 +101,9 @@ include $(CHIBIOS)/os/hal/osal/rt/osal.mk include $(CHIBIOS)/os/rt/rt.mk include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk # Other files (optional). -include $(CHIBIOS)/test/rt/test.mk +include $(CHIBIOS)/test/lib/test.mk +include $(CHIBIOS)/test/rt/rt_test.mk +include $(CHIBIOS)/test/oslib/oslib_test.mk include $(CHIBIOS)/os/hal/lib/streams/streams.mk include $(CHIBIOS)/os/various/shell/shell.mk @@ -108,22 +112,14 @@ LDSCRIPT= $(STARTUPLD)/MK20DX128.ld # C sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CSRC = $(STARTUPSRC) \ - $(KERNSRC) \ - $(PORTSRC) \ - $(OSALSRC) \ - $(HALSRC) \ - $(PLATFORMSRC) \ - $(BOARDSRC) \ +CSRC = $(ALLCSRC) \ $(TESTSRC) \ - $(STREAMSSRC) \ - $(SHELLSRC) \ usbcfg.c \ main.c # C++ sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CPPSRC = +CPPSRC = $(ALLCPPSRC) # C sources to be compiled in ARM mode regardless of the global setting. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler @@ -146,13 +142,11 @@ TCSRC = TCPPSRC = # List ASM source files here -ASMSRC = -ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM) +ASMSRC = $(ALLASMSRC) +ASMXSRC = $(ALLXASMSRC) -INCDIR = $(CHIBIOS)/os/license \ - $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ - $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \ - $(STREAMSINC) $(SHELLINC) $(CHIBIOS)/os/various +INCDIR = $(ALLINC) $(TESTINC) \ + $(TESTHAL) # # Project, sources and paths diff --git a/testhal/KINETIS/FRDM-K20D50M/USB_SERIAL/chconf.h b/testhal/KINETIS/FRDM-K20D50M/USB_SERIAL/chconf.h index 222c5ea..0ac7be8 100644 --- a/testhal/KINETIS/FRDM-K20D50M/USB_SERIAL/chconf.h +++ b/testhal/KINETIS/FRDM-K20D50M/USB_SERIAL/chconf.h @@ -1,5 +1,5 @@ /* - ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio + ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -25,11 +25,11 @@ * @{ */ -#ifndef _CHCONF_H_ -#define _CHCONF_H_ +#ifndef CHCONF_H +#define CHCONF_H #define _CHIBIOS_RT_CONF_ -#define _CHIBIOS_RT_CONF_VER_5_0_ +#define _CHIBIOS_RT_CONF_VER_5_1_ /*===========================================================================*/ /** @@ -42,14 +42,34 @@ * @brief System time counter resolution. * @note Allowed values are 16 or 32 bits. */ +#if !defined(CH_CFG_ST_RESOLUTION) #define CH_CFG_ST_RESOLUTION 32 +#endif /** * @brief System tick frequency. * @details Frequency of the system timer that drives the system ticks. This * setting also defines the system tick time unit. */ +#if !defined(CH_CFG_ST_FREQUENCY) #define CH_CFG_ST_FREQUENCY 1000 +#endif + +/** + * @brief Time intervals data size. + * @note Allowed values are 16, 32 or 64 bits. + */ +#if !defined(CH_CFG_INTERVALS_SIZE) +#define CH_CFG_INTERVALS_SIZE 32 +#endif + +/** + * @brief Time types data size. + * @note Allowed values are 16 or 32 bits. + */ +#if !defined(CH_CFG_TIME_TYPES_SIZE) +#define CH_CFG_TIME_TYPES_SIZE 32 +#endif /** * @brief Time delta constant for the tick-less mode. @@ -59,7 +79,9 @@ * The value one is not valid, timeouts are rounded up to * this value. */ +#if !defined(CH_CFG_ST_TIMEDELTA) #define CH_CFG_ST_TIMEDELTA 0 +#endif /** @} */ @@ -82,7 +104,9 @@ * @note The round robin preemption is not supported in tickless mode and * must be set to zero in that case. */ -#define CH_CFG_TIME_QUANTUM 20 +#if !defined(CH_CFG_TIME_QUANTUM) +#define CH_CFG_TIME_QUANTUM 2 +#endif /** * @brief Managed RAM size. @@ -95,7 +119,9 @@ * provide the @p __heap_base__ and @p __heap_end__ symbols. * @note Requires @p CH_CFG_USE_MEMCORE. */ +#if !defined(CH_CFG_MEMCORE_SIZE) #define CH_CFG_MEMCORE_SIZE 0 +#endif /** * @brief Idle thread automatic spawn suppression. @@ -104,7 +130,9 @@ * function becomes the idle thread and must implement an * infinite loop. */ +#if !defined(CH_CFG_NO_IDLE_THREAD) #define CH_CFG_NO_IDLE_THREAD FALSE +#endif /** @} */ @@ -123,7 +151,9 @@ * @note This is not related to the compiler optimization options. * @note The default is @p TRUE. */ +#if !defined(CH_CFG_OPTIMIZE_SPEED) #define CH_CFG_OPTIMIZE_SPEED TRUE +#endif /** @} */ @@ -141,7 +171,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_TM) #define CH_CFG_USE_TM FALSE +#endif /** * @brief Threads registry APIs. @@ -149,7 +181,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_REGISTRY) #define CH_CFG_USE_REGISTRY TRUE +#endif /** * @brief Threads synchronization APIs. @@ -158,7 +192,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_WAITEXIT) #define CH_CFG_USE_WAITEXIT TRUE +#endif /** * @brief Semaphores APIs. @@ -166,7 +202,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_SEMAPHORES) #define CH_CFG_USE_SEMAPHORES TRUE +#endif /** * @brief Semaphores queuing mode. @@ -177,7 +215,9 @@ * requirements. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ +#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY) #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE +#endif /** * @brief Mutexes APIs. @@ -185,7 +225,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MUTEXES) #define CH_CFG_USE_MUTEXES TRUE +#endif /** * @brief Enables recursive behavior on mutexes. @@ -195,7 +237,9 @@ * @note The default is @p FALSE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE) #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE +#endif /** * @brief Conditional Variables APIs. @@ -205,7 +249,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_CONDVARS) #define CH_CFG_USE_CONDVARS TRUE +#endif /** * @brief Conditional Variables APIs with timeout. @@ -215,7 +261,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_CONDVARS. */ +#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT) #define CH_CFG_USE_CONDVARS_TIMEOUT TRUE +#endif /** * @brief Events Flags APIs. @@ -223,7 +271,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_EVENTS) #define CH_CFG_USE_EVENTS TRUE +#endif /** * @brief Events Flags APIs with timeout. @@ -233,7 +283,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_EVENTS. */ +#if !defined(CH_CFG_USE_EVENTS_TIMEOUT) #define CH_CFG_USE_EVENTS_TIMEOUT TRUE +#endif /** * @brief Synchronous Messages APIs. @@ -242,7 +294,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MESSAGES) #define CH_CFG_USE_MESSAGES TRUE +#endif /** * @brief Synchronous Messages queuing mode. @@ -253,7 +307,9 @@ * requirements. * @note Requires @p CH_CFG_USE_MESSAGES. */ +#if !defined(CH_CFG_USE_MESSAGES_PRIORITY) #define CH_CFG_USE_MESSAGES_PRIORITY FALSE +#endif /** * @brief Mailboxes APIs. @@ -263,7 +319,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ +#if !defined(CH_CFG_USE_MAILBOXES) #define CH_CFG_USE_MAILBOXES TRUE +#endif /** * @brief Core Memory Manager APIs. @@ -272,7 +330,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMCORE) #define CH_CFG_USE_MEMCORE TRUE +#endif /** * @brief Heap Allocator APIs. @@ -284,7 +344,9 @@ * @p CH_CFG_USE_SEMAPHORES. * @note Mutexes are recommended. */ +#if !defined(CH_CFG_USE_HEAP) #define CH_CFG_USE_HEAP TRUE +#endif /** * @brief Memory Pools Allocator APIs. @@ -293,7 +355,20 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMPOOLS) #define CH_CFG_USE_MEMPOOLS TRUE +#endif + +/** + * @brief Objects FIFOs APIs. + * @details If enabled then the objects FIFOs APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#if !defined(CH_CFG_USE_OBJ_FIFOS) +#define CH_CFG_USE_OBJ_FIFOS TRUE +#endif /** * @brief Dynamic Threads APIs. @@ -304,7 +379,73 @@ * @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. */ +#if !defined(CH_CFG_USE_DYNAMIC) #define CH_CFG_USE_DYNAMIC TRUE +#endif + +/** @} */ + +/*===========================================================================*/ +/** + * @name Objects factory options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Objects Factory APIs. + * @details If enabled then the objects factory APIs are included in the + * kernel. + * + * @note The default is @p FALSE. + */ +#if !defined(CH_CFG_USE_FACTORY) +#define CH_CFG_USE_FACTORY TRUE +#endif + +/** + * @brief Maximum length for object names. + * @details If the specified length is zero then the name is stored by + * pointer but this could have unintended side effects. + */ +#if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH) +#define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8 +#endif + +/** + * @brief Enables the registry of generic objects. + */ +#if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY) +#define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE +#endif + +/** + * @brief Enables factory for generic buffers. + */ +#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS) +#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE +#endif + +/** + * @brief Enables factory for semaphores. + */ +#if !defined(CH_CFG_FACTORY_SEMAPHORES) +#define CH_CFG_FACTORY_SEMAPHORES TRUE +#endif + +/** + * @brief Enables factory for mailboxes. + */ +#if !defined(CH_CFG_FACTORY_MAILBOXES) +#define CH_CFG_FACTORY_MAILBOXES TRUE +#endif + +/** + * @brief Enables factory for objects FIFOs. + */ +#if !defined(CH_CFG_FACTORY_OBJ_FIFOS) +#define CH_CFG_FACTORY_OBJ_FIFOS TRUE +#endif /** @} */ @@ -320,7 +461,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_STATISTICS) #define CH_DBG_STATISTICS FALSE +#endif /** * @brief Debug option, system state check. @@ -329,7 +472,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_SYSTEM_STATE_CHECK FALSE +#if !defined(CH_DBG_SYSTEM_STATE_CHECK) +#define CH_DBG_SYSTEM_STATE_CHECK TRUE +#endif /** * @brief Debug option, parameters checks. @@ -338,7 +483,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_ENABLE_CHECKS FALSE +#if !defined(CH_DBG_ENABLE_CHECKS) +#define CH_DBG_ENABLE_CHECKS TRUE +#endif /** * @brief Debug option, consistency checks. @@ -348,16 +495,28 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_ENABLE_ASSERTS FALSE +#if !defined(CH_DBG_ENABLE_ASSERTS) +#define CH_DBG_ENABLE_ASSERTS TRUE +#endif /** * @brief Debug option, trace buffer. - * @details If enabled then the context switch circular trace buffer is - * activated. + * @details If enabled then the trace buffer is activated. * - * @note The default is @p FALSE. + * @note The default is @p CH_DBG_TRACE_MASK_DISABLED. + */ +#if !defined(CH_DBG_TRACE_MASK) +#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL +#endif + +/** + * @brief Trace buffer entries. + * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is + * different from @p CH_DBG_TRACE_MASK_DISABLED. */ -#define CH_DBG_ENABLE_TRACE FALSE +#if !defined(CH_DBG_TRACE_BUFFER_SIZE) +#define CH_DBG_TRACE_BUFFER_SIZE 128 +#endif /** * @brief Debug option, stack checks. @@ -369,7 +528,9 @@ * @note The default failure mode is to halt the system with the global * @p panic_msg variable set to @p NULL. */ -#define CH_DBG_ENABLE_STACK_CHECK FALSE +#if !defined(CH_DBG_ENABLE_STACK_CHECK) +#define CH_DBG_ENABLE_STACK_CHECK TRUE +#endif /** * @brief Debug option, stacks initialization. @@ -379,7 +540,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_FILL_THREADS FALSE +#if !defined(CH_DBG_FILL_THREADS) +#define CH_DBG_FILL_THREADS TRUE +#endif /** * @brief Debug option, threads profiling. @@ -390,7 +553,9 @@ * @note This debug option is not currently compatible with the * tickless mode. */ +#if !defined(CH_DBG_THREADS_PROFILING) #define CH_DBG_THREADS_PROFILING FALSE +#endif /** @} */ @@ -401,6 +566,22 @@ */ /*===========================================================================*/ +/** + * @brief System structure extension. + * @details User fields added to the end of the @p ch_system_t structure. + */ +#define CH_CFG_SYSTEM_EXTRA_FIELDS \ + /* Add threads custom fields here.*/ + +/** + * @brief System initialization hook. + * @details User initialization code added to the @p chSysInit() function + * just before interrupts are enabled globally. + */ +#define CH_CFG_SYSTEM_INIT_HOOK() { \ + /* Add threads initialization code here.*/ \ +} + /** * @brief Threads descriptor structure extension. * @details User fields added to the end of the @p thread_t structure. @@ -410,9 +591,9 @@ /** * @brief Threads initialization hook. - * @details User initialization code added to the @p chThdInit() API. + * @details User initialization code added to the @p _thread_init() function. * - * @note It is invoked from within @p chThdInit() and implicitly from all + * @note It is invoked from within @p _thread_init() and implicitly from all * the threads creation APIs. */ #define CH_CFG_THREAD_INIT_HOOK(tp) { \ @@ -422,10 +603,6 @@ /** * @brief Threads finalization hook. * @details User finalization code added to the @p chThdExit() API. - * - * @note It is inserted into lock zone. - * @note It is also invoked when the threads simply return in order to - * terminate. */ #define CH_CFG_THREAD_EXIT_HOOK(tp) { \ /* Add threads finalization code here.*/ \ @@ -460,6 +637,7 @@ * @note This macro can be used to activate a power saving mode. */ #define CH_CFG_IDLE_ENTER_HOOK() { \ + /* Idle-enter code here.*/ \ } /** @@ -469,6 +647,7 @@ * @note This macro can be used to deactivate a power saving mode. */ #define CH_CFG_IDLE_LEAVE_HOOK() { \ + /* Idle-leave code here.*/ \ } /** @@ -512,6 +691,6 @@ /* Port-specific settings (override port settings defaulted in chcore.h). */ /*===========================================================================*/ -#endif /* _CHCONF_H_ */ +#endif /* CHCONF_H */ /** @} */ diff --git a/testhal/KINETIS/FRDM-K20D50M/USB_SERIAL/halconf_community.h b/testhal/KINETIS/FRDM-K20D50M/USB_SERIAL/halconf_community.h new file mode 100644 index 0000000..43fdbf8 --- /dev/null +++ b/testhal/KINETIS/FRDM-K20D50M/USB_SERIAL/halconf_community.h @@ -0,0 +1,173 @@ +/* + ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#ifndef HALCONF_COMMUNITY_H +#define HALCONF_COMMUNITY_H + +/** + * @brief Enables the community overlay. + */ +#if !defined(HAL_USE_COMMUNITY) || defined(__DOXYGEN__) +#define HAL_USE_COMMUNITY TRUE +#endif + +/** + * @brief Enables the FSMC subsystem. + */ +#if !defined(HAL_USE_FSMC) || defined(__DOXYGEN__) +#define HAL_USE_FSMC FALSE +#endif + +/** + * @brief Enables the NAND subsystem. + */ +#if !defined(HAL_USE_NAND) || defined(__DOXYGEN__) +#define HAL_USE_NAND FALSE +#endif + +/** + * @brief Enables the 1-wire subsystem. + */ +#if !defined(HAL_USE_ONEWIRE) || defined(__DOXYGEN__) +#define HAL_USE_ONEWIRE FALSE +#endif + +/** + * @brief Enables the EICU subsystem. + */ +#if !defined(HAL_USE_EICU) || defined(__DOXYGEN__) +#define HAL_USE_EICU FALSE +#endif + +/** + * @brief Enables the CRC subsystem. + */ +#if !defined(HAL_USE_CRC) || defined(__DOXYGEN__) +#define HAL_USE_CRC FALSE +#endif + +/** + * @brief Enables the RNG subsystem. + */ +#if !defined(HAL_USE_RNG) || defined(__DOXYGEN__) +#define HAL_USE_RNG FALSE +#endif + +/** + * @brief Enables the EEPROM subsystem. + */ +#if !defined(HAL_USE_EEPROM) || defined(__DOXYGEN__) +#define HAL_USE_EEPROM FALSE +#endif + +/** + * @brief Enables the TIMCAP subsystem. + */ +#if !defined(HAL_USE_TIMCAP) || defined(__DOXYGEN__) +#define HAL_USE_TIMCAP FALSE +#endif + +/** + * @brief Enables the TIMCAP subsystem. + */ +#if !defined(HAL_USE_COMP) || defined(__DOXYGEN__) +#define HAL_USE_COMP FALSE +#endif + +/** + * @brief Enables the QEI subsystem. + */ +#if !defined(HAL_USE_QEI) || defined(__DOXYGEN__) +#define HAL_USE_QEI FALSE +#endif + +/** + * @brief Enables the USBH subsystem. + */ +#if !defined(HAL_USE_USBH) || defined(__DOXYGEN__) +#define HAL_USE_USBH FALSE +#endif + +/** + * @brief Enables the USB_MSD subsystem. + */ +#if !defined(HAL_USE_USB_MSD) || defined(__DOXYGEN__) +#define HAL_USE_USB_MSD FALSE +#endif + +/*===========================================================================*/ +/* FSMCNAND driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables the @p nandAcquireBus() and @p nanReleaseBus() APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(NAND_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define NAND_USE_MUTUAL_EXCLUSION TRUE +#endif + +/*===========================================================================*/ +/* 1-wire driver related settings. */ +/*===========================================================================*/ +/** + * @brief Enables strong pull up feature. + * @note Disabling this option saves both code and data space. + */ +#define ONEWIRE_USE_STRONG_PULLUP FALSE + +/** + * @brief Enables search ROM feature. + * @note Disabling this option saves both code and data space. + */ +#define ONEWIRE_USE_SEARCH_ROM TRUE + +/*===========================================================================*/ +/* QEI driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables discard of overlow + */ +#if !defined(QEI_USE_OVERFLOW_DISCARD) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_DISCARD FALSE +#endif + +/** + * @brief Enables min max of overlow + */ +#if !defined(QEI_USE_OVERFLOW_MINMAX) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_MINMAX FALSE +#endif + +/*===========================================================================*/ +/* EEProm driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables 24xx series I2C eeprom device driver. + * @note Disabling this option saves both code and data space. + */ +#define EEPROM_USE_EE24XX FALSE + /** + * @brief Enables 25xx series SPI eeprom device driver. + * @note Disabling this option saves both code and data space. + */ +#define EEPROM_USE_EE25XX FALSE + +#endif /* HALCONF_COMMUNITY_H */ + +/** @} */ diff --git a/testhal/KINETIS/FRDM-KL25Z/ADC/Makefile b/testhal/KINETIS/FRDM-KL25Z/ADC/Makefile index d5120b9..0a813ec 100644 --- a/testhal/KINETIS/FRDM-KL25Z/ADC/Makefile +++ b/testhal/KINETIS/FRDM-KL25Z/ADC/Makefile @@ -5,12 +5,12 @@ # Compiler options here. ifeq ($(USE_OPT),) - USE_OPT = -O0 -ggdb -fomit-frame-pointer -falign-functions=16 + USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16 endif # C specific options here (added to USE_OPT). ifeq ($(USE_COPT),) - USE_COPT = -std=gnu99 + USE_COPT = endif # C++ specific options here (added to USE_OPT). @@ -30,7 +30,7 @@ endif # Enable this if you want link time optimizations (LTO) ifeq ($(USE_LTO),) - USE_LTO = no + USE_LTO = yes endif # If enabled, this option allows to compile the application in THUMB mode. @@ -69,6 +69,11 @@ ifeq ($(USE_EXCEPTIONS_STACKSIZE),) USE_EXCEPTIONS_STACKSIZE = 0x400 endif +# Enables the use of FPU on Cortex-M4 (no, softfp, hard). +ifeq ($(USE_FPU),) + USE_FPU = no +endif + # # Architecture or project specific options ############################################################################## @@ -83,32 +88,32 @@ PROJECT = ch # Imported source files and paths CHIBIOS = ../../../../../ChibiOS-RT CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib - +# Licensing files. +include $(CHIBIOS)/os/license/license.mk +# Startup files. include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_kl2x.mk +# HAL-OSAL files (optional). include $(CHIBIOS)/os/hal/hal.mk include $(CHIBIOS_CONTRIB)/os/hal/ports/KINETIS/KL2x/platform.mk include $(CHIBIOS_CONTRIB)/os/hal/boards/FREESCALE_FREEDOM_KL25Z/board.mk include $(CHIBIOS)/os/hal/osal/rt/osal.mk +# RTOS files (optional). include $(CHIBIOS)/os/rt/rt.mk include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk +# Other files (optional). # Define linker script file here LDSCRIPT= $(STARTUPLD)/MKL2xZ128.ld # C sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CSRC = $(STARTUPSRC) \ - $(KERNSRC) \ - $(PORTSRC) \ - $(OSALSRC) \ - $(HALSRC) \ - $(PLATFORMSRC) \ - $(BOARDSRC) \ +CSRC = $(ALLCSRC) \ + $(TESTSRC) \ main.c # C++ sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CPPSRC = +CPPSRC = $(ALLCPPSRC) # C sources to be compiled in ARM mode regardless of the global setting. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler @@ -131,13 +136,11 @@ TCSRC = TCPPSRC = # List ASM source files here -ASMSRC = -ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM) +ASMSRC = $(ALLASMSRC) +ASMXSRC = $(ALLXASMSRC) -INCDIR = $(CHIBIOS)/os/license \ - $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ - $(HALINC) $(PLATFORMINC) $(BOARDINC) \ - $(CHIBIOS)/os/various +INCDIR = $(ALLINC) $(TESTINC) \ + $(TESTHAL) # # Project, sources and paths @@ -160,6 +163,7 @@ LD = $(TRGT)gcc #LD = $(TRGT)g++ CP = $(TRGT)objcopy AS = $(TRGT)gcc -x assembler-with-cpp +AR = $(TRGT)ar OD = $(TRGT)objdump SZ = $(TRGT)size HEX = $(CP) -O ihex diff --git a/testhal/KINETIS/FRDM-KL25Z/ADC/chconf.h b/testhal/KINETIS/FRDM-KL25Z/ADC/chconf.h index 5f05547..1750f63 100644 --- a/testhal/KINETIS/FRDM-KL25Z/ADC/chconf.h +++ b/testhal/KINETIS/FRDM-KL25Z/ADC/chconf.h @@ -1,5 +1,5 @@ /* - ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio + ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -25,11 +25,11 @@ * @{ */ -#ifndef _CHCONF_H_ -#define _CHCONF_H_ - -#define _CHIBIOS_RT_CONF_ -#define _CHIBIOS_RT_CONF_VER_5_0_ +#ifndef CHCONF_H +#define CHCONF_H + +#define _CHIBIOS_RT_CONF_ +#define _CHIBIOS_RT_CONF_VER_5_1_ /*===========================================================================*/ /** @@ -42,14 +42,34 @@ * @brief System time counter resolution. * @note Allowed values are 16 or 32 bits. */ +#if !defined(CH_CFG_ST_RESOLUTION) #define CH_CFG_ST_RESOLUTION 32 +#endif /** * @brief System tick frequency. * @details Frequency of the system timer that drives the system ticks. This * setting also defines the system tick time unit. */ +#if !defined(CH_CFG_ST_FREQUENCY) #define CH_CFG_ST_FREQUENCY 1000 +#endif + +/** + * @brief Time intervals data size. + * @note Allowed values are 16, 32 or 64 bits. + */ +#if !defined(CH_CFG_INTERVALS_SIZE) +#define CH_CFG_INTERVALS_SIZE 32 +#endif + +/** + * @brief Time types data size. + * @note Allowed values are 16 or 32 bits. + */ +#if !defined(CH_CFG_TIME_TYPES_SIZE) +#define CH_CFG_TIME_TYPES_SIZE 32 +#endif /** * @brief Time delta constant for the tick-less mode. @@ -59,7 +79,9 @@ * The value one is not valid, timeouts are rounded up to * this value. */ +#if !defined(CH_CFG_ST_TIMEDELTA) #define CH_CFG_ST_TIMEDELTA 0 +#endif /** @} */ @@ -82,7 +104,9 @@ * @note The round robin preemption is not supported in tickless mode and * must be set to zero in that case. */ -#define CH_CFG_TIME_QUANTUM 20 +#if !defined(CH_CFG_TIME_QUANTUM) +#define CH_CFG_TIME_QUANTUM 2 +#endif /** * @brief Managed RAM size. @@ -95,7 +119,9 @@ * provide the @p __heap_base__ and @p __heap_end__ symbols. * @note Requires @p CH_CFG_USE_MEMCORE. */ +#if !defined(CH_CFG_MEMCORE_SIZE) #define CH_CFG_MEMCORE_SIZE 0 +#endif /** * @brief Idle thread automatic spawn suppression. @@ -104,7 +130,9 @@ * function becomes the idle thread and must implement an * infinite loop. */ +#if !defined(CH_CFG_NO_IDLE_THREAD) #define CH_CFG_NO_IDLE_THREAD FALSE +#endif /** @} */ @@ -123,7 +151,9 @@ * @note This is not related to the compiler optimization options. * @note The default is @p TRUE. */ +#if !defined(CH_CFG_OPTIMIZE_SPEED) #define CH_CFG_OPTIMIZE_SPEED TRUE +#endif /** @} */ @@ -141,7 +171,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_TM) #define CH_CFG_USE_TM FALSE +#endif /** * @brief Threads registry APIs. @@ -149,7 +181,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_REGISTRY) #define CH_CFG_USE_REGISTRY TRUE +#endif /** * @brief Threads synchronization APIs. @@ -158,7 +192,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_WAITEXIT) #define CH_CFG_USE_WAITEXIT TRUE +#endif /** * @brief Semaphores APIs. @@ -166,7 +202,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_SEMAPHORES) #define CH_CFG_USE_SEMAPHORES TRUE +#endif /** * @brief Semaphores queuing mode. @@ -177,7 +215,9 @@ * requirements. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ +#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY) #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE +#endif /** * @brief Mutexes APIs. @@ -185,7 +225,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MUTEXES) #define CH_CFG_USE_MUTEXES TRUE +#endif /** * @brief Enables recursive behavior on mutexes. @@ -195,7 +237,9 @@ * @note The default is @p FALSE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE) #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE +#endif /** * @brief Conditional Variables APIs. @@ -205,7 +249,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_CONDVARS) #define CH_CFG_USE_CONDVARS TRUE +#endif /** * @brief Conditional Variables APIs with timeout. @@ -215,7 +261,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_CONDVARS. */ +#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT) #define CH_CFG_USE_CONDVARS_TIMEOUT TRUE +#endif /** * @brief Events Flags APIs. @@ -223,7 +271,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_EVENTS) #define CH_CFG_USE_EVENTS TRUE +#endif /** * @brief Events Flags APIs with timeout. @@ -233,7 +283,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_EVENTS. */ +#if !defined(CH_CFG_USE_EVENTS_TIMEOUT) #define CH_CFG_USE_EVENTS_TIMEOUT TRUE +#endif /** * @brief Synchronous Messages APIs. @@ -242,7 +294,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MESSAGES) #define CH_CFG_USE_MESSAGES TRUE +#endif /** * @brief Synchronous Messages queuing mode. @@ -253,7 +307,9 @@ * requirements. * @note Requires @p CH_CFG_USE_MESSAGES. */ +#if !defined(CH_CFG_USE_MESSAGES_PRIORITY) #define CH_CFG_USE_MESSAGES_PRIORITY FALSE +#endif /** * @brief Mailboxes APIs. @@ -263,7 +319,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ +#if !defined(CH_CFG_USE_MAILBOXES) #define CH_CFG_USE_MAILBOXES TRUE +#endif /** * @brief Core Memory Manager APIs. @@ -272,7 +330,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMCORE) #define CH_CFG_USE_MEMCORE TRUE +#endif /** * @brief Heap Allocator APIs. @@ -284,7 +344,9 @@ * @p CH_CFG_USE_SEMAPHORES. * @note Mutexes are recommended. */ +#if !defined(CH_CFG_USE_HEAP) #define CH_CFG_USE_HEAP TRUE +#endif /** * @brief Memory Pools Allocator APIs. @@ -293,7 +355,20 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMPOOLS) #define CH_CFG_USE_MEMPOOLS TRUE +#endif + +/** + * @brief Objects FIFOs APIs. + * @details If enabled then the objects FIFOs APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#if !defined(CH_CFG_USE_OBJ_FIFOS) +#define CH_CFG_USE_OBJ_FIFOS TRUE +#endif /** * @brief Dynamic Threads APIs. @@ -304,7 +379,73 @@ * @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. */ +#if !defined(CH_CFG_USE_DYNAMIC) #define CH_CFG_USE_DYNAMIC TRUE +#endif + +/** @} */ + +/*===========================================================================*/ +/** + * @name Objects factory options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Objects Factory APIs. + * @details If enabled then the objects factory APIs are included in the + * kernel. + * + * @note The default is @p FALSE. + */ +#if !defined(CH_CFG_USE_FACTORY) +#define CH_CFG_USE_FACTORY TRUE +#endif + +/** + * @brief Maximum length for object names. + * @details If the specified length is zero then the name is stored by + * pointer but this could have unintended side effects. + */ +#if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH) +#define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8 +#endif + +/** + * @brief Enables the registry of generic objects. + */ +#if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY) +#define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE +#endif + +/** + * @brief Enables factory for generic buffers. + */ +#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS) +#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE +#endif + +/** + * @brief Enables factory for semaphores. + */ +#if !defined(CH_CFG_FACTORY_SEMAPHORES) +#define CH_CFG_FACTORY_SEMAPHORES TRUE +#endif + +/** + * @brief Enables factory for mailboxes. + */ +#if !defined(CH_CFG_FACTORY_MAILBOXES) +#define CH_CFG_FACTORY_MAILBOXES TRUE +#endif + +/** + * @brief Enables factory for objects FIFOs. + */ +#if !defined(CH_CFG_FACTORY_OBJ_FIFOS) +#define CH_CFG_FACTORY_OBJ_FIFOS TRUE +#endif /** @} */ @@ -320,7 +461,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_STATISTICS) #define CH_DBG_STATISTICS FALSE +#endif /** * @brief Debug option, system state check. @@ -329,7 +472,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_SYSTEM_STATE_CHECK FALSE +#if !defined(CH_DBG_SYSTEM_STATE_CHECK) +#define CH_DBG_SYSTEM_STATE_CHECK TRUE +#endif /** * @brief Debug option, parameters checks. @@ -338,7 +483,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_ENABLE_CHECKS FALSE +#if !defined(CH_DBG_ENABLE_CHECKS) +#define CH_DBG_ENABLE_CHECKS TRUE +#endif /** * @brief Debug option, consistency checks. @@ -348,16 +495,28 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_ENABLE_ASSERTS FALSE +#if !defined(CH_DBG_ENABLE_ASSERTS) +#define CH_DBG_ENABLE_ASSERTS TRUE +#endif /** * @brief Debug option, trace buffer. - * @details If enabled then the context switch circular trace buffer is - * activated. + * @details If enabled then the trace buffer is activated. * - * @note The default is @p FALSE. + * @note The default is @p CH_DBG_TRACE_MASK_DISABLED. */ -#define CH_DBG_ENABLE_TRACE FALSE +#if !defined(CH_DBG_TRACE_MASK) +#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL +#endif + +/** + * @brief Trace buffer entries. + * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is + * different from @p CH_DBG_TRACE_MASK_DISABLED. + */ +#if !defined(CH_DBG_TRACE_BUFFER_SIZE) +#define CH_DBG_TRACE_BUFFER_SIZE 128 +#endif /** * @brief Debug option, stack checks. @@ -369,7 +528,9 @@ * @note The default failure mode is to halt the system with the global * @p panic_msg variable set to @p NULL. */ -#define CH_DBG_ENABLE_STACK_CHECK FALSE +#if !defined(CH_DBG_ENABLE_STACK_CHECK) +#define CH_DBG_ENABLE_STACK_CHECK TRUE +#endif /** * @brief Debug option, stacks initialization. @@ -379,7 +540,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_FILL_THREADS FALSE +#if !defined(CH_DBG_FILL_THREADS) +#define CH_DBG_FILL_THREADS TRUE +#endif /** * @brief Debug option, threads profiling. @@ -390,7 +553,9 @@ * @note This debug option is not currently compatible with the * tickless mode. */ +#if !defined(CH_DBG_THREADS_PROFILING) #define CH_DBG_THREADS_PROFILING FALSE +#endif /** @} */ @@ -401,6 +566,22 @@ */ /*===========================================================================*/ +/** + * @brief System structure extension. + * @details User fields added to the end of the @p ch_system_t structure. + */ +#define CH_CFG_SYSTEM_EXTRA_FIELDS \ + /* Add threads custom fields here.*/ + +/** + * @brief System initialization hook. + * @details User initialization code added to the @p chSysInit() function + * just before interrupts are enabled globally. + */ +#define CH_CFG_SYSTEM_INIT_HOOK() { \ + /* Add threads initialization code here.*/ \ +} + /** * @brief Threads descriptor structure extension. * @details User fields added to the end of the @p thread_t structure. @@ -410,9 +591,9 @@ /** * @brief Threads initialization hook. - * @details User initialization code added to the @p chThdInit() API. + * @details User initialization code added to the @p _thread_init() function. * - * @note It is invoked from within @p chThdInit() and implicitly from all + * @note It is invoked from within @p _thread_init() and implicitly from all * the threads creation APIs. */ #define CH_CFG_THREAD_INIT_HOOK(tp) { \ @@ -422,10 +603,6 @@ /** * @brief Threads finalization hook. * @details User finalization code added to the @p chThdExit() API. - * - * @note It is inserted into lock zone. - * @note It is also invoked when the threads simply return in order to - * terminate. */ #define CH_CFG_THREAD_EXIT_HOOK(tp) { \ /* Add threads finalization code here.*/ \ @@ -438,20 +615,20 @@ #define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \ /* Context switch code here.*/ \ } - -/** - * @brief ISR enter hook. - */ -#define CH_CFG_IRQ_PROLOGUE_HOOK() { \ - /* IRQ prologue code here.*/ \ -} - -/** - * @brief ISR exit hook. - */ -#define CH_CFG_IRQ_EPILOGUE_HOOK() { \ - /* IRQ epilogue code here.*/ \ -} + +/** + * @brief ISR enter hook. + */ +#define CH_CFG_IRQ_PROLOGUE_HOOK() { \ + /* IRQ prologue code here.*/ \ +} + +/** + * @brief ISR exit hook. + */ +#define CH_CFG_IRQ_EPILOGUE_HOOK() { \ + /* IRQ epilogue code here.*/ \ +} /** * @brief Idle thread enter hook. @@ -460,6 +637,7 @@ * @note This macro can be used to activate a power saving mode. */ #define CH_CFG_IDLE_ENTER_HOOK() { \ + /* Idle-enter code here.*/ \ } /** @@ -469,6 +647,7 @@ * @note This macro can be used to deactivate a power saving mode. */ #define CH_CFG_IDLE_LEAVE_HOOK() { \ + /* Idle-leave code here.*/ \ } /** @@ -496,15 +675,15 @@ #define CH_CFG_SYSTEM_HALT_HOOK(reason) { \ /* System halt code here.*/ \ } - -/** - * @brief Trace hook. - * @details This hook is invoked each time a new record is written in the - * trace buffer. - */ -#define CH_CFG_TRACE_HOOK(tep) { \ - /* Trace code here.*/ \ -} + +/** + * @brief Trace hook. + * @details This hook is invoked each time a new record is written in the + * trace buffer. + */ +#define CH_CFG_TRACE_HOOK(tep) { \ + /* Trace code here.*/ \ +} /** @} */ @@ -512,6 +691,6 @@ /* Port-specific settings (override port settings defaulted in chcore.h). */ /*===========================================================================*/ -#endif /* _CHCONF_H_ */ +#endif /* CHCONF_H */ /** @} */ diff --git a/testhal/KINETIS/FRDM-KL25Z/ADC/halconf_community.h b/testhal/KINETIS/FRDM-KL25Z/ADC/halconf_community.h new file mode 100644 index 0000000..43fdbf8 --- /dev/null +++ b/testhal/KINETIS/FRDM-KL25Z/ADC/halconf_community.h @@ -0,0 +1,173 @@ +/* + ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#ifndef HALCONF_COMMUNITY_H +#define HALCONF_COMMUNITY_H + +/** + * @brief Enables the community overlay. + */ +#if !defined(HAL_USE_COMMUNITY) || defined(__DOXYGEN__) +#define HAL_USE_COMMUNITY TRUE +#endif + +/** + * @brief Enables the FSMC subsystem. + */ +#if !defined(HAL_USE_FSMC) || defined(__DOXYGEN__) +#define HAL_USE_FSMC FALSE +#endif + +/** + * @brief Enables the NAND subsystem. + */ +#if !defined(HAL_USE_NAND) || defined(__DOXYGEN__) +#define HAL_USE_NAND FALSE +#endif + +/** + * @brief Enables the 1-wire subsystem. + */ +#if !defined(HAL_USE_ONEWIRE) || defined(__DOXYGEN__) +#define HAL_USE_ONEWIRE FALSE +#endif + +/** + * @brief Enables the EICU subsystem. + */ +#if !defined(HAL_USE_EICU) || defined(__DOXYGEN__) +#define HAL_USE_EICU FALSE +#endif + +/** + * @brief Enables the CRC subsystem. + */ +#if !defined(HAL_USE_CRC) || defined(__DOXYGEN__) +#define HAL_USE_CRC FALSE +#endif + +/** + * @brief Enables the RNG subsystem. + */ +#if !defined(HAL_USE_RNG) || defined(__DOXYGEN__) +#define HAL_USE_RNG FALSE +#endif + +/** + * @brief Enables the EEPROM subsystem. + */ +#if !defined(HAL_USE_EEPROM) || defined(__DOXYGEN__) +#define HAL_USE_EEPROM FALSE +#endif + +/** + * @brief Enables the TIMCAP subsystem. + */ +#if !defined(HAL_USE_TIMCAP) || defined(__DOXYGEN__) +#define HAL_USE_TIMCAP FALSE +#endif + +/** + * @brief Enables the TIMCAP subsystem. + */ +#if !defined(HAL_USE_COMP) || defined(__DOXYGEN__) +#define HAL_USE_COMP FALSE +#endif + +/** + * @brief Enables the QEI subsystem. + */ +#if !defined(HAL_USE_QEI) || defined(__DOXYGEN__) +#define HAL_USE_QEI FALSE +#endif + +/** + * @brief Enables the USBH subsystem. + */ +#if !defined(HAL_USE_USBH) || defined(__DOXYGEN__) +#define HAL_USE_USBH FALSE +#endif + +/** + * @brief Enables the USB_MSD subsystem. + */ +#if !defined(HAL_USE_USB_MSD) || defined(__DOXYGEN__) +#define HAL_USE_USB_MSD FALSE +#endif + +/*===========================================================================*/ +/* FSMCNAND driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables the @p nandAcquireBus() and @p nanReleaseBus() APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(NAND_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define NAND_USE_MUTUAL_EXCLUSION TRUE +#endif + +/*===========================================================================*/ +/* 1-wire driver related settings. */ +/*===========================================================================*/ +/** + * @brief Enables strong pull up feature. + * @note Disabling this option saves both code and data space. + */ +#define ONEWIRE_USE_STRONG_PULLUP FALSE + +/** + * @brief Enables search ROM feature. + * @note Disabling this option saves both code and data space. + */ +#define ONEWIRE_USE_SEARCH_ROM TRUE + +/*===========================================================================*/ +/* QEI driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables discard of overlow + */ +#if !defined(QEI_USE_OVERFLOW_DISCARD) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_DISCARD FALSE +#endif + +/** + * @brief Enables min max of overlow + */ +#if !defined(QEI_USE_OVERFLOW_MINMAX) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_MINMAX FALSE +#endif + +/*===========================================================================*/ +/* EEProm driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables 24xx series I2C eeprom device driver. + * @note Disabling this option saves both code and data space. + */ +#define EEPROM_USE_EE24XX FALSE + /** + * @brief Enables 25xx series SPI eeprom device driver. + * @note Disabling this option saves both code and data space. + */ +#define EEPROM_USE_EE25XX FALSE + +#endif /* HALCONF_COMMUNITY_H */ + +/** @} */ diff --git a/testhal/KINETIS/FRDM-KL25Z/GPT/Makefile b/testhal/KINETIS/FRDM-KL25Z/GPT/Makefile index 8ea9026..0a813ec 100644 --- a/testhal/KINETIS/FRDM-KL25Z/GPT/Makefile +++ b/testhal/KINETIS/FRDM-KL25Z/GPT/Makefile @@ -5,7 +5,7 @@ # Compiler options here. ifeq ($(USE_OPT),) - USE_OPT = -O0 -ggdb -fomit-frame-pointer -falign-functions=16 + USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16 endif # C specific options here (added to USE_OPT). @@ -30,7 +30,7 @@ endif # Enable this if you want link time optimizations (LTO) ifeq ($(USE_LTO),) - USE_LTO = no + USE_LTO = yes endif # If enabled, this option allows to compile the application in THUMB mode. @@ -69,6 +69,11 @@ ifeq ($(USE_EXCEPTIONS_STACKSIZE),) USE_EXCEPTIONS_STACKSIZE = 0x400 endif +# Enables the use of FPU on Cortex-M4 (no, softfp, hard). +ifeq ($(USE_FPU),) + USE_FPU = no +endif + # # Architecture or project specific options ############################################################################## @@ -83,6 +88,8 @@ PROJECT = ch # Imported source files and paths CHIBIOS = ../../../../../ChibiOS-RT CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib +# Licensing files. +include $(CHIBIOS)/os/license/license.mk # Startup files. include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_kl2x.mk # HAL-OSAL files (optional). @@ -94,25 +101,19 @@ include $(CHIBIOS)/os/hal/osal/rt/osal.mk include $(CHIBIOS)/os/rt/rt.mk include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk # Other files (optional). -include $(CHIBIOS)/test/rt/test.mk # Define linker script file here LDSCRIPT= $(STARTUPLD)/MKL2xZ128.ld # C sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CSRC = $(STARTUPSRC) \ - $(KERNSRC) \ - $(PORTSRC) \ - $(OSALSRC) \ - $(HALSRC) \ - $(PLATFORMSRC) \ - $(BOARDSRC) \ +CSRC = $(ALLCSRC) \ + $(TESTSRC) \ main.c # C++ sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CPPSRC = +CPPSRC = $(ALLCPPSRC) # C sources to be compiled in ARM mode regardless of the global setting. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler @@ -135,12 +136,11 @@ TCSRC = TCPPSRC = # List ASM source files here -ASMSRC = -ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM) +ASMSRC = $(ALLASMSRC) +ASMXSRC = $(ALLXASMSRC) -INCDIR = $(CHIBIOS)/os/license \ - $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ - $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) +INCDIR = $(ALLINC) $(TESTINC) \ + $(TESTHAL) # # Project, sources and paths diff --git a/testhal/KINETIS/FRDM-KL25Z/GPT/chconf.h b/testhal/KINETIS/FRDM-KL25Z/GPT/chconf.h index 5d231c8..1750f63 100644 --- a/testhal/KINETIS/FRDM-KL25Z/GPT/chconf.h +++ b/testhal/KINETIS/FRDM-KL25Z/GPT/chconf.h @@ -1,5 +1,5 @@ /* - ChibiOS - (C) 2015-2016 flabbergast + ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -15,19 +15,21 @@ */ /** - * @file FRDM-KL25Z/GPT/chconf.h - * @brief Configuration file. + * @file templates/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 config * @details Kernel related settings and hooks. * @{ */ -#ifndef _CHCONF_H_ -#define _CHCONF_H_ +#ifndef CHCONF_H +#define CHCONF_H #define _CHIBIOS_RT_CONF_ -#define _CHIBIOS_RT_CONF_VER_5_0_ +#define _CHIBIOS_RT_CONF_VER_5_1_ /*===========================================================================*/ /** @@ -40,14 +42,34 @@ * @brief System time counter resolution. * @note Allowed values are 16 or 32 bits. */ +#if !defined(CH_CFG_ST_RESOLUTION) #define CH_CFG_ST_RESOLUTION 32 +#endif /** * @brief System tick frequency. * @details Frequency of the system timer that drives the system ticks. This * setting also defines the system tick time unit. */ +#if !defined(CH_CFG_ST_FREQUENCY) #define CH_CFG_ST_FREQUENCY 1000 +#endif + +/** + * @brief Time intervals data size. + * @note Allowed values are 16, 32 or 64 bits. + */ +#if !defined(CH_CFG_INTERVALS_SIZE) +#define CH_CFG_INTERVALS_SIZE 32 +#endif + +/** + * @brief Time types data size. + * @note Allowed values are 16 or 32 bits. + */ +#if !defined(CH_CFG_TIME_TYPES_SIZE) +#define CH_CFG_TIME_TYPES_SIZE 32 +#endif /** * @brief Time delta constant for the tick-less mode. @@ -57,7 +79,9 @@ * The value one is not valid, timeouts are rounded up to * this value. */ +#if !defined(CH_CFG_ST_TIMEDELTA) #define CH_CFG_ST_TIMEDELTA 0 +#endif /** @} */ @@ -80,7 +104,9 @@ * @note The round robin preemption is not supported in tickless mode and * must be set to zero in that case. */ -#define CH_CFG_TIME_QUANTUM 20 +#if !defined(CH_CFG_TIME_QUANTUM) +#define CH_CFG_TIME_QUANTUM 2 +#endif /** * @brief Managed RAM size. @@ -93,7 +119,9 @@ * provide the @p __heap_base__ and @p __heap_end__ symbols. * @note Requires @p CH_CFG_USE_MEMCORE. */ +#if !defined(CH_CFG_MEMCORE_SIZE) #define CH_CFG_MEMCORE_SIZE 0 +#endif /** * @brief Idle thread automatic spawn suppression. @@ -102,7 +130,9 @@ * function becomes the idle thread and must implement an * infinite loop. */ +#if !defined(CH_CFG_NO_IDLE_THREAD) #define CH_CFG_NO_IDLE_THREAD FALSE +#endif /** @} */ @@ -121,7 +151,9 @@ * @note This is not related to the compiler optimization options. * @note The default is @p TRUE. */ +#if !defined(CH_CFG_OPTIMIZE_SPEED) #define CH_CFG_OPTIMIZE_SPEED TRUE +#endif /** @} */ @@ -139,7 +171,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_TM) #define CH_CFG_USE_TM FALSE +#endif /** * @brief Threads registry APIs. @@ -147,7 +181,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_REGISTRY) #define CH_CFG_USE_REGISTRY TRUE +#endif /** * @brief Threads synchronization APIs. @@ -156,7 +192,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_WAITEXIT) #define CH_CFG_USE_WAITEXIT TRUE +#endif /** * @brief Semaphores APIs. @@ -164,7 +202,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_SEMAPHORES) #define CH_CFG_USE_SEMAPHORES TRUE +#endif /** * @brief Semaphores queuing mode. @@ -175,7 +215,9 @@ * requirements. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ +#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY) #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE +#endif /** * @brief Mutexes APIs. @@ -183,7 +225,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MUTEXES) #define CH_CFG_USE_MUTEXES TRUE +#endif /** * @brief Enables recursive behavior on mutexes. @@ -193,7 +237,9 @@ * @note The default is @p FALSE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE) #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE +#endif /** * @brief Conditional Variables APIs. @@ -203,7 +249,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_CONDVARS) #define CH_CFG_USE_CONDVARS TRUE +#endif /** * @brief Conditional Variables APIs with timeout. @@ -213,7 +261,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_CONDVARS. */ +#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT) #define CH_CFG_USE_CONDVARS_TIMEOUT TRUE +#endif /** * @brief Events Flags APIs. @@ -221,7 +271,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_EVENTS) #define CH_CFG_USE_EVENTS TRUE +#endif /** * @brief Events Flags APIs with timeout. @@ -231,7 +283,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_EVENTS. */ +#if !defined(CH_CFG_USE_EVENTS_TIMEOUT) #define CH_CFG_USE_EVENTS_TIMEOUT TRUE +#endif /** * @brief Synchronous Messages APIs. @@ -240,7 +294,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MESSAGES) #define CH_CFG_USE_MESSAGES TRUE +#endif /** * @brief Synchronous Messages queuing mode. @@ -251,7 +307,9 @@ * requirements. * @note Requires @p CH_CFG_USE_MESSAGES. */ +#if !defined(CH_CFG_USE_MESSAGES_PRIORITY) #define CH_CFG_USE_MESSAGES_PRIORITY FALSE +#endif /** * @brief Mailboxes APIs. @@ -261,7 +319,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ +#if !defined(CH_CFG_USE_MAILBOXES) #define CH_CFG_USE_MAILBOXES TRUE +#endif /** * @brief Core Memory Manager APIs. @@ -270,7 +330,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMCORE) #define CH_CFG_USE_MEMCORE TRUE +#endif /** * @brief Heap Allocator APIs. @@ -282,7 +344,9 @@ * @p CH_CFG_USE_SEMAPHORES. * @note Mutexes are recommended. */ +#if !defined(CH_CFG_USE_HEAP) #define CH_CFG_USE_HEAP TRUE +#endif /** * @brief Memory Pools Allocator APIs. @@ -291,7 +355,20 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMPOOLS) #define CH_CFG_USE_MEMPOOLS TRUE +#endif + +/** + * @brief Objects FIFOs APIs. + * @details If enabled then the objects FIFOs APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#if !defined(CH_CFG_USE_OBJ_FIFOS) +#define CH_CFG_USE_OBJ_FIFOS TRUE +#endif /** * @brief Dynamic Threads APIs. @@ -302,7 +379,73 @@ * @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. */ +#if !defined(CH_CFG_USE_DYNAMIC) #define CH_CFG_USE_DYNAMIC TRUE +#endif + +/** @} */ + +/*===========================================================================*/ +/** + * @name Objects factory options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Objects Factory APIs. + * @details If enabled then the objects factory APIs are included in the + * kernel. + * + * @note The default is @p FALSE. + */ +#if !defined(CH_CFG_USE_FACTORY) +#define CH_CFG_USE_FACTORY TRUE +#endif + +/** + * @brief Maximum length for object names. + * @details If the specified length is zero then the name is stored by + * pointer but this could have unintended side effects. + */ +#if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH) +#define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8 +#endif + +/** + * @brief Enables the registry of generic objects. + */ +#if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY) +#define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE +#endif + +/** + * @brief Enables factory for generic buffers. + */ +#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS) +#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE +#endif + +/** + * @brief Enables factory for semaphores. + */ +#if !defined(CH_CFG_FACTORY_SEMAPHORES) +#define CH_CFG_FACTORY_SEMAPHORES TRUE +#endif + +/** + * @brief Enables factory for mailboxes. + */ +#if !defined(CH_CFG_FACTORY_MAILBOXES) +#define CH_CFG_FACTORY_MAILBOXES TRUE +#endif + +/** + * @brief Enables factory for objects FIFOs. + */ +#if !defined(CH_CFG_FACTORY_OBJ_FIFOS) +#define CH_CFG_FACTORY_OBJ_FIFOS TRUE +#endif /** @} */ @@ -318,7 +461,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_STATISTICS) #define CH_DBG_STATISTICS FALSE +#endif /** * @brief Debug option, system state check. @@ -327,7 +472,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_SYSTEM_STATE_CHECK FALSE +#if !defined(CH_DBG_SYSTEM_STATE_CHECK) +#define CH_DBG_SYSTEM_STATE_CHECK TRUE +#endif /** * @brief Debug option, parameters checks. @@ -336,7 +483,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_ENABLE_CHECKS FALSE +#if !defined(CH_DBG_ENABLE_CHECKS) +#define CH_DBG_ENABLE_CHECKS TRUE +#endif /** * @brief Debug option, consistency checks. @@ -346,16 +495,28 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_ENABLE_ASSERTS FALSE +#if !defined(CH_DBG_ENABLE_ASSERTS) +#define CH_DBG_ENABLE_ASSERTS TRUE +#endif /** * @brief Debug option, trace buffer. - * @details If enabled then the context switch circular trace buffer is - * activated. + * @details If enabled then the trace buffer is activated. * - * @note The default is @p FALSE. + * @note The default is @p CH_DBG_TRACE_MASK_DISABLED. + */ +#if !defined(CH_DBG_TRACE_MASK) +#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL +#endif + +/** + * @brief Trace buffer entries. + * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is + * different from @p CH_DBG_TRACE_MASK_DISABLED. */ -#define CH_DBG_ENABLE_TRACE FALSE +#if !defined(CH_DBG_TRACE_BUFFER_SIZE) +#define CH_DBG_TRACE_BUFFER_SIZE 128 +#endif /** * @brief Debug option, stack checks. @@ -367,7 +528,9 @@ * @note The default failure mode is to halt the system with the global * @p panic_msg variable set to @p NULL. */ -#define CH_DBG_ENABLE_STACK_CHECK FALSE +#if !defined(CH_DBG_ENABLE_STACK_CHECK) +#define CH_DBG_ENABLE_STACK_CHECK TRUE +#endif /** * @brief Debug option, stacks initialization. @@ -377,7 +540,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_FILL_THREADS FALSE +#if !defined(CH_DBG_FILL_THREADS) +#define CH_DBG_FILL_THREADS TRUE +#endif /** * @brief Debug option, threads profiling. @@ -388,7 +553,9 @@ * @note This debug option is not currently compatible with the * tickless mode. */ +#if !defined(CH_DBG_THREADS_PROFILING) #define CH_DBG_THREADS_PROFILING FALSE +#endif /** @} */ @@ -399,6 +566,22 @@ */ /*===========================================================================*/ +/** + * @brief System structure extension. + * @details User fields added to the end of the @p ch_system_t structure. + */ +#define CH_CFG_SYSTEM_EXTRA_FIELDS \ + /* Add threads custom fields here.*/ + +/** + * @brief System initialization hook. + * @details User initialization code added to the @p chSysInit() function + * just before interrupts are enabled globally. + */ +#define CH_CFG_SYSTEM_INIT_HOOK() { \ + /* Add threads initialization code here.*/ \ +} + /** * @brief Threads descriptor structure extension. * @details User fields added to the end of the @p thread_t structure. @@ -408,9 +591,9 @@ /** * @brief Threads initialization hook. - * @details User initialization code added to the @p chThdInit() API. + * @details User initialization code added to the @p _thread_init() function. * - * @note It is invoked from within @p chThdInit() and implicitly from all + * @note It is invoked from within @p _thread_init() and implicitly from all * the threads creation APIs. */ #define CH_CFG_THREAD_INIT_HOOK(tp) { \ @@ -420,10 +603,6 @@ /** * @brief Threads finalization hook. * @details User finalization code added to the @p chThdExit() API. - * - * @note It is inserted into lock zone. - * @note It is also invoked when the threads simply return in order to - * terminate. */ #define CH_CFG_THREAD_EXIT_HOOK(tp) { \ /* Add threads finalization code here.*/ \ @@ -458,6 +637,7 @@ * @note This macro can be used to activate a power saving mode. */ #define CH_CFG_IDLE_ENTER_HOOK() { \ + /* Idle-enter code here.*/ \ } /** @@ -467,6 +647,7 @@ * @note This macro can be used to deactivate a power saving mode. */ #define CH_CFG_IDLE_LEAVE_HOOK() { \ + /* Idle-leave code here.*/ \ } /** @@ -510,6 +691,6 @@ /* Port-specific settings (override port settings defaulted in chcore.h). */ /*===========================================================================*/ -#endif /* _CHCONF_H_ */ +#endif /* CHCONF_H */ /** @} */ diff --git a/testhal/KINETIS/FRDM-KL25Z/GPT/halconf_community.h b/testhal/KINETIS/FRDM-KL25Z/GPT/halconf_community.h new file mode 100644 index 0000000..43fdbf8 --- /dev/null +++ b/testhal/KINETIS/FRDM-KL25Z/GPT/halconf_community.h @@ -0,0 +1,173 @@ +/* + ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#ifndef HALCONF_COMMUNITY_H +#define HALCONF_COMMUNITY_H + +/** + * @brief Enables the community overlay. + */ +#if !defined(HAL_USE_COMMUNITY) || defined(__DOXYGEN__) +#define HAL_USE_COMMUNITY TRUE +#endif + +/** + * @brief Enables the FSMC subsystem. + */ +#if !defined(HAL_USE_FSMC) || defined(__DOXYGEN__) +#define HAL_USE_FSMC FALSE +#endif + +/** + * @brief Enables the NAND subsystem. + */ +#if !defined(HAL_USE_NAND) || defined(__DOXYGEN__) +#define HAL_USE_NAND FALSE +#endif + +/** + * @brief Enables the 1-wire subsystem. + */ +#if !defined(HAL_USE_ONEWIRE) || defined(__DOXYGEN__) +#define HAL_USE_ONEWIRE FALSE +#endif + +/** + * @brief Enables the EICU subsystem. + */ +#if !defined(HAL_USE_EICU) || defined(__DOXYGEN__) +#define HAL_USE_EICU FALSE +#endif + +/** + * @brief Enables the CRC subsystem. + */ +#if !defined(HAL_USE_CRC) || defined(__DOXYGEN__) +#define HAL_USE_CRC FALSE +#endif + +/** + * @brief Enables the RNG subsystem. + */ +#if !defined(HAL_USE_RNG) || defined(__DOXYGEN__) +#define HAL_USE_RNG FALSE +#endif + +/** + * @brief Enables the EEPROM subsystem. + */ +#if !defined(HAL_USE_EEPROM) || defined(__DOXYGEN__) +#define HAL_USE_EEPROM FALSE +#endif + +/** + * @brief Enables the TIMCAP subsystem. + */ +#if !defined(HAL_USE_TIMCAP) || defined(__DOXYGEN__) +#define HAL_USE_TIMCAP FALSE +#endif + +/** + * @brief Enables the TIMCAP subsystem. + */ +#if !defined(HAL_USE_COMP) || defined(__DOXYGEN__) +#define HAL_USE_COMP FALSE +#endif + +/** + * @brief Enables the QEI subsystem. + */ +#if !defined(HAL_USE_QEI) || defined(__DOXYGEN__) +#define HAL_USE_QEI FALSE +#endif + +/** + * @brief Enables the USBH subsystem. + */ +#if !defined(HAL_USE_USBH) || defined(__DOXYGEN__) +#define HAL_USE_USBH FALSE +#endif + +/** + * @brief Enables the USB_MSD subsystem. + */ +#if !defined(HAL_USE_USB_MSD) || defined(__DOXYGEN__) +#define HAL_USE_USB_MSD FALSE +#endif + +/*===========================================================================*/ +/* FSMCNAND driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables the @p nandAcquireBus() and @p nanReleaseBus() APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(NAND_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define NAND_USE_MUTUAL_EXCLUSION TRUE +#endif + +/*===========================================================================*/ +/* 1-wire driver related settings. */ +/*===========================================================================*/ +/** + * @brief Enables strong pull up feature. + * @note Disabling this option saves both code and data space. + */ +#define ONEWIRE_USE_STRONG_PULLUP FALSE + +/** + * @brief Enables search ROM feature. + * @note Disabling this option saves both code and data space. + */ +#define ONEWIRE_USE_SEARCH_ROM TRUE + +/*===========================================================================*/ +/* QEI driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables discard of overlow + */ +#if !defined(QEI_USE_OVERFLOW_DISCARD) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_DISCARD FALSE +#endif + +/** + * @brief Enables min max of overlow + */ +#if !defined(QEI_USE_OVERFLOW_MINMAX) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_MINMAX FALSE +#endif + +/*===========================================================================*/ +/* EEProm driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables 24xx series I2C eeprom device driver. + * @note Disabling this option saves both code and data space. + */ +#define EEPROM_USE_EE24XX FALSE + /** + * @brief Enables 25xx series SPI eeprom device driver. + * @note Disabling this option saves both code and data space. + */ +#define EEPROM_USE_EE25XX FALSE + +#endif /* HALCONF_COMMUNITY_H */ + +/** @} */ diff --git a/testhal/KINETIS/FRDM-KL25Z/PWM/Makefile b/testhal/KINETIS/FRDM-KL25Z/PWM/Makefile index 8ea9026..0a813ec 100644 --- a/testhal/KINETIS/FRDM-KL25Z/PWM/Makefile +++ b/testhal/KINETIS/FRDM-KL25Z/PWM/Makefile @@ -5,7 +5,7 @@ # Compiler options here. ifeq ($(USE_OPT),) - USE_OPT = -O0 -ggdb -fomit-frame-pointer -falign-functions=16 + USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16 endif # C specific options here (added to USE_OPT). @@ -30,7 +30,7 @@ endif # Enable this if you want link time optimizations (LTO) ifeq ($(USE_LTO),) - USE_LTO = no + USE_LTO = yes endif # If enabled, this option allows to compile the application in THUMB mode. @@ -69,6 +69,11 @@ ifeq ($(USE_EXCEPTIONS_STACKSIZE),) USE_EXCEPTIONS_STACKSIZE = 0x400 endif +# Enables the use of FPU on Cortex-M4 (no, softfp, hard). +ifeq ($(USE_FPU),) + USE_FPU = no +endif + # # Architecture or project specific options ############################################################################## @@ -83,6 +88,8 @@ PROJECT = ch # Imported source files and paths CHIBIOS = ../../../../../ChibiOS-RT CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib +# Licensing files. +include $(CHIBIOS)/os/license/license.mk # Startup files. include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_kl2x.mk # HAL-OSAL files (optional). @@ -94,25 +101,19 @@ include $(CHIBIOS)/os/hal/osal/rt/osal.mk include $(CHIBIOS)/os/rt/rt.mk include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk # Other files (optional). -include $(CHIBIOS)/test/rt/test.mk # Define linker script file here LDSCRIPT= $(STARTUPLD)/MKL2xZ128.ld # C sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CSRC = $(STARTUPSRC) \ - $(KERNSRC) \ - $(PORTSRC) \ - $(OSALSRC) \ - $(HALSRC) \ - $(PLATFORMSRC) \ - $(BOARDSRC) \ +CSRC = $(ALLCSRC) \ + $(TESTSRC) \ main.c # C++ sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CPPSRC = +CPPSRC = $(ALLCPPSRC) # C sources to be compiled in ARM mode regardless of the global setting. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler @@ -135,12 +136,11 @@ TCSRC = TCPPSRC = # List ASM source files here -ASMSRC = -ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM) +ASMSRC = $(ALLASMSRC) +ASMXSRC = $(ALLXASMSRC) -INCDIR = $(CHIBIOS)/os/license \ - $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ - $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) +INCDIR = $(ALLINC) $(TESTINC) \ + $(TESTHAL) # # Project, sources and paths diff --git a/testhal/KINETIS/FRDM-KL25Z/PWM/chconf.h b/testhal/KINETIS/FRDM-KL25Z/PWM/chconf.h index 2a25a25..1750f63 100644 --- a/testhal/KINETIS/FRDM-KL25Z/PWM/chconf.h +++ b/testhal/KINETIS/FRDM-KL25Z/PWM/chconf.h @@ -1,5 +1,5 @@ /* - ChibiOS - (C) 2015-2016 flabbergast + ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -15,19 +15,21 @@ */ /** - * @file FRDM-KL25Z/PWM/chconf.h - * @brief Configuration file. + * @file templates/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 config * @details Kernel related settings and hooks. * @{ */ -#ifndef _CHCONF_H_ -#define _CHCONF_H_ +#ifndef CHCONF_H +#define CHCONF_H #define _CHIBIOS_RT_CONF_ -#define _CHIBIOS_RT_CONF_VER_5_0_ +#define _CHIBIOS_RT_CONF_VER_5_1_ /*===========================================================================*/ /** @@ -40,14 +42,34 @@ * @brief System time counter resolution. * @note Allowed values are 16 or 32 bits. */ +#if !defined(CH_CFG_ST_RESOLUTION) #define CH_CFG_ST_RESOLUTION 32 +#endif /** * @brief System tick frequency. * @details Frequency of the system timer that drives the system ticks. This * setting also defines the system tick time unit. */ +#if !defined(CH_CFG_ST_FREQUENCY) #define CH_CFG_ST_FREQUENCY 1000 +#endif + +/** + * @brief Time intervals data size. + * @note Allowed values are 16, 32 or 64 bits. + */ +#if !defined(CH_CFG_INTERVALS_SIZE) +#define CH_CFG_INTERVALS_SIZE 32 +#endif + +/** + * @brief Time types data size. + * @note Allowed values are 16 or 32 bits. + */ +#if !defined(CH_CFG_TIME_TYPES_SIZE) +#define CH_CFG_TIME_TYPES_SIZE 32 +#endif /** * @brief Time delta constant for the tick-less mode. @@ -57,7 +79,9 @@ * The value one is not valid, timeouts are rounded up to * this value. */ +#if !defined(CH_CFG_ST_TIMEDELTA) #define CH_CFG_ST_TIMEDELTA 0 +#endif /** @} */ @@ -80,7 +104,9 @@ * @note The round robin preemption is not supported in tickless mode and * must be set to zero in that case. */ -#define CH_CFG_TIME_QUANTUM 20 +#if !defined(CH_CFG_TIME_QUANTUM) +#define CH_CFG_TIME_QUANTUM 2 +#endif /** * @brief Managed RAM size. @@ -93,7 +119,9 @@ * provide the @p __heap_base__ and @p __heap_end__ symbols. * @note Requires @p CH_CFG_USE_MEMCORE. */ +#if !defined(CH_CFG_MEMCORE_SIZE) #define CH_CFG_MEMCORE_SIZE 0 +#endif /** * @brief Idle thread automatic spawn suppression. @@ -102,7 +130,9 @@ * function becomes the idle thread and must implement an * infinite loop. */ +#if !defined(CH_CFG_NO_IDLE_THREAD) #define CH_CFG_NO_IDLE_THREAD FALSE +#endif /** @} */ @@ -121,7 +151,9 @@ * @note This is not related to the compiler optimization options. * @note The default is @p TRUE. */ +#if !defined(CH_CFG_OPTIMIZE_SPEED) #define CH_CFG_OPTIMIZE_SPEED TRUE +#endif /** @} */ @@ -139,7 +171,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_TM) #define CH_CFG_USE_TM FALSE +#endif /** * @brief Threads registry APIs. @@ -147,7 +181,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_REGISTRY) #define CH_CFG_USE_REGISTRY TRUE +#endif /** * @brief Threads synchronization APIs. @@ -156,7 +192,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_WAITEXIT) #define CH_CFG_USE_WAITEXIT TRUE +#endif /** * @brief Semaphores APIs. @@ -164,7 +202,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_SEMAPHORES) #define CH_CFG_USE_SEMAPHORES TRUE +#endif /** * @brief Semaphores queuing mode. @@ -175,7 +215,9 @@ * requirements. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ +#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY) #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE +#endif /** * @brief Mutexes APIs. @@ -183,7 +225,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MUTEXES) #define CH_CFG_USE_MUTEXES TRUE +#endif /** * @brief Enables recursive behavior on mutexes. @@ -193,7 +237,9 @@ * @note The default is @p FALSE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE) #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE +#endif /** * @brief Conditional Variables APIs. @@ -203,7 +249,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_CONDVARS) #define CH_CFG_USE_CONDVARS TRUE +#endif /** * @brief Conditional Variables APIs with timeout. @@ -213,7 +261,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_CONDVARS. */ +#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT) #define CH_CFG_USE_CONDVARS_TIMEOUT TRUE +#endif /** * @brief Events Flags APIs. @@ -221,7 +271,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_EVENTS) #define CH_CFG_USE_EVENTS TRUE +#endif /** * @brief Events Flags APIs with timeout. @@ -231,7 +283,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_EVENTS. */ +#if !defined(CH_CFG_USE_EVENTS_TIMEOUT) #define CH_CFG_USE_EVENTS_TIMEOUT TRUE +#endif /** * @brief Synchronous Messages APIs. @@ -240,7 +294,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MESSAGES) #define CH_CFG_USE_MESSAGES TRUE +#endif /** * @brief Synchronous Messages queuing mode. @@ -251,7 +307,9 @@ * requirements. * @note Requires @p CH_CFG_USE_MESSAGES. */ +#if !defined(CH_CFG_USE_MESSAGES_PRIORITY) #define CH_CFG_USE_MESSAGES_PRIORITY FALSE +#endif /** * @brief Mailboxes APIs. @@ -261,7 +319,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ +#if !defined(CH_CFG_USE_MAILBOXES) #define CH_CFG_USE_MAILBOXES TRUE +#endif /** * @brief Core Memory Manager APIs. @@ -270,7 +330,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMCORE) #define CH_CFG_USE_MEMCORE TRUE +#endif /** * @brief Heap Allocator APIs. @@ -282,7 +344,9 @@ * @p CH_CFG_USE_SEMAPHORES. * @note Mutexes are recommended. */ +#if !defined(CH_CFG_USE_HEAP) #define CH_CFG_USE_HEAP TRUE +#endif /** * @brief Memory Pools Allocator APIs. @@ -291,7 +355,20 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMPOOLS) #define CH_CFG_USE_MEMPOOLS TRUE +#endif + +/** + * @brief Objects FIFOs APIs. + * @details If enabled then the objects FIFOs APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#if !defined(CH_CFG_USE_OBJ_FIFOS) +#define CH_CFG_USE_OBJ_FIFOS TRUE +#endif /** * @brief Dynamic Threads APIs. @@ -302,7 +379,73 @@ * @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. */ +#if !defined(CH_CFG_USE_DYNAMIC) #define CH_CFG_USE_DYNAMIC TRUE +#endif + +/** @} */ + +/*===========================================================================*/ +/** + * @name Objects factory options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Objects Factory APIs. + * @details If enabled then the objects factory APIs are included in the + * kernel. + * + * @note The default is @p FALSE. + */ +#if !defined(CH_CFG_USE_FACTORY) +#define CH_CFG_USE_FACTORY TRUE +#endif + +/** + * @brief Maximum length for object names. + * @details If the specified length is zero then the name is stored by + * pointer but this could have unintended side effects. + */ +#if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH) +#define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8 +#endif + +/** + * @brief Enables the registry of generic objects. + */ +#if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY) +#define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE +#endif + +/** + * @brief Enables factory for generic buffers. + */ +#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS) +#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE +#endif + +/** + * @brief Enables factory for semaphores. + */ +#if !defined(CH_CFG_FACTORY_SEMAPHORES) +#define CH_CFG_FACTORY_SEMAPHORES TRUE +#endif + +/** + * @brief Enables factory for mailboxes. + */ +#if !defined(CH_CFG_FACTORY_MAILBOXES) +#define CH_CFG_FACTORY_MAILBOXES TRUE +#endif + +/** + * @brief Enables factory for objects FIFOs. + */ +#if !defined(CH_CFG_FACTORY_OBJ_FIFOS) +#define CH_CFG_FACTORY_OBJ_FIFOS TRUE +#endif /** @} */ @@ -318,7 +461,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_STATISTICS) #define CH_DBG_STATISTICS FALSE +#endif /** * @brief Debug option, system state check. @@ -327,7 +472,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_SYSTEM_STATE_CHECK) #define CH_DBG_SYSTEM_STATE_CHECK TRUE +#endif /** * @brief Debug option, parameters checks. @@ -336,7 +483,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_ENABLE_CHECKS) #define CH_DBG_ENABLE_CHECKS TRUE +#endif /** * @brief Debug option, consistency checks. @@ -346,16 +495,28 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_ENABLE_ASSERTS) #define CH_DBG_ENABLE_ASSERTS TRUE +#endif /** * @brief Debug option, trace buffer. - * @details If enabled then the context switch circular trace buffer is - * activated. + * @details If enabled then the trace buffer is activated. * - * @note The default is @p FALSE. + * @note The default is @p CH_DBG_TRACE_MASK_DISABLED. + */ +#if !defined(CH_DBG_TRACE_MASK) +#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL +#endif + +/** + * @brief Trace buffer entries. + * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is + * different from @p CH_DBG_TRACE_MASK_DISABLED. */ -#define CH_DBG_ENABLE_TRACE TRUE +#if !defined(CH_DBG_TRACE_BUFFER_SIZE) +#define CH_DBG_TRACE_BUFFER_SIZE 128 +#endif /** * @brief Debug option, stack checks. @@ -367,7 +528,9 @@ * @note The default failure mode is to halt the system with the global * @p panic_msg variable set to @p NULL. */ +#if !defined(CH_DBG_ENABLE_STACK_CHECK) #define CH_DBG_ENABLE_STACK_CHECK TRUE +#endif /** * @brief Debug option, stacks initialization. @@ -377,7 +540,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_FILL_THREADS) #define CH_DBG_FILL_THREADS TRUE +#endif /** * @brief Debug option, threads profiling. @@ -388,7 +553,9 @@ * @note This debug option is not currently compatible with the * tickless mode. */ +#if !defined(CH_DBG_THREADS_PROFILING) #define CH_DBG_THREADS_PROFILING FALSE +#endif /** @} */ @@ -399,6 +566,22 @@ */ /*===========================================================================*/ +/** + * @brief System structure extension. + * @details User fields added to the end of the @p ch_system_t structure. + */ +#define CH_CFG_SYSTEM_EXTRA_FIELDS \ + /* Add threads custom fields here.*/ + +/** + * @brief System initialization hook. + * @details User initialization code added to the @p chSysInit() function + * just before interrupts are enabled globally. + */ +#define CH_CFG_SYSTEM_INIT_HOOK() { \ + /* Add threads initialization code here.*/ \ +} + /** * @brief Threads descriptor structure extension. * @details User fields added to the end of the @p thread_t structure. @@ -408,9 +591,9 @@ /** * @brief Threads initialization hook. - * @details User initialization code added to the @p chThdInit() API. + * @details User initialization code added to the @p _thread_init() function. * - * @note It is invoked from within @p chThdInit() and implicitly from all + * @note It is invoked from within @p _thread_init() and implicitly from all * the threads creation APIs. */ #define CH_CFG_THREAD_INIT_HOOK(tp) { \ @@ -420,10 +603,6 @@ /** * @brief Threads finalization hook. * @details User finalization code added to the @p chThdExit() API. - * - * @note It is inserted into lock zone. - * @note It is also invoked when the threads simply return in order to - * terminate. */ #define CH_CFG_THREAD_EXIT_HOOK(tp) { \ /* Add threads finalization code here.*/ \ @@ -458,6 +637,7 @@ * @note This macro can be used to activate a power saving mode. */ #define CH_CFG_IDLE_ENTER_HOOK() { \ + /* Idle-enter code here.*/ \ } /** @@ -467,6 +647,7 @@ * @note This macro can be used to deactivate a power saving mode. */ #define CH_CFG_IDLE_LEAVE_HOOK() { \ + /* Idle-leave code here.*/ \ } /** @@ -510,6 +691,6 @@ /* Port-specific settings (override port settings defaulted in chcore.h). */ /*===========================================================================*/ -#endif /* _CHCONF_H_ */ +#endif /* CHCONF_H */ /** @} */ diff --git a/testhal/KINETIS/FRDM-KL25Z/PWM/halconf_community.h b/testhal/KINETIS/FRDM-KL25Z/PWM/halconf_community.h new file mode 100644 index 0000000..43fdbf8 --- /dev/null +++ b/testhal/KINETIS/FRDM-KL25Z/PWM/halconf_community.h @@ -0,0 +1,173 @@ +/* + ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#ifndef HALCONF_COMMUNITY_H +#define HALCONF_COMMUNITY_H + +/** + * @brief Enables the community overlay. + */ +#if !defined(HAL_USE_COMMUNITY) || defined(__DOXYGEN__) +#define HAL_USE_COMMUNITY TRUE +#endif + +/** + * @brief Enables the FSMC subsystem. + */ +#if !defined(HAL_USE_FSMC) || defined(__DOXYGEN__) +#define HAL_USE_FSMC FALSE +#endif + +/** + * @brief Enables the NAND subsystem. + */ +#if !defined(HAL_USE_NAND) || defined(__DOXYGEN__) +#define HAL_USE_NAND FALSE +#endif + +/** + * @brief Enables the 1-wire subsystem. + */ +#if !defined(HAL_USE_ONEWIRE) || defined(__DOXYGEN__) +#define HAL_USE_ONEWIRE FALSE +#endif + +/** + * @brief Enables the EICU subsystem. + */ +#if !defined(HAL_USE_EICU) || defined(__DOXYGEN__) +#define HAL_USE_EICU FALSE +#endif + +/** + * @brief Enables the CRC subsystem. + */ +#if !defined(HAL_USE_CRC) || defined(__DOXYGEN__) +#define HAL_USE_CRC FALSE +#endif + +/** + * @brief Enables the RNG subsystem. + */ +#if !defined(HAL_USE_RNG) || defined(__DOXYGEN__) +#define HAL_USE_RNG FALSE +#endif + +/** + * @brief Enables the EEPROM subsystem. + */ +#if !defined(HAL_USE_EEPROM) || defined(__DOXYGEN__) +#define HAL_USE_EEPROM FALSE +#endif + +/** + * @brief Enables the TIMCAP subsystem. + */ +#if !defined(HAL_USE_TIMCAP) || defined(__DOXYGEN__) +#define HAL_USE_TIMCAP FALSE +#endif + +/** + * @brief Enables the TIMCAP subsystem. + */ +#if !defined(HAL_USE_COMP) || defined(__DOXYGEN__) +#define HAL_USE_COMP FALSE +#endif + +/** + * @brief Enables the QEI subsystem. + */ +#if !defined(HAL_USE_QEI) || defined(__DOXYGEN__) +#define HAL_USE_QEI FALSE +#endif + +/** + * @brief Enables the USBH subsystem. + */ +#if !defined(HAL_USE_USBH) || defined(__DOXYGEN__) +#define HAL_USE_USBH FALSE +#endif + +/** + * @brief Enables the USB_MSD subsystem. + */ +#if !defined(HAL_USE_USB_MSD) || defined(__DOXYGEN__) +#define HAL_USE_USB_MSD FALSE +#endif + +/*===========================================================================*/ +/* FSMCNAND driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables the @p nandAcquireBus() and @p nanReleaseBus() APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(NAND_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define NAND_USE_MUTUAL_EXCLUSION TRUE +#endif + +/*===========================================================================*/ +/* 1-wire driver related settings. */ +/*===========================================================================*/ +/** + * @brief Enables strong pull up feature. + * @note Disabling this option saves both code and data space. + */ +#define ONEWIRE_USE_STRONG_PULLUP FALSE + +/** + * @brief Enables search ROM feature. + * @note Disabling this option saves both code and data space. + */ +#define ONEWIRE_USE_SEARCH_ROM TRUE + +/*===========================================================================*/ +/* QEI driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables discard of overlow + */ +#if !defined(QEI_USE_OVERFLOW_DISCARD) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_DISCARD FALSE +#endif + +/** + * @brief Enables min max of overlow + */ +#if !defined(QEI_USE_OVERFLOW_MINMAX) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_MINMAX FALSE +#endif + +/*===========================================================================*/ +/* EEProm driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables 24xx series I2C eeprom device driver. + * @note Disabling this option saves both code and data space. + */ +#define EEPROM_USE_EE24XX FALSE + /** + * @brief Enables 25xx series SPI eeprom device driver. + * @note Disabling this option saves both code and data space. + */ +#define EEPROM_USE_EE25XX FALSE + +#endif /* HALCONF_COMMUNITY_H */ + +/** @} */ diff --git a/testhal/KINETIS/FRDM-KL25Z/USB_HID/Makefile b/testhal/KINETIS/FRDM-KL25Z/USB_HID/Makefile index 39c7ccd..3c25877 100644 --- a/testhal/KINETIS/FRDM-KL25Z/USB_HID/Makefile +++ b/testhal/KINETIS/FRDM-KL25Z/USB_HID/Makefile @@ -5,7 +5,7 @@ # Compiler options here. ifeq ($(USE_OPT),) - USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16 --specs=nosys.specs -lnosys + USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16 endif # C specific options here (added to USE_OPT). @@ -30,7 +30,7 @@ endif # Enable this if you want link time optimizations (LTO) ifeq ($(USE_LTO),) - USE_LTO = no + USE_LTO = yes endif # If enabled, this option allows to compile the application in THUMB mode. @@ -69,6 +69,11 @@ ifeq ($(USE_EXCEPTIONS_STACKSIZE),) USE_EXCEPTIONS_STACKSIZE = 0x400 endif +# Enables the use of FPU on Cortex-M4 (no, softfp, hard). +ifeq ($(USE_FPU),) + USE_FPU = no +endif + # # Architecture or project specific options ############################################################################## @@ -83,6 +88,8 @@ PROJECT = ch # Imported source files and paths CHIBIOS = ../../../../../ChibiOS-RT CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib +# Licensing files. +include $(CHIBIOS)/os/license/license.mk # Startup files. include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_kl2x.mk # HAL-OSAL files (optional). @@ -94,27 +101,24 @@ include $(CHIBIOS)/os/hal/osal/rt/osal.mk include $(CHIBIOS)/os/rt/rt.mk include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk # Other files (optional). -#include $(CHIBIOS)/test/rt/test.mk -#include $(CHIBIOS)/os/hal/lib/streams/streams.mk +include $(CHIBIOS)/test/lib/test.mk +include $(CHIBIOS)/test/rt/rt_test.mk +include $(CHIBIOS)/test/oslib/oslib_test.mk +include $(CHIBIOS)/os/hal/lib/streams/streams.mk # Define linker script file here LDSCRIPT= $(STARTUPLD)/MKL2xZ128.ld # C sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CSRC = $(STARTUPSRC) \ - $(KERNSRC) \ - $(PORTSRC) \ - $(OSALSRC) \ - $(HALSRC) \ - $(PLATFORMSRC) \ - $(BOARDSRC) \ +CSRC = $(ALLCSRC) \ + $(TESTSRC) \ usbcfg.c \ main.c # C++ sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CPPSRC = +CPPSRC = $(ALLCPPSRC) # C sources to be compiled in ARM mode regardless of the global setting. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler @@ -137,13 +141,11 @@ TCSRC = TCPPSRC = # List ASM source files here -ASMSRC = -ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM) - -INCDIR = $(CHIBIOS)/os/license \ - $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ - $(HALINC) $(PLATFORMINC) $(BOARDINC) +ASMSRC = $(ALLASMSRC) +ASMXSRC = $(ALLXASMSRC) +INCDIR = $(ALLINC) $(TESTINC) \ + $(TESTHAL) # # Project, sources and paths @@ -153,7 +155,7 @@ INCDIR = $(CHIBIOS)/os/license \ # Compiler settings # -MCU = cortex-m0 +MCU = cortex-m0plus #TRGT = arm-elf- TRGT = arm-none-eabi- diff --git a/testhal/KINETIS/FRDM-KL25Z/USB_HID/chconf.h b/testhal/KINETIS/FRDM-KL25Z/USB_HID/chconf.h index 424cf02..1750f63 100644 --- a/testhal/KINETIS/FRDM-KL25Z/USB_HID/chconf.h +++ b/testhal/KINETIS/FRDM-KL25Z/USB_HID/chconf.h @@ -1,5 +1,5 @@ /* - ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio + ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -29,7 +29,7 @@ #define CHCONF_H #define _CHIBIOS_RT_CONF_ -#define _CHIBIOS_RT_CONF_VER_5_0_ +#define _CHIBIOS_RT_CONF_VER_5_1_ /*===========================================================================*/ /** @@ -42,14 +42,34 @@ * @brief System time counter resolution. * @note Allowed values are 16 or 32 bits. */ +#if !defined(CH_CFG_ST_RESOLUTION) #define CH_CFG_ST_RESOLUTION 32 +#endif /** * @brief System tick frequency. * @details Frequency of the system timer that drives the system ticks. This * setting also defines the system tick time unit. */ +#if !defined(CH_CFG_ST_FREQUENCY) #define CH_CFG_ST_FREQUENCY 1000 +#endif + +/** + * @brief Time intervals data size. + * @note Allowed values are 16, 32 or 64 bits. + */ +#if !defined(CH_CFG_INTERVALS_SIZE) +#define CH_CFG_INTERVALS_SIZE 32 +#endif + +/** + * @brief Time types data size. + * @note Allowed values are 16 or 32 bits. + */ +#if !defined(CH_CFG_TIME_TYPES_SIZE) +#define CH_CFG_TIME_TYPES_SIZE 32 +#endif /** * @brief Time delta constant for the tick-less mode. @@ -59,7 +79,9 @@ * The value one is not valid, timeouts are rounded up to * this value. */ +#if !defined(CH_CFG_ST_TIMEDELTA) #define CH_CFG_ST_TIMEDELTA 0 +#endif /** @} */ @@ -82,7 +104,9 @@ * @note The round robin preemption is not supported in tickless mode and * must be set to zero in that case. */ -#define CH_CFG_TIME_QUANTUM 20 +#if !defined(CH_CFG_TIME_QUANTUM) +#define CH_CFG_TIME_QUANTUM 2 +#endif /** * @brief Managed RAM size. @@ -95,7 +119,9 @@ * provide the @p __heap_base__ and @p __heap_end__ symbols. * @note Requires @p CH_CFG_USE_MEMCORE. */ +#if !defined(CH_CFG_MEMCORE_SIZE) #define CH_CFG_MEMCORE_SIZE 0 +#endif /** * @brief Idle thread automatic spawn suppression. @@ -104,7 +130,9 @@ * function becomes the idle thread and must implement an * infinite loop. */ +#if !defined(CH_CFG_NO_IDLE_THREAD) #define CH_CFG_NO_IDLE_THREAD FALSE +#endif /** @} */ @@ -123,7 +151,9 @@ * @note This is not related to the compiler optimization options. * @note The default is @p TRUE. */ +#if !defined(CH_CFG_OPTIMIZE_SPEED) #define CH_CFG_OPTIMIZE_SPEED TRUE +#endif /** @} */ @@ -141,7 +171,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_TM) #define CH_CFG_USE_TM FALSE +#endif /** * @brief Threads registry APIs. @@ -149,7 +181,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_REGISTRY) #define CH_CFG_USE_REGISTRY TRUE +#endif /** * @brief Threads synchronization APIs. @@ -158,7 +192,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_WAITEXIT) #define CH_CFG_USE_WAITEXIT TRUE +#endif /** * @brief Semaphores APIs. @@ -166,7 +202,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_SEMAPHORES) #define CH_CFG_USE_SEMAPHORES TRUE +#endif /** * @brief Semaphores queuing mode. @@ -177,7 +215,9 @@ * requirements. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ +#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY) #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE +#endif /** * @brief Mutexes APIs. @@ -185,7 +225,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MUTEXES) #define CH_CFG_USE_MUTEXES TRUE +#endif /** * @brief Enables recursive behavior on mutexes. @@ -195,7 +237,9 @@ * @note The default is @p FALSE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE) #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE +#endif /** * @brief Conditional Variables APIs. @@ -205,7 +249,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_CONDVARS) #define CH_CFG_USE_CONDVARS TRUE +#endif /** * @brief Conditional Variables APIs with timeout. @@ -215,7 +261,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_CONDVARS. */ +#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT) #define CH_CFG_USE_CONDVARS_TIMEOUT TRUE +#endif /** * @brief Events Flags APIs. @@ -223,7 +271,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_EVENTS) #define CH_CFG_USE_EVENTS TRUE +#endif /** * @brief Events Flags APIs with timeout. @@ -233,7 +283,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_EVENTS. */ +#if !defined(CH_CFG_USE_EVENTS_TIMEOUT) #define CH_CFG_USE_EVENTS_TIMEOUT TRUE +#endif /** * @brief Synchronous Messages APIs. @@ -242,7 +294,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MESSAGES) #define CH_CFG_USE_MESSAGES TRUE +#endif /** * @brief Synchronous Messages queuing mode. @@ -253,7 +307,9 @@ * requirements. * @note Requires @p CH_CFG_USE_MESSAGES. */ +#if !defined(CH_CFG_USE_MESSAGES_PRIORITY) #define CH_CFG_USE_MESSAGES_PRIORITY FALSE +#endif /** * @brief Mailboxes APIs. @@ -263,7 +319,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ +#if !defined(CH_CFG_USE_MAILBOXES) #define CH_CFG_USE_MAILBOXES TRUE +#endif /** * @brief Core Memory Manager APIs. @@ -272,7 +330,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMCORE) #define CH_CFG_USE_MEMCORE TRUE +#endif /** * @brief Heap Allocator APIs. @@ -284,7 +344,9 @@ * @p CH_CFG_USE_SEMAPHORES. * @note Mutexes are recommended. */ +#if !defined(CH_CFG_USE_HEAP) #define CH_CFG_USE_HEAP TRUE +#endif /** * @brief Memory Pools Allocator APIs. @@ -293,7 +355,20 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMPOOLS) #define CH_CFG_USE_MEMPOOLS TRUE +#endif + +/** + * @brief Objects FIFOs APIs. + * @details If enabled then the objects FIFOs APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#if !defined(CH_CFG_USE_OBJ_FIFOS) +#define CH_CFG_USE_OBJ_FIFOS TRUE +#endif /** * @brief Dynamic Threads APIs. @@ -304,7 +379,73 @@ * @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. */ +#if !defined(CH_CFG_USE_DYNAMIC) #define CH_CFG_USE_DYNAMIC TRUE +#endif + +/** @} */ + +/*===========================================================================*/ +/** + * @name Objects factory options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Objects Factory APIs. + * @details If enabled then the objects factory APIs are included in the + * kernel. + * + * @note The default is @p FALSE. + */ +#if !defined(CH_CFG_USE_FACTORY) +#define CH_CFG_USE_FACTORY TRUE +#endif + +/** + * @brief Maximum length for object names. + * @details If the specified length is zero then the name is stored by + * pointer but this could have unintended side effects. + */ +#if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH) +#define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8 +#endif + +/** + * @brief Enables the registry of generic objects. + */ +#if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY) +#define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE +#endif + +/** + * @brief Enables factory for generic buffers. + */ +#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS) +#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE +#endif + +/** + * @brief Enables factory for semaphores. + */ +#if !defined(CH_CFG_FACTORY_SEMAPHORES) +#define CH_CFG_FACTORY_SEMAPHORES TRUE +#endif + +/** + * @brief Enables factory for mailboxes. + */ +#if !defined(CH_CFG_FACTORY_MAILBOXES) +#define CH_CFG_FACTORY_MAILBOXES TRUE +#endif + +/** + * @brief Enables factory for objects FIFOs. + */ +#if !defined(CH_CFG_FACTORY_OBJ_FIFOS) +#define CH_CFG_FACTORY_OBJ_FIFOS TRUE +#endif /** @} */ @@ -320,7 +461,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_STATISTICS) #define CH_DBG_STATISTICS FALSE +#endif /** * @brief Debug option, system state check. @@ -329,7 +472,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_SYSTEM_STATE_CHECK) #define CH_DBG_SYSTEM_STATE_CHECK TRUE +#endif /** * @brief Debug option, parameters checks. @@ -338,7 +483,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_ENABLE_CHECKS) #define CH_DBG_ENABLE_CHECKS TRUE +#endif /** * @brief Debug option, consistency checks. @@ -348,16 +495,28 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_ENABLE_ASSERTS) #define CH_DBG_ENABLE_ASSERTS TRUE +#endif /** * @brief Debug option, trace buffer. - * @details If enabled then the context switch circular trace buffer is - * activated. + * @details If enabled then the trace buffer is activated. * - * @note The default is @p FALSE. + * @note The default is @p CH_DBG_TRACE_MASK_DISABLED. */ -#define CH_DBG_ENABLE_TRACE TRUE +#if !defined(CH_DBG_TRACE_MASK) +#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL +#endif + +/** + * @brief Trace buffer entries. + * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is + * different from @p CH_DBG_TRACE_MASK_DISABLED. + */ +#if !defined(CH_DBG_TRACE_BUFFER_SIZE) +#define CH_DBG_TRACE_BUFFER_SIZE 128 +#endif /** * @brief Debug option, stack checks. @@ -369,7 +528,9 @@ * @note The default failure mode is to halt the system with the global * @p panic_msg variable set to @p NULL. */ -#define CH_DBG_ENABLE_STACK_CHECK FALSE +#if !defined(CH_DBG_ENABLE_STACK_CHECK) +#define CH_DBG_ENABLE_STACK_CHECK TRUE +#endif /** * @brief Debug option, stacks initialization. @@ -379,7 +540,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_FILL_THREADS) #define CH_DBG_FILL_THREADS TRUE +#endif /** * @brief Debug option, threads profiling. @@ -390,7 +553,9 @@ * @note This debug option is not currently compatible with the * tickless mode. */ +#if !defined(CH_DBG_THREADS_PROFILING) #define CH_DBG_THREADS_PROFILING FALSE +#endif /** @} */ @@ -401,6 +566,22 @@ */ /*===========================================================================*/ +/** + * @brief System structure extension. + * @details User fields added to the end of the @p ch_system_t structure. + */ +#define CH_CFG_SYSTEM_EXTRA_FIELDS \ + /* Add threads custom fields here.*/ + +/** + * @brief System initialization hook. + * @details User initialization code added to the @p chSysInit() function + * just before interrupts are enabled globally. + */ +#define CH_CFG_SYSTEM_INIT_HOOK() { \ + /* Add threads initialization code here.*/ \ +} + /** * @brief Threads descriptor structure extension. * @details User fields added to the end of the @p thread_t structure. @@ -410,9 +591,9 @@ /** * @brief Threads initialization hook. - * @details User initialization code added to the @p chThdInit() API. + * @details User initialization code added to the @p _thread_init() function. * - * @note It is invoked from within @p chThdInit() and implicitly from all + * @note It is invoked from within @p _thread_init() and implicitly from all * the threads creation APIs. */ #define CH_CFG_THREAD_INIT_HOOK(tp) { \ @@ -422,10 +603,6 @@ /** * @brief Threads finalization hook. * @details User finalization code added to the @p chThdExit() API. - * - * @note It is inserted into lock zone. - * @note It is also invoked when the threads simply return in order to - * terminate. */ #define CH_CFG_THREAD_EXIT_HOOK(tp) { \ /* Add threads finalization code here.*/ \ @@ -433,7 +610,14 @@ /** * @brief Context switch hook. - * @details This hook is invoked jus * @brief ISR enter hook. + * @details This hook is invoked just before switching between threads. + */ +#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \ + /* Context switch code here.*/ \ +} + +/** + * @brief ISR enter hook. */ #define CH_CFG_IRQ_PROLOGUE_HOOK() { \ /* IRQ prologue code here.*/ \ @@ -446,13 +630,6 @@ /* IRQ epilogue code here.*/ \ } -/** -t before switching between threads. - */ -#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \ - /* Context switch code here.*/ \ -} - /** * @brief Idle thread enter hook. * @note This hook is invoked within a critical zone, no OS functions @@ -460,6 +637,7 @@ t before switching between threads. * @note This macro can be used to activate a power saving mode. */ #define CH_CFG_IDLE_ENTER_HOOK() { \ + /* Idle-enter code here.*/ \ } /** @@ -469,6 +647,7 @@ t before switching between threads. * @note This macro can be used to deactivate a power saving mode. */ #define CH_CFG_IDLE_LEAVE_HOOK() { \ + /* Idle-leave code here.*/ \ } /** diff --git a/testhal/KINETIS/FRDM-KL25Z/USB_HID/halconf_community.h b/testhal/KINETIS/FRDM-KL25Z/USB_HID/halconf_community.h index b2f75af..fb7ebf6 100644 --- a/testhal/KINETIS/FRDM-KL25Z/USB_HID/halconf_community.h +++ b/testhal/KINETIS/FRDM-KL25Z/USB_HID/halconf_community.h @@ -80,15 +80,36 @@ #define HAL_USE_TIMCAP FALSE #endif +/** + * @brief Enables the TIMCAP subsystem. + */ +#if !defined(HAL_USE_COMP) || defined(__DOXYGEN__) +#define HAL_USE_COMP FALSE +#endif + +/** + * @brief Enables the QEI subsystem. + */ +#if !defined(HAL_USE_QEI) || defined(__DOXYGEN__) +#define HAL_USE_QEI FALSE +#endif + /** * @brief Enables the USBH subsystem. */ #if !defined(HAL_USE_USBH) || defined(__DOXYGEN__) -#define HAL_USE_USBH FALSE +#define HAL_USE_USBH FALSE +#endif + +/** + * @brief Enables the USB_MSD subsystem. + */ +#if !defined(HAL_USE_USB_MSD) || defined(__DOXYGEN__) +#define HAL_USE_USB_MSD FALSE #endif /** - * @brief Enables the USB HID subsystem. + * @brief Enables the USB_HID subsystem. */ #if !defined(HAL_USE_USB_HID) || defined(__DOXYGEN__) #define HAL_USE_USB_HID TRUE @@ -121,7 +142,25 @@ */ #define ONEWIRE_USE_SEARCH_ROM TRUE - /*===========================================================================*/ +/*===========================================================================*/ +/* QEI driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables discard of overlow + */ +#if !defined(QEI_USE_OVERFLOW_DISCARD) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_DISCARD FALSE +#endif + +/** + * @brief Enables min max of overlow + */ +#if !defined(QEI_USE_OVERFLOW_MINMAX) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_MINMAX FALSE +#endif + +/*===========================================================================*/ /* EEProm driver related settings. */ /*===========================================================================*/ @@ -129,13 +168,12 @@ * @brief Enables 24xx series I2C eeprom device driver. * @note Disabling this option saves both code and data space. */ -#define EEPROM_USE_EE24XX TRUE +#define EEPROM_USE_EE24XX FALSE /** * @brief Enables 25xx series SPI eeprom device driver. * @note Disabling this option saves both code and data space. */ -#define EEPROM_USE_EE25XX TRUE - +#define EEPROM_USE_EE25XX FALSE #endif /* HALCONF_COMMUNITY_H */ diff --git a/testhal/KINETIS/FRDM-KL25Z/USB_SERIAL/Makefile b/testhal/KINETIS/FRDM-KL25Z/USB_SERIAL/Makefile index 57ab9e8..0eab704 100644 --- a/testhal/KINETIS/FRDM-KL25Z/USB_SERIAL/Makefile +++ b/testhal/KINETIS/FRDM-KL25Z/USB_SERIAL/Makefile @@ -5,7 +5,7 @@ # Compiler options here. ifeq ($(USE_OPT),) - USE_OPT = -O0 -ggdb -fomit-frame-pointer -falign-functions=16 + USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16 endif # C specific options here (added to USE_OPT). @@ -30,7 +30,7 @@ endif # Enable this if you want link time optimizations (LTO) ifeq ($(USE_LTO),) - USE_LTO = no + USE_LTO = yes endif # If enabled, this option allows to compile the application in THUMB mode. @@ -69,6 +69,11 @@ ifeq ($(USE_EXCEPTIONS_STACKSIZE),) USE_EXCEPTIONS_STACKSIZE = 0x400 endif +# Enables the use of FPU on Cortex-M4 (no, softfp, hard). +ifeq ($(USE_FPU),) + USE_FPU = no +endif + # # Architecture or project specific options ############################################################################## @@ -83,6 +88,8 @@ PROJECT = ch # Imported source files and paths CHIBIOS = ../../../../../ChibiOS-RT CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib +# Licensing files. +include $(CHIBIOS)/os/license/license.mk # Startup files. include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_kl2x.mk # HAL-OSAL files (optional). @@ -94,7 +101,9 @@ include $(CHIBIOS)/os/hal/osal/rt/osal.mk include $(CHIBIOS)/os/rt/rt.mk include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk # Other files (optional). -include $(CHIBIOS)/test/rt/test.mk +include $(CHIBIOS)/test/lib/test.mk +include $(CHIBIOS)/test/rt/rt_test.mk +include $(CHIBIOS)/test/oslib/oslib_test.mk include $(CHIBIOS)/os/hal/lib/streams/streams.mk include $(CHIBIOS)/os/various/shell/shell.mk @@ -103,22 +112,14 @@ LDSCRIPT= $(STARTUPLD)/MKL2xZ128.ld # C sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CSRC = $(STARTUPSRC) \ - $(KERNSRC) \ - $(PORTSRC) \ - $(OSALSRC) \ - $(HALSRC) \ - $(PLATFORMSRC) \ - $(BOARDSRC) \ +CSRC = $(ALLCSRC) \ $(TESTSRC) \ - $(STREAMSSRC) \ - $(SHELLSRC) \ usbcfg.c \ - main.c \ + main.c # C++ sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CPPSRC = +CPPSRC = $(ALLCPPSRC) # C sources to be compiled in ARM mode regardless of the global setting. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler @@ -141,13 +142,11 @@ TCSRC = TCPPSRC = # List ASM source files here -ASMSRC = -ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM) +ASMSRC = $(ALLASMSRC) +ASMXSRC = $(ALLXASMSRC) -INCDIR = $(CHIBIOS)/os/license \ - $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ - $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \ - $(STREAMSINC) $(SHELLINC) +INCDIR = $(ALLINC) $(TESTINC) \ + $(TESTHAL) # # Project, sources and paths diff --git a/testhal/KINETIS/FRDM-KL25Z/USB_SERIAL/chconf.h b/testhal/KINETIS/FRDM-KL25Z/USB_SERIAL/chconf.h index e89ec1f..1750f63 100644 --- a/testhal/KINETIS/FRDM-KL25Z/USB_SERIAL/chconf.h +++ b/testhal/KINETIS/FRDM-KL25Z/USB_SERIAL/chconf.h @@ -1,5 +1,5 @@ /* - ChibiOS - (C) 2015-2016 flabbergast + ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -15,19 +15,21 @@ */ /** - * @file FRDM-KL25Z/USB_SERIAL/chconf.h - * @brief Configuration file. + * @file templates/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 config * @details Kernel related settings and hooks. * @{ */ -#ifndef _CHCONF_H_ -#define _CHCONF_H_ +#ifndef CHCONF_H +#define CHCONF_H #define _CHIBIOS_RT_CONF_ -#define _CHIBIOS_RT_CONF_VER_5_0_ +#define _CHIBIOS_RT_CONF_VER_5_1_ /*===========================================================================*/ /** @@ -40,14 +42,34 @@ * @brief System time counter resolution. * @note Allowed values are 16 or 32 bits. */ +#if !defined(CH_CFG_ST_RESOLUTION) #define CH_CFG_ST_RESOLUTION 32 +#endif /** * @brief System tick frequency. * @details Frequency of the system timer that drives the system ticks. This * setting also defines the system tick time unit. */ +#if !defined(CH_CFG_ST_FREQUENCY) #define CH_CFG_ST_FREQUENCY 1000 +#endif + +/** + * @brief Time intervals data size. + * @note Allowed values are 16, 32 or 64 bits. + */ +#if !defined(CH_CFG_INTERVALS_SIZE) +#define CH_CFG_INTERVALS_SIZE 32 +#endif + +/** + * @brief Time types data size. + * @note Allowed values are 16 or 32 bits. + */ +#if !defined(CH_CFG_TIME_TYPES_SIZE) +#define CH_CFG_TIME_TYPES_SIZE 32 +#endif /** * @brief Time delta constant for the tick-less mode. @@ -57,7 +79,9 @@ * The value one is not valid, timeouts are rounded up to * this value. */ +#if !defined(CH_CFG_ST_TIMEDELTA) #define CH_CFG_ST_TIMEDELTA 0 +#endif /** @} */ @@ -80,7 +104,9 @@ * @note The round robin preemption is not supported in tickless mode and * must be set to zero in that case. */ -#define CH_CFG_TIME_QUANTUM 20 +#if !defined(CH_CFG_TIME_QUANTUM) +#define CH_CFG_TIME_QUANTUM 2 +#endif /** * @brief Managed RAM size. @@ -93,7 +119,9 @@ * provide the @p __heap_base__ and @p __heap_end__ symbols. * @note Requires @p CH_CFG_USE_MEMCORE. */ +#if !defined(CH_CFG_MEMCORE_SIZE) #define CH_CFG_MEMCORE_SIZE 0 +#endif /** * @brief Idle thread automatic spawn suppression. @@ -102,7 +130,9 @@ * function becomes the idle thread and must implement an * infinite loop. */ +#if !defined(CH_CFG_NO_IDLE_THREAD) #define CH_CFG_NO_IDLE_THREAD FALSE +#endif /** @} */ @@ -121,7 +151,9 @@ * @note This is not related to the compiler optimization options. * @note The default is @p TRUE. */ +#if !defined(CH_CFG_OPTIMIZE_SPEED) #define CH_CFG_OPTIMIZE_SPEED TRUE +#endif /** @} */ @@ -139,7 +171,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_TM) #define CH_CFG_USE_TM FALSE +#endif /** * @brief Threads registry APIs. @@ -147,7 +181,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_REGISTRY) #define CH_CFG_USE_REGISTRY TRUE +#endif /** * @brief Threads synchronization APIs. @@ -156,7 +192,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_WAITEXIT) #define CH_CFG_USE_WAITEXIT TRUE +#endif /** * @brief Semaphores APIs. @@ -164,7 +202,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_SEMAPHORES) #define CH_CFG_USE_SEMAPHORES TRUE +#endif /** * @brief Semaphores queuing mode. @@ -175,7 +215,9 @@ * requirements. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ +#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY) #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE +#endif /** * @brief Mutexes APIs. @@ -183,7 +225,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MUTEXES) #define CH_CFG_USE_MUTEXES TRUE +#endif /** * @brief Enables recursive behavior on mutexes. @@ -193,7 +237,9 @@ * @note The default is @p FALSE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE) #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE +#endif /** * @brief Conditional Variables APIs. @@ -203,7 +249,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_CONDVARS) #define CH_CFG_USE_CONDVARS TRUE +#endif /** * @brief Conditional Variables APIs with timeout. @@ -213,7 +261,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_CONDVARS. */ +#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT) #define CH_CFG_USE_CONDVARS_TIMEOUT TRUE +#endif /** * @brief Events Flags APIs. @@ -221,7 +271,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_EVENTS) #define CH_CFG_USE_EVENTS TRUE +#endif /** * @brief Events Flags APIs with timeout. @@ -231,7 +283,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_EVENTS. */ +#if !defined(CH_CFG_USE_EVENTS_TIMEOUT) #define CH_CFG_USE_EVENTS_TIMEOUT TRUE +#endif /** * @brief Synchronous Messages APIs. @@ -240,7 +294,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MESSAGES) #define CH_CFG_USE_MESSAGES TRUE +#endif /** * @brief Synchronous Messages queuing mode. @@ -251,7 +307,9 @@ * requirements. * @note Requires @p CH_CFG_USE_MESSAGES. */ +#if !defined(CH_CFG_USE_MESSAGES_PRIORITY) #define CH_CFG_USE_MESSAGES_PRIORITY FALSE +#endif /** * @brief Mailboxes APIs. @@ -261,7 +319,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ +#if !defined(CH_CFG_USE_MAILBOXES) #define CH_CFG_USE_MAILBOXES TRUE +#endif /** * @brief Core Memory Manager APIs. @@ -270,7 +330,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMCORE) #define CH_CFG_USE_MEMCORE TRUE +#endif /** * @brief Heap Allocator APIs. @@ -282,7 +344,9 @@ * @p CH_CFG_USE_SEMAPHORES. * @note Mutexes are recommended. */ +#if !defined(CH_CFG_USE_HEAP) #define CH_CFG_USE_HEAP TRUE +#endif /** * @brief Memory Pools Allocator APIs. @@ -291,7 +355,20 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMPOOLS) #define CH_CFG_USE_MEMPOOLS TRUE +#endif + +/** + * @brief Objects FIFOs APIs. + * @details If enabled then the objects FIFOs APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#if !defined(CH_CFG_USE_OBJ_FIFOS) +#define CH_CFG_USE_OBJ_FIFOS TRUE +#endif /** * @brief Dynamic Threads APIs. @@ -302,7 +379,73 @@ * @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. */ +#if !defined(CH_CFG_USE_DYNAMIC) #define CH_CFG_USE_DYNAMIC TRUE +#endif + +/** @} */ + +/*===========================================================================*/ +/** + * @name Objects factory options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Objects Factory APIs. + * @details If enabled then the objects factory APIs are included in the + * kernel. + * + * @note The default is @p FALSE. + */ +#if !defined(CH_CFG_USE_FACTORY) +#define CH_CFG_USE_FACTORY TRUE +#endif + +/** + * @brief Maximum length for object names. + * @details If the specified length is zero then the name is stored by + * pointer but this could have unintended side effects. + */ +#if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH) +#define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8 +#endif + +/** + * @brief Enables the registry of generic objects. + */ +#if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY) +#define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE +#endif + +/** + * @brief Enables factory for generic buffers. + */ +#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS) +#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE +#endif + +/** + * @brief Enables factory for semaphores. + */ +#if !defined(CH_CFG_FACTORY_SEMAPHORES) +#define CH_CFG_FACTORY_SEMAPHORES TRUE +#endif + +/** + * @brief Enables factory for mailboxes. + */ +#if !defined(CH_CFG_FACTORY_MAILBOXES) +#define CH_CFG_FACTORY_MAILBOXES TRUE +#endif + +/** + * @brief Enables factory for objects FIFOs. + */ +#if !defined(CH_CFG_FACTORY_OBJ_FIFOS) +#define CH_CFG_FACTORY_OBJ_FIFOS TRUE +#endif /** @} */ @@ -318,7 +461,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_STATISTICS) #define CH_DBG_STATISTICS FALSE +#endif /** * @brief Debug option, system state check. @@ -327,7 +472,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_SYSTEM_STATE_CHECK) #define CH_DBG_SYSTEM_STATE_CHECK TRUE +#endif /** * @brief Debug option, parameters checks. @@ -336,7 +483,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_ENABLE_CHECKS) #define CH_DBG_ENABLE_CHECKS TRUE +#endif /** * @brief Debug option, consistency checks. @@ -346,16 +495,28 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_ENABLE_ASSERTS) #define CH_DBG_ENABLE_ASSERTS TRUE +#endif /** * @brief Debug option, trace buffer. - * @details If enabled then the context switch circular trace buffer is - * activated. + * @details If enabled then the trace buffer is activated. * - * @note The default is @p FALSE. + * @note The default is @p CH_DBG_TRACE_MASK_DISABLED. + */ +#if !defined(CH_DBG_TRACE_MASK) +#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL +#endif + +/** + * @brief Trace buffer entries. + * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is + * different from @p CH_DBG_TRACE_MASK_DISABLED. */ -#define CH_DBG_ENABLE_TRACE TRUE +#if !defined(CH_DBG_TRACE_BUFFER_SIZE) +#define CH_DBG_TRACE_BUFFER_SIZE 128 +#endif /** * @brief Debug option, stack checks. @@ -367,7 +528,9 @@ * @note The default failure mode is to halt the system with the global * @p panic_msg variable set to @p NULL. */ -#define CH_DBG_ENABLE_STACK_CHECK FALSE +#if !defined(CH_DBG_ENABLE_STACK_CHECK) +#define CH_DBG_ENABLE_STACK_CHECK TRUE +#endif /** * @brief Debug option, stacks initialization. @@ -377,7 +540,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_FILL_THREADS) #define CH_DBG_FILL_THREADS TRUE +#endif /** * @brief Debug option, threads profiling. @@ -388,7 +553,9 @@ * @note This debug option is not currently compatible with the * tickless mode. */ +#if !defined(CH_DBG_THREADS_PROFILING) #define CH_DBG_THREADS_PROFILING FALSE +#endif /** @} */ @@ -399,6 +566,22 @@ */ /*===========================================================================*/ +/** + * @brief System structure extension. + * @details User fields added to the end of the @p ch_system_t structure. + */ +#define CH_CFG_SYSTEM_EXTRA_FIELDS \ + /* Add threads custom fields here.*/ + +/** + * @brief System initialization hook. + * @details User initialization code added to the @p chSysInit() function + * just before interrupts are enabled globally. + */ +#define CH_CFG_SYSTEM_INIT_HOOK() { \ + /* Add threads initialization code here.*/ \ +} + /** * @brief Threads descriptor structure extension. * @details User fields added to the end of the @p thread_t structure. @@ -408,9 +591,9 @@ /** * @brief Threads initialization hook. - * @details User initialization code added to the @p chThdInit() API. + * @details User initialization code added to the @p _thread_init() function. * - * @note It is invoked from within @p chThdInit() and implicitly from all + * @note It is invoked from within @p _thread_init() and implicitly from all * the threads creation APIs. */ #define CH_CFG_THREAD_INIT_HOOK(tp) { \ @@ -420,10 +603,6 @@ /** * @brief Threads finalization hook. * @details User finalization code added to the @p chThdExit() API. - * - * @note It is inserted into lock zone. - * @note It is also invoked when the threads simply return in order to - * terminate. */ #define CH_CFG_THREAD_EXIT_HOOK(tp) { \ /* Add threads finalization code here.*/ \ @@ -458,6 +637,7 @@ * @note This macro can be used to activate a power saving mode. */ #define CH_CFG_IDLE_ENTER_HOOK() { \ + /* Idle-enter code here.*/ \ } /** @@ -467,6 +647,7 @@ * @note This macro can be used to deactivate a power saving mode. */ #define CH_CFG_IDLE_LEAVE_HOOK() { \ + /* Idle-leave code here.*/ \ } /** @@ -510,6 +691,6 @@ /* Port-specific settings (override port settings defaulted in chcore.h). */ /*===========================================================================*/ -#endif /* _CHCONF_H_ */ +#endif /* CHCONF_H */ /** @} */ diff --git a/testhal/KINETIS/FRDM-KL25Z/USB_SERIAL/halconf_community.h b/testhal/KINETIS/FRDM-KL25Z/USB_SERIAL/halconf_community.h new file mode 100644 index 0000000..cf0b508 --- /dev/null +++ b/testhal/KINETIS/FRDM-KL25Z/USB_SERIAL/halconf_community.h @@ -0,0 +1,180 @@ +/* + ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#ifndef HALCONF_COMMUNITY_H +#define HALCONF_COMMUNITY_H + +/** + * @brief Enables the community overlay. + */ +#if !defined(HAL_USE_COMMUNITY) || defined(__DOXYGEN__) +#define HAL_USE_COMMUNITY TRUE +#endif + +/** + * @brief Enables the FSMC subsystem. + */ +#if !defined(HAL_USE_FSMC) || defined(__DOXYGEN__) +#define HAL_USE_FSMC FALSE +#endif + +/** + * @brief Enables the NAND subsystem. + */ +#if !defined(HAL_USE_NAND) || defined(__DOXYGEN__) +#define HAL_USE_NAND FALSE +#endif + +/** + * @brief Enables the 1-wire subsystem. + */ +#if !defined(HAL_USE_ONEWIRE) || defined(__DOXYGEN__) +#define HAL_USE_ONEWIRE FALSE +#endif + +/** + * @brief Enables the EICU subsystem. + */ +#if !defined(HAL_USE_EICU) || defined(__DOXYGEN__) +#define HAL_USE_EICU FALSE +#endif + +/** + * @brief Enables the CRC subsystem. + */ +#if !defined(HAL_USE_CRC) || defined(__DOXYGEN__) +#define HAL_USE_CRC FALSE +#endif + +/** + * @brief Enables the RNG subsystem. + */ +#if !defined(HAL_USE_RNG) || defined(__DOXYGEN__) +#define HAL_USE_RNG FALSE +#endif + +/** + * @brief Enables the EEPROM subsystem. + */ +#if !defined(HAL_USE_EEPROM) || defined(__DOXYGEN__) +#define HAL_USE_EEPROM FALSE +#endif + +/** + * @brief Enables the TIMCAP subsystem. + */ +#if !defined(HAL_USE_TIMCAP) || defined(__DOXYGEN__) +#define HAL_USE_TIMCAP FALSE +#endif + +/** + * @brief Enables the TIMCAP subsystem. + */ +#if !defined(HAL_USE_COMP) || defined(__DOXYGEN__) +#define HAL_USE_COMP FALSE +#endif + +/** + * @brief Enables the QEI subsystem. + */ +#if !defined(HAL_USE_QEI) || defined(__DOXYGEN__) +#define HAL_USE_QEI FALSE +#endif + +/** + * @brief Enables the USBH subsystem. + */ +#if !defined(HAL_USE_USBH) || defined(__DOXYGEN__) +#define HAL_USE_USBH FALSE +#endif + +/** + * @brief Enables the USB_MSD subsystem. + */ +#if !defined(HAL_USE_USB_MSD) || defined(__DOXYGEN__) +#define HAL_USE_USB_MSD FALSE +#endif + +/** + * @brief Enables the USB_HID subsystem. + */ +#if !defined(HAL_USE_USB_HID) || defined(__DOXYGEN__) +#define HAL_USE_USB_HID FALSE +#endif + +/*===========================================================================*/ +/* FSMCNAND driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables the @p nandAcquireBus() and @p nanReleaseBus() APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(NAND_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define NAND_USE_MUTUAL_EXCLUSION TRUE +#endif + +/*===========================================================================*/ +/* 1-wire driver related settings. */ +/*===========================================================================*/ +/** + * @brief Enables strong pull up feature. + * @note Disabling this option saves both code and data space. + */ +#define ONEWIRE_USE_STRONG_PULLUP FALSE + +/** + * @brief Enables search ROM feature. + * @note Disabling this option saves both code and data space. + */ +#define ONEWIRE_USE_SEARCH_ROM TRUE + +/*===========================================================================*/ +/* QEI driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables discard of overlow + */ +#if !defined(QEI_USE_OVERFLOW_DISCARD) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_DISCARD FALSE +#endif + +/** + * @brief Enables min max of overlow + */ +#if !defined(QEI_USE_OVERFLOW_MINMAX) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_MINMAX FALSE +#endif + +/*===========================================================================*/ +/* EEProm driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables 24xx series I2C eeprom device driver. + * @note Disabling this option saves both code and data space. + */ +#define EEPROM_USE_EE24XX FALSE + /** + * @brief Enables 25xx series SPI eeprom device driver. + * @note Disabling this option saves both code and data space. + */ +#define EEPROM_USE_EE25XX FALSE + +#endif /* HALCONF_COMMUNITY_H */ + +/** @} */ diff --git a/testhal/KINETIS/FRDM-KL26Z/I2C/Makefile b/testhal/KINETIS/FRDM-KL26Z/I2C/Makefile index 597f431..7ce4956 100644 --- a/testhal/KINETIS/FRDM-KL26Z/I2C/Makefile +++ b/testhal/KINETIS/FRDM-KL26Z/I2C/Makefile @@ -5,7 +5,7 @@ # Compiler options here. ifeq ($(USE_OPT),) - USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16 -DCRT0_INIT_STACKS=0 + USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16 endif # C specific options here (added to USE_OPT). @@ -30,7 +30,7 @@ endif # Enable this if you want link time optimizations (LTO) ifeq ($(USE_LTO),) - USE_LTO = no + USE_LTO = yes endif # If enabled, this option allows to compile the application in THUMB mode. @@ -69,6 +69,11 @@ ifeq ($(USE_EXCEPTIONS_STACKSIZE),) USE_EXCEPTIONS_STACKSIZE = 0x400 endif +# Enables the use of FPU on Cortex-M4 (no, softfp, hard). +ifeq ($(USE_FPU),) + USE_FPU = no +endif + # # Architecture or project specific options ############################################################################## @@ -83,6 +88,8 @@ PROJECT = ch # Imported source files and paths CHIBIOS = ../../../../../ChibiOS-RT CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib +# Licensing files. +include $(CHIBIOS)/os/license/license.mk # Startup files. include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_kl2x.mk # HAL-OSAL files (optional). @@ -100,18 +107,13 @@ LDSCRIPT= $(STARTUPLD)/MKL2xZ128.ld # C sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CSRC = $(STARTUPSRC) \ - $(KERNSRC) \ - $(PORTSRC) \ - $(OSALSRC) \ - $(HALSRC) \ - $(PLATFORMSRC) \ - $(BOARDSRC) \ +CSRC = $(ALLCSRC) \ + $(TESTSRC) \ main.c # C++ sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CPPSRC = +CPPSRC = $(ALLCPPSRC) # C sources to be compiled in ARM mode regardless of the global setting. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler @@ -134,12 +136,11 @@ TCSRC = TCPPSRC = # List ASM source files here -ASMSRC = -ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM) +ASMSRC = $(ALLASMSRC) +ASMXSRC = $(ALLXASMSRC) -INCDIR = $(CHIBIOS)/os/license \ - $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ - $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) +INCDIR = $(ALLINC) $(TESTINC) \ + $(TESTHAL) # # Project, sources and paths diff --git a/testhal/KINETIS/FRDM-KL26Z/I2C/chconf.h b/testhal/KINETIS/FRDM-KL26Z/I2C/chconf.h index 5f05547..1750f63 100644 --- a/testhal/KINETIS/FRDM-KL26Z/I2C/chconf.h +++ b/testhal/KINETIS/FRDM-KL26Z/I2C/chconf.h @@ -1,5 +1,5 @@ /* - ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio + ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -25,11 +25,11 @@ * @{ */ -#ifndef _CHCONF_H_ -#define _CHCONF_H_ - -#define _CHIBIOS_RT_CONF_ -#define _CHIBIOS_RT_CONF_VER_5_0_ +#ifndef CHCONF_H +#define CHCONF_H + +#define _CHIBIOS_RT_CONF_ +#define _CHIBIOS_RT_CONF_VER_5_1_ /*===========================================================================*/ /** @@ -42,14 +42,34 @@ * @brief System time counter resolution. * @note Allowed values are 16 or 32 bits. */ +#if !defined(CH_CFG_ST_RESOLUTION) #define CH_CFG_ST_RESOLUTION 32 +#endif /** * @brief System tick frequency. * @details Frequency of the system timer that drives the system ticks. This * setting also defines the system tick time unit. */ +#if !defined(CH_CFG_ST_FREQUENCY) #define CH_CFG_ST_FREQUENCY 1000 +#endif + +/** + * @brief Time intervals data size. + * @note Allowed values are 16, 32 or 64 bits. + */ +#if !defined(CH_CFG_INTERVALS_SIZE) +#define CH_CFG_INTERVALS_SIZE 32 +#endif + +/** + * @brief Time types data size. + * @note Allowed values are 16 or 32 bits. + */ +#if !defined(CH_CFG_TIME_TYPES_SIZE) +#define CH_CFG_TIME_TYPES_SIZE 32 +#endif /** * @brief Time delta constant for the tick-less mode. @@ -59,7 +79,9 @@ * The value one is not valid, timeouts are rounded up to * this value. */ +#if !defined(CH_CFG_ST_TIMEDELTA) #define CH_CFG_ST_TIMEDELTA 0 +#endif /** @} */ @@ -82,7 +104,9 @@ * @note The round robin preemption is not supported in tickless mode and * must be set to zero in that case. */ -#define CH_CFG_TIME_QUANTUM 20 +#if !defined(CH_CFG_TIME_QUANTUM) +#define CH_CFG_TIME_QUANTUM 2 +#endif /** * @brief Managed RAM size. @@ -95,7 +119,9 @@ * provide the @p __heap_base__ and @p __heap_end__ symbols. * @note Requires @p CH_CFG_USE_MEMCORE. */ +#if !defined(CH_CFG_MEMCORE_SIZE) #define CH_CFG_MEMCORE_SIZE 0 +#endif /** * @brief Idle thread automatic spawn suppression. @@ -104,7 +130,9 @@ * function becomes the idle thread and must implement an * infinite loop. */ +#if !defined(CH_CFG_NO_IDLE_THREAD) #define CH_CFG_NO_IDLE_THREAD FALSE +#endif /** @} */ @@ -123,7 +151,9 @@ * @note This is not related to the compiler optimization options. * @note The default is @p TRUE. */ +#if !defined(CH_CFG_OPTIMIZE_SPEED) #define CH_CFG_OPTIMIZE_SPEED TRUE +#endif /** @} */ @@ -141,7 +171,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_TM) #define CH_CFG_USE_TM FALSE +#endif /** * @brief Threads registry APIs. @@ -149,7 +181,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_REGISTRY) #define CH_CFG_USE_REGISTRY TRUE +#endif /** * @brief Threads synchronization APIs. @@ -158,7 +192,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_WAITEXIT) #define CH_CFG_USE_WAITEXIT TRUE +#endif /** * @brief Semaphores APIs. @@ -166,7 +202,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_SEMAPHORES) #define CH_CFG_USE_SEMAPHORES TRUE +#endif /** * @brief Semaphores queuing mode. @@ -177,7 +215,9 @@ * requirements. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ +#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY) #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE +#endif /** * @brief Mutexes APIs. @@ -185,7 +225,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MUTEXES) #define CH_CFG_USE_MUTEXES TRUE +#endif /** * @brief Enables recursive behavior on mutexes. @@ -195,7 +237,9 @@ * @note The default is @p FALSE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE) #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE +#endif /** * @brief Conditional Variables APIs. @@ -205,7 +249,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_CONDVARS) #define CH_CFG_USE_CONDVARS TRUE +#endif /** * @brief Conditional Variables APIs with timeout. @@ -215,7 +261,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_CONDVARS. */ +#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT) #define CH_CFG_USE_CONDVARS_TIMEOUT TRUE +#endif /** * @brief Events Flags APIs. @@ -223,7 +271,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_EVENTS) #define CH_CFG_USE_EVENTS TRUE +#endif /** * @brief Events Flags APIs with timeout. @@ -233,7 +283,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_EVENTS. */ +#if !defined(CH_CFG_USE_EVENTS_TIMEOUT) #define CH_CFG_USE_EVENTS_TIMEOUT TRUE +#endif /** * @brief Synchronous Messages APIs. @@ -242,7 +294,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MESSAGES) #define CH_CFG_USE_MESSAGES TRUE +#endif /** * @brief Synchronous Messages queuing mode. @@ -253,7 +307,9 @@ * requirements. * @note Requires @p CH_CFG_USE_MESSAGES. */ +#if !defined(CH_CFG_USE_MESSAGES_PRIORITY) #define CH_CFG_USE_MESSAGES_PRIORITY FALSE +#endif /** * @brief Mailboxes APIs. @@ -263,7 +319,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ +#if !defined(CH_CFG_USE_MAILBOXES) #define CH_CFG_USE_MAILBOXES TRUE +#endif /** * @brief Core Memory Manager APIs. @@ -272,7 +330,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMCORE) #define CH_CFG_USE_MEMCORE TRUE +#endif /** * @brief Heap Allocator APIs. @@ -284,7 +344,9 @@ * @p CH_CFG_USE_SEMAPHORES. * @note Mutexes are recommended. */ +#if !defined(CH_CFG_USE_HEAP) #define CH_CFG_USE_HEAP TRUE +#endif /** * @brief Memory Pools Allocator APIs. @@ -293,7 +355,20 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMPOOLS) #define CH_CFG_USE_MEMPOOLS TRUE +#endif + +/** + * @brief Objects FIFOs APIs. + * @details If enabled then the objects FIFOs APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#if !defined(CH_CFG_USE_OBJ_FIFOS) +#define CH_CFG_USE_OBJ_FIFOS TRUE +#endif /** * @brief Dynamic Threads APIs. @@ -304,7 +379,73 @@ * @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. */ +#if !defined(CH_CFG_USE_DYNAMIC) #define CH_CFG_USE_DYNAMIC TRUE +#endif + +/** @} */ + +/*===========================================================================*/ +/** + * @name Objects factory options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Objects Factory APIs. + * @details If enabled then the objects factory APIs are included in the + * kernel. + * + * @note The default is @p FALSE. + */ +#if !defined(CH_CFG_USE_FACTORY) +#define CH_CFG_USE_FACTORY TRUE +#endif + +/** + * @brief Maximum length for object names. + * @details If the specified length is zero then the name is stored by + * pointer but this could have unintended side effects. + */ +#if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH) +#define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8 +#endif + +/** + * @brief Enables the registry of generic objects. + */ +#if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY) +#define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE +#endif + +/** + * @brief Enables factory for generic buffers. + */ +#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS) +#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE +#endif + +/** + * @brief Enables factory for semaphores. + */ +#if !defined(CH_CFG_FACTORY_SEMAPHORES) +#define CH_CFG_FACTORY_SEMAPHORES TRUE +#endif + +/** + * @brief Enables factory for mailboxes. + */ +#if !defined(CH_CFG_FACTORY_MAILBOXES) +#define CH_CFG_FACTORY_MAILBOXES TRUE +#endif + +/** + * @brief Enables factory for objects FIFOs. + */ +#if !defined(CH_CFG_FACTORY_OBJ_FIFOS) +#define CH_CFG_FACTORY_OBJ_FIFOS TRUE +#endif /** @} */ @@ -320,7 +461,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_STATISTICS) #define CH_DBG_STATISTICS FALSE +#endif /** * @brief Debug option, system state check. @@ -329,7 +472,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_SYSTEM_STATE_CHECK FALSE +#if !defined(CH_DBG_SYSTEM_STATE_CHECK) +#define CH_DBG_SYSTEM_STATE_CHECK TRUE +#endif /** * @brief Debug option, parameters checks. @@ -338,7 +483,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_ENABLE_CHECKS FALSE +#if !defined(CH_DBG_ENABLE_CHECKS) +#define CH_DBG_ENABLE_CHECKS TRUE +#endif /** * @brief Debug option, consistency checks. @@ -348,16 +495,28 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_ENABLE_ASSERTS FALSE +#if !defined(CH_DBG_ENABLE_ASSERTS) +#define CH_DBG_ENABLE_ASSERTS TRUE +#endif /** * @brief Debug option, trace buffer. - * @details If enabled then the context switch circular trace buffer is - * activated. + * @details If enabled then the trace buffer is activated. * - * @note The default is @p FALSE. + * @note The default is @p CH_DBG_TRACE_MASK_DISABLED. */ -#define CH_DBG_ENABLE_TRACE FALSE +#if !defined(CH_DBG_TRACE_MASK) +#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL +#endif + +/** + * @brief Trace buffer entries. + * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is + * different from @p CH_DBG_TRACE_MASK_DISABLED. + */ +#if !defined(CH_DBG_TRACE_BUFFER_SIZE) +#define CH_DBG_TRACE_BUFFER_SIZE 128 +#endif /** * @brief Debug option, stack checks. @@ -369,7 +528,9 @@ * @note The default failure mode is to halt the system with the global * @p panic_msg variable set to @p NULL. */ -#define CH_DBG_ENABLE_STACK_CHECK FALSE +#if !defined(CH_DBG_ENABLE_STACK_CHECK) +#define CH_DBG_ENABLE_STACK_CHECK TRUE +#endif /** * @brief Debug option, stacks initialization. @@ -379,7 +540,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_FILL_THREADS FALSE +#if !defined(CH_DBG_FILL_THREADS) +#define CH_DBG_FILL_THREADS TRUE +#endif /** * @brief Debug option, threads profiling. @@ -390,7 +553,9 @@ * @note This debug option is not currently compatible with the * tickless mode. */ +#if !defined(CH_DBG_THREADS_PROFILING) #define CH_DBG_THREADS_PROFILING FALSE +#endif /** @} */ @@ -401,6 +566,22 @@ */ /*===========================================================================*/ +/** + * @brief System structure extension. + * @details User fields added to the end of the @p ch_system_t structure. + */ +#define CH_CFG_SYSTEM_EXTRA_FIELDS \ + /* Add threads custom fields here.*/ + +/** + * @brief System initialization hook. + * @details User initialization code added to the @p chSysInit() function + * just before interrupts are enabled globally. + */ +#define CH_CFG_SYSTEM_INIT_HOOK() { \ + /* Add threads initialization code here.*/ \ +} + /** * @brief Threads descriptor structure extension. * @details User fields added to the end of the @p thread_t structure. @@ -410,9 +591,9 @@ /** * @brief Threads initialization hook. - * @details User initialization code added to the @p chThdInit() API. + * @details User initialization code added to the @p _thread_init() function. * - * @note It is invoked from within @p chThdInit() and implicitly from all + * @note It is invoked from within @p _thread_init() and implicitly from all * the threads creation APIs. */ #define CH_CFG_THREAD_INIT_HOOK(tp) { \ @@ -422,10 +603,6 @@ /** * @brief Threads finalization hook. * @details User finalization code added to the @p chThdExit() API. - * - * @note It is inserted into lock zone. - * @note It is also invoked when the threads simply return in order to - * terminate. */ #define CH_CFG_THREAD_EXIT_HOOK(tp) { \ /* Add threads finalization code here.*/ \ @@ -438,20 +615,20 @@ #define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \ /* Context switch code here.*/ \ } - -/** - * @brief ISR enter hook. - */ -#define CH_CFG_IRQ_PROLOGUE_HOOK() { \ - /* IRQ prologue code here.*/ \ -} - -/** - * @brief ISR exit hook. - */ -#define CH_CFG_IRQ_EPILOGUE_HOOK() { \ - /* IRQ epilogue code here.*/ \ -} + +/** + * @brief ISR enter hook. + */ +#define CH_CFG_IRQ_PROLOGUE_HOOK() { \ + /* IRQ prologue code here.*/ \ +} + +/** + * @brief ISR exit hook. + */ +#define CH_CFG_IRQ_EPILOGUE_HOOK() { \ + /* IRQ epilogue code here.*/ \ +} /** * @brief Idle thread enter hook. @@ -460,6 +637,7 @@ * @note This macro can be used to activate a power saving mode. */ #define CH_CFG_IDLE_ENTER_HOOK() { \ + /* Idle-enter code here.*/ \ } /** @@ -469,6 +647,7 @@ * @note This macro can be used to deactivate a power saving mode. */ #define CH_CFG_IDLE_LEAVE_HOOK() { \ + /* Idle-leave code here.*/ \ } /** @@ -496,15 +675,15 @@ #define CH_CFG_SYSTEM_HALT_HOOK(reason) { \ /* System halt code here.*/ \ } - -/** - * @brief Trace hook. - * @details This hook is invoked each time a new record is written in the - * trace buffer. - */ -#define CH_CFG_TRACE_HOOK(tep) { \ - /* Trace code here.*/ \ -} + +/** + * @brief Trace hook. + * @details This hook is invoked each time a new record is written in the + * trace buffer. + */ +#define CH_CFG_TRACE_HOOK(tep) { \ + /* Trace code here.*/ \ +} /** @} */ @@ -512,6 +691,6 @@ /* Port-specific settings (override port settings defaulted in chcore.h). */ /*===========================================================================*/ -#endif /* _CHCONF_H_ */ +#endif /* CHCONF_H */ /** @} */ diff --git a/testhal/KINETIS/FRDM-KL26Z/I2C/halconf_community.h b/testhal/KINETIS/FRDM-KL26Z/I2C/halconf_community.h new file mode 100644 index 0000000..43fdbf8 --- /dev/null +++ b/testhal/KINETIS/FRDM-KL26Z/I2C/halconf_community.h @@ -0,0 +1,173 @@ +/* + ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#ifndef HALCONF_COMMUNITY_H +#define HALCONF_COMMUNITY_H + +/** + * @brief Enables the community overlay. + */ +#if !defined(HAL_USE_COMMUNITY) || defined(__DOXYGEN__) +#define HAL_USE_COMMUNITY TRUE +#endif + +/** + * @brief Enables the FSMC subsystem. + */ +#if !defined(HAL_USE_FSMC) || defined(__DOXYGEN__) +#define HAL_USE_FSMC FALSE +#endif + +/** + * @brief Enables the NAND subsystem. + */ +#if !defined(HAL_USE_NAND) || defined(__DOXYGEN__) +#define HAL_USE_NAND FALSE +#endif + +/** + * @brief Enables the 1-wire subsystem. + */ +#if !defined(HAL_USE_ONEWIRE) || defined(__DOXYGEN__) +#define HAL_USE_ONEWIRE FALSE +#endif + +/** + * @brief Enables the EICU subsystem. + */ +#if !defined(HAL_USE_EICU) || defined(__DOXYGEN__) +#define HAL_USE_EICU FALSE +#endif + +/** + * @brief Enables the CRC subsystem. + */ +#if !defined(HAL_USE_CRC) || defined(__DOXYGEN__) +#define HAL_USE_CRC FALSE +#endif + +/** + * @brief Enables the RNG subsystem. + */ +#if !defined(HAL_USE_RNG) || defined(__DOXYGEN__) +#define HAL_USE_RNG FALSE +#endif + +/** + * @brief Enables the EEPROM subsystem. + */ +#if !defined(HAL_USE_EEPROM) || defined(__DOXYGEN__) +#define HAL_USE_EEPROM FALSE +#endif + +/** + * @brief Enables the TIMCAP subsystem. + */ +#if !defined(HAL_USE_TIMCAP) || defined(__DOXYGEN__) +#define HAL_USE_TIMCAP FALSE +#endif + +/** + * @brief Enables the TIMCAP subsystem. + */ +#if !defined(HAL_USE_COMP) || defined(__DOXYGEN__) +#define HAL_USE_COMP FALSE +#endif + +/** + * @brief Enables the QEI subsystem. + */ +#if !defined(HAL_USE_QEI) || defined(__DOXYGEN__) +#define HAL_USE_QEI FALSE +#endif + +/** + * @brief Enables the USBH subsystem. + */ +#if !defined(HAL_USE_USBH) || defined(__DOXYGEN__) +#define HAL_USE_USBH FALSE +#endif + +/** + * @brief Enables the USB_MSD subsystem. + */ +#if !defined(HAL_USE_USB_MSD) || defined(__DOXYGEN__) +#define HAL_USE_USB_MSD FALSE +#endif + +/*===========================================================================*/ +/* FSMCNAND driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables the @p nandAcquireBus() and @p nanReleaseBus() APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(NAND_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define NAND_USE_MUTUAL_EXCLUSION TRUE +#endif + +/*===========================================================================*/ +/* 1-wire driver related settings. */ +/*===========================================================================*/ +/** + * @brief Enables strong pull up feature. + * @note Disabling this option saves both code and data space. + */ +#define ONEWIRE_USE_STRONG_PULLUP FALSE + +/** + * @brief Enables search ROM feature. + * @note Disabling this option saves both code and data space. + */ +#define ONEWIRE_USE_SEARCH_ROM TRUE + +/*===========================================================================*/ +/* QEI driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables discard of overlow + */ +#if !defined(QEI_USE_OVERFLOW_DISCARD) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_DISCARD FALSE +#endif + +/** + * @brief Enables min max of overlow + */ +#if !defined(QEI_USE_OVERFLOW_MINMAX) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_MINMAX FALSE +#endif + +/*===========================================================================*/ +/* EEProm driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables 24xx series I2C eeprom device driver. + * @note Disabling this option saves both code and data space. + */ +#define EEPROM_USE_EE24XX FALSE + /** + * @brief Enables 25xx series SPI eeprom device driver. + * @note Disabling this option saves both code and data space. + */ +#define EEPROM_USE_EE25XX FALSE + +#endif /* HALCONF_COMMUNITY_H */ + +/** @} */ diff --git a/testhal/KINETIS/FRDM-KL26Z/PWM/Makefile b/testhal/KINETIS/FRDM-KL26Z/PWM/Makefile index bca626d..7ce4956 100644 --- a/testhal/KINETIS/FRDM-KL26Z/PWM/Makefile +++ b/testhal/KINETIS/FRDM-KL26Z/PWM/Makefile @@ -5,7 +5,7 @@ # Compiler options here. ifeq ($(USE_OPT),) - USE_OPT = -O0 -ggdb -fomit-frame-pointer -falign-functions=16 + USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16 endif # C specific options here (added to USE_OPT). @@ -30,7 +30,7 @@ endif # Enable this if you want link time optimizations (LTO) ifeq ($(USE_LTO),) - USE_LTO = no + USE_LTO = yes endif # If enabled, this option allows to compile the application in THUMB mode. @@ -69,6 +69,11 @@ ifeq ($(USE_EXCEPTIONS_STACKSIZE),) USE_EXCEPTIONS_STACKSIZE = 0x400 endif +# Enables the use of FPU on Cortex-M4 (no, softfp, hard). +ifeq ($(USE_FPU),) + USE_FPU = no +endif + # # Architecture or project specific options ############################################################################## @@ -83,6 +88,8 @@ PROJECT = ch # Imported source files and paths CHIBIOS = ../../../../../ChibiOS-RT CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib +# Licensing files. +include $(CHIBIOS)/os/license/license.mk # Startup files. include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_kl2x.mk # HAL-OSAL files (optional). @@ -94,25 +101,19 @@ include $(CHIBIOS)/os/hal/osal/rt/osal.mk include $(CHIBIOS)/os/rt/rt.mk include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk # Other files (optional). -include $(CHIBIOS)/test/rt/test.mk # Define linker script file here LDSCRIPT= $(STARTUPLD)/MKL2xZ128.ld # C sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CSRC = $(STARTUPSRC) \ - $(KERNSRC) \ - $(PORTSRC) \ - $(OSALSRC) \ - $(HALSRC) \ - $(PLATFORMSRC) \ - $(BOARDSRC) \ +CSRC = $(ALLCSRC) \ + $(TESTSRC) \ main.c # C++ sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CPPSRC = +CPPSRC = $(ALLCPPSRC) # C sources to be compiled in ARM mode regardless of the global setting. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler @@ -135,12 +136,11 @@ TCSRC = TCPPSRC = # List ASM source files here -ASMSRC = -ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM) +ASMSRC = $(ALLASMSRC) +ASMXSRC = $(ALLXASMSRC) -INCDIR = $(CHIBIOS)/os/license \ - $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ - $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) +INCDIR = $(ALLINC) $(TESTINC) \ + $(TESTHAL) # # Project, sources and paths diff --git a/testhal/KINETIS/FRDM-KL26Z/PWM/chconf.h b/testhal/KINETIS/FRDM-KL26Z/PWM/chconf.h index 9f9b3e9..1750f63 100644 --- a/testhal/KINETIS/FRDM-KL26Z/PWM/chconf.h +++ b/testhal/KINETIS/FRDM-KL26Z/PWM/chconf.h @@ -1,5 +1,5 @@ /* - ChibiOS - (C) 2015-2016 flabbergast + ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -15,19 +15,21 @@ */ /** - * @file FRDM-KL26Z/PWM/chconf.h - * @brief Configuration file. + * @file templates/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 config * @details Kernel related settings and hooks. * @{ */ -#ifndef _CHCONF_H_ -#define _CHCONF_H_ +#ifndef CHCONF_H +#define CHCONF_H #define _CHIBIOS_RT_CONF_ -#define _CHIBIOS_RT_CONF_VER_5_0_ +#define _CHIBIOS_RT_CONF_VER_5_1_ /*===========================================================================*/ /** @@ -40,14 +42,34 @@ * @brief System time counter resolution. * @note Allowed values are 16 or 32 bits. */ +#if !defined(CH_CFG_ST_RESOLUTION) #define CH_CFG_ST_RESOLUTION 32 +#endif /** * @brief System tick frequency. * @details Frequency of the system timer that drives the system ticks. This * setting also defines the system tick time unit. */ +#if !defined(CH_CFG_ST_FREQUENCY) #define CH_CFG_ST_FREQUENCY 1000 +#endif + +/** + * @brief Time intervals data size. + * @note Allowed values are 16, 32 or 64 bits. + */ +#if !defined(CH_CFG_INTERVALS_SIZE) +#define CH_CFG_INTERVALS_SIZE 32 +#endif + +/** + * @brief Time types data size. + * @note Allowed values are 16 or 32 bits. + */ +#if !defined(CH_CFG_TIME_TYPES_SIZE) +#define CH_CFG_TIME_TYPES_SIZE 32 +#endif /** * @brief Time delta constant for the tick-less mode. @@ -57,7 +79,9 @@ * The value one is not valid, timeouts are rounded up to * this value. */ +#if !defined(CH_CFG_ST_TIMEDELTA) #define CH_CFG_ST_TIMEDELTA 0 +#endif /** @} */ @@ -80,7 +104,9 @@ * @note The round robin preemption is not supported in tickless mode and * must be set to zero in that case. */ -#define CH_CFG_TIME_QUANTUM 20 +#if !defined(CH_CFG_TIME_QUANTUM) +#define CH_CFG_TIME_QUANTUM 2 +#endif /** * @brief Managed RAM size. @@ -93,7 +119,9 @@ * provide the @p __heap_base__ and @p __heap_end__ symbols. * @note Requires @p CH_CFG_USE_MEMCORE. */ +#if !defined(CH_CFG_MEMCORE_SIZE) #define CH_CFG_MEMCORE_SIZE 0 +#endif /** * @brief Idle thread automatic spawn suppression. @@ -102,7 +130,9 @@ * function becomes the idle thread and must implement an * infinite loop. */ +#if !defined(CH_CFG_NO_IDLE_THREAD) #define CH_CFG_NO_IDLE_THREAD FALSE +#endif /** @} */ @@ -121,7 +151,9 @@ * @note This is not related to the compiler optimization options. * @note The default is @p TRUE. */ +#if !defined(CH_CFG_OPTIMIZE_SPEED) #define CH_CFG_OPTIMIZE_SPEED TRUE +#endif /** @} */ @@ -139,7 +171,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_TM) #define CH_CFG_USE_TM FALSE +#endif /** * @brief Threads registry APIs. @@ -147,7 +181,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_REGISTRY) #define CH_CFG_USE_REGISTRY TRUE +#endif /** * @brief Threads synchronization APIs. @@ -156,7 +192,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_WAITEXIT) #define CH_CFG_USE_WAITEXIT TRUE +#endif /** * @brief Semaphores APIs. @@ -164,7 +202,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_SEMAPHORES) #define CH_CFG_USE_SEMAPHORES TRUE +#endif /** * @brief Semaphores queuing mode. @@ -175,7 +215,9 @@ * requirements. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ +#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY) #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE +#endif /** * @brief Mutexes APIs. @@ -183,7 +225,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MUTEXES) #define CH_CFG_USE_MUTEXES TRUE +#endif /** * @brief Enables recursive behavior on mutexes. @@ -193,7 +237,9 @@ * @note The default is @p FALSE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE) #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE +#endif /** * @brief Conditional Variables APIs. @@ -203,7 +249,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_CONDVARS) #define CH_CFG_USE_CONDVARS TRUE +#endif /** * @brief Conditional Variables APIs with timeout. @@ -213,7 +261,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_CONDVARS. */ +#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT) #define CH_CFG_USE_CONDVARS_TIMEOUT TRUE +#endif /** * @brief Events Flags APIs. @@ -221,7 +271,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_EVENTS) #define CH_CFG_USE_EVENTS TRUE +#endif /** * @brief Events Flags APIs with timeout. @@ -231,7 +283,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_EVENTS. */ +#if !defined(CH_CFG_USE_EVENTS_TIMEOUT) #define CH_CFG_USE_EVENTS_TIMEOUT TRUE +#endif /** * @brief Synchronous Messages APIs. @@ -240,7 +294,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MESSAGES) #define CH_CFG_USE_MESSAGES TRUE +#endif /** * @brief Synchronous Messages queuing mode. @@ -251,7 +307,9 @@ * requirements. * @note Requires @p CH_CFG_USE_MESSAGES. */ +#if !defined(CH_CFG_USE_MESSAGES_PRIORITY) #define CH_CFG_USE_MESSAGES_PRIORITY FALSE +#endif /** * @brief Mailboxes APIs. @@ -261,7 +319,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ +#if !defined(CH_CFG_USE_MAILBOXES) #define CH_CFG_USE_MAILBOXES TRUE +#endif /** * @brief Core Memory Manager APIs. @@ -270,7 +330,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMCORE) #define CH_CFG_USE_MEMCORE TRUE +#endif /** * @brief Heap Allocator APIs. @@ -282,7 +344,9 @@ * @p CH_CFG_USE_SEMAPHORES. * @note Mutexes are recommended. */ +#if !defined(CH_CFG_USE_HEAP) #define CH_CFG_USE_HEAP TRUE +#endif /** * @brief Memory Pools Allocator APIs. @@ -291,7 +355,20 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMPOOLS) #define CH_CFG_USE_MEMPOOLS TRUE +#endif + +/** + * @brief Objects FIFOs APIs. + * @details If enabled then the objects FIFOs APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#if !defined(CH_CFG_USE_OBJ_FIFOS) +#define CH_CFG_USE_OBJ_FIFOS TRUE +#endif /** * @brief Dynamic Threads APIs. @@ -302,7 +379,73 @@ * @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. */ +#if !defined(CH_CFG_USE_DYNAMIC) #define CH_CFG_USE_DYNAMIC TRUE +#endif + +/** @} */ + +/*===========================================================================*/ +/** + * @name Objects factory options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Objects Factory APIs. + * @details If enabled then the objects factory APIs are included in the + * kernel. + * + * @note The default is @p FALSE. + */ +#if !defined(CH_CFG_USE_FACTORY) +#define CH_CFG_USE_FACTORY TRUE +#endif + +/** + * @brief Maximum length for object names. + * @details If the specified length is zero then the name is stored by + * pointer but this could have unintended side effects. + */ +#if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH) +#define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8 +#endif + +/** + * @brief Enables the registry of generic objects. + */ +#if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY) +#define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE +#endif + +/** + * @brief Enables factory for generic buffers. + */ +#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS) +#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE +#endif + +/** + * @brief Enables factory for semaphores. + */ +#if !defined(CH_CFG_FACTORY_SEMAPHORES) +#define CH_CFG_FACTORY_SEMAPHORES TRUE +#endif + +/** + * @brief Enables factory for mailboxes. + */ +#if !defined(CH_CFG_FACTORY_MAILBOXES) +#define CH_CFG_FACTORY_MAILBOXES TRUE +#endif + +/** + * @brief Enables factory for objects FIFOs. + */ +#if !defined(CH_CFG_FACTORY_OBJ_FIFOS) +#define CH_CFG_FACTORY_OBJ_FIFOS TRUE +#endif /** @} */ @@ -318,7 +461,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_STATISTICS) #define CH_DBG_STATISTICS FALSE +#endif /** * @brief Debug option, system state check. @@ -327,7 +472,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_SYSTEM_STATE_CHECK) #define CH_DBG_SYSTEM_STATE_CHECK TRUE +#endif /** * @brief Debug option, parameters checks. @@ -336,7 +483,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_ENABLE_CHECKS) #define CH_DBG_ENABLE_CHECKS TRUE +#endif /** * @brief Debug option, consistency checks. @@ -346,16 +495,28 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_ENABLE_ASSERTS) #define CH_DBG_ENABLE_ASSERTS TRUE +#endif /** * @brief Debug option, trace buffer. - * @details If enabled then the context switch circular trace buffer is - * activated. + * @details If enabled then the trace buffer is activated. * - * @note The default is @p FALSE. + * @note The default is @p CH_DBG_TRACE_MASK_DISABLED. + */ +#if !defined(CH_DBG_TRACE_MASK) +#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL +#endif + +/** + * @brief Trace buffer entries. + * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is + * different from @p CH_DBG_TRACE_MASK_DISABLED. */ -#define CH_DBG_ENABLE_TRACE TRUE +#if !defined(CH_DBG_TRACE_BUFFER_SIZE) +#define CH_DBG_TRACE_BUFFER_SIZE 128 +#endif /** * @brief Debug option, stack checks. @@ -367,7 +528,9 @@ * @note The default failure mode is to halt the system with the global * @p panic_msg variable set to @p NULL. */ +#if !defined(CH_DBG_ENABLE_STACK_CHECK) #define CH_DBG_ENABLE_STACK_CHECK TRUE +#endif /** * @brief Debug option, stacks initialization. @@ -377,7 +540,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_FILL_THREADS) #define CH_DBG_FILL_THREADS TRUE +#endif /** * @brief Debug option, threads profiling. @@ -388,7 +553,9 @@ * @note This debug option is not currently compatible with the * tickless mode. */ +#if !defined(CH_DBG_THREADS_PROFILING) #define CH_DBG_THREADS_PROFILING FALSE +#endif /** @} */ @@ -399,6 +566,22 @@ */ /*===========================================================================*/ +/** + * @brief System structure extension. + * @details User fields added to the end of the @p ch_system_t structure. + */ +#define CH_CFG_SYSTEM_EXTRA_FIELDS \ + /* Add threads custom fields here.*/ + +/** + * @brief System initialization hook. + * @details User initialization code added to the @p chSysInit() function + * just before interrupts are enabled globally. + */ +#define CH_CFG_SYSTEM_INIT_HOOK() { \ + /* Add threads initialization code here.*/ \ +} + /** * @brief Threads descriptor structure extension. * @details User fields added to the end of the @p thread_t structure. @@ -408,9 +591,9 @@ /** * @brief Threads initialization hook. - * @details User initialization code added to the @p chThdInit() API. + * @details User initialization code added to the @p _thread_init() function. * - * @note It is invoked from within @p chThdInit() and implicitly from all + * @note It is invoked from within @p _thread_init() and implicitly from all * the threads creation APIs. */ #define CH_CFG_THREAD_INIT_HOOK(tp) { \ @@ -420,10 +603,6 @@ /** * @brief Threads finalization hook. * @details User finalization code added to the @p chThdExit() API. - * - * @note It is inserted into lock zone. - * @note It is also invoked when the threads simply return in order to - * terminate. */ #define CH_CFG_THREAD_EXIT_HOOK(tp) { \ /* Add threads finalization code here.*/ \ @@ -458,6 +637,7 @@ * @note This macro can be used to activate a power saving mode. */ #define CH_CFG_IDLE_ENTER_HOOK() { \ + /* Idle-enter code here.*/ \ } /** @@ -467,6 +647,7 @@ * @note This macro can be used to deactivate a power saving mode. */ #define CH_CFG_IDLE_LEAVE_HOOK() { \ + /* Idle-leave code here.*/ \ } /** @@ -510,6 +691,6 @@ /* Port-specific settings (override port settings defaulted in chcore.h). */ /*===========================================================================*/ -#endif /* _CHCONF_H_ */ +#endif /* CHCONF_H */ /** @} */ diff --git a/testhal/KINETIS/FRDM-KL26Z/PWM/halconf_community.h b/testhal/KINETIS/FRDM-KL26Z/PWM/halconf_community.h new file mode 100644 index 0000000..43fdbf8 --- /dev/null +++ b/testhal/KINETIS/FRDM-KL26Z/PWM/halconf_community.h @@ -0,0 +1,173 @@ +/* + ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#ifndef HALCONF_COMMUNITY_H +#define HALCONF_COMMUNITY_H + +/** + * @brief Enables the community overlay. + */ +#if !defined(HAL_USE_COMMUNITY) || defined(__DOXYGEN__) +#define HAL_USE_COMMUNITY TRUE +#endif + +/** + * @brief Enables the FSMC subsystem. + */ +#if !defined(HAL_USE_FSMC) || defined(__DOXYGEN__) +#define HAL_USE_FSMC FALSE +#endif + +/** + * @brief Enables the NAND subsystem. + */ +#if !defined(HAL_USE_NAND) || defined(__DOXYGEN__) +#define HAL_USE_NAND FALSE +#endif + +/** + * @brief Enables the 1-wire subsystem. + */ +#if !defined(HAL_USE_ONEWIRE) || defined(__DOXYGEN__) +#define HAL_USE_ONEWIRE FALSE +#endif + +/** + * @brief Enables the EICU subsystem. + */ +#if !defined(HAL_USE_EICU) || defined(__DOXYGEN__) +#define HAL_USE_EICU FALSE +#endif + +/** + * @brief Enables the CRC subsystem. + */ +#if !defined(HAL_USE_CRC) || defined(__DOXYGEN__) +#define HAL_USE_CRC FALSE +#endif + +/** + * @brief Enables the RNG subsystem. + */ +#if !defined(HAL_USE_RNG) || defined(__DOXYGEN__) +#define HAL_USE_RNG FALSE +#endif + +/** + * @brief Enables the EEPROM subsystem. + */ +#if !defined(HAL_USE_EEPROM) || defined(__DOXYGEN__) +#define HAL_USE_EEPROM FALSE +#endif + +/** + * @brief Enables the TIMCAP subsystem. + */ +#if !defined(HAL_USE_TIMCAP) || defined(__DOXYGEN__) +#define HAL_USE_TIMCAP FALSE +#endif + +/** + * @brief Enables the TIMCAP subsystem. + */ +#if !defined(HAL_USE_COMP) || defined(__DOXYGEN__) +#define HAL_USE_COMP FALSE +#endif + +/** + * @brief Enables the QEI subsystem. + */ +#if !defined(HAL_USE_QEI) || defined(__DOXYGEN__) +#define HAL_USE_QEI FALSE +#endif + +/** + * @brief Enables the USBH subsystem. + */ +#if !defined(HAL_USE_USBH) || defined(__DOXYGEN__) +#define HAL_USE_USBH FALSE +#endif + +/** + * @brief Enables the USB_MSD subsystem. + */ +#if !defined(HAL_USE_USB_MSD) || defined(__DOXYGEN__) +#define HAL_USE_USB_MSD FALSE +#endif + +/*===========================================================================*/ +/* FSMCNAND driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables the @p nandAcquireBus() and @p nanReleaseBus() APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(NAND_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define NAND_USE_MUTUAL_EXCLUSION TRUE +#endif + +/*===========================================================================*/ +/* 1-wire driver related settings. */ +/*===========================================================================*/ +/** + * @brief Enables strong pull up feature. + * @note Disabling this option saves both code and data space. + */ +#define ONEWIRE_USE_STRONG_PULLUP FALSE + +/** + * @brief Enables search ROM feature. + * @note Disabling this option saves both code and data space. + */ +#define ONEWIRE_USE_SEARCH_ROM TRUE + +/*===========================================================================*/ +/* QEI driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables discard of overlow + */ +#if !defined(QEI_USE_OVERFLOW_DISCARD) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_DISCARD FALSE +#endif + +/** + * @brief Enables min max of overlow + */ +#if !defined(QEI_USE_OVERFLOW_MINMAX) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_MINMAX FALSE +#endif + +/*===========================================================================*/ +/* EEProm driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables 24xx series I2C eeprom device driver. + * @note Disabling this option saves both code and data space. + */ +#define EEPROM_USE_EE24XX FALSE + /** + * @brief Enables 25xx series SPI eeprom device driver. + * @note Disabling this option saves both code and data space. + */ +#define EEPROM_USE_EE25XX FALSE + +#endif /* HALCONF_COMMUNITY_H */ + +/** @} */ diff --git a/testhal/KINETIS/FRDM-KL26Z/USB_SERIAL/Makefile b/testhal/KINETIS/FRDM-KL26Z/USB_SERIAL/Makefile index 3cf61b4..b71d3b1 100644 --- a/testhal/KINETIS/FRDM-KL26Z/USB_SERIAL/Makefile +++ b/testhal/KINETIS/FRDM-KL26Z/USB_SERIAL/Makefile @@ -5,7 +5,7 @@ # Compiler options here. ifeq ($(USE_OPT),) - USE_OPT = -O0 -ggdb -fomit-frame-pointer -falign-functions=16 + USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16 endif # C specific options here (added to USE_OPT). @@ -30,7 +30,7 @@ endif # Enable this if you want link time optimizations (LTO) ifeq ($(USE_LTO),) - USE_LTO = no + USE_LTO = yes endif # If enabled, this option allows to compile the application in THUMB mode. @@ -69,6 +69,11 @@ ifeq ($(USE_EXCEPTIONS_STACKSIZE),) USE_EXCEPTIONS_STACKSIZE = 0x400 endif +# Enables the use of FPU on Cortex-M4 (no, softfp, hard). +ifeq ($(USE_FPU),) + USE_FPU = no +endif + # # Architecture or project specific options ############################################################################## @@ -83,6 +88,8 @@ PROJECT = ch # Imported source files and paths CHIBIOS = ../../../../../ChibiOS-RT CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib +# Licensing files. +include $(CHIBIOS)/os/license/license.mk # Startup files. include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_kl2x.mk # HAL-OSAL files (optional). @@ -94,7 +101,9 @@ include $(CHIBIOS)/os/hal/osal/rt/osal.mk include $(CHIBIOS)/os/rt/rt.mk include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk # Other files (optional). -include $(CHIBIOS)/test/rt/test.mk +include $(CHIBIOS)/test/lib/test.mk +include $(CHIBIOS)/test/rt/rt_test.mk +include $(CHIBIOS)/test/oslib/oslib_test.mk include $(CHIBIOS)/os/hal/lib/streams/streams.mk include $(CHIBIOS)/os/various/shell/shell.mk @@ -103,22 +112,14 @@ LDSCRIPT= $(STARTUPLD)/MKL2xZ128.ld # C sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CSRC = $(STARTUPSRC) \ - $(KERNSRC) \ - $(PORTSRC) \ - $(OSALSRC) \ - $(HALSRC) \ - $(PLATFORMSRC) \ - $(BOARDSRC) \ +CSRC = $(ALLCSRC) \ $(TESTSRC) \ - $(STREAMSSRC) \ - $(SHELLSRC) \ - main.c \ usbcfg.c \ + main.c # C++ sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CPPSRC = +CPPSRC = $(ALLCPPSRC) # C sources to be compiled in ARM mode regardless of the global setting. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler @@ -141,13 +142,11 @@ TCSRC = TCPPSRC = # List ASM source files here -ASMSRC = -ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM) +ASMSRC = $(ALLASMSRC) +ASMXSRC = $(ALLXASMSRC) -INCDIR = $(CHIBIOS)/os/license \ - $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ - $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \ - $(STREAMSINC) $(SHELLINC) +INCDIR = $(ALLINC) $(TESTINC) \ + $(TESTHAL) # # Project, sources and paths diff --git a/testhal/KINETIS/FRDM-KL26Z/USB_SERIAL/chconf.h b/testhal/KINETIS/FRDM-KL26Z/USB_SERIAL/chconf.h index 9c9a479..1750f63 100644 --- a/testhal/KINETIS/FRDM-KL26Z/USB_SERIAL/chconf.h +++ b/testhal/KINETIS/FRDM-KL26Z/USB_SERIAL/chconf.h @@ -1,5 +1,5 @@ /* - ChibiOS - (C) 2015-2016 flabbergast + ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -15,19 +15,21 @@ */ /** - * @file FRDM-KL26Z/USB_SERIAL/chconf.h - * @brief Configuration file. + * @file templates/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 config * @details Kernel related settings and hooks. * @{ */ -#ifndef _CHCONF_H_ -#define _CHCONF_H_ +#ifndef CHCONF_H +#define CHCONF_H #define _CHIBIOS_RT_CONF_ -#define _CHIBIOS_RT_CONF_VER_5_0_ +#define _CHIBIOS_RT_CONF_VER_5_1_ /*===========================================================================*/ /** @@ -40,14 +42,34 @@ * @brief System time counter resolution. * @note Allowed values are 16 or 32 bits. */ +#if !defined(CH_CFG_ST_RESOLUTION) #define CH_CFG_ST_RESOLUTION 32 +#endif /** * @brief System tick frequency. * @details Frequency of the system timer that drives the system ticks. This * setting also defines the system tick time unit. */ +#if !defined(CH_CFG_ST_FREQUENCY) #define CH_CFG_ST_FREQUENCY 1000 +#endif + +/** + * @brief Time intervals data size. + * @note Allowed values are 16, 32 or 64 bits. + */ +#if !defined(CH_CFG_INTERVALS_SIZE) +#define CH_CFG_INTERVALS_SIZE 32 +#endif + +/** + * @brief Time types data size. + * @note Allowed values are 16 or 32 bits. + */ +#if !defined(CH_CFG_TIME_TYPES_SIZE) +#define CH_CFG_TIME_TYPES_SIZE 32 +#endif /** * @brief Time delta constant for the tick-less mode. @@ -57,7 +79,9 @@ * The value one is not valid, timeouts are rounded up to * this value. */ +#if !defined(CH_CFG_ST_TIMEDELTA) #define CH_CFG_ST_TIMEDELTA 0 +#endif /** @} */ @@ -80,7 +104,9 @@ * @note The round robin preemption is not supported in tickless mode and * must be set to zero in that case. */ -#define CH_CFG_TIME_QUANTUM 20 +#if !defined(CH_CFG_TIME_QUANTUM) +#define CH_CFG_TIME_QUANTUM 2 +#endif /** * @brief Managed RAM size. @@ -93,7 +119,9 @@ * provide the @p __heap_base__ and @p __heap_end__ symbols. * @note Requires @p CH_CFG_USE_MEMCORE. */ +#if !defined(CH_CFG_MEMCORE_SIZE) #define CH_CFG_MEMCORE_SIZE 0 +#endif /** * @brief Idle thread automatic spawn suppression. @@ -102,7 +130,9 @@ * function becomes the idle thread and must implement an * infinite loop. */ +#if !defined(CH_CFG_NO_IDLE_THREAD) #define CH_CFG_NO_IDLE_THREAD FALSE +#endif /** @} */ @@ -121,7 +151,9 @@ * @note This is not related to the compiler optimization options. * @note The default is @p TRUE. */ +#if !defined(CH_CFG_OPTIMIZE_SPEED) #define CH_CFG_OPTIMIZE_SPEED TRUE +#endif /** @} */ @@ -139,7 +171,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_TM) #define CH_CFG_USE_TM FALSE +#endif /** * @brief Threads registry APIs. @@ -147,7 +181,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_REGISTRY) #define CH_CFG_USE_REGISTRY TRUE +#endif /** * @brief Threads synchronization APIs. @@ -156,7 +192,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_WAITEXIT) #define CH_CFG_USE_WAITEXIT TRUE +#endif /** * @brief Semaphores APIs. @@ -164,7 +202,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_SEMAPHORES) #define CH_CFG_USE_SEMAPHORES TRUE +#endif /** * @brief Semaphores queuing mode. @@ -175,7 +215,9 @@ * requirements. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ +#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY) #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE +#endif /** * @brief Mutexes APIs. @@ -183,7 +225,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MUTEXES) #define CH_CFG_USE_MUTEXES TRUE +#endif /** * @brief Enables recursive behavior on mutexes. @@ -193,7 +237,9 @@ * @note The default is @p FALSE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE) #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE +#endif /** * @brief Conditional Variables APIs. @@ -203,7 +249,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_CONDVARS) #define CH_CFG_USE_CONDVARS TRUE +#endif /** * @brief Conditional Variables APIs with timeout. @@ -213,7 +261,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_CONDVARS. */ +#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT) #define CH_CFG_USE_CONDVARS_TIMEOUT TRUE +#endif /** * @brief Events Flags APIs. @@ -221,7 +271,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_EVENTS) #define CH_CFG_USE_EVENTS TRUE +#endif /** * @brief Events Flags APIs with timeout. @@ -231,7 +283,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_EVENTS. */ +#if !defined(CH_CFG_USE_EVENTS_TIMEOUT) #define CH_CFG_USE_EVENTS_TIMEOUT TRUE +#endif /** * @brief Synchronous Messages APIs. @@ -240,7 +294,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MESSAGES) #define CH_CFG_USE_MESSAGES TRUE +#endif /** * @brief Synchronous Messages queuing mode. @@ -251,7 +307,9 @@ * requirements. * @note Requires @p CH_CFG_USE_MESSAGES. */ +#if !defined(CH_CFG_USE_MESSAGES_PRIORITY) #define CH_CFG_USE_MESSAGES_PRIORITY FALSE +#endif /** * @brief Mailboxes APIs. @@ -261,7 +319,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ +#if !defined(CH_CFG_USE_MAILBOXES) #define CH_CFG_USE_MAILBOXES TRUE +#endif /** * @brief Core Memory Manager APIs. @@ -270,7 +330,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMCORE) #define CH_CFG_USE_MEMCORE TRUE +#endif /** * @brief Heap Allocator APIs. @@ -282,7 +344,9 @@ * @p CH_CFG_USE_SEMAPHORES. * @note Mutexes are recommended. */ +#if !defined(CH_CFG_USE_HEAP) #define CH_CFG_USE_HEAP TRUE +#endif /** * @brief Memory Pools Allocator APIs. @@ -291,7 +355,20 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMPOOLS) #define CH_CFG_USE_MEMPOOLS TRUE +#endif + +/** + * @brief Objects FIFOs APIs. + * @details If enabled then the objects FIFOs APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#if !defined(CH_CFG_USE_OBJ_FIFOS) +#define CH_CFG_USE_OBJ_FIFOS TRUE +#endif /** * @brief Dynamic Threads APIs. @@ -302,7 +379,73 @@ * @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. */ +#if !defined(CH_CFG_USE_DYNAMIC) #define CH_CFG_USE_DYNAMIC TRUE +#endif + +/** @} */ + +/*===========================================================================*/ +/** + * @name Objects factory options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Objects Factory APIs. + * @details If enabled then the objects factory APIs are included in the + * kernel. + * + * @note The default is @p FALSE. + */ +#if !defined(CH_CFG_USE_FACTORY) +#define CH_CFG_USE_FACTORY TRUE +#endif + +/** + * @brief Maximum length for object names. + * @details If the specified length is zero then the name is stored by + * pointer but this could have unintended side effects. + */ +#if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH) +#define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8 +#endif + +/** + * @brief Enables the registry of generic objects. + */ +#if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY) +#define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE +#endif + +/** + * @brief Enables factory for generic buffers. + */ +#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS) +#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE +#endif + +/** + * @brief Enables factory for semaphores. + */ +#if !defined(CH_CFG_FACTORY_SEMAPHORES) +#define CH_CFG_FACTORY_SEMAPHORES TRUE +#endif + +/** + * @brief Enables factory for mailboxes. + */ +#if !defined(CH_CFG_FACTORY_MAILBOXES) +#define CH_CFG_FACTORY_MAILBOXES TRUE +#endif + +/** + * @brief Enables factory for objects FIFOs. + */ +#if !defined(CH_CFG_FACTORY_OBJ_FIFOS) +#define CH_CFG_FACTORY_OBJ_FIFOS TRUE +#endif /** @} */ @@ -318,7 +461,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_STATISTICS) #define CH_DBG_STATISTICS FALSE +#endif /** * @brief Debug option, system state check. @@ -327,7 +472,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_SYSTEM_STATE_CHECK) #define CH_DBG_SYSTEM_STATE_CHECK TRUE +#endif /** * @brief Debug option, parameters checks. @@ -336,7 +483,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_ENABLE_CHECKS) #define CH_DBG_ENABLE_CHECKS TRUE +#endif /** * @brief Debug option, consistency checks. @@ -346,16 +495,28 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_ENABLE_ASSERTS) #define CH_DBG_ENABLE_ASSERTS TRUE +#endif /** * @brief Debug option, trace buffer. - * @details If enabled then the context switch circular trace buffer is - * activated. + * @details If enabled then the trace buffer is activated. * - * @note The default is @p FALSE. + * @note The default is @p CH_DBG_TRACE_MASK_DISABLED. + */ +#if !defined(CH_DBG_TRACE_MASK) +#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL +#endif + +/** + * @brief Trace buffer entries. + * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is + * different from @p CH_DBG_TRACE_MASK_DISABLED. */ -#define CH_DBG_ENABLE_TRACE TRUE +#if !defined(CH_DBG_TRACE_BUFFER_SIZE) +#define CH_DBG_TRACE_BUFFER_SIZE 128 +#endif /** * @brief Debug option, stack checks. @@ -367,7 +528,9 @@ * @note The default failure mode is to halt the system with the global * @p panic_msg variable set to @p NULL. */ -#define CH_DBG_ENABLE_STACK_CHECK FALSE +#if !defined(CH_DBG_ENABLE_STACK_CHECK) +#define CH_DBG_ENABLE_STACK_CHECK TRUE +#endif /** * @brief Debug option, stacks initialization. @@ -377,7 +540,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_FILL_THREADS) #define CH_DBG_FILL_THREADS TRUE +#endif /** * @brief Debug option, threads profiling. @@ -388,7 +553,9 @@ * @note This debug option is not currently compatible with the * tickless mode. */ +#if !defined(CH_DBG_THREADS_PROFILING) #define CH_DBG_THREADS_PROFILING FALSE +#endif /** @} */ @@ -399,6 +566,22 @@ */ /*===========================================================================*/ +/** + * @brief System structure extension. + * @details User fields added to the end of the @p ch_system_t structure. + */ +#define CH_CFG_SYSTEM_EXTRA_FIELDS \ + /* Add threads custom fields here.*/ + +/** + * @brief System initialization hook. + * @details User initialization code added to the @p chSysInit() function + * just before interrupts are enabled globally. + */ +#define CH_CFG_SYSTEM_INIT_HOOK() { \ + /* Add threads initialization code here.*/ \ +} + /** * @brief Threads descriptor structure extension. * @details User fields added to the end of the @p thread_t structure. @@ -408,9 +591,9 @@ /** * @brief Threads initialization hook. - * @details User initialization code added to the @p chThdInit() API. + * @details User initialization code added to the @p _thread_init() function. * - * @note It is invoked from within @p chThdInit() and implicitly from all + * @note It is invoked from within @p _thread_init() and implicitly from all * the threads creation APIs. */ #define CH_CFG_THREAD_INIT_HOOK(tp) { \ @@ -420,10 +603,6 @@ /** * @brief Threads finalization hook. * @details User finalization code added to the @p chThdExit() API. - * - * @note It is inserted into lock zone. - * @note It is also invoked when the threads simply return in order to - * terminate. */ #define CH_CFG_THREAD_EXIT_HOOK(tp) { \ /* Add threads finalization code here.*/ \ @@ -458,6 +637,7 @@ * @note This macro can be used to activate a power saving mode. */ #define CH_CFG_IDLE_ENTER_HOOK() { \ + /* Idle-enter code here.*/ \ } /** @@ -467,6 +647,7 @@ * @note This macro can be used to deactivate a power saving mode. */ #define CH_CFG_IDLE_LEAVE_HOOK() { \ + /* Idle-leave code here.*/ \ } /** @@ -510,6 +691,6 @@ /* Port-specific settings (override port settings defaulted in chcore.h). */ /*===========================================================================*/ -#endif /* _CHCONF_H_ */ +#endif /* CHCONF_H */ /** @} */ diff --git a/testhal/KINETIS/FRDM-KL26Z/USB_SERIAL/halconf_community.h b/testhal/KINETIS/FRDM-KL26Z/USB_SERIAL/halconf_community.h new file mode 100644 index 0000000..43fdbf8 --- /dev/null +++ b/testhal/KINETIS/FRDM-KL26Z/USB_SERIAL/halconf_community.h @@ -0,0 +1,173 @@ +/* + ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#ifndef HALCONF_COMMUNITY_H +#define HALCONF_COMMUNITY_H + +/** + * @brief Enables the community overlay. + */ +#if !defined(HAL_USE_COMMUNITY) || defined(__DOXYGEN__) +#define HAL_USE_COMMUNITY TRUE +#endif + +/** + * @brief Enables the FSMC subsystem. + */ +#if !defined(HAL_USE_FSMC) || defined(__DOXYGEN__) +#define HAL_USE_FSMC FALSE +#endif + +/** + * @brief Enables the NAND subsystem. + */ +#if !defined(HAL_USE_NAND) || defined(__DOXYGEN__) +#define HAL_USE_NAND FALSE +#endif + +/** + * @brief Enables the 1-wire subsystem. + */ +#if !defined(HAL_USE_ONEWIRE) || defined(__DOXYGEN__) +#define HAL_USE_ONEWIRE FALSE +#endif + +/** + * @brief Enables the EICU subsystem. + */ +#if !defined(HAL_USE_EICU) || defined(__DOXYGEN__) +#define HAL_USE_EICU FALSE +#endif + +/** + * @brief Enables the CRC subsystem. + */ +#if !defined(HAL_USE_CRC) || defined(__DOXYGEN__) +#define HAL_USE_CRC FALSE +#endif + +/** + * @brief Enables the RNG subsystem. + */ +#if !defined(HAL_USE_RNG) || defined(__DOXYGEN__) +#define HAL_USE_RNG FALSE +#endif + +/** + * @brief Enables the EEPROM subsystem. + */ +#if !defined(HAL_USE_EEPROM) || defined(__DOXYGEN__) +#define HAL_USE_EEPROM FALSE +#endif + +/** + * @brief Enables the TIMCAP subsystem. + */ +#if !defined(HAL_USE_TIMCAP) || defined(__DOXYGEN__) +#define HAL_USE_TIMCAP FALSE +#endif + +/** + * @brief Enables the TIMCAP subsystem. + */ +#if !defined(HAL_USE_COMP) || defined(__DOXYGEN__) +#define HAL_USE_COMP FALSE +#endif + +/** + * @brief Enables the QEI subsystem. + */ +#if !defined(HAL_USE_QEI) || defined(__DOXYGEN__) +#define HAL_USE_QEI FALSE +#endif + +/** + * @brief Enables the USBH subsystem. + */ +#if !defined(HAL_USE_USBH) || defined(__DOXYGEN__) +#define HAL_USE_USBH FALSE +#endif + +/** + * @brief Enables the USB_MSD subsystem. + */ +#if !defined(HAL_USE_USB_MSD) || defined(__DOXYGEN__) +#define HAL_USE_USB_MSD FALSE +#endif + +/*===========================================================================*/ +/* FSMCNAND driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables the @p nandAcquireBus() and @p nanReleaseBus() APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(NAND_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define NAND_USE_MUTUAL_EXCLUSION TRUE +#endif + +/*===========================================================================*/ +/* 1-wire driver related settings. */ +/*===========================================================================*/ +/** + * @brief Enables strong pull up feature. + * @note Disabling this option saves both code and data space. + */ +#define ONEWIRE_USE_STRONG_PULLUP FALSE + +/** + * @brief Enables search ROM feature. + * @note Disabling this option saves both code and data space. + */ +#define ONEWIRE_USE_SEARCH_ROM TRUE + +/*===========================================================================*/ +/* QEI driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables discard of overlow + */ +#if !defined(QEI_USE_OVERFLOW_DISCARD) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_DISCARD FALSE +#endif + +/** + * @brief Enables min max of overlow + */ +#if !defined(QEI_USE_OVERFLOW_MINMAX) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_MINMAX FALSE +#endif + +/*===========================================================================*/ +/* EEProm driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables 24xx series I2C eeprom device driver. + * @note Disabling this option saves both code and data space. + */ +#define EEPROM_USE_EE24XX FALSE + /** + * @brief Enables 25xx series SPI eeprom device driver. + * @note Disabling this option saves both code and data space. + */ +#define EEPROM_USE_EE25XX FALSE + +#endif /* HALCONF_COMMUNITY_H */ + +/** @} */ diff --git a/testhal/KINETIS/KL27Z/BLINK/Makefile b/testhal/KINETIS/KL27Z/BLINK/Makefile index 16025f3..cd6424e 100644 --- a/testhal/KINETIS/KL27Z/BLINK/Makefile +++ b/testhal/KINETIS/KL27Z/BLINK/Makefile @@ -5,7 +5,7 @@ # Compiler options here. ifeq ($(USE_OPT),) - USE_OPT = -O0 -ggdb -fomit-frame-pointer -falign-functions=16 + USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16 endif # C specific options here (added to USE_OPT). @@ -30,7 +30,7 @@ endif # Enable this if you want link time optimizations (LTO) ifeq ($(USE_LTO),) - USE_LTO = no + USE_LTO = yes endif # If enabled, this option allows to compile the application in THUMB mode. @@ -69,6 +69,11 @@ ifeq ($(USE_EXCEPTIONS_STACKSIZE),) USE_EXCEPTIONS_STACKSIZE = 0x400 endif +# Enables the use of FPU on Cortex-M4 (no, softfp, hard). +ifeq ($(USE_FPU),) + USE_FPU = no +endif + # # Architecture or project specific options ############################################################################## @@ -83,6 +88,8 @@ PROJECT = ch # Imported source files and paths CHIBIOS = ../../../../../ChibiOS-RT CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib +# Licensing files. +include $(CHIBIOS)/os/license/license.mk # Startup files. include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_kl2x.mk # HAL-OSAL files (optional). @@ -100,18 +107,13 @@ LDSCRIPT= $(STARTUPLD)/MKL27Z256.ld # C sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CSRC = $(STARTUPSRC) \ - $(KERNSRC) \ - $(PORTSRC) \ - $(OSALSRC) \ - $(HALSRC) \ - $(PLATFORMSRC) \ - $(BOARDSRC) \ +CSRC = $(ALLCSRC) \ + $(TESTSRC) \ main.c # C++ sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CPPSRC = +CPPSRC = $(ALLCPPSRC) # C sources to be compiled in ARM mode regardless of the global setting. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler @@ -134,13 +136,11 @@ TCSRC = TCPPSRC = # List ASM source files here -ASMSRC = -ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM) +ASMSRC = $(ALLASMSRC) +ASMXSRC = $(ALLXASMSRC) -INCDIR = $(CHIBIOS)/os/license \ - $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ - $(HALINC) $(PLATFORMINC) $(BOARDINC) \ - $(CHIBIOS)/os/various +INCDIR = $(ALLINC) $(TESTINC) \ + $(TESTHAL) # # Project, sources and paths diff --git a/testhal/KINETIS/KL27Z/BLINK/board/board.mk b/testhal/KINETIS/KL27Z/BLINK/board/board.mk index 14102c4..b410cdb 100644 --- a/testhal/KINETIS/KL27Z/BLINK/board/board.mk +++ b/testhal/KINETIS/KL27Z/BLINK/board/board.mk @@ -3,3 +3,7 @@ BOARDSRC = ./board/board.c # Required include directories BOARDINC = ./board + +# Shared variables +ALLCSRC += $(BOARDSRC) +ALLINC += $(BOARDINC) diff --git a/testhal/KINETIS/KL27Z/BLINK/chconf.h b/testhal/KINETIS/KL27Z/BLINK/chconf.h index 49d21ae..1750f63 100644 --- a/testhal/KINETIS/KL27Z/BLINK/chconf.h +++ b/testhal/KINETIS/KL27Z/BLINK/chconf.h @@ -1,5 +1,5 @@ /* - ChibiOS - (C) 2015-2016 flabbergast + ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ */ /** - * @file KL27Z/BLINK/chconf.h + * @file templates/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. @@ -25,11 +25,11 @@ * @{ */ -#ifndef _CHCONF_H_ -#define _CHCONF_H_ +#ifndef CHCONF_H +#define CHCONF_H #define _CHIBIOS_RT_CONF_ -#define _CHIBIOS_RT_CONF_VER_5_0_ +#define _CHIBIOS_RT_CONF_VER_5_1_ /*===========================================================================*/ /** @@ -42,14 +42,34 @@ * @brief System time counter resolution. * @note Allowed values are 16 or 32 bits. */ +#if !defined(CH_CFG_ST_RESOLUTION) #define CH_CFG_ST_RESOLUTION 32 +#endif /** * @brief System tick frequency. * @details Frequency of the system timer that drives the system ticks. This * setting also defines the system tick time unit. */ +#if !defined(CH_CFG_ST_FREQUENCY) #define CH_CFG_ST_FREQUENCY 1000 +#endif + +/** + * @brief Time intervals data size. + * @note Allowed values are 16, 32 or 64 bits. + */ +#if !defined(CH_CFG_INTERVALS_SIZE) +#define CH_CFG_INTERVALS_SIZE 32 +#endif + +/** + * @brief Time types data size. + * @note Allowed values are 16 or 32 bits. + */ +#if !defined(CH_CFG_TIME_TYPES_SIZE) +#define CH_CFG_TIME_TYPES_SIZE 32 +#endif /** * @brief Time delta constant for the tick-less mode. @@ -59,7 +79,9 @@ * The value one is not valid, timeouts are rounded up to * this value. */ +#if !defined(CH_CFG_ST_TIMEDELTA) #define CH_CFG_ST_TIMEDELTA 0 +#endif /** @} */ @@ -82,7 +104,9 @@ * @note The round robin preemption is not supported in tickless mode and * must be set to zero in that case. */ -#define CH_CFG_TIME_QUANTUM 20 +#if !defined(CH_CFG_TIME_QUANTUM) +#define CH_CFG_TIME_QUANTUM 2 +#endif /** * @brief Managed RAM size. @@ -95,7 +119,9 @@ * provide the @p __heap_base__ and @p __heap_end__ symbols. * @note Requires @p CH_CFG_USE_MEMCORE. */ +#if !defined(CH_CFG_MEMCORE_SIZE) #define CH_CFG_MEMCORE_SIZE 0 +#endif /** * @brief Idle thread automatic spawn suppression. @@ -104,7 +130,9 @@ * function becomes the idle thread and must implement an * infinite loop. */ +#if !defined(CH_CFG_NO_IDLE_THREAD) #define CH_CFG_NO_IDLE_THREAD FALSE +#endif /** @} */ @@ -123,7 +151,9 @@ * @note This is not related to the compiler optimization options. * @note The default is @p TRUE. */ +#if !defined(CH_CFG_OPTIMIZE_SPEED) #define CH_CFG_OPTIMIZE_SPEED TRUE +#endif /** @} */ @@ -141,7 +171,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_TM) #define CH_CFG_USE_TM FALSE +#endif /** * @brief Threads registry APIs. @@ -149,7 +181,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_REGISTRY) #define CH_CFG_USE_REGISTRY TRUE +#endif /** * @brief Threads synchronization APIs. @@ -158,7 +192,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_WAITEXIT) #define CH_CFG_USE_WAITEXIT TRUE +#endif /** * @brief Semaphores APIs. @@ -166,7 +202,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_SEMAPHORES) #define CH_CFG_USE_SEMAPHORES TRUE +#endif /** * @brief Semaphores queuing mode. @@ -177,7 +215,9 @@ * requirements. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ -#define CH_CFG_USE_SEMAPHORES_PRIORITY TRUE +#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY) +#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE +#endif /** * @brief Mutexes APIs. @@ -185,7 +225,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MUTEXES) #define CH_CFG_USE_MUTEXES TRUE +#endif /** * @brief Enables recursive behavior on mutexes. @@ -195,7 +237,9 @@ * @note The default is @p FALSE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE) #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE +#endif /** * @brief Conditional Variables APIs. @@ -205,7 +249,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_CONDVARS) #define CH_CFG_USE_CONDVARS TRUE +#endif /** * @brief Conditional Variables APIs with timeout. @@ -215,7 +261,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_CONDVARS. */ +#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT) #define CH_CFG_USE_CONDVARS_TIMEOUT TRUE +#endif /** * @brief Events Flags APIs. @@ -223,7 +271,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_EVENTS) #define CH_CFG_USE_EVENTS TRUE +#endif /** * @brief Events Flags APIs with timeout. @@ -233,7 +283,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_EVENTS. */ +#if !defined(CH_CFG_USE_EVENTS_TIMEOUT) #define CH_CFG_USE_EVENTS_TIMEOUT TRUE +#endif /** * @brief Synchronous Messages APIs. @@ -242,7 +294,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MESSAGES) #define CH_CFG_USE_MESSAGES TRUE +#endif /** * @brief Synchronous Messages queuing mode. @@ -253,7 +307,9 @@ * requirements. * @note Requires @p CH_CFG_USE_MESSAGES. */ +#if !defined(CH_CFG_USE_MESSAGES_PRIORITY) #define CH_CFG_USE_MESSAGES_PRIORITY FALSE +#endif /** * @brief Mailboxes APIs. @@ -263,7 +319,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ +#if !defined(CH_CFG_USE_MAILBOXES) #define CH_CFG_USE_MAILBOXES TRUE +#endif /** * @brief Core Memory Manager APIs. @@ -272,7 +330,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMCORE) #define CH_CFG_USE_MEMCORE TRUE +#endif /** * @brief Heap Allocator APIs. @@ -284,7 +344,9 @@ * @p CH_CFG_USE_SEMAPHORES. * @note Mutexes are recommended. */ +#if !defined(CH_CFG_USE_HEAP) #define CH_CFG_USE_HEAP TRUE +#endif /** * @brief Memory Pools Allocator APIs. @@ -293,7 +355,20 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMPOOLS) #define CH_CFG_USE_MEMPOOLS TRUE +#endif + +/** + * @brief Objects FIFOs APIs. + * @details If enabled then the objects FIFOs APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#if !defined(CH_CFG_USE_OBJ_FIFOS) +#define CH_CFG_USE_OBJ_FIFOS TRUE +#endif /** * @brief Dynamic Threads APIs. @@ -304,7 +379,73 @@ * @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. */ +#if !defined(CH_CFG_USE_DYNAMIC) #define CH_CFG_USE_DYNAMIC TRUE +#endif + +/** @} */ + +/*===========================================================================*/ +/** + * @name Objects factory options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Objects Factory APIs. + * @details If enabled then the objects factory APIs are included in the + * kernel. + * + * @note The default is @p FALSE. + */ +#if !defined(CH_CFG_USE_FACTORY) +#define CH_CFG_USE_FACTORY TRUE +#endif + +/** + * @brief Maximum length for object names. + * @details If the specified length is zero then the name is stored by + * pointer but this could have unintended side effects. + */ +#if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH) +#define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8 +#endif + +/** + * @brief Enables the registry of generic objects. + */ +#if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY) +#define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE +#endif + +/** + * @brief Enables factory for generic buffers. + */ +#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS) +#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE +#endif + +/** + * @brief Enables factory for semaphores. + */ +#if !defined(CH_CFG_FACTORY_SEMAPHORES) +#define CH_CFG_FACTORY_SEMAPHORES TRUE +#endif + +/** + * @brief Enables factory for mailboxes. + */ +#if !defined(CH_CFG_FACTORY_MAILBOXES) +#define CH_CFG_FACTORY_MAILBOXES TRUE +#endif + +/** + * @brief Enables factory for objects FIFOs. + */ +#if !defined(CH_CFG_FACTORY_OBJ_FIFOS) +#define CH_CFG_FACTORY_OBJ_FIFOS TRUE +#endif /** @} */ @@ -320,7 +461,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_STATISTICS) #define CH_DBG_STATISTICS FALSE +#endif /** * @brief Debug option, system state check. @@ -329,7 +472,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_SYSTEM_STATE_CHECK) #define CH_DBG_SYSTEM_STATE_CHECK TRUE +#endif /** * @brief Debug option, parameters checks. @@ -338,7 +483,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_ENABLE_CHECKS) #define CH_DBG_ENABLE_CHECKS TRUE +#endif /** * @brief Debug option, consistency checks. @@ -348,16 +495,28 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_ENABLE_ASSERTS) #define CH_DBG_ENABLE_ASSERTS TRUE +#endif /** * @brief Debug option, trace buffer. - * @details If enabled then the context switch circular trace buffer is - * activated. + * @details If enabled then the trace buffer is activated. * - * @note The default is @p FALSE. + * @note The default is @p CH_DBG_TRACE_MASK_DISABLED. + */ +#if !defined(CH_DBG_TRACE_MASK) +#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL +#endif + +/** + * @brief Trace buffer entries. + * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is + * different from @p CH_DBG_TRACE_MASK_DISABLED. */ -#define CH_DBG_ENABLE_TRACE TRUE +#if !defined(CH_DBG_TRACE_BUFFER_SIZE) +#define CH_DBG_TRACE_BUFFER_SIZE 128 +#endif /** * @brief Debug option, stack checks. @@ -369,7 +528,9 @@ * @note The default failure mode is to halt the system with the global * @p panic_msg variable set to @p NULL. */ +#if !defined(CH_DBG_ENABLE_STACK_CHECK) #define CH_DBG_ENABLE_STACK_CHECK TRUE +#endif /** * @brief Debug option, stacks initialization. @@ -379,7 +540,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_FILL_THREADS) #define CH_DBG_FILL_THREADS TRUE +#endif /** * @brief Debug option, threads profiling. @@ -390,7 +553,9 @@ * @note This debug option is not currently compatible with the * tickless mode. */ +#if !defined(CH_DBG_THREADS_PROFILING) #define CH_DBG_THREADS_PROFILING FALSE +#endif /** @} */ @@ -401,6 +566,22 @@ */ /*===========================================================================*/ +/** + * @brief System structure extension. + * @details User fields added to the end of the @p ch_system_t structure. + */ +#define CH_CFG_SYSTEM_EXTRA_FIELDS \ + /* Add threads custom fields here.*/ + +/** + * @brief System initialization hook. + * @details User initialization code added to the @p chSysInit() function + * just before interrupts are enabled globally. + */ +#define CH_CFG_SYSTEM_INIT_HOOK() { \ + /* Add threads initialization code here.*/ \ +} + /** * @brief Threads descriptor structure extension. * @details User fields added to the end of the @p thread_t structure. @@ -410,9 +591,9 @@ /** * @brief Threads initialization hook. - * @details User initialization code added to the @p chThdInit() API. + * @details User initialization code added to the @p _thread_init() function. * - * @note It is invoked from within @p chThdInit() and implicitly from all + * @note It is invoked from within @p _thread_init() and implicitly from all * the threads creation APIs. */ #define CH_CFG_THREAD_INIT_HOOK(tp) { \ @@ -422,10 +603,6 @@ /** * @brief Threads finalization hook. * @details User finalization code added to the @p chThdExit() API. - * - * @note It is inserted into lock zone. - * @note It is also invoked when the threads simply return in order to - * terminate. */ #define CH_CFG_THREAD_EXIT_HOOK(tp) { \ /* Add threads finalization code here.*/ \ @@ -460,6 +637,7 @@ * @note This macro can be used to activate a power saving mode. */ #define CH_CFG_IDLE_ENTER_HOOK() { \ + /* Idle-enter code here.*/ \ } /** @@ -469,6 +647,7 @@ * @note This macro can be used to deactivate a power saving mode. */ #define CH_CFG_IDLE_LEAVE_HOOK() { \ + /* Idle-leave code here.*/ \ } /** @@ -512,6 +691,6 @@ /* Port-specific settings (override port settings defaulted in chcore.h). */ /*===========================================================================*/ -#endif /* _CHCONF_H_ */ +#endif /* CHCONF_H */ /** @} */ diff --git a/testhal/KINETIS/KL27Z/BLINK/halconf_community.h b/testhal/KINETIS/KL27Z/BLINK/halconf_community.h new file mode 100644 index 0000000..43fdbf8 --- /dev/null +++ b/testhal/KINETIS/KL27Z/BLINK/halconf_community.h @@ -0,0 +1,173 @@ +/* + ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#ifndef HALCONF_COMMUNITY_H +#define HALCONF_COMMUNITY_H + +/** + * @brief Enables the community overlay. + */ +#if !defined(HAL_USE_COMMUNITY) || defined(__DOXYGEN__) +#define HAL_USE_COMMUNITY TRUE +#endif + +/** + * @brief Enables the FSMC subsystem. + */ +#if !defined(HAL_USE_FSMC) || defined(__DOXYGEN__) +#define HAL_USE_FSMC FALSE +#endif + +/** + * @brief Enables the NAND subsystem. + */ +#if !defined(HAL_USE_NAND) || defined(__DOXYGEN__) +#define HAL_USE_NAND FALSE +#endif + +/** + * @brief Enables the 1-wire subsystem. + */ +#if !defined(HAL_USE_ONEWIRE) || defined(__DOXYGEN__) +#define HAL_USE_ONEWIRE FALSE +#endif + +/** + * @brief Enables the EICU subsystem. + */ +#if !defined(HAL_USE_EICU) || defined(__DOXYGEN__) +#define HAL_USE_EICU FALSE +#endif + +/** + * @brief Enables the CRC subsystem. + */ +#if !defined(HAL_USE_CRC) || defined(__DOXYGEN__) +#define HAL_USE_CRC FALSE +#endif + +/** + * @brief Enables the RNG subsystem. + */ +#if !defined(HAL_USE_RNG) || defined(__DOXYGEN__) +#define HAL_USE_RNG FALSE +#endif + +/** + * @brief Enables the EEPROM subsystem. + */ +#if !defined(HAL_USE_EEPROM) || defined(__DOXYGEN__) +#define HAL_USE_EEPROM FALSE +#endif + +/** + * @brief Enables the TIMCAP subsystem. + */ +#if !defined(HAL_USE_TIMCAP) || defined(__DOXYGEN__) +#define HAL_USE_TIMCAP FALSE +#endif + +/** + * @brief Enables the TIMCAP subsystem. + */ +#if !defined(HAL_USE_COMP) || defined(__DOXYGEN__) +#define HAL_USE_COMP FALSE +#endif + +/** + * @brief Enables the QEI subsystem. + */ +#if !defined(HAL_USE_QEI) || defined(__DOXYGEN__) +#define HAL_USE_QEI FALSE +#endif + +/** + * @brief Enables the USBH subsystem. + */ +#if !defined(HAL_USE_USBH) || defined(__DOXYGEN__) +#define HAL_USE_USBH FALSE +#endif + +/** + * @brief Enables the USB_MSD subsystem. + */ +#if !defined(HAL_USE_USB_MSD) || defined(__DOXYGEN__) +#define HAL_USE_USB_MSD FALSE +#endif + +/*===========================================================================*/ +/* FSMCNAND driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables the @p nandAcquireBus() and @p nanReleaseBus() APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(NAND_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define NAND_USE_MUTUAL_EXCLUSION TRUE +#endif + +/*===========================================================================*/ +/* 1-wire driver related settings. */ +/*===========================================================================*/ +/** + * @brief Enables strong pull up feature. + * @note Disabling this option saves both code and data space. + */ +#define ONEWIRE_USE_STRONG_PULLUP FALSE + +/** + * @brief Enables search ROM feature. + * @note Disabling this option saves both code and data space. + */ +#define ONEWIRE_USE_SEARCH_ROM TRUE + +/*===========================================================================*/ +/* QEI driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables discard of overlow + */ +#if !defined(QEI_USE_OVERFLOW_DISCARD) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_DISCARD FALSE +#endif + +/** + * @brief Enables min max of overlow + */ +#if !defined(QEI_USE_OVERFLOW_MINMAX) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_MINMAX FALSE +#endif + +/*===========================================================================*/ +/* EEProm driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables 24xx series I2C eeprom device driver. + * @note Disabling this option saves both code and data space. + */ +#define EEPROM_USE_EE24XX FALSE + /** + * @brief Enables 25xx series SPI eeprom device driver. + * @note Disabling this option saves both code and data space. + */ +#define EEPROM_USE_EE25XX FALSE + +#endif /* HALCONF_COMMUNITY_H */ + +/** @} */ diff --git a/testhal/KINETIS/MCHCK/BOOTLOADER/Makefile b/testhal/KINETIS/MCHCK/BOOTLOADER/Makefile index 884d20e..8ff8acd 100644 --- a/testhal/KINETIS/MCHCK/BOOTLOADER/Makefile +++ b/testhal/KINETIS/MCHCK/BOOTLOADER/Makefile @@ -30,7 +30,7 @@ endif # Enable this if you want link time optimizations (LTO) ifeq ($(USE_LTO),) - USE_LTO = no + USE_LTO = yes endif # If enabled, this option allows to compile the application in THUMB mode. @@ -88,6 +88,8 @@ PROJECT = ch # Imported source files and paths CHIBIOS = ../../../../../ChibiOS-RT CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib +# Licensing files. +include $(CHIBIOS)/os/license/license.mk # Startup files. include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_k20x5.mk # HAL-OSAL files (optional). @@ -106,19 +108,13 @@ LDSCRIPT= $(STARTUPLD)/MK20DX128BLDR4.ld # C sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CSRC = $(STARTUPSRC) \ - $(KERNSRC) \ - $(PORTSRC) \ - $(OSALSRC) \ - $(HALSRC) \ - $(PLATFORMSRC) \ - $(BOARDSRC) \ +CSRC = $(ALLCSRC) \ $(TESTSRC) \ main.c # C++ sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CPPSRC = +CPPSRC = $(ALLCPPSRC) # C sources to be compiled in ARM mode regardless of the global setting. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler @@ -141,13 +137,11 @@ TCSRC = TCPPSRC = # List ASM source files here -ASMSRC = -ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM) +ASMSRC = $(ALLASMSRC) +ASMXSRC = $(ALLXASMSRC) -INCDIR = $(CHIBIOS)/os/license \ - $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ - $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \ - $(CHIBIOS)/os/various +INCDIR = $(ALLINC) $(TESTINC) \ + $(TESTHAL) # # Project, sources and paths diff --git a/testhal/KINETIS/MCHCK/BOOTLOADER/chconf.h b/testhal/KINETIS/MCHCK/BOOTLOADER/chconf.h index a185459..1750f63 100644 --- a/testhal/KINETIS/MCHCK/BOOTLOADER/chconf.h +++ b/testhal/KINETIS/MCHCK/BOOTLOADER/chconf.h @@ -1,5 +1,5 @@ /* - ChibiOS - (C) 2015-2016 flabbergast + ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -15,19 +15,21 @@ */ /** - * @file MCHCK/BOOTLOADER/chconf.h - * @brief Configuration file. + * @file templates/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 config * @details Kernel related settings and hooks. * @{ */ -#ifndef _CHCONF_H_ -#define _CHCONF_H_ +#ifndef CHCONF_H +#define CHCONF_H #define _CHIBIOS_RT_CONF_ -#define _CHIBIOS_RT_CONF_VER_5_0_ +#define _CHIBIOS_RT_CONF_VER_5_1_ /*===========================================================================*/ /** @@ -40,14 +42,34 @@ * @brief System time counter resolution. * @note Allowed values are 16 or 32 bits. */ +#if !defined(CH_CFG_ST_RESOLUTION) #define CH_CFG_ST_RESOLUTION 32 +#endif /** * @brief System tick frequency. * @details Frequency of the system timer that drives the system ticks. This * setting also defines the system tick time unit. */ +#if !defined(CH_CFG_ST_FREQUENCY) #define CH_CFG_ST_FREQUENCY 1000 +#endif + +/** + * @brief Time intervals data size. + * @note Allowed values are 16, 32 or 64 bits. + */ +#if !defined(CH_CFG_INTERVALS_SIZE) +#define CH_CFG_INTERVALS_SIZE 32 +#endif + +/** + * @brief Time types data size. + * @note Allowed values are 16 or 32 bits. + */ +#if !defined(CH_CFG_TIME_TYPES_SIZE) +#define CH_CFG_TIME_TYPES_SIZE 32 +#endif /** * @brief Time delta constant for the tick-less mode. @@ -57,7 +79,9 @@ * The value one is not valid, timeouts are rounded up to * this value. */ +#if !defined(CH_CFG_ST_TIMEDELTA) #define CH_CFG_ST_TIMEDELTA 0 +#endif /** @} */ @@ -80,7 +104,9 @@ * @note The round robin preemption is not supported in tickless mode and * must be set to zero in that case. */ -#define CH_CFG_TIME_QUANTUM 20 +#if !defined(CH_CFG_TIME_QUANTUM) +#define CH_CFG_TIME_QUANTUM 2 +#endif /** * @brief Managed RAM size. @@ -93,7 +119,9 @@ * provide the @p __heap_base__ and @p __heap_end__ symbols. * @note Requires @p CH_CFG_USE_MEMCORE. */ +#if !defined(CH_CFG_MEMCORE_SIZE) #define CH_CFG_MEMCORE_SIZE 0 +#endif /** * @brief Idle thread automatic spawn suppression. @@ -102,7 +130,9 @@ * function becomes the idle thread and must implement an * infinite loop. */ +#if !defined(CH_CFG_NO_IDLE_THREAD) #define CH_CFG_NO_IDLE_THREAD FALSE +#endif /** @} */ @@ -121,7 +151,9 @@ * @note This is not related to the compiler optimization options. * @note The default is @p TRUE. */ +#if !defined(CH_CFG_OPTIMIZE_SPEED) #define CH_CFG_OPTIMIZE_SPEED TRUE +#endif /** @} */ @@ -139,7 +171,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_TM) #define CH_CFG_USE_TM FALSE +#endif /** * @brief Threads registry APIs. @@ -147,7 +181,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_REGISTRY) #define CH_CFG_USE_REGISTRY TRUE +#endif /** * @brief Threads synchronization APIs. @@ -156,7 +192,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_WAITEXIT) #define CH_CFG_USE_WAITEXIT TRUE +#endif /** * @brief Semaphores APIs. @@ -164,7 +202,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_SEMAPHORES) #define CH_CFG_USE_SEMAPHORES TRUE +#endif /** * @brief Semaphores queuing mode. @@ -175,7 +215,9 @@ * requirements. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ -#define CH_CFG_USE_SEMAPHORES_PRIORITY TRUE +#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY) +#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE +#endif /** * @brief Mutexes APIs. @@ -183,7 +225,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MUTEXES) #define CH_CFG_USE_MUTEXES TRUE +#endif /** * @brief Enables recursive behavior on mutexes. @@ -193,7 +237,9 @@ * @note The default is @p FALSE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE) #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE +#endif /** * @brief Conditional Variables APIs. @@ -203,7 +249,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_CONDVARS) #define CH_CFG_USE_CONDVARS TRUE +#endif /** * @brief Conditional Variables APIs with timeout. @@ -213,7 +261,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_CONDVARS. */ +#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT) #define CH_CFG_USE_CONDVARS_TIMEOUT TRUE +#endif /** * @brief Events Flags APIs. @@ -221,7 +271,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_EVENTS) #define CH_CFG_USE_EVENTS TRUE +#endif /** * @brief Events Flags APIs with timeout. @@ -231,7 +283,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_EVENTS. */ +#if !defined(CH_CFG_USE_EVENTS_TIMEOUT) #define CH_CFG_USE_EVENTS_TIMEOUT TRUE +#endif /** * @brief Synchronous Messages APIs. @@ -240,7 +294,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MESSAGES) #define CH_CFG_USE_MESSAGES TRUE +#endif /** * @brief Synchronous Messages queuing mode. @@ -251,7 +307,9 @@ * requirements. * @note Requires @p CH_CFG_USE_MESSAGES. */ +#if !defined(CH_CFG_USE_MESSAGES_PRIORITY) #define CH_CFG_USE_MESSAGES_PRIORITY FALSE +#endif /** * @brief Mailboxes APIs. @@ -261,7 +319,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ +#if !defined(CH_CFG_USE_MAILBOXES) #define CH_CFG_USE_MAILBOXES TRUE +#endif /** * @brief Core Memory Manager APIs. @@ -270,7 +330,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMCORE) #define CH_CFG_USE_MEMCORE TRUE +#endif /** * @brief Heap Allocator APIs. @@ -282,7 +344,9 @@ * @p CH_CFG_USE_SEMAPHORES. * @note Mutexes are recommended. */ +#if !defined(CH_CFG_USE_HEAP) #define CH_CFG_USE_HEAP TRUE +#endif /** * @brief Memory Pools Allocator APIs. @@ -291,7 +355,20 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMPOOLS) #define CH_CFG_USE_MEMPOOLS TRUE +#endif + +/** + * @brief Objects FIFOs APIs. + * @details If enabled then the objects FIFOs APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#if !defined(CH_CFG_USE_OBJ_FIFOS) +#define CH_CFG_USE_OBJ_FIFOS TRUE +#endif /** * @brief Dynamic Threads APIs. @@ -302,7 +379,73 @@ * @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. */ +#if !defined(CH_CFG_USE_DYNAMIC) #define CH_CFG_USE_DYNAMIC TRUE +#endif + +/** @} */ + +/*===========================================================================*/ +/** + * @name Objects factory options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Objects Factory APIs. + * @details If enabled then the objects factory APIs are included in the + * kernel. + * + * @note The default is @p FALSE. + */ +#if !defined(CH_CFG_USE_FACTORY) +#define CH_CFG_USE_FACTORY TRUE +#endif + +/** + * @brief Maximum length for object names. + * @details If the specified length is zero then the name is stored by + * pointer but this could have unintended side effects. + */ +#if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH) +#define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8 +#endif + +/** + * @brief Enables the registry of generic objects. + */ +#if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY) +#define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE +#endif + +/** + * @brief Enables factory for generic buffers. + */ +#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS) +#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE +#endif + +/** + * @brief Enables factory for semaphores. + */ +#if !defined(CH_CFG_FACTORY_SEMAPHORES) +#define CH_CFG_FACTORY_SEMAPHORES TRUE +#endif + +/** + * @brief Enables factory for mailboxes. + */ +#if !defined(CH_CFG_FACTORY_MAILBOXES) +#define CH_CFG_FACTORY_MAILBOXES TRUE +#endif + +/** + * @brief Enables factory for objects FIFOs. + */ +#if !defined(CH_CFG_FACTORY_OBJ_FIFOS) +#define CH_CFG_FACTORY_OBJ_FIFOS TRUE +#endif /** @} */ @@ -318,7 +461,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_STATISTICS) #define CH_DBG_STATISTICS FALSE +#endif /** * @brief Debug option, system state check. @@ -327,7 +472,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_SYSTEM_STATE_CHECK) #define CH_DBG_SYSTEM_STATE_CHECK TRUE +#endif /** * @brief Debug option, parameters checks. @@ -336,7 +483,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_ENABLE_CHECKS) #define CH_DBG_ENABLE_CHECKS TRUE +#endif /** * @brief Debug option, consistency checks. @@ -346,16 +495,28 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_ENABLE_ASSERTS) #define CH_DBG_ENABLE_ASSERTS TRUE +#endif /** * @brief Debug option, trace buffer. - * @details If enabled then the context switch circular trace buffer is - * activated. + * @details If enabled then the trace buffer is activated. * - * @note The default is @p FALSE. + * @note The default is @p CH_DBG_TRACE_MASK_DISABLED. + */ +#if !defined(CH_DBG_TRACE_MASK) +#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL +#endif + +/** + * @brief Trace buffer entries. + * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is + * different from @p CH_DBG_TRACE_MASK_DISABLED. */ -#define CH_DBG_ENABLE_TRACE TRUE +#if !defined(CH_DBG_TRACE_BUFFER_SIZE) +#define CH_DBG_TRACE_BUFFER_SIZE 128 +#endif /** * @brief Debug option, stack checks. @@ -367,7 +528,9 @@ * @note The default failure mode is to halt the system with the global * @p panic_msg variable set to @p NULL. */ +#if !defined(CH_DBG_ENABLE_STACK_CHECK) #define CH_DBG_ENABLE_STACK_CHECK TRUE +#endif /** * @brief Debug option, stacks initialization. @@ -377,7 +540,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_FILL_THREADS) #define CH_DBG_FILL_THREADS TRUE +#endif /** * @brief Debug option, threads profiling. @@ -388,7 +553,9 @@ * @note This debug option is not currently compatible with the * tickless mode. */ +#if !defined(CH_DBG_THREADS_PROFILING) #define CH_DBG_THREADS_PROFILING FALSE +#endif /** @} */ @@ -399,6 +566,22 @@ */ /*===========================================================================*/ +/** + * @brief System structure extension. + * @details User fields added to the end of the @p ch_system_t structure. + */ +#define CH_CFG_SYSTEM_EXTRA_FIELDS \ + /* Add threads custom fields here.*/ + +/** + * @brief System initialization hook. + * @details User initialization code added to the @p chSysInit() function + * just before interrupts are enabled globally. + */ +#define CH_CFG_SYSTEM_INIT_HOOK() { \ + /* Add threads initialization code here.*/ \ +} + /** * @brief Threads descriptor structure extension. * @details User fields added to the end of the @p thread_t structure. @@ -408,9 +591,9 @@ /** * @brief Threads initialization hook. - * @details User initialization code added to the @p chThdInit() API. + * @details User initialization code added to the @p _thread_init() function. * - * @note It is invoked from within @p chThdInit() and implicitly from all + * @note It is invoked from within @p _thread_init() and implicitly from all * the threads creation APIs. */ #define CH_CFG_THREAD_INIT_HOOK(tp) { \ @@ -420,10 +603,6 @@ /** * @brief Threads finalization hook. * @details User finalization code added to the @p chThdExit() API. - * - * @note It is inserted into lock zone. - * @note It is also invoked when the threads simply return in order to - * terminate. */ #define CH_CFG_THREAD_EXIT_HOOK(tp) { \ /* Add threads finalization code here.*/ \ @@ -458,6 +637,7 @@ * @note This macro can be used to activate a power saving mode. */ #define CH_CFG_IDLE_ENTER_HOOK() { \ + /* Idle-enter code here.*/ \ } /** @@ -467,6 +647,7 @@ * @note This macro can be used to deactivate a power saving mode. */ #define CH_CFG_IDLE_LEAVE_HOOK() { \ + /* Idle-leave code here.*/ \ } /** @@ -510,6 +691,6 @@ /* Port-specific settings (override port settings defaulted in chcore.h). */ /*===========================================================================*/ -#endif /* _CHCONF_H_ */ +#endif /* CHCONF_H */ /** @} */ diff --git a/testhal/KINETIS/MCHCK/BOOTLOADER/halconf_community.h b/testhal/KINETIS/MCHCK/BOOTLOADER/halconf_community.h new file mode 100644 index 0000000..43fdbf8 --- /dev/null +++ b/testhal/KINETIS/MCHCK/BOOTLOADER/halconf_community.h @@ -0,0 +1,173 @@ +/* + ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#ifndef HALCONF_COMMUNITY_H +#define HALCONF_COMMUNITY_H + +/** + * @brief Enables the community overlay. + */ +#if !defined(HAL_USE_COMMUNITY) || defined(__DOXYGEN__) +#define HAL_USE_COMMUNITY TRUE +#endif + +/** + * @brief Enables the FSMC subsystem. + */ +#if !defined(HAL_USE_FSMC) || defined(__DOXYGEN__) +#define HAL_USE_FSMC FALSE +#endif + +/** + * @brief Enables the NAND subsystem. + */ +#if !defined(HAL_USE_NAND) || defined(__DOXYGEN__) +#define HAL_USE_NAND FALSE +#endif + +/** + * @brief Enables the 1-wire subsystem. + */ +#if !defined(HAL_USE_ONEWIRE) || defined(__DOXYGEN__) +#define HAL_USE_ONEWIRE FALSE +#endif + +/** + * @brief Enables the EICU subsystem. + */ +#if !defined(HAL_USE_EICU) || defined(__DOXYGEN__) +#define HAL_USE_EICU FALSE +#endif + +/** + * @brief Enables the CRC subsystem. + */ +#if !defined(HAL_USE_CRC) || defined(__DOXYGEN__) +#define HAL_USE_CRC FALSE +#endif + +/** + * @brief Enables the RNG subsystem. + */ +#if !defined(HAL_USE_RNG) || defined(__DOXYGEN__) +#define HAL_USE_RNG FALSE +#endif + +/** + * @brief Enables the EEPROM subsystem. + */ +#if !defined(HAL_USE_EEPROM) || defined(__DOXYGEN__) +#define HAL_USE_EEPROM FALSE +#endif + +/** + * @brief Enables the TIMCAP subsystem. + */ +#if !defined(HAL_USE_TIMCAP) || defined(__DOXYGEN__) +#define HAL_USE_TIMCAP FALSE +#endif + +/** + * @brief Enables the TIMCAP subsystem. + */ +#if !defined(HAL_USE_COMP) || defined(__DOXYGEN__) +#define HAL_USE_COMP FALSE +#endif + +/** + * @brief Enables the QEI subsystem. + */ +#if !defined(HAL_USE_QEI) || defined(__DOXYGEN__) +#define HAL_USE_QEI FALSE +#endif + +/** + * @brief Enables the USBH subsystem. + */ +#if !defined(HAL_USE_USBH) || defined(__DOXYGEN__) +#define HAL_USE_USBH FALSE +#endif + +/** + * @brief Enables the USB_MSD subsystem. + */ +#if !defined(HAL_USE_USB_MSD) || defined(__DOXYGEN__) +#define HAL_USE_USB_MSD FALSE +#endif + +/*===========================================================================*/ +/* FSMCNAND driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables the @p nandAcquireBus() and @p nanReleaseBus() APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(NAND_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define NAND_USE_MUTUAL_EXCLUSION TRUE +#endif + +/*===========================================================================*/ +/* 1-wire driver related settings. */ +/*===========================================================================*/ +/** + * @brief Enables strong pull up feature. + * @note Disabling this option saves both code and data space. + */ +#define ONEWIRE_USE_STRONG_PULLUP FALSE + +/** + * @brief Enables search ROM feature. + * @note Disabling this option saves both code and data space. + */ +#define ONEWIRE_USE_SEARCH_ROM TRUE + +/*===========================================================================*/ +/* QEI driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables discard of overlow + */ +#if !defined(QEI_USE_OVERFLOW_DISCARD) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_DISCARD FALSE +#endif + +/** + * @brief Enables min max of overlow + */ +#if !defined(QEI_USE_OVERFLOW_MINMAX) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_MINMAX FALSE +#endif + +/*===========================================================================*/ +/* EEProm driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables 24xx series I2C eeprom device driver. + * @note Disabling this option saves both code and data space. + */ +#define EEPROM_USE_EE24XX FALSE + /** + * @brief Enables 25xx series SPI eeprom device driver. + * @note Disabling this option saves both code and data space. + */ +#define EEPROM_USE_EE25XX FALSE + +#endif /* HALCONF_COMMUNITY_H */ + +/** @} */ diff --git a/testhal/KINETIS/MCHCK/PWM/Makefile b/testhal/KINETIS/MCHCK/PWM/Makefile index 884d20e..8ff8acd 100644 --- a/testhal/KINETIS/MCHCK/PWM/Makefile +++ b/testhal/KINETIS/MCHCK/PWM/Makefile @@ -30,7 +30,7 @@ endif # Enable this if you want link time optimizations (LTO) ifeq ($(USE_LTO),) - USE_LTO = no + USE_LTO = yes endif # If enabled, this option allows to compile the application in THUMB mode. @@ -88,6 +88,8 @@ PROJECT = ch # Imported source files and paths CHIBIOS = ../../../../../ChibiOS-RT CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib +# Licensing files. +include $(CHIBIOS)/os/license/license.mk # Startup files. include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_k20x5.mk # HAL-OSAL files (optional). @@ -106,19 +108,13 @@ LDSCRIPT= $(STARTUPLD)/MK20DX128BLDR4.ld # C sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CSRC = $(STARTUPSRC) \ - $(KERNSRC) \ - $(PORTSRC) \ - $(OSALSRC) \ - $(HALSRC) \ - $(PLATFORMSRC) \ - $(BOARDSRC) \ +CSRC = $(ALLCSRC) \ $(TESTSRC) \ main.c # C++ sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CPPSRC = +CPPSRC = $(ALLCPPSRC) # C sources to be compiled in ARM mode regardless of the global setting. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler @@ -141,13 +137,11 @@ TCSRC = TCPPSRC = # List ASM source files here -ASMSRC = -ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM) +ASMSRC = $(ALLASMSRC) +ASMXSRC = $(ALLXASMSRC) -INCDIR = $(CHIBIOS)/os/license \ - $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ - $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \ - $(CHIBIOS)/os/various +INCDIR = $(ALLINC) $(TESTINC) \ + $(TESTHAL) # # Project, sources and paths diff --git a/testhal/KINETIS/MCHCK/PWM/chconf.h b/testhal/KINETIS/MCHCK/PWM/chconf.h index 2f2938a..1750f63 100644 --- a/testhal/KINETIS/MCHCK/PWM/chconf.h +++ b/testhal/KINETIS/MCHCK/PWM/chconf.h @@ -1,5 +1,5 @@ /* - ChibiOS - (C) 2015-2016 flabbergast + ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -15,19 +15,21 @@ */ /** - * @file MCHCK/PWM/chconf.h - * @brief Configuration file. + * @file templates/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 config * @details Kernel related settings and hooks. * @{ */ -#ifndef _CHCONF_H_ -#define _CHCONF_H_ +#ifndef CHCONF_H +#define CHCONF_H #define _CHIBIOS_RT_CONF_ -#define _CHIBIOS_RT_CONF_VER_5_0_ +#define _CHIBIOS_RT_CONF_VER_5_1_ /*===========================================================================*/ /** @@ -40,14 +42,34 @@ * @brief System time counter resolution. * @note Allowed values are 16 or 32 bits. */ +#if !defined(CH_CFG_ST_RESOLUTION) #define CH_CFG_ST_RESOLUTION 32 +#endif /** * @brief System tick frequency. * @details Frequency of the system timer that drives the system ticks. This * setting also defines the system tick time unit. */ +#if !defined(CH_CFG_ST_FREQUENCY) #define CH_CFG_ST_FREQUENCY 1000 +#endif + +/** + * @brief Time intervals data size. + * @note Allowed values are 16, 32 or 64 bits. + */ +#if !defined(CH_CFG_INTERVALS_SIZE) +#define CH_CFG_INTERVALS_SIZE 32 +#endif + +/** + * @brief Time types data size. + * @note Allowed values are 16 or 32 bits. + */ +#if !defined(CH_CFG_TIME_TYPES_SIZE) +#define CH_CFG_TIME_TYPES_SIZE 32 +#endif /** * @brief Time delta constant for the tick-less mode. @@ -57,7 +79,9 @@ * The value one is not valid, timeouts are rounded up to * this value. */ +#if !defined(CH_CFG_ST_TIMEDELTA) #define CH_CFG_ST_TIMEDELTA 0 +#endif /** @} */ @@ -80,7 +104,9 @@ * @note The round robin preemption is not supported in tickless mode and * must be set to zero in that case. */ -#define CH_CFG_TIME_QUANTUM 20 +#if !defined(CH_CFG_TIME_QUANTUM) +#define CH_CFG_TIME_QUANTUM 2 +#endif /** * @brief Managed RAM size. @@ -93,7 +119,9 @@ * provide the @p __heap_base__ and @p __heap_end__ symbols. * @note Requires @p CH_CFG_USE_MEMCORE. */ +#if !defined(CH_CFG_MEMCORE_SIZE) #define CH_CFG_MEMCORE_SIZE 0 +#endif /** * @brief Idle thread automatic spawn suppression. @@ -102,7 +130,9 @@ * function becomes the idle thread and must implement an * infinite loop. */ +#if !defined(CH_CFG_NO_IDLE_THREAD) #define CH_CFG_NO_IDLE_THREAD FALSE +#endif /** @} */ @@ -121,7 +151,9 @@ * @note This is not related to the compiler optimization options. * @note The default is @p TRUE. */ +#if !defined(CH_CFG_OPTIMIZE_SPEED) #define CH_CFG_OPTIMIZE_SPEED TRUE +#endif /** @} */ @@ -139,7 +171,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_TM) #define CH_CFG_USE_TM FALSE +#endif /** * @brief Threads registry APIs. @@ -147,7 +181,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_REGISTRY) #define CH_CFG_USE_REGISTRY TRUE +#endif /** * @brief Threads synchronization APIs. @@ -156,7 +192,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_WAITEXIT) #define CH_CFG_USE_WAITEXIT TRUE +#endif /** * @brief Semaphores APIs. @@ -164,7 +202,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_SEMAPHORES) #define CH_CFG_USE_SEMAPHORES TRUE +#endif /** * @brief Semaphores queuing mode. @@ -175,7 +215,9 @@ * requirements. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ +#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY) #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE +#endif /** * @brief Mutexes APIs. @@ -183,7 +225,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MUTEXES) #define CH_CFG_USE_MUTEXES TRUE +#endif /** * @brief Enables recursive behavior on mutexes. @@ -193,7 +237,9 @@ * @note The default is @p FALSE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE) #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE +#endif /** * @brief Conditional Variables APIs. @@ -203,7 +249,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_CONDVARS) #define CH_CFG_USE_CONDVARS TRUE +#endif /** * @brief Conditional Variables APIs with timeout. @@ -213,7 +261,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_CONDVARS. */ +#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT) #define CH_CFG_USE_CONDVARS_TIMEOUT TRUE +#endif /** * @brief Events Flags APIs. @@ -221,7 +271,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_EVENTS) #define CH_CFG_USE_EVENTS TRUE +#endif /** * @brief Events Flags APIs with timeout. @@ -231,7 +283,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_EVENTS. */ +#if !defined(CH_CFG_USE_EVENTS_TIMEOUT) #define CH_CFG_USE_EVENTS_TIMEOUT TRUE +#endif /** * @brief Synchronous Messages APIs. @@ -240,7 +294,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MESSAGES) #define CH_CFG_USE_MESSAGES TRUE +#endif /** * @brief Synchronous Messages queuing mode. @@ -251,7 +307,9 @@ * requirements. * @note Requires @p CH_CFG_USE_MESSAGES. */ +#if !defined(CH_CFG_USE_MESSAGES_PRIORITY) #define CH_CFG_USE_MESSAGES_PRIORITY FALSE +#endif /** * @brief Mailboxes APIs. @@ -261,7 +319,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ +#if !defined(CH_CFG_USE_MAILBOXES) #define CH_CFG_USE_MAILBOXES TRUE +#endif /** * @brief Core Memory Manager APIs. @@ -270,7 +330,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMCORE) #define CH_CFG_USE_MEMCORE TRUE +#endif /** * @brief Heap Allocator APIs. @@ -282,7 +344,9 @@ * @p CH_CFG_USE_SEMAPHORES. * @note Mutexes are recommended. */ +#if !defined(CH_CFG_USE_HEAP) #define CH_CFG_USE_HEAP TRUE +#endif /** * @brief Memory Pools Allocator APIs. @@ -291,7 +355,20 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMPOOLS) #define CH_CFG_USE_MEMPOOLS TRUE +#endif + +/** + * @brief Objects FIFOs APIs. + * @details If enabled then the objects FIFOs APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#if !defined(CH_CFG_USE_OBJ_FIFOS) +#define CH_CFG_USE_OBJ_FIFOS TRUE +#endif /** * @brief Dynamic Threads APIs. @@ -302,7 +379,73 @@ * @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. */ +#if !defined(CH_CFG_USE_DYNAMIC) #define CH_CFG_USE_DYNAMIC TRUE +#endif + +/** @} */ + +/*===========================================================================*/ +/** + * @name Objects factory options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Objects Factory APIs. + * @details If enabled then the objects factory APIs are included in the + * kernel. + * + * @note The default is @p FALSE. + */ +#if !defined(CH_CFG_USE_FACTORY) +#define CH_CFG_USE_FACTORY TRUE +#endif + +/** + * @brief Maximum length for object names. + * @details If the specified length is zero then the name is stored by + * pointer but this could have unintended side effects. + */ +#if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH) +#define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8 +#endif + +/** + * @brief Enables the registry of generic objects. + */ +#if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY) +#define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE +#endif + +/** + * @brief Enables factory for generic buffers. + */ +#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS) +#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE +#endif + +/** + * @brief Enables factory for semaphores. + */ +#if !defined(CH_CFG_FACTORY_SEMAPHORES) +#define CH_CFG_FACTORY_SEMAPHORES TRUE +#endif + +/** + * @brief Enables factory for mailboxes. + */ +#if !defined(CH_CFG_FACTORY_MAILBOXES) +#define CH_CFG_FACTORY_MAILBOXES TRUE +#endif + +/** + * @brief Enables factory for objects FIFOs. + */ +#if !defined(CH_CFG_FACTORY_OBJ_FIFOS) +#define CH_CFG_FACTORY_OBJ_FIFOS TRUE +#endif /** @} */ @@ -318,7 +461,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_STATISTICS) #define CH_DBG_STATISTICS FALSE +#endif /** * @brief Debug option, system state check. @@ -327,7 +472,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_SYSTEM_STATE_CHECK FALSE +#if !defined(CH_DBG_SYSTEM_STATE_CHECK) +#define CH_DBG_SYSTEM_STATE_CHECK TRUE +#endif /** * @brief Debug option, parameters checks. @@ -336,7 +483,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_ENABLE_CHECKS FALSE +#if !defined(CH_DBG_ENABLE_CHECKS) +#define CH_DBG_ENABLE_CHECKS TRUE +#endif /** * @brief Debug option, consistency checks. @@ -346,16 +495,28 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_ENABLE_ASSERTS FALSE +#if !defined(CH_DBG_ENABLE_ASSERTS) +#define CH_DBG_ENABLE_ASSERTS TRUE +#endif /** * @brief Debug option, trace buffer. - * @details If enabled then the context switch circular trace buffer is - * activated. + * @details If enabled then the trace buffer is activated. * - * @note The default is @p FALSE. + * @note The default is @p CH_DBG_TRACE_MASK_DISABLED. + */ +#if !defined(CH_DBG_TRACE_MASK) +#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL +#endif + +/** + * @brief Trace buffer entries. + * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is + * different from @p CH_DBG_TRACE_MASK_DISABLED. */ -#define CH_DBG_ENABLE_TRACE FALSE +#if !defined(CH_DBG_TRACE_BUFFER_SIZE) +#define CH_DBG_TRACE_BUFFER_SIZE 128 +#endif /** * @brief Debug option, stack checks. @@ -367,7 +528,9 @@ * @note The default failure mode is to halt the system with the global * @p panic_msg variable set to @p NULL. */ -#define CH_DBG_ENABLE_STACK_CHECK FALSE +#if !defined(CH_DBG_ENABLE_STACK_CHECK) +#define CH_DBG_ENABLE_STACK_CHECK TRUE +#endif /** * @brief Debug option, stacks initialization. @@ -377,7 +540,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_FILL_THREADS FALSE +#if !defined(CH_DBG_FILL_THREADS) +#define CH_DBG_FILL_THREADS TRUE +#endif /** * @brief Debug option, threads profiling. @@ -388,7 +553,9 @@ * @note This debug option is not currently compatible with the * tickless mode. */ +#if !defined(CH_DBG_THREADS_PROFILING) #define CH_DBG_THREADS_PROFILING FALSE +#endif /** @} */ @@ -399,6 +566,22 @@ */ /*===========================================================================*/ +/** + * @brief System structure extension. + * @details User fields added to the end of the @p ch_system_t structure. + */ +#define CH_CFG_SYSTEM_EXTRA_FIELDS \ + /* Add threads custom fields here.*/ + +/** + * @brief System initialization hook. + * @details User initialization code added to the @p chSysInit() function + * just before interrupts are enabled globally. + */ +#define CH_CFG_SYSTEM_INIT_HOOK() { \ + /* Add threads initialization code here.*/ \ +} + /** * @brief Threads descriptor structure extension. * @details User fields added to the end of the @p thread_t structure. @@ -408,9 +591,9 @@ /** * @brief Threads initialization hook. - * @details User initialization code added to the @p chThdInit() API. + * @details User initialization code added to the @p _thread_init() function. * - * @note It is invoked from within @p chThdInit() and implicitly from all + * @note It is invoked from within @p _thread_init() and implicitly from all * the threads creation APIs. */ #define CH_CFG_THREAD_INIT_HOOK(tp) { \ @@ -420,10 +603,6 @@ /** * @brief Threads finalization hook. * @details User finalization code added to the @p chThdExit() API. - * - * @note It is inserted into lock zone. - * @note It is also invoked when the threads simply return in order to - * terminate. */ #define CH_CFG_THREAD_EXIT_HOOK(tp) { \ /* Add threads finalization code here.*/ \ @@ -458,6 +637,7 @@ * @note This macro can be used to activate a power saving mode. */ #define CH_CFG_IDLE_ENTER_HOOK() { \ + /* Idle-enter code here.*/ \ } /** @@ -467,6 +647,7 @@ * @note This macro can be used to deactivate a power saving mode. */ #define CH_CFG_IDLE_LEAVE_HOOK() { \ + /* Idle-leave code here.*/ \ } /** @@ -510,6 +691,6 @@ /* Port-specific settings (override port settings defaulted in chcore.h). */ /*===========================================================================*/ -#endif /* _CHCONF_H_ */ +#endif /* CHCONF_H */ /** @} */ diff --git a/testhal/KINETIS/MCHCK/PWM/halconf_community.h b/testhal/KINETIS/MCHCK/PWM/halconf_community.h new file mode 100644 index 0000000..43fdbf8 --- /dev/null +++ b/testhal/KINETIS/MCHCK/PWM/halconf_community.h @@ -0,0 +1,173 @@ +/* + ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#ifndef HALCONF_COMMUNITY_H +#define HALCONF_COMMUNITY_H + +/** + * @brief Enables the community overlay. + */ +#if !defined(HAL_USE_COMMUNITY) || defined(__DOXYGEN__) +#define HAL_USE_COMMUNITY TRUE +#endif + +/** + * @brief Enables the FSMC subsystem. + */ +#if !defined(HAL_USE_FSMC) || defined(__DOXYGEN__) +#define HAL_USE_FSMC FALSE +#endif + +/** + * @brief Enables the NAND subsystem. + */ +#if !defined(HAL_USE_NAND) || defined(__DOXYGEN__) +#define HAL_USE_NAND FALSE +#endif + +/** + * @brief Enables the 1-wire subsystem. + */ +#if !defined(HAL_USE_ONEWIRE) || defined(__DOXYGEN__) +#define HAL_USE_ONEWIRE FALSE +#endif + +/** + * @brief Enables the EICU subsystem. + */ +#if !defined(HAL_USE_EICU) || defined(__DOXYGEN__) +#define HAL_USE_EICU FALSE +#endif + +/** + * @brief Enables the CRC subsystem. + */ +#if !defined(HAL_USE_CRC) || defined(__DOXYGEN__) +#define HAL_USE_CRC FALSE +#endif + +/** + * @brief Enables the RNG subsystem. + */ +#if !defined(HAL_USE_RNG) || defined(__DOXYGEN__) +#define HAL_USE_RNG FALSE +#endif + +/** + * @brief Enables the EEPROM subsystem. + */ +#if !defined(HAL_USE_EEPROM) || defined(__DOXYGEN__) +#define HAL_USE_EEPROM FALSE +#endif + +/** + * @brief Enables the TIMCAP subsystem. + */ +#if !defined(HAL_USE_TIMCAP) || defined(__DOXYGEN__) +#define HAL_USE_TIMCAP FALSE +#endif + +/** + * @brief Enables the TIMCAP subsystem. + */ +#if !defined(HAL_USE_COMP) || defined(__DOXYGEN__) +#define HAL_USE_COMP FALSE +#endif + +/** + * @brief Enables the QEI subsystem. + */ +#if !defined(HAL_USE_QEI) || defined(__DOXYGEN__) +#define HAL_USE_QEI FALSE +#endif + +/** + * @brief Enables the USBH subsystem. + */ +#if !defined(HAL_USE_USBH) || defined(__DOXYGEN__) +#define HAL_USE_USBH FALSE +#endif + +/** + * @brief Enables the USB_MSD subsystem. + */ +#if !defined(HAL_USE_USB_MSD) || defined(__DOXYGEN__) +#define HAL_USE_USB_MSD FALSE +#endif + +/*===========================================================================*/ +/* FSMCNAND driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables the @p nandAcquireBus() and @p nanReleaseBus() APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(NAND_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define NAND_USE_MUTUAL_EXCLUSION TRUE +#endif + +/*===========================================================================*/ +/* 1-wire driver related settings. */ +/*===========================================================================*/ +/** + * @brief Enables strong pull up feature. + * @note Disabling this option saves both code and data space. + */ +#define ONEWIRE_USE_STRONG_PULLUP FALSE + +/** + * @brief Enables search ROM feature. + * @note Disabling this option saves both code and data space. + */ +#define ONEWIRE_USE_SEARCH_ROM TRUE + +/*===========================================================================*/ +/* QEI driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables discard of overlow + */ +#if !defined(QEI_USE_OVERFLOW_DISCARD) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_DISCARD FALSE +#endif + +/** + * @brief Enables min max of overlow + */ +#if !defined(QEI_USE_OVERFLOW_MINMAX) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_MINMAX FALSE +#endif + +/*===========================================================================*/ +/* EEProm driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables 24xx series I2C eeprom device driver. + * @note Disabling this option saves both code and data space. + */ +#define EEPROM_USE_EE24XX FALSE + /** + * @brief Enables 25xx series SPI eeprom device driver. + * @note Disabling this option saves both code and data space. + */ +#define EEPROM_USE_EE25XX FALSE + +#endif /* HALCONF_COMMUNITY_H */ + +/** @} */ diff --git a/testhal/KINETIS/MCHCK/USB_SERIAL/Makefile b/testhal/KINETIS/MCHCK/USB_SERIAL/Makefile index b4d1ef8..cc51364 100644 --- a/testhal/KINETIS/MCHCK/USB_SERIAL/Makefile +++ b/testhal/KINETIS/MCHCK/USB_SERIAL/Makefile @@ -30,7 +30,7 @@ endif # Enable this if you want link time optimizations (LTO) ifeq ($(USE_LTO),) - USE_LTO = no + USE_LTO = yes endif # If enabled, this option allows to compile the application in THUMB mode. @@ -88,6 +88,8 @@ PROJECT = ch # Imported source files and paths CHIBIOS = ../../../../../ChibiOS-RT CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib +# Licensing files. +include $(CHIBIOS)/os/license/license.mk # Startup files. include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_k20x5.mk # HAL-OSAL files (optional). @@ -99,7 +101,9 @@ include $(CHIBIOS)/os/hal/osal/rt/osal.mk include $(CHIBIOS)/os/rt/rt.mk include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk # Other files (optional). -include $(CHIBIOS)/test/rt/test.mk +include $(CHIBIOS)/test/lib/test.mk +include $(CHIBIOS)/test/rt/rt_test.mk +include $(CHIBIOS)/test/oslib/oslib_test.mk include $(CHIBIOS)/os/hal/lib/streams/streams.mk include $(CHIBIOS)/os/various/shell/shell.mk @@ -109,22 +113,14 @@ LDSCRIPT= $(STARTUPLD)/MK20DX128BLDR4.ld # C sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CSRC = $(STARTUPSRC) \ - $(KERNSRC) \ - $(PORTSRC) \ - $(OSALSRC) \ - $(HALSRC) \ - $(PLATFORMSRC) \ - $(BOARDSRC) \ +CSRC = $(ALLCSRC) \ $(TESTSRC) \ - $(STREAMSSRC) \ - $(SHELLSRC) \ usbcfg.c \ - main.c \ + main.c # C++ sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CPPSRC = +CPPSRC = $(ALLCPPSRC) # C sources to be compiled in ARM mode regardless of the global setting. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler @@ -147,13 +143,11 @@ TCSRC = TCPPSRC = # List ASM source files here -ASMSRC = -ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM) +ASMSRC = $(ALLASMSRC) +ASMXSRC = $(ALLXASMSRC) -INCDIR = $(CHIBIOS)/os/license \ - $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ - $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \ - $(STREAMSINC) $(SHELLINC) +INCDIR = $(ALLINC) $(TESTINC) \ + $(TESTHAL) # # Project, sources and paths diff --git a/testhal/KINETIS/MCHCK/USB_SERIAL/chconf.h b/testhal/KINETIS/MCHCK/USB_SERIAL/chconf.h index 22272b1..1750f63 100644 --- a/testhal/KINETIS/MCHCK/USB_SERIAL/chconf.h +++ b/testhal/KINETIS/MCHCK/USB_SERIAL/chconf.h @@ -1,5 +1,5 @@ /* - ChibiOS - (C) 2015-2016 flabbergast + ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -15,19 +15,21 @@ */ /** - * @file MCHCK/USB_SERIAL/chconf.h - * @brief Configuration file. + * @file templates/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 config * @details Kernel related settings and hooks. * @{ */ -#ifndef _CHCONF_H_ -#define _CHCONF_H_ +#ifndef CHCONF_H +#define CHCONF_H #define _CHIBIOS_RT_CONF_ -#define _CHIBIOS_RT_CONF_VER_5_0_ +#define _CHIBIOS_RT_CONF_VER_5_1_ /*===========================================================================*/ /** @@ -40,14 +42,34 @@ * @brief System time counter resolution. * @note Allowed values are 16 or 32 bits. */ +#if !defined(CH_CFG_ST_RESOLUTION) #define CH_CFG_ST_RESOLUTION 32 +#endif /** * @brief System tick frequency. * @details Frequency of the system timer that drives the system ticks. This * setting also defines the system tick time unit. */ +#if !defined(CH_CFG_ST_FREQUENCY) #define CH_CFG_ST_FREQUENCY 1000 +#endif + +/** + * @brief Time intervals data size. + * @note Allowed values are 16, 32 or 64 bits. + */ +#if !defined(CH_CFG_INTERVALS_SIZE) +#define CH_CFG_INTERVALS_SIZE 32 +#endif + +/** + * @brief Time types data size. + * @note Allowed values are 16 or 32 bits. + */ +#if !defined(CH_CFG_TIME_TYPES_SIZE) +#define CH_CFG_TIME_TYPES_SIZE 32 +#endif /** * @brief Time delta constant for the tick-less mode. @@ -57,7 +79,9 @@ * The value one is not valid, timeouts are rounded up to * this value. */ +#if !defined(CH_CFG_ST_TIMEDELTA) #define CH_CFG_ST_TIMEDELTA 0 +#endif /** @} */ @@ -80,7 +104,9 @@ * @note The round robin preemption is not supported in tickless mode and * must be set to zero in that case. */ -#define CH_CFG_TIME_QUANTUM 20 +#if !defined(CH_CFG_TIME_QUANTUM) +#define CH_CFG_TIME_QUANTUM 2 +#endif /** * @brief Managed RAM size. @@ -93,15 +119,20 @@ * provide the @p __heap_base__ and @p __heap_end__ symbols. * @note Requires @p CH_CFG_USE_MEMCORE. */ +#if !defined(CH_CFG_MEMCORE_SIZE) #define CH_CFG_MEMCORE_SIZE 0 +#endif /** * @brief Idle thread automatic spawn suppression. * @details When this option is activated the function @p chSysInit() * does not spawn the idle thread. The application @p main() * function becomes the idle thread and must implement an - * infinite loop. */ + * infinite loop. + */ +#if !defined(CH_CFG_NO_IDLE_THREAD) #define CH_CFG_NO_IDLE_THREAD FALSE +#endif /** @} */ @@ -120,7 +151,9 @@ * @note This is not related to the compiler optimization options. * @note The default is @p TRUE. */ +#if !defined(CH_CFG_OPTIMIZE_SPEED) #define CH_CFG_OPTIMIZE_SPEED TRUE +#endif /** @} */ @@ -138,7 +171,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_TM) #define CH_CFG_USE_TM FALSE +#endif /** * @brief Threads registry APIs. @@ -146,7 +181,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_REGISTRY) #define CH_CFG_USE_REGISTRY TRUE +#endif /** * @brief Threads synchronization APIs. @@ -155,7 +192,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_WAITEXIT) #define CH_CFG_USE_WAITEXIT TRUE +#endif /** * @brief Semaphores APIs. @@ -163,7 +202,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_SEMAPHORES) #define CH_CFG_USE_SEMAPHORES TRUE +#endif /** * @brief Semaphores queuing mode. @@ -174,7 +215,9 @@ * requirements. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ +#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY) #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE +#endif /** * @brief Mutexes APIs. @@ -182,7 +225,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MUTEXES) #define CH_CFG_USE_MUTEXES TRUE +#endif /** * @brief Enables recursive behavior on mutexes. @@ -192,7 +237,9 @@ * @note The default is @p FALSE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE) #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE +#endif /** * @brief Conditional Variables APIs. @@ -202,7 +249,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_CONDVARS) #define CH_CFG_USE_CONDVARS TRUE +#endif /** * @brief Conditional Variables APIs with timeout. @@ -212,7 +261,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_CONDVARS. */ +#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT) #define CH_CFG_USE_CONDVARS_TIMEOUT TRUE +#endif /** * @brief Events Flags APIs. @@ -220,7 +271,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_EVENTS) #define CH_CFG_USE_EVENTS TRUE +#endif /** * @brief Events Flags APIs with timeout. @@ -230,7 +283,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_EVENTS. */ +#if !defined(CH_CFG_USE_EVENTS_TIMEOUT) #define CH_CFG_USE_EVENTS_TIMEOUT TRUE +#endif /** * @brief Synchronous Messages APIs. @@ -239,7 +294,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MESSAGES) #define CH_CFG_USE_MESSAGES TRUE +#endif /** * @brief Synchronous Messages queuing mode. @@ -250,7 +307,9 @@ * requirements. * @note Requires @p CH_CFG_USE_MESSAGES. */ +#if !defined(CH_CFG_USE_MESSAGES_PRIORITY) #define CH_CFG_USE_MESSAGES_PRIORITY FALSE +#endif /** * @brief Mailboxes APIs. @@ -260,7 +319,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ +#if !defined(CH_CFG_USE_MAILBOXES) #define CH_CFG_USE_MAILBOXES TRUE +#endif /** * @brief Core Memory Manager APIs. @@ -269,7 +330,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMCORE) #define CH_CFG_USE_MEMCORE TRUE +#endif /** * @brief Heap Allocator APIs. @@ -281,7 +344,9 @@ * @p CH_CFG_USE_SEMAPHORES. * @note Mutexes are recommended. */ +#if !defined(CH_CFG_USE_HEAP) #define CH_CFG_USE_HEAP TRUE +#endif /** * @brief Memory Pools Allocator APIs. @@ -290,7 +355,20 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMPOOLS) #define CH_CFG_USE_MEMPOOLS TRUE +#endif + +/** + * @brief Objects FIFOs APIs. + * @details If enabled then the objects FIFOs APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#if !defined(CH_CFG_USE_OBJ_FIFOS) +#define CH_CFG_USE_OBJ_FIFOS TRUE +#endif /** * @brief Dynamic Threads APIs. @@ -301,7 +379,73 @@ * @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. */ +#if !defined(CH_CFG_USE_DYNAMIC) #define CH_CFG_USE_DYNAMIC TRUE +#endif + +/** @} */ + +/*===========================================================================*/ +/** + * @name Objects factory options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Objects Factory APIs. + * @details If enabled then the objects factory APIs are included in the + * kernel. + * + * @note The default is @p FALSE. + */ +#if !defined(CH_CFG_USE_FACTORY) +#define CH_CFG_USE_FACTORY TRUE +#endif + +/** + * @brief Maximum length for object names. + * @details If the specified length is zero then the name is stored by + * pointer but this could have unintended side effects. + */ +#if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH) +#define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8 +#endif + +/** + * @brief Enables the registry of generic objects. + */ +#if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY) +#define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE +#endif + +/** + * @brief Enables factory for generic buffers. + */ +#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS) +#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE +#endif + +/** + * @brief Enables factory for semaphores. + */ +#if !defined(CH_CFG_FACTORY_SEMAPHORES) +#define CH_CFG_FACTORY_SEMAPHORES TRUE +#endif + +/** + * @brief Enables factory for mailboxes. + */ +#if !defined(CH_CFG_FACTORY_MAILBOXES) +#define CH_CFG_FACTORY_MAILBOXES TRUE +#endif + +/** + * @brief Enables factory for objects FIFOs. + */ +#if !defined(CH_CFG_FACTORY_OBJ_FIFOS) +#define CH_CFG_FACTORY_OBJ_FIFOS TRUE +#endif /** @} */ @@ -317,7 +461,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_STATISTICS) #define CH_DBG_STATISTICS FALSE +#endif /** * @brief Debug option, system state check. @@ -326,7 +472,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_SYSTEM_STATE_CHECK FALSE +#if !defined(CH_DBG_SYSTEM_STATE_CHECK) +#define CH_DBG_SYSTEM_STATE_CHECK TRUE +#endif /** * @brief Debug option, parameters checks. @@ -335,7 +483,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_ENABLE_CHECKS FALSE +#if !defined(CH_DBG_ENABLE_CHECKS) +#define CH_DBG_ENABLE_CHECKS TRUE +#endif /** * @brief Debug option, consistency checks. @@ -345,16 +495,28 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_ENABLE_ASSERTS FALSE +#if !defined(CH_DBG_ENABLE_ASSERTS) +#define CH_DBG_ENABLE_ASSERTS TRUE +#endif /** * @brief Debug option, trace buffer. - * @details If enabled then the context switch circular trace buffer is - * activated. + * @details If enabled then the trace buffer is activated. * - * @note The default is @p FALSE. + * @note The default is @p CH_DBG_TRACE_MASK_DISABLED. + */ +#if !defined(CH_DBG_TRACE_MASK) +#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL +#endif + +/** + * @brief Trace buffer entries. + * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is + * different from @p CH_DBG_TRACE_MASK_DISABLED. */ -#define CH_DBG_ENABLE_TRACE FALSE +#if !defined(CH_DBG_TRACE_BUFFER_SIZE) +#define CH_DBG_TRACE_BUFFER_SIZE 128 +#endif /** * @brief Debug option, stack checks. @@ -366,7 +528,9 @@ * @note The default failure mode is to halt the system with the global * @p panic_msg variable set to @p NULL. */ -#define CH_DBG_ENABLE_STACK_CHECK FALSE +#if !defined(CH_DBG_ENABLE_STACK_CHECK) +#define CH_DBG_ENABLE_STACK_CHECK TRUE +#endif /** * @brief Debug option, stacks initialization. @@ -376,7 +540,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_FILL_THREADS FALSE +#if !defined(CH_DBG_FILL_THREADS) +#define CH_DBG_FILL_THREADS TRUE +#endif /** * @brief Debug option, threads profiling. @@ -387,7 +553,9 @@ * @note This debug option is not currently compatible with the * tickless mode. */ +#if !defined(CH_DBG_THREADS_PROFILING) #define CH_DBG_THREADS_PROFILING FALSE +#endif /** @} */ @@ -398,6 +566,22 @@ */ /*===========================================================================*/ +/** + * @brief System structure extension. + * @details User fields added to the end of the @p ch_system_t structure. + */ +#define CH_CFG_SYSTEM_EXTRA_FIELDS \ + /* Add threads custom fields here.*/ + +/** + * @brief System initialization hook. + * @details User initialization code added to the @p chSysInit() function + * just before interrupts are enabled globally. + */ +#define CH_CFG_SYSTEM_INIT_HOOK() { \ + /* Add threads initialization code here.*/ \ +} + /** * @brief Threads descriptor structure extension. * @details User fields added to the end of the @p thread_t structure. @@ -407,9 +591,9 @@ /** * @brief Threads initialization hook. - * @details User initialization code added to the @p chThdInit() API. + * @details User initialization code added to the @p _thread_init() function. * - * @note It is invoked from within @p chThdInit() and implicitly from all + * @note It is invoked from within @p _thread_init() and implicitly from all * the threads creation APIs. */ #define CH_CFG_THREAD_INIT_HOOK(tp) { \ @@ -419,10 +603,6 @@ /** * @brief Threads finalization hook. * @details User finalization code added to the @p chThdExit() API. - * - * @note It is inserted into lock zone. - * @note It is also invoked when the threads simply return in order to - * terminate. */ #define CH_CFG_THREAD_EXIT_HOOK(tp) { \ /* Add threads finalization code here.*/ \ @@ -433,7 +613,7 @@ * @details This hook is invoked just before switching between threads. */ #define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \ - /* System halt code here.*/ \ + /* Context switch code here.*/ \ } /** @@ -456,7 +636,8 @@ * should be invoked from here. * @note This macro can be used to activate a power saving mode. */ -#define CH_CFG_IDLE_ENTER_HOOK() { \ +#define CH_CFG_IDLE_ENTER_HOOK() { \ + /* Idle-enter code here.*/ \ } /** @@ -465,7 +646,8 @@ * should be invoked from here. * @note This macro can be used to deactivate a power saving mode. */ -#define CH_CFG_IDLE_LEAVE_HOOK() { \ +#define CH_CFG_IDLE_LEAVE_HOOK() { \ + /* Idle-leave code here.*/ \ } /** @@ -509,6 +691,6 @@ /* Port-specific settings (override port settings defaulted in chcore.h). */ /*===========================================================================*/ -#endif /* _CHCONF_H_ */ +#endif /* CHCONF_H */ /** @} */ diff --git a/testhal/KINETIS/MCHCK/USB_SERIAL/halconf_community.h b/testhal/KINETIS/MCHCK/USB_SERIAL/halconf_community.h new file mode 100644 index 0000000..43fdbf8 --- /dev/null +++ b/testhal/KINETIS/MCHCK/USB_SERIAL/halconf_community.h @@ -0,0 +1,173 @@ +/* + ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#ifndef HALCONF_COMMUNITY_H +#define HALCONF_COMMUNITY_H + +/** + * @brief Enables the community overlay. + */ +#if !defined(HAL_USE_COMMUNITY) || defined(__DOXYGEN__) +#define HAL_USE_COMMUNITY TRUE +#endif + +/** + * @brief Enables the FSMC subsystem. + */ +#if !defined(HAL_USE_FSMC) || defined(__DOXYGEN__) +#define HAL_USE_FSMC FALSE +#endif + +/** + * @brief Enables the NAND subsystem. + */ +#if !defined(HAL_USE_NAND) || defined(__DOXYGEN__) +#define HAL_USE_NAND FALSE +#endif + +/** + * @brief Enables the 1-wire subsystem. + */ +#if !defined(HAL_USE_ONEWIRE) || defined(__DOXYGEN__) +#define HAL_USE_ONEWIRE FALSE +#endif + +/** + * @brief Enables the EICU subsystem. + */ +#if !defined(HAL_USE_EICU) || defined(__DOXYGEN__) +#define HAL_USE_EICU FALSE +#endif + +/** + * @brief Enables the CRC subsystem. + */ +#if !defined(HAL_USE_CRC) || defined(__DOXYGEN__) +#define HAL_USE_CRC FALSE +#endif + +/** + * @brief Enables the RNG subsystem. + */ +#if !defined(HAL_USE_RNG) || defined(__DOXYGEN__) +#define HAL_USE_RNG FALSE +#endif + +/** + * @brief Enables the EEPROM subsystem. + */ +#if !defined(HAL_USE_EEPROM) || defined(__DOXYGEN__) +#define HAL_USE_EEPROM FALSE +#endif + +/** + * @brief Enables the TIMCAP subsystem. + */ +#if !defined(HAL_USE_TIMCAP) || defined(__DOXYGEN__) +#define HAL_USE_TIMCAP FALSE +#endif + +/** + * @brief Enables the TIMCAP subsystem. + */ +#if !defined(HAL_USE_COMP) || defined(__DOXYGEN__) +#define HAL_USE_COMP FALSE +#endif + +/** + * @brief Enables the QEI subsystem. + */ +#if !defined(HAL_USE_QEI) || defined(__DOXYGEN__) +#define HAL_USE_QEI FALSE +#endif + +/** + * @brief Enables the USBH subsystem. + */ +#if !defined(HAL_USE_USBH) || defined(__DOXYGEN__) +#define HAL_USE_USBH FALSE +#endif + +/** + * @brief Enables the USB_MSD subsystem. + */ +#if !defined(HAL_USE_USB_MSD) || defined(__DOXYGEN__) +#define HAL_USE_USB_MSD FALSE +#endif + +/*===========================================================================*/ +/* FSMCNAND driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables the @p nandAcquireBus() and @p nanReleaseBus() APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(NAND_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define NAND_USE_MUTUAL_EXCLUSION TRUE +#endif + +/*===========================================================================*/ +/* 1-wire driver related settings. */ +/*===========================================================================*/ +/** + * @brief Enables strong pull up feature. + * @note Disabling this option saves both code and data space. + */ +#define ONEWIRE_USE_STRONG_PULLUP FALSE + +/** + * @brief Enables search ROM feature. + * @note Disabling this option saves both code and data space. + */ +#define ONEWIRE_USE_SEARCH_ROM TRUE + +/*===========================================================================*/ +/* QEI driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables discard of overlow + */ +#if !defined(QEI_USE_OVERFLOW_DISCARD) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_DISCARD FALSE +#endif + +/** + * @brief Enables min max of overlow + */ +#if !defined(QEI_USE_OVERFLOW_MINMAX) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_MINMAX FALSE +#endif + +/*===========================================================================*/ +/* EEProm driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables 24xx series I2C eeprom device driver. + * @note Disabling this option saves both code and data space. + */ +#define EEPROM_USE_EE24XX FALSE + /** + * @brief Enables 25xx series SPI eeprom device driver. + * @note Disabling this option saves both code and data space. + */ +#define EEPROM_USE_EE25XX FALSE + +#endif /* HALCONF_COMMUNITY_H */ + +/** @} */ diff --git a/testhal/KINETIS/TEENSY3_x/ADC/Makefile b/testhal/KINETIS/TEENSY3_x/ADC/Makefile index 6510052..d12b346 100644 --- a/testhal/KINETIS/TEENSY3_x/ADC/Makefile +++ b/testhal/KINETIS/TEENSY3_x/ADC/Makefile @@ -30,7 +30,7 @@ endif # Enable this if you want link time optimizations (LTO) ifeq ($(USE_LTO),) - USE_LTO = no + USE_LTO = yes endif # If enabled, this option allows to compile the application in THUMB mode. @@ -88,6 +88,8 @@ PROJECT = ch # Imported source files and paths CHIBIOS = ../../../../../ChibiOS-RT CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib +# Licensing files. +include $(CHIBIOS)/os/license/license.mk # Startup files. include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_k20x7.mk # HAL-OSAL files (optional). @@ -105,19 +107,13 @@ LDSCRIPT= $(STARTUPLD)/MK20DX256.ld # C sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CSRC = $(STARTUPSRC) \ - $(KERNSRC) \ - $(PORTSRC) \ - $(OSALSRC) \ - $(HALSRC) \ - $(PLATFORMSRC) \ - $(BOARDSRC) \ +CSRC = $(ALLCSRC) \ $(TESTSRC) \ main.c # C++ sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CPPSRC = +CPPSRC = $(ALLCPPSRC) # C sources to be compiled in ARM mode regardless of the global setting. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler @@ -140,13 +136,11 @@ TCSRC = TCPPSRC = # List ASM source files here -ASMSRC = -ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM) +ASMSRC = $(ALLASMSRC) +ASMXSRC = $(ALLXASMSRC) -INCDIR = $(CHIBIOS)/os/license \ - $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ - $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \ - $(CHIBIOS)/os/various +INCDIR = $(ALLINC) $(TESTINC) \ + $(TESTHAL) # # Project, sources and paths diff --git a/testhal/KINETIS/TEENSY3_x/ADC/chconf.h b/testhal/KINETIS/TEENSY3_x/ADC/chconf.h index 029e4ec..1750f63 100644 --- a/testhal/KINETIS/TEENSY3_x/ADC/chconf.h +++ b/testhal/KINETIS/TEENSY3_x/ADC/chconf.h @@ -1,5 +1,5 @@ /* - ChibiOS - (C) 2015 RedoX https://github.com/RedoXyde + ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -15,19 +15,21 @@ */ /** - * @file TEENSY3_x/ADC/chconf.h - * @brief Configuration file. + * @file templates/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 config * @details Kernel related settings and hooks. * @{ */ -#ifndef _CHCONF_H_ -#define _CHCONF_H_ +#ifndef CHCONF_H +#define CHCONF_H #define _CHIBIOS_RT_CONF_ -#define _CHIBIOS_RT_CONF_VER_5_0_ +#define _CHIBIOS_RT_CONF_VER_5_1_ /*===========================================================================*/ /** @@ -40,14 +42,34 @@ * @brief System time counter resolution. * @note Allowed values are 16 or 32 bits. */ +#if !defined(CH_CFG_ST_RESOLUTION) #define CH_CFG_ST_RESOLUTION 32 +#endif /** * @brief System tick frequency. * @details Frequency of the system timer that drives the system ticks. This * setting also defines the system tick time unit. */ +#if !defined(CH_CFG_ST_FREQUENCY) #define CH_CFG_ST_FREQUENCY 1000 +#endif + +/** + * @brief Time intervals data size. + * @note Allowed values are 16, 32 or 64 bits. + */ +#if !defined(CH_CFG_INTERVALS_SIZE) +#define CH_CFG_INTERVALS_SIZE 32 +#endif + +/** + * @brief Time types data size. + * @note Allowed values are 16 or 32 bits. + */ +#if !defined(CH_CFG_TIME_TYPES_SIZE) +#define CH_CFG_TIME_TYPES_SIZE 32 +#endif /** * @brief Time delta constant for the tick-less mode. @@ -57,7 +79,9 @@ * The value one is not valid, timeouts are rounded up to * this value. */ +#if !defined(CH_CFG_ST_TIMEDELTA) #define CH_CFG_ST_TIMEDELTA 0 +#endif /** @} */ @@ -80,7 +104,9 @@ * @note The round robin preemption is not supported in tickless mode and * must be set to zero in that case. */ -#define CH_CFG_TIME_QUANTUM 20 +#if !defined(CH_CFG_TIME_QUANTUM) +#define CH_CFG_TIME_QUANTUM 2 +#endif /** * @brief Managed RAM size. @@ -93,7 +119,9 @@ * provide the @p __heap_base__ and @p __heap_end__ symbols. * @note Requires @p CH_CFG_USE_MEMCORE. */ +#if !defined(CH_CFG_MEMCORE_SIZE) #define CH_CFG_MEMCORE_SIZE 0 +#endif /** * @brief Idle thread automatic spawn suppression. @@ -102,7 +130,9 @@ * function becomes the idle thread and must implement an * infinite loop. */ +#if !defined(CH_CFG_NO_IDLE_THREAD) #define CH_CFG_NO_IDLE_THREAD FALSE +#endif /** @} */ @@ -121,7 +151,9 @@ * @note This is not related to the compiler optimization options. * @note The default is @p TRUE. */ +#if !defined(CH_CFG_OPTIMIZE_SPEED) #define CH_CFG_OPTIMIZE_SPEED TRUE +#endif /** @} */ @@ -139,7 +171,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_TM) #define CH_CFG_USE_TM FALSE +#endif /** * @brief Threads registry APIs. @@ -147,7 +181,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_REGISTRY) #define CH_CFG_USE_REGISTRY TRUE +#endif /** * @brief Threads synchronization APIs. @@ -156,7 +192,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_WAITEXIT) #define CH_CFG_USE_WAITEXIT TRUE +#endif /** * @brief Semaphores APIs. @@ -164,7 +202,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_SEMAPHORES) #define CH_CFG_USE_SEMAPHORES TRUE +#endif /** * @brief Semaphores queuing mode. @@ -175,7 +215,9 @@ * requirements. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ +#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY) #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE +#endif /** * @brief Mutexes APIs. @@ -183,7 +225,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MUTEXES) #define CH_CFG_USE_MUTEXES TRUE +#endif /** * @brief Enables recursive behavior on mutexes. @@ -193,7 +237,9 @@ * @note The default is @p FALSE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE) #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE +#endif /** * @brief Conditional Variables APIs. @@ -203,7 +249,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_CONDVARS) #define CH_CFG_USE_CONDVARS TRUE +#endif /** * @brief Conditional Variables APIs with timeout. @@ -213,7 +261,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_CONDVARS. */ +#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT) #define CH_CFG_USE_CONDVARS_TIMEOUT TRUE +#endif /** * @brief Events Flags APIs. @@ -221,7 +271,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_EVENTS) #define CH_CFG_USE_EVENTS TRUE +#endif /** * @brief Events Flags APIs with timeout. @@ -231,7 +283,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_EVENTS. */ +#if !defined(CH_CFG_USE_EVENTS_TIMEOUT) #define CH_CFG_USE_EVENTS_TIMEOUT TRUE +#endif /** * @brief Synchronous Messages APIs. @@ -240,7 +294,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MESSAGES) #define CH_CFG_USE_MESSAGES TRUE +#endif /** * @brief Synchronous Messages queuing mode. @@ -251,7 +307,9 @@ * requirements. * @note Requires @p CH_CFG_USE_MESSAGES. */ +#if !defined(CH_CFG_USE_MESSAGES_PRIORITY) #define CH_CFG_USE_MESSAGES_PRIORITY FALSE +#endif /** * @brief Mailboxes APIs. @@ -261,7 +319,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ +#if !defined(CH_CFG_USE_MAILBOXES) #define CH_CFG_USE_MAILBOXES TRUE +#endif /** * @brief Core Memory Manager APIs. @@ -270,7 +330,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMCORE) #define CH_CFG_USE_MEMCORE TRUE +#endif /** * @brief Heap Allocator APIs. @@ -282,7 +344,9 @@ * @p CH_CFG_USE_SEMAPHORES. * @note Mutexes are recommended. */ +#if !defined(CH_CFG_USE_HEAP) #define CH_CFG_USE_HEAP TRUE +#endif /** * @brief Memory Pools Allocator APIs. @@ -291,7 +355,20 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMPOOLS) #define CH_CFG_USE_MEMPOOLS TRUE +#endif + +/** + * @brief Objects FIFOs APIs. + * @details If enabled then the objects FIFOs APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#if !defined(CH_CFG_USE_OBJ_FIFOS) +#define CH_CFG_USE_OBJ_FIFOS TRUE +#endif /** * @brief Dynamic Threads APIs. @@ -302,7 +379,73 @@ * @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. */ +#if !defined(CH_CFG_USE_DYNAMIC) #define CH_CFG_USE_DYNAMIC TRUE +#endif + +/** @} */ + +/*===========================================================================*/ +/** + * @name Objects factory options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Objects Factory APIs. + * @details If enabled then the objects factory APIs are included in the + * kernel. + * + * @note The default is @p FALSE. + */ +#if !defined(CH_CFG_USE_FACTORY) +#define CH_CFG_USE_FACTORY TRUE +#endif + +/** + * @brief Maximum length for object names. + * @details If the specified length is zero then the name is stored by + * pointer but this could have unintended side effects. + */ +#if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH) +#define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8 +#endif + +/** + * @brief Enables the registry of generic objects. + */ +#if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY) +#define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE +#endif + +/** + * @brief Enables factory for generic buffers. + */ +#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS) +#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE +#endif + +/** + * @brief Enables factory for semaphores. + */ +#if !defined(CH_CFG_FACTORY_SEMAPHORES) +#define CH_CFG_FACTORY_SEMAPHORES TRUE +#endif + +/** + * @brief Enables factory for mailboxes. + */ +#if !defined(CH_CFG_FACTORY_MAILBOXES) +#define CH_CFG_FACTORY_MAILBOXES TRUE +#endif + +/** + * @brief Enables factory for objects FIFOs. + */ +#if !defined(CH_CFG_FACTORY_OBJ_FIFOS) +#define CH_CFG_FACTORY_OBJ_FIFOS TRUE +#endif /** @} */ @@ -318,7 +461,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_STATISTICS) #define CH_DBG_STATISTICS FALSE +#endif /** * @brief Debug option, system state check. @@ -327,7 +472,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_SYSTEM_STATE_CHECK FALSE +#if !defined(CH_DBG_SYSTEM_STATE_CHECK) +#define CH_DBG_SYSTEM_STATE_CHECK TRUE +#endif /** * @brief Debug option, parameters checks. @@ -336,7 +483,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_ENABLE_CHECKS FALSE +#if !defined(CH_DBG_ENABLE_CHECKS) +#define CH_DBG_ENABLE_CHECKS TRUE +#endif /** * @brief Debug option, consistency checks. @@ -346,16 +495,28 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_ENABLE_ASSERTS FALSE +#if !defined(CH_DBG_ENABLE_ASSERTS) +#define CH_DBG_ENABLE_ASSERTS TRUE +#endif /** * @brief Debug option, trace buffer. - * @details If enabled then the context switch circular trace buffer is - * activated. + * @details If enabled then the trace buffer is activated. * - * @note The default is @p FALSE. + * @note The default is @p CH_DBG_TRACE_MASK_DISABLED. + */ +#if !defined(CH_DBG_TRACE_MASK) +#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL +#endif + +/** + * @brief Trace buffer entries. + * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is + * different from @p CH_DBG_TRACE_MASK_DISABLED. */ -#define CH_DBG_ENABLE_TRACE FALSE +#if !defined(CH_DBG_TRACE_BUFFER_SIZE) +#define CH_DBG_TRACE_BUFFER_SIZE 128 +#endif /** * @brief Debug option, stack checks. @@ -367,7 +528,9 @@ * @note The default failure mode is to halt the system with the global * @p panic_msg variable set to @p NULL. */ -#define CH_DBG_ENABLE_STACK_CHECK FALSE +#if !defined(CH_DBG_ENABLE_STACK_CHECK) +#define CH_DBG_ENABLE_STACK_CHECK TRUE +#endif /** * @brief Debug option, stacks initialization. @@ -377,7 +540,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_FILL_THREADS FALSE +#if !defined(CH_DBG_FILL_THREADS) +#define CH_DBG_FILL_THREADS TRUE +#endif /** * @brief Debug option, threads profiling. @@ -388,7 +553,9 @@ * @note This debug option is not currently compatible with the * tickless mode. */ +#if !defined(CH_DBG_THREADS_PROFILING) #define CH_DBG_THREADS_PROFILING FALSE +#endif /** @} */ @@ -399,6 +566,22 @@ */ /*===========================================================================*/ +/** + * @brief System structure extension. + * @details User fields added to the end of the @p ch_system_t structure. + */ +#define CH_CFG_SYSTEM_EXTRA_FIELDS \ + /* Add threads custom fields here.*/ + +/** + * @brief System initialization hook. + * @details User initialization code added to the @p chSysInit() function + * just before interrupts are enabled globally. + */ +#define CH_CFG_SYSTEM_INIT_HOOK() { \ + /* Add threads initialization code here.*/ \ +} + /** * @brief Threads descriptor structure extension. * @details User fields added to the end of the @p thread_t structure. @@ -408,9 +591,9 @@ /** * @brief Threads initialization hook. - * @details User initialization code added to the @p chThdInit() API. + * @details User initialization code added to the @p _thread_init() function. * - * @note It is invoked from within @p chThdInit() and implicitly from all + * @note It is invoked from within @p _thread_init() and implicitly from all * the threads creation APIs. */ #define CH_CFG_THREAD_INIT_HOOK(tp) { \ @@ -420,10 +603,6 @@ /** * @brief Threads finalization hook. * @details User finalization code added to the @p chThdExit() API. - * - * @note It is inserted into lock zone. - * @note It is also invoked when the threads simply return in order to - * terminate. */ #define CH_CFG_THREAD_EXIT_HOOK(tp) { \ /* Add threads finalization code here.*/ \ @@ -458,6 +637,7 @@ * @note This macro can be used to activate a power saving mode. */ #define CH_CFG_IDLE_ENTER_HOOK() { \ + /* Idle-enter code here.*/ \ } /** @@ -467,6 +647,7 @@ * @note This macro can be used to deactivate a power saving mode. */ #define CH_CFG_IDLE_LEAVE_HOOK() { \ + /* Idle-leave code here.*/ \ } /** @@ -510,6 +691,6 @@ /* Port-specific settings (override port settings defaulted in chcore.h). */ /*===========================================================================*/ -#endif /* _CHCONF_H_ */ +#endif /* CHCONF_H */ /** @} */ diff --git a/testhal/KINETIS/TEENSY3_x/ADC/halconf_community.h b/testhal/KINETIS/TEENSY3_x/ADC/halconf_community.h new file mode 100644 index 0000000..43fdbf8 --- /dev/null +++ b/testhal/KINETIS/TEENSY3_x/ADC/halconf_community.h @@ -0,0 +1,173 @@ +/* + ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#ifndef HALCONF_COMMUNITY_H +#define HALCONF_COMMUNITY_H + +/** + * @brief Enables the community overlay. + */ +#if !defined(HAL_USE_COMMUNITY) || defined(__DOXYGEN__) +#define HAL_USE_COMMUNITY TRUE +#endif + +/** + * @brief Enables the FSMC subsystem. + */ +#if !defined(HAL_USE_FSMC) || defined(__DOXYGEN__) +#define HAL_USE_FSMC FALSE +#endif + +/** + * @brief Enables the NAND subsystem. + */ +#if !defined(HAL_USE_NAND) || defined(__DOXYGEN__) +#define HAL_USE_NAND FALSE +#endif + +/** + * @brief Enables the 1-wire subsystem. + */ +#if !defined(HAL_USE_ONEWIRE) || defined(__DOXYGEN__) +#define HAL_USE_ONEWIRE FALSE +#endif + +/** + * @brief Enables the EICU subsystem. + */ +#if !defined(HAL_USE_EICU) || defined(__DOXYGEN__) +#define HAL_USE_EICU FALSE +#endif + +/** + * @brief Enables the CRC subsystem. + */ +#if !defined(HAL_USE_CRC) || defined(__DOXYGEN__) +#define HAL_USE_CRC FALSE +#endif + +/** + * @brief Enables the RNG subsystem. + */ +#if !defined(HAL_USE_RNG) || defined(__DOXYGEN__) +#define HAL_USE_RNG FALSE +#endif + +/** + * @brief Enables the EEPROM subsystem. + */ +#if !defined(HAL_USE_EEPROM) || defined(__DOXYGEN__) +#define HAL_USE_EEPROM FALSE +#endif + +/** + * @brief Enables the TIMCAP subsystem. + */ +#if !defined(HAL_USE_TIMCAP) || defined(__DOXYGEN__) +#define HAL_USE_TIMCAP FALSE +#endif + +/** + * @brief Enables the TIMCAP subsystem. + */ +#if !defined(HAL_USE_COMP) || defined(__DOXYGEN__) +#define HAL_USE_COMP FALSE +#endif + +/** + * @brief Enables the QEI subsystem. + */ +#if !defined(HAL_USE_QEI) || defined(__DOXYGEN__) +#define HAL_USE_QEI FALSE +#endif + +/** + * @brief Enables the USBH subsystem. + */ +#if !defined(HAL_USE_USBH) || defined(__DOXYGEN__) +#define HAL_USE_USBH FALSE +#endif + +/** + * @brief Enables the USB_MSD subsystem. + */ +#if !defined(HAL_USE_USB_MSD) || defined(__DOXYGEN__) +#define HAL_USE_USB_MSD FALSE +#endif + +/*===========================================================================*/ +/* FSMCNAND driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables the @p nandAcquireBus() and @p nanReleaseBus() APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(NAND_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define NAND_USE_MUTUAL_EXCLUSION TRUE +#endif + +/*===========================================================================*/ +/* 1-wire driver related settings. */ +/*===========================================================================*/ +/** + * @brief Enables strong pull up feature. + * @note Disabling this option saves both code and data space. + */ +#define ONEWIRE_USE_STRONG_PULLUP FALSE + +/** + * @brief Enables search ROM feature. + * @note Disabling this option saves both code and data space. + */ +#define ONEWIRE_USE_SEARCH_ROM TRUE + +/*===========================================================================*/ +/* QEI driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables discard of overlow + */ +#if !defined(QEI_USE_OVERFLOW_DISCARD) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_DISCARD FALSE +#endif + +/** + * @brief Enables min max of overlow + */ +#if !defined(QEI_USE_OVERFLOW_MINMAX) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_MINMAX FALSE +#endif + +/*===========================================================================*/ +/* EEProm driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables 24xx series I2C eeprom device driver. + * @note Disabling this option saves both code and data space. + */ +#define EEPROM_USE_EE24XX FALSE + /** + * @brief Enables 25xx series SPI eeprom device driver. + * @note Disabling this option saves both code and data space. + */ +#define EEPROM_USE_EE25XX FALSE + +#endif /* HALCONF_COMMUNITY_H */ + +/** @} */ diff --git a/testhal/KINETIS/TEENSY3_x/EEPROM_EMU/Makefile b/testhal/KINETIS/TEENSY3_x/EEPROM_EMU/Makefile index fa5084c..1733c56 100644 --- a/testhal/KINETIS/TEENSY3_x/EEPROM_EMU/Makefile +++ b/testhal/KINETIS/TEENSY3_x/EEPROM_EMU/Makefile @@ -5,7 +5,7 @@ # Compiler options here. ifeq ($(USE_OPT),) - USE_OPT = -O0 -ggdb -fomit-frame-pointer -falign-functions=16 + USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16 endif # C specific options here (added to USE_OPT). @@ -30,7 +30,7 @@ endif # Enable this if you want link time optimizations (LTO) ifeq ($(USE_LTO),) - USE_LTO = no + USE_LTO = yes endif # If enabled, this option allows to compile the application in THUMB mode. @@ -88,6 +88,8 @@ PROJECT = ch # Imported source files and paths CHIBIOS = ../../../../../ChibiOS-RT CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib +# Licensing files. +include $(CHIBIOS)/os/license/license.mk # Startup files. include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_k20x7.mk # HAL-OSAL files (optional). @@ -105,19 +107,14 @@ LDSCRIPT= $(STARTUPLD)/MK20DX256.ld # C sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CSRC = $(STARTUPSRC) \ - $(KERNSRC) \ - $(PORTSRC) \ - $(OSALSRC) \ - $(HALSRC) \ - $(PLATFORMSRC) \ - $(BOARDSRC) \ +CSRC = $(ALLCSRC) \ + $(TESTSRC) \ eeprom.c \ main.c # C++ sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CPPSRC = +CPPSRC = $(ALLCPPSRC) # C sources to be compiled in ARM mode regardless of the global setting. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler @@ -140,13 +137,11 @@ TCSRC = TCPPSRC = # List ASM source files here -ASMSRC = -ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM) +ASMSRC = $(ALLASMSRC) +ASMXSRC = $(ALLXASMSRC) -INCDIR = $(CHIBIOS)/os/license \ - $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ - $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \ - $(CHIBIOS)/os/various +INCDIR = $(ALLINC) $(TESTINC) \ + $(TESTHAL) # # Project, sources and paths diff --git a/testhal/KINETIS/TEENSY3_x/EEPROM_EMU/chconf.h b/testhal/KINETIS/TEENSY3_x/EEPROM_EMU/chconf.h index 3bb57de..1750f63 100644 --- a/testhal/KINETIS/TEENSY3_x/EEPROM_EMU/chconf.h +++ b/testhal/KINETIS/TEENSY3_x/EEPROM_EMU/chconf.h @@ -1,5 +1,5 @@ /* - ChibiOS - (C) 2015-2016 flabbergast + ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ */ /** - * @file TEENSY3_x/EEPROM_EMU/chconf.h + * @file templates/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. @@ -25,11 +25,11 @@ * @{ */ -#ifndef _CHCONF_H_ -#define _CHCONF_H_ +#ifndef CHCONF_H +#define CHCONF_H #define _CHIBIOS_RT_CONF_ -#define _CHIBIOS_RT_CONF_VER_5_0_ +#define _CHIBIOS_RT_CONF_VER_5_1_ /*===========================================================================*/ /** @@ -42,14 +42,34 @@ * @brief System time counter resolution. * @note Allowed values are 16 or 32 bits. */ +#if !defined(CH_CFG_ST_RESOLUTION) #define CH_CFG_ST_RESOLUTION 32 +#endif /** * @brief System tick frequency. * @details Frequency of the system timer that drives the system ticks. This * setting also defines the system tick time unit. */ +#if !defined(CH_CFG_ST_FREQUENCY) #define CH_CFG_ST_FREQUENCY 1000 +#endif + +/** + * @brief Time intervals data size. + * @note Allowed values are 16, 32 or 64 bits. + */ +#if !defined(CH_CFG_INTERVALS_SIZE) +#define CH_CFG_INTERVALS_SIZE 32 +#endif + +/** + * @brief Time types data size. + * @note Allowed values are 16 or 32 bits. + */ +#if !defined(CH_CFG_TIME_TYPES_SIZE) +#define CH_CFG_TIME_TYPES_SIZE 32 +#endif /** * @brief Time delta constant for the tick-less mode. @@ -59,7 +79,9 @@ * The value one is not valid, timeouts are rounded up to * this value. */ +#if !defined(CH_CFG_ST_TIMEDELTA) #define CH_CFG_ST_TIMEDELTA 0 +#endif /** @} */ @@ -82,7 +104,9 @@ * @note The round robin preemption is not supported in tickless mode and * must be set to zero in that case. */ -#define CH_CFG_TIME_QUANTUM 20 +#if !defined(CH_CFG_TIME_QUANTUM) +#define CH_CFG_TIME_QUANTUM 2 +#endif /** * @brief Managed RAM size. @@ -95,7 +119,9 @@ * provide the @p __heap_base__ and @p __heap_end__ symbols. * @note Requires @p CH_CFG_USE_MEMCORE. */ +#if !defined(CH_CFG_MEMCORE_SIZE) #define CH_CFG_MEMCORE_SIZE 0 +#endif /** * @brief Idle thread automatic spawn suppression. @@ -104,7 +130,9 @@ * function becomes the idle thread and must implement an * infinite loop. */ +#if !defined(CH_CFG_NO_IDLE_THREAD) #define CH_CFG_NO_IDLE_THREAD FALSE +#endif /** @} */ @@ -123,7 +151,9 @@ * @note This is not related to the compiler optimization options. * @note The default is @p TRUE. */ +#if !defined(CH_CFG_OPTIMIZE_SPEED) #define CH_CFG_OPTIMIZE_SPEED TRUE +#endif /** @} */ @@ -141,7 +171,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_TM) #define CH_CFG_USE_TM FALSE +#endif /** * @brief Threads registry APIs. @@ -149,7 +181,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_REGISTRY) #define CH_CFG_USE_REGISTRY TRUE +#endif /** * @brief Threads synchronization APIs. @@ -158,7 +192,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_WAITEXIT) #define CH_CFG_USE_WAITEXIT TRUE +#endif /** * @brief Semaphores APIs. @@ -166,7 +202,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_SEMAPHORES) #define CH_CFG_USE_SEMAPHORES TRUE +#endif /** * @brief Semaphores queuing mode. @@ -177,7 +215,9 @@ * requirements. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ -#define CH_CFG_USE_SEMAPHORES_PRIORITY TRUE +#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY) +#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE +#endif /** * @brief Mutexes APIs. @@ -185,7 +225,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MUTEXES) #define CH_CFG_USE_MUTEXES TRUE +#endif /** * @brief Enables recursive behavior on mutexes. @@ -195,7 +237,9 @@ * @note The default is @p FALSE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE) #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE +#endif /** * @brief Conditional Variables APIs. @@ -205,7 +249,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_CONDVARS) #define CH_CFG_USE_CONDVARS TRUE +#endif /** * @brief Conditional Variables APIs with timeout. @@ -215,7 +261,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_CONDVARS. */ +#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT) #define CH_CFG_USE_CONDVARS_TIMEOUT TRUE +#endif /** * @brief Events Flags APIs. @@ -223,7 +271,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_EVENTS) #define CH_CFG_USE_EVENTS TRUE +#endif /** * @brief Events Flags APIs with timeout. @@ -233,7 +283,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_EVENTS. */ +#if !defined(CH_CFG_USE_EVENTS_TIMEOUT) #define CH_CFG_USE_EVENTS_TIMEOUT TRUE +#endif /** * @brief Synchronous Messages APIs. @@ -242,7 +294,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MESSAGES) #define CH_CFG_USE_MESSAGES TRUE +#endif /** * @brief Synchronous Messages queuing mode. @@ -253,7 +307,9 @@ * requirements. * @note Requires @p CH_CFG_USE_MESSAGES. */ +#if !defined(CH_CFG_USE_MESSAGES_PRIORITY) #define CH_CFG_USE_MESSAGES_PRIORITY FALSE +#endif /** * @brief Mailboxes APIs. @@ -263,7 +319,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ +#if !defined(CH_CFG_USE_MAILBOXES) #define CH_CFG_USE_MAILBOXES TRUE +#endif /** * @brief Core Memory Manager APIs. @@ -272,7 +330,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMCORE) #define CH_CFG_USE_MEMCORE TRUE +#endif /** * @brief Heap Allocator APIs. @@ -284,7 +344,9 @@ * @p CH_CFG_USE_SEMAPHORES. * @note Mutexes are recommended. */ +#if !defined(CH_CFG_USE_HEAP) #define CH_CFG_USE_HEAP TRUE +#endif /** * @brief Memory Pools Allocator APIs. @@ -293,7 +355,20 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMPOOLS) #define CH_CFG_USE_MEMPOOLS TRUE +#endif + +/** + * @brief Objects FIFOs APIs. + * @details If enabled then the objects FIFOs APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#if !defined(CH_CFG_USE_OBJ_FIFOS) +#define CH_CFG_USE_OBJ_FIFOS TRUE +#endif /** * @brief Dynamic Threads APIs. @@ -304,7 +379,73 @@ * @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. */ +#if !defined(CH_CFG_USE_DYNAMIC) #define CH_CFG_USE_DYNAMIC TRUE +#endif + +/** @} */ + +/*===========================================================================*/ +/** + * @name Objects factory options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Objects Factory APIs. + * @details If enabled then the objects factory APIs are included in the + * kernel. + * + * @note The default is @p FALSE. + */ +#if !defined(CH_CFG_USE_FACTORY) +#define CH_CFG_USE_FACTORY TRUE +#endif + +/** + * @brief Maximum length for object names. + * @details If the specified length is zero then the name is stored by + * pointer but this could have unintended side effects. + */ +#if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH) +#define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8 +#endif + +/** + * @brief Enables the registry of generic objects. + */ +#if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY) +#define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE +#endif + +/** + * @brief Enables factory for generic buffers. + */ +#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS) +#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE +#endif + +/** + * @brief Enables factory for semaphores. + */ +#if !defined(CH_CFG_FACTORY_SEMAPHORES) +#define CH_CFG_FACTORY_SEMAPHORES TRUE +#endif + +/** + * @brief Enables factory for mailboxes. + */ +#if !defined(CH_CFG_FACTORY_MAILBOXES) +#define CH_CFG_FACTORY_MAILBOXES TRUE +#endif + +/** + * @brief Enables factory for objects FIFOs. + */ +#if !defined(CH_CFG_FACTORY_OBJ_FIFOS) +#define CH_CFG_FACTORY_OBJ_FIFOS TRUE +#endif /** @} */ @@ -320,7 +461,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_STATISTICS) #define CH_DBG_STATISTICS FALSE +#endif /** * @brief Debug option, system state check. @@ -329,7 +472,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_SYSTEM_STATE_CHECK) #define CH_DBG_SYSTEM_STATE_CHECK TRUE +#endif /** * @brief Debug option, parameters checks. @@ -338,7 +483,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_ENABLE_CHECKS) #define CH_DBG_ENABLE_CHECKS TRUE +#endif /** * @brief Debug option, consistency checks. @@ -348,16 +495,28 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_ENABLE_ASSERTS) #define CH_DBG_ENABLE_ASSERTS TRUE +#endif /** * @brief Debug option, trace buffer. - * @details If enabled then the context switch circular trace buffer is - * activated. + * @details If enabled then the trace buffer is activated. * - * @note The default is @p FALSE. + * @note The default is @p CH_DBG_TRACE_MASK_DISABLED. + */ +#if !defined(CH_DBG_TRACE_MASK) +#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL +#endif + +/** + * @brief Trace buffer entries. + * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is + * different from @p CH_DBG_TRACE_MASK_DISABLED. */ -#define CH_DBG_ENABLE_TRACE TRUE +#if !defined(CH_DBG_TRACE_BUFFER_SIZE) +#define CH_DBG_TRACE_BUFFER_SIZE 128 +#endif /** * @brief Debug option, stack checks. @@ -369,7 +528,9 @@ * @note The default failure mode is to halt the system with the global * @p panic_msg variable set to @p NULL. */ +#if !defined(CH_DBG_ENABLE_STACK_CHECK) #define CH_DBG_ENABLE_STACK_CHECK TRUE +#endif /** * @brief Debug option, stacks initialization. @@ -379,7 +540,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_FILL_THREADS) #define CH_DBG_FILL_THREADS TRUE +#endif /** * @brief Debug option, threads profiling. @@ -390,7 +553,9 @@ * @note This debug option is not currently compatible with the * tickless mode. */ +#if !defined(CH_DBG_THREADS_PROFILING) #define CH_DBG_THREADS_PROFILING FALSE +#endif /** @} */ @@ -401,6 +566,22 @@ */ /*===========================================================================*/ +/** + * @brief System structure extension. + * @details User fields added to the end of the @p ch_system_t structure. + */ +#define CH_CFG_SYSTEM_EXTRA_FIELDS \ + /* Add threads custom fields here.*/ + +/** + * @brief System initialization hook. + * @details User initialization code added to the @p chSysInit() function + * just before interrupts are enabled globally. + */ +#define CH_CFG_SYSTEM_INIT_HOOK() { \ + /* Add threads initialization code here.*/ \ +} + /** * @brief Threads descriptor structure extension. * @details User fields added to the end of the @p thread_t structure. @@ -410,9 +591,9 @@ /** * @brief Threads initialization hook. - * @details User initialization code added to the @p chThdInit() API. + * @details User initialization code added to the @p _thread_init() function. * - * @note It is invoked from within @p chThdInit() and implicitly from all + * @note It is invoked from within @p _thread_init() and implicitly from all * the threads creation APIs. */ #define CH_CFG_THREAD_INIT_HOOK(tp) { \ @@ -422,10 +603,6 @@ /** * @brief Threads finalization hook. * @details User finalization code added to the @p chThdExit() API. - * - * @note It is inserted into lock zone. - * @note It is also invoked when the threads simply return in order to - * terminate. */ #define CH_CFG_THREAD_EXIT_HOOK(tp) { \ /* Add threads finalization code here.*/ \ @@ -460,6 +637,7 @@ * @note This macro can be used to activate a power saving mode. */ #define CH_CFG_IDLE_ENTER_HOOK() { \ + /* Idle-enter code here.*/ \ } /** @@ -469,6 +647,7 @@ * @note This macro can be used to deactivate a power saving mode. */ #define CH_CFG_IDLE_LEAVE_HOOK() { \ + /* Idle-leave code here.*/ \ } /** @@ -512,6 +691,6 @@ /* Port-specific settings (override port settings defaulted in chcore.h). */ /*===========================================================================*/ -#endif /* _CHCONF_H_ */ +#endif /* CHCONF_H */ /** @} */ diff --git a/testhal/KINETIS/TEENSY3_x/EEPROM_EMU/halconf_community.h b/testhal/KINETIS/TEENSY3_x/EEPROM_EMU/halconf_community.h new file mode 100644 index 0000000..43fdbf8 --- /dev/null +++ b/testhal/KINETIS/TEENSY3_x/EEPROM_EMU/halconf_community.h @@ -0,0 +1,173 @@ +/* + ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#ifndef HALCONF_COMMUNITY_H +#define HALCONF_COMMUNITY_H + +/** + * @brief Enables the community overlay. + */ +#if !defined(HAL_USE_COMMUNITY) || defined(__DOXYGEN__) +#define HAL_USE_COMMUNITY TRUE +#endif + +/** + * @brief Enables the FSMC subsystem. + */ +#if !defined(HAL_USE_FSMC) || defined(__DOXYGEN__) +#define HAL_USE_FSMC FALSE +#endif + +/** + * @brief Enables the NAND subsystem. + */ +#if !defined(HAL_USE_NAND) || defined(__DOXYGEN__) +#define HAL_USE_NAND FALSE +#endif + +/** + * @brief Enables the 1-wire subsystem. + */ +#if !defined(HAL_USE_ONEWIRE) || defined(__DOXYGEN__) +#define HAL_USE_ONEWIRE FALSE +#endif + +/** + * @brief Enables the EICU subsystem. + */ +#if !defined(HAL_USE_EICU) || defined(__DOXYGEN__) +#define HAL_USE_EICU FALSE +#endif + +/** + * @brief Enables the CRC subsystem. + */ +#if !defined(HAL_USE_CRC) || defined(__DOXYGEN__) +#define HAL_USE_CRC FALSE +#endif + +/** + * @brief Enables the RNG subsystem. + */ +#if !defined(HAL_USE_RNG) || defined(__DOXYGEN__) +#define HAL_USE_RNG FALSE +#endif + +/** + * @brief Enables the EEPROM subsystem. + */ +#if !defined(HAL_USE_EEPROM) || defined(__DOXYGEN__) +#define HAL_USE_EEPROM FALSE +#endif + +/** + * @brief Enables the TIMCAP subsystem. + */ +#if !defined(HAL_USE_TIMCAP) || defined(__DOXYGEN__) +#define HAL_USE_TIMCAP FALSE +#endif + +/** + * @brief Enables the TIMCAP subsystem. + */ +#if !defined(HAL_USE_COMP) || defined(__DOXYGEN__) +#define HAL_USE_COMP FALSE +#endif + +/** + * @brief Enables the QEI subsystem. + */ +#if !defined(HAL_USE_QEI) || defined(__DOXYGEN__) +#define HAL_USE_QEI FALSE +#endif + +/** + * @brief Enables the USBH subsystem. + */ +#if !defined(HAL_USE_USBH) || defined(__DOXYGEN__) +#define HAL_USE_USBH FALSE +#endif + +/** + * @brief Enables the USB_MSD subsystem. + */ +#if !defined(HAL_USE_USB_MSD) || defined(__DOXYGEN__) +#define HAL_USE_USB_MSD FALSE +#endif + +/*===========================================================================*/ +/* FSMCNAND driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables the @p nandAcquireBus() and @p nanReleaseBus() APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(NAND_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define NAND_USE_MUTUAL_EXCLUSION TRUE +#endif + +/*===========================================================================*/ +/* 1-wire driver related settings. */ +/*===========================================================================*/ +/** + * @brief Enables strong pull up feature. + * @note Disabling this option saves both code and data space. + */ +#define ONEWIRE_USE_STRONG_PULLUP FALSE + +/** + * @brief Enables search ROM feature. + * @note Disabling this option saves both code and data space. + */ +#define ONEWIRE_USE_SEARCH_ROM TRUE + +/*===========================================================================*/ +/* QEI driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables discard of overlow + */ +#if !defined(QEI_USE_OVERFLOW_DISCARD) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_DISCARD FALSE +#endif + +/** + * @brief Enables min max of overlow + */ +#if !defined(QEI_USE_OVERFLOW_MINMAX) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_MINMAX FALSE +#endif + +/*===========================================================================*/ +/* EEProm driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables 24xx series I2C eeprom device driver. + * @note Disabling this option saves both code and data space. + */ +#define EEPROM_USE_EE24XX FALSE + /** + * @brief Enables 25xx series SPI eeprom device driver. + * @note Disabling this option saves both code and data space. + */ +#define EEPROM_USE_EE25XX FALSE + +#endif /* HALCONF_COMMUNITY_H */ + +/** @} */ diff --git a/testhal/KINETIS/TEENSY3_x/EXT/Makefile b/testhal/KINETIS/TEENSY3_x/EXT/Makefile index 6510052..d12b346 100644 --- a/testhal/KINETIS/TEENSY3_x/EXT/Makefile +++ b/testhal/KINETIS/TEENSY3_x/EXT/Makefile @@ -30,7 +30,7 @@ endif # Enable this if you want link time optimizations (LTO) ifeq ($(USE_LTO),) - USE_LTO = no + USE_LTO = yes endif # If enabled, this option allows to compile the application in THUMB mode. @@ -88,6 +88,8 @@ PROJECT = ch # Imported source files and paths CHIBIOS = ../../../../../ChibiOS-RT CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib +# Licensing files. +include $(CHIBIOS)/os/license/license.mk # Startup files. include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_k20x7.mk # HAL-OSAL files (optional). @@ -105,19 +107,13 @@ LDSCRIPT= $(STARTUPLD)/MK20DX256.ld # C sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CSRC = $(STARTUPSRC) \ - $(KERNSRC) \ - $(PORTSRC) \ - $(OSALSRC) \ - $(HALSRC) \ - $(PLATFORMSRC) \ - $(BOARDSRC) \ +CSRC = $(ALLCSRC) \ $(TESTSRC) \ main.c # C++ sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CPPSRC = +CPPSRC = $(ALLCPPSRC) # C sources to be compiled in ARM mode regardless of the global setting. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler @@ -140,13 +136,11 @@ TCSRC = TCPPSRC = # List ASM source files here -ASMSRC = -ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM) +ASMSRC = $(ALLASMSRC) +ASMXSRC = $(ALLXASMSRC) -INCDIR = $(CHIBIOS)/os/license \ - $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ - $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \ - $(CHIBIOS)/os/various +INCDIR = $(ALLINC) $(TESTINC) \ + $(TESTHAL) # # Project, sources and paths diff --git a/testhal/KINETIS/TEENSY3_x/EXT/chconf.h b/testhal/KINETIS/TEENSY3_x/EXT/chconf.h index 0be6605..1750f63 100644 --- a/testhal/KINETIS/TEENSY3_x/EXT/chconf.h +++ b/testhal/KINETIS/TEENSY3_x/EXT/chconf.h @@ -1,5 +1,5 @@ /* - ChibiOS - (C) 2015 RedoX https://github.com/RedoXyde + ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -15,19 +15,21 @@ */ /** - * @file TEENSY3_x/EXT/chconf.h - * @brief Configuration file. + * @file templates/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 config * @details Kernel related settings and hooks. * @{ */ -#ifndef _CHCONF_H_ -#define _CHCONF_H_ +#ifndef CHCONF_H +#define CHCONF_H #define _CHIBIOS_RT_CONF_ -#define _CHIBIOS_RT_CONF_VER_5_0_ +#define _CHIBIOS_RT_CONF_VER_5_1_ /*===========================================================================*/ /** @@ -40,14 +42,34 @@ * @brief System time counter resolution. * @note Allowed values are 16 or 32 bits. */ +#if !defined(CH_CFG_ST_RESOLUTION) #define CH_CFG_ST_RESOLUTION 32 +#endif /** * @brief System tick frequency. * @details Frequency of the system timer that drives the system ticks. This * setting also defines the system tick time unit. */ +#if !defined(CH_CFG_ST_FREQUENCY) #define CH_CFG_ST_FREQUENCY 1000 +#endif + +/** + * @brief Time intervals data size. + * @note Allowed values are 16, 32 or 64 bits. + */ +#if !defined(CH_CFG_INTERVALS_SIZE) +#define CH_CFG_INTERVALS_SIZE 32 +#endif + +/** + * @brief Time types data size. + * @note Allowed values are 16 or 32 bits. + */ +#if !defined(CH_CFG_TIME_TYPES_SIZE) +#define CH_CFG_TIME_TYPES_SIZE 32 +#endif /** * @brief Time delta constant for the tick-less mode. @@ -57,7 +79,9 @@ * The value one is not valid, timeouts are rounded up to * this value. */ +#if !defined(CH_CFG_ST_TIMEDELTA) #define CH_CFG_ST_TIMEDELTA 0 +#endif /** @} */ @@ -80,7 +104,9 @@ * @note The round robin preemption is not supported in tickless mode and * must be set to zero in that case. */ -#define CH_CFG_TIME_QUANTUM 20 +#if !defined(CH_CFG_TIME_QUANTUM) +#define CH_CFG_TIME_QUANTUM 2 +#endif /** * @brief Managed RAM size. @@ -93,7 +119,9 @@ * provide the @p __heap_base__ and @p __heap_end__ symbols. * @note Requires @p CH_CFG_USE_MEMCORE. */ +#if !defined(CH_CFG_MEMCORE_SIZE) #define CH_CFG_MEMCORE_SIZE 0 +#endif /** * @brief Idle thread automatic spawn suppression. @@ -102,7 +130,9 @@ * function becomes the idle thread and must implement an * infinite loop. */ +#if !defined(CH_CFG_NO_IDLE_THREAD) #define CH_CFG_NO_IDLE_THREAD FALSE +#endif /** @} */ @@ -121,7 +151,9 @@ * @note This is not related to the compiler optimization options. * @note The default is @p TRUE. */ +#if !defined(CH_CFG_OPTIMIZE_SPEED) #define CH_CFG_OPTIMIZE_SPEED TRUE +#endif /** @} */ @@ -139,7 +171,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_TM) #define CH_CFG_USE_TM FALSE +#endif /** * @brief Threads registry APIs. @@ -147,7 +181,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_REGISTRY) #define CH_CFG_USE_REGISTRY TRUE +#endif /** * @brief Threads synchronization APIs. @@ -156,7 +192,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_WAITEXIT) #define CH_CFG_USE_WAITEXIT TRUE +#endif /** * @brief Semaphores APIs. @@ -164,7 +202,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_SEMAPHORES) #define CH_CFG_USE_SEMAPHORES TRUE +#endif /** * @brief Semaphores queuing mode. @@ -175,7 +215,9 @@ * requirements. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ +#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY) #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE +#endif /** * @brief Mutexes APIs. @@ -183,7 +225,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MUTEXES) #define CH_CFG_USE_MUTEXES TRUE +#endif /** * @brief Enables recursive behavior on mutexes. @@ -193,7 +237,9 @@ * @note The default is @p FALSE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE) #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE +#endif /** * @brief Conditional Variables APIs. @@ -203,7 +249,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_CONDVARS) #define CH_CFG_USE_CONDVARS TRUE +#endif /** * @brief Conditional Variables APIs with timeout. @@ -213,7 +261,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_CONDVARS. */ +#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT) #define CH_CFG_USE_CONDVARS_TIMEOUT TRUE +#endif /** * @brief Events Flags APIs. @@ -221,7 +271,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_EVENTS) #define CH_CFG_USE_EVENTS TRUE +#endif /** * @brief Events Flags APIs with timeout. @@ -231,7 +283,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_EVENTS. */ +#if !defined(CH_CFG_USE_EVENTS_TIMEOUT) #define CH_CFG_USE_EVENTS_TIMEOUT TRUE +#endif /** * @brief Synchronous Messages APIs. @@ -240,7 +294,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MESSAGES) #define CH_CFG_USE_MESSAGES TRUE +#endif /** * @brief Synchronous Messages queuing mode. @@ -251,7 +307,9 @@ * requirements. * @note Requires @p CH_CFG_USE_MESSAGES. */ +#if !defined(CH_CFG_USE_MESSAGES_PRIORITY) #define CH_CFG_USE_MESSAGES_PRIORITY FALSE +#endif /** * @brief Mailboxes APIs. @@ -261,7 +319,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ +#if !defined(CH_CFG_USE_MAILBOXES) #define CH_CFG_USE_MAILBOXES TRUE +#endif /** * @brief Core Memory Manager APIs. @@ -270,7 +330,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMCORE) #define CH_CFG_USE_MEMCORE TRUE +#endif /** * @brief Heap Allocator APIs. @@ -282,7 +344,9 @@ * @p CH_CFG_USE_SEMAPHORES. * @note Mutexes are recommended. */ +#if !defined(CH_CFG_USE_HEAP) #define CH_CFG_USE_HEAP TRUE +#endif /** * @brief Memory Pools Allocator APIs. @@ -291,7 +355,20 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMPOOLS) #define CH_CFG_USE_MEMPOOLS TRUE +#endif + +/** + * @brief Objects FIFOs APIs. + * @details If enabled then the objects FIFOs APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#if !defined(CH_CFG_USE_OBJ_FIFOS) +#define CH_CFG_USE_OBJ_FIFOS TRUE +#endif /** * @brief Dynamic Threads APIs. @@ -302,7 +379,73 @@ * @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. */ +#if !defined(CH_CFG_USE_DYNAMIC) #define CH_CFG_USE_DYNAMIC TRUE +#endif + +/** @} */ + +/*===========================================================================*/ +/** + * @name Objects factory options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Objects Factory APIs. + * @details If enabled then the objects factory APIs are included in the + * kernel. + * + * @note The default is @p FALSE. + */ +#if !defined(CH_CFG_USE_FACTORY) +#define CH_CFG_USE_FACTORY TRUE +#endif + +/** + * @brief Maximum length for object names. + * @details If the specified length is zero then the name is stored by + * pointer but this could have unintended side effects. + */ +#if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH) +#define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8 +#endif + +/** + * @brief Enables the registry of generic objects. + */ +#if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY) +#define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE +#endif + +/** + * @brief Enables factory for generic buffers. + */ +#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS) +#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE +#endif + +/** + * @brief Enables factory for semaphores. + */ +#if !defined(CH_CFG_FACTORY_SEMAPHORES) +#define CH_CFG_FACTORY_SEMAPHORES TRUE +#endif + +/** + * @brief Enables factory for mailboxes. + */ +#if !defined(CH_CFG_FACTORY_MAILBOXES) +#define CH_CFG_FACTORY_MAILBOXES TRUE +#endif + +/** + * @brief Enables factory for objects FIFOs. + */ +#if !defined(CH_CFG_FACTORY_OBJ_FIFOS) +#define CH_CFG_FACTORY_OBJ_FIFOS TRUE +#endif /** @} */ @@ -318,7 +461,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_STATISTICS) #define CH_DBG_STATISTICS FALSE +#endif /** * @brief Debug option, system state check. @@ -327,7 +472,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_SYSTEM_STATE_CHECK FALSE +#if !defined(CH_DBG_SYSTEM_STATE_CHECK) +#define CH_DBG_SYSTEM_STATE_CHECK TRUE +#endif /** * @brief Debug option, parameters checks. @@ -336,7 +483,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_ENABLE_CHECKS FALSE +#if !defined(CH_DBG_ENABLE_CHECKS) +#define CH_DBG_ENABLE_CHECKS TRUE +#endif /** * @brief Debug option, consistency checks. @@ -346,16 +495,28 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_ENABLE_ASSERTS FALSE +#if !defined(CH_DBG_ENABLE_ASSERTS) +#define CH_DBG_ENABLE_ASSERTS TRUE +#endif /** * @brief Debug option, trace buffer. - * @details If enabled then the context switch circular trace buffer is - * activated. + * @details If enabled then the trace buffer is activated. * - * @note The default is @p FALSE. + * @note The default is @p CH_DBG_TRACE_MASK_DISABLED. + */ +#if !defined(CH_DBG_TRACE_MASK) +#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL +#endif + +/** + * @brief Trace buffer entries. + * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is + * different from @p CH_DBG_TRACE_MASK_DISABLED. */ -#define CH_DBG_ENABLE_TRACE FALSE +#if !defined(CH_DBG_TRACE_BUFFER_SIZE) +#define CH_DBG_TRACE_BUFFER_SIZE 128 +#endif /** * @brief Debug option, stack checks. @@ -367,7 +528,9 @@ * @note The default failure mode is to halt the system with the global * @p panic_msg variable set to @p NULL. */ -#define CH_DBG_ENABLE_STACK_CHECK FALSE +#if !defined(CH_DBG_ENABLE_STACK_CHECK) +#define CH_DBG_ENABLE_STACK_CHECK TRUE +#endif /** * @brief Debug option, stacks initialization. @@ -377,7 +540,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_FILL_THREADS FALSE +#if !defined(CH_DBG_FILL_THREADS) +#define CH_DBG_FILL_THREADS TRUE +#endif /** * @brief Debug option, threads profiling. @@ -388,7 +553,9 @@ * @note This debug option is not currently compatible with the * tickless mode. */ +#if !defined(CH_DBG_THREADS_PROFILING) #define CH_DBG_THREADS_PROFILING FALSE +#endif /** @} */ @@ -399,6 +566,22 @@ */ /*===========================================================================*/ +/** + * @brief System structure extension. + * @details User fields added to the end of the @p ch_system_t structure. + */ +#define CH_CFG_SYSTEM_EXTRA_FIELDS \ + /* Add threads custom fields here.*/ + +/** + * @brief System initialization hook. + * @details User initialization code added to the @p chSysInit() function + * just before interrupts are enabled globally. + */ +#define CH_CFG_SYSTEM_INIT_HOOK() { \ + /* Add threads initialization code here.*/ \ +} + /** * @brief Threads descriptor structure extension. * @details User fields added to the end of the @p thread_t structure. @@ -408,9 +591,9 @@ /** * @brief Threads initialization hook. - * @details User initialization code added to the @p chThdInit() API. + * @details User initialization code added to the @p _thread_init() function. * - * @note It is invoked from within @p chThdInit() and implicitly from all + * @note It is invoked from within @p _thread_init() and implicitly from all * the threads creation APIs. */ #define CH_CFG_THREAD_INIT_HOOK(tp) { \ @@ -420,10 +603,6 @@ /** * @brief Threads finalization hook. * @details User finalization code added to the @p chThdExit() API. - * - * @note It is inserted into lock zone. - * @note It is also invoked when the threads simply return in order to - * terminate. */ #define CH_CFG_THREAD_EXIT_HOOK(tp) { \ /* Add threads finalization code here.*/ \ @@ -458,6 +637,7 @@ * @note This macro can be used to activate a power saving mode. */ #define CH_CFG_IDLE_ENTER_HOOK() { \ + /* Idle-enter code here.*/ \ } /** @@ -467,6 +647,7 @@ * @note This macro can be used to deactivate a power saving mode. */ #define CH_CFG_IDLE_LEAVE_HOOK() { \ + /* Idle-leave code here.*/ \ } /** @@ -510,6 +691,6 @@ /* Port-specific settings (override port settings defaulted in chcore.h). */ /*===========================================================================*/ -#endif /* _CHCONF_H_ */ +#endif /* CHCONF_H */ /** @} */ diff --git a/testhal/KINETIS/TEENSY3_x/EXT/halconf_community.h b/testhal/KINETIS/TEENSY3_x/EXT/halconf_community.h new file mode 100644 index 0000000..43fdbf8 --- /dev/null +++ b/testhal/KINETIS/TEENSY3_x/EXT/halconf_community.h @@ -0,0 +1,173 @@ +/* + ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#ifndef HALCONF_COMMUNITY_H +#define HALCONF_COMMUNITY_H + +/** + * @brief Enables the community overlay. + */ +#if !defined(HAL_USE_COMMUNITY) || defined(__DOXYGEN__) +#define HAL_USE_COMMUNITY TRUE +#endif + +/** + * @brief Enables the FSMC subsystem. + */ +#if !defined(HAL_USE_FSMC) || defined(__DOXYGEN__) +#define HAL_USE_FSMC FALSE +#endif + +/** + * @brief Enables the NAND subsystem. + */ +#if !defined(HAL_USE_NAND) || defined(__DOXYGEN__) +#define HAL_USE_NAND FALSE +#endif + +/** + * @brief Enables the 1-wire subsystem. + */ +#if !defined(HAL_USE_ONEWIRE) || defined(__DOXYGEN__) +#define HAL_USE_ONEWIRE FALSE +#endif + +/** + * @brief Enables the EICU subsystem. + */ +#if !defined(HAL_USE_EICU) || defined(__DOXYGEN__) +#define HAL_USE_EICU FALSE +#endif + +/** + * @brief Enables the CRC subsystem. + */ +#if !defined(HAL_USE_CRC) || defined(__DOXYGEN__) +#define HAL_USE_CRC FALSE +#endif + +/** + * @brief Enables the RNG subsystem. + */ +#if !defined(HAL_USE_RNG) || defined(__DOXYGEN__) +#define HAL_USE_RNG FALSE +#endif + +/** + * @brief Enables the EEPROM subsystem. + */ +#if !defined(HAL_USE_EEPROM) || defined(__DOXYGEN__) +#define HAL_USE_EEPROM FALSE +#endif + +/** + * @brief Enables the TIMCAP subsystem. + */ +#if !defined(HAL_USE_TIMCAP) || defined(__DOXYGEN__) +#define HAL_USE_TIMCAP FALSE +#endif + +/** + * @brief Enables the TIMCAP subsystem. + */ +#if !defined(HAL_USE_COMP) || defined(__DOXYGEN__) +#define HAL_USE_COMP FALSE +#endif + +/** + * @brief Enables the QEI subsystem. + */ +#if !defined(HAL_USE_QEI) || defined(__DOXYGEN__) +#define HAL_USE_QEI FALSE +#endif + +/** + * @brief Enables the USBH subsystem. + */ +#if !defined(HAL_USE_USBH) || defined(__DOXYGEN__) +#define HAL_USE_USBH FALSE +#endif + +/** + * @brief Enables the USB_MSD subsystem. + */ +#if !defined(HAL_USE_USB_MSD) || defined(__DOXYGEN__) +#define HAL_USE_USB_MSD FALSE +#endif + +/*===========================================================================*/ +/* FSMCNAND driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables the @p nandAcquireBus() and @p nanReleaseBus() APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(NAND_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define NAND_USE_MUTUAL_EXCLUSION TRUE +#endif + +/*===========================================================================*/ +/* 1-wire driver related settings. */ +/*===========================================================================*/ +/** + * @brief Enables strong pull up feature. + * @note Disabling this option saves both code and data space. + */ +#define ONEWIRE_USE_STRONG_PULLUP FALSE + +/** + * @brief Enables search ROM feature. + * @note Disabling this option saves both code and data space. + */ +#define ONEWIRE_USE_SEARCH_ROM TRUE + +/*===========================================================================*/ +/* QEI driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables discard of overlow + */ +#if !defined(QEI_USE_OVERFLOW_DISCARD) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_DISCARD FALSE +#endif + +/** + * @brief Enables min max of overlow + */ +#if !defined(QEI_USE_OVERFLOW_MINMAX) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_MINMAX FALSE +#endif + +/*===========================================================================*/ +/* EEProm driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables 24xx series I2C eeprom device driver. + * @note Disabling this option saves both code and data space. + */ +#define EEPROM_USE_EE24XX FALSE + /** + * @brief Enables 25xx series SPI eeprom device driver. + * @note Disabling this option saves both code and data space. + */ +#define EEPROM_USE_EE25XX FALSE + +#endif /* HALCONF_COMMUNITY_H */ + +/** @} */ diff --git a/testhal/KINETIS/TEENSY3_x/GPT/Makefile b/testhal/KINETIS/TEENSY3_x/GPT/Makefile index 6510052..d12b346 100644 --- a/testhal/KINETIS/TEENSY3_x/GPT/Makefile +++ b/testhal/KINETIS/TEENSY3_x/GPT/Makefile @@ -30,7 +30,7 @@ endif # Enable this if you want link time optimizations (LTO) ifeq ($(USE_LTO),) - USE_LTO = no + USE_LTO = yes endif # If enabled, this option allows to compile the application in THUMB mode. @@ -88,6 +88,8 @@ PROJECT = ch # Imported source files and paths CHIBIOS = ../../../../../ChibiOS-RT CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib +# Licensing files. +include $(CHIBIOS)/os/license/license.mk # Startup files. include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_k20x7.mk # HAL-OSAL files (optional). @@ -105,19 +107,13 @@ LDSCRIPT= $(STARTUPLD)/MK20DX256.ld # C sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CSRC = $(STARTUPSRC) \ - $(KERNSRC) \ - $(PORTSRC) \ - $(OSALSRC) \ - $(HALSRC) \ - $(PLATFORMSRC) \ - $(BOARDSRC) \ +CSRC = $(ALLCSRC) \ $(TESTSRC) \ main.c # C++ sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CPPSRC = +CPPSRC = $(ALLCPPSRC) # C sources to be compiled in ARM mode regardless of the global setting. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler @@ -140,13 +136,11 @@ TCSRC = TCPPSRC = # List ASM source files here -ASMSRC = -ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM) +ASMSRC = $(ALLASMSRC) +ASMXSRC = $(ALLXASMSRC) -INCDIR = $(CHIBIOS)/os/license \ - $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ - $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \ - $(CHIBIOS)/os/various +INCDIR = $(ALLINC) $(TESTINC) \ + $(TESTHAL) # # Project, sources and paths diff --git a/testhal/KINETIS/TEENSY3_x/GPT/chconf.h b/testhal/KINETIS/TEENSY3_x/GPT/chconf.h index 93ba7b8..1750f63 100644 --- a/testhal/KINETIS/TEENSY3_x/GPT/chconf.h +++ b/testhal/KINETIS/TEENSY3_x/GPT/chconf.h @@ -1,5 +1,5 @@ /* - ChibiOS - (C) 2015 RedoX https://github.com/RedoXyde + ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -15,19 +15,21 @@ */ /** - * @file TEENSY3_x/GPT/chconf.h - * @brief Configuration file. + * @file templates/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 config * @details Kernel related settings and hooks. * @{ */ -#ifndef _CHCONF_H_ -#define _CHCONF_H_ +#ifndef CHCONF_H +#define CHCONF_H #define _CHIBIOS_RT_CONF_ -#define _CHIBIOS_RT_CONF_VER_5_0_ +#define _CHIBIOS_RT_CONF_VER_5_1_ /*===========================================================================*/ /** @@ -40,14 +42,34 @@ * @brief System time counter resolution. * @note Allowed values are 16 or 32 bits. */ +#if !defined(CH_CFG_ST_RESOLUTION) #define CH_CFG_ST_RESOLUTION 32 +#endif /** * @brief System tick frequency. * @details Frequency of the system timer that drives the system ticks. This * setting also defines the system tick time unit. */ +#if !defined(CH_CFG_ST_FREQUENCY) #define CH_CFG_ST_FREQUENCY 1000 +#endif + +/** + * @brief Time intervals data size. + * @note Allowed values are 16, 32 or 64 bits. + */ +#if !defined(CH_CFG_INTERVALS_SIZE) +#define CH_CFG_INTERVALS_SIZE 32 +#endif + +/** + * @brief Time types data size. + * @note Allowed values are 16 or 32 bits. + */ +#if !defined(CH_CFG_TIME_TYPES_SIZE) +#define CH_CFG_TIME_TYPES_SIZE 32 +#endif /** * @brief Time delta constant for the tick-less mode. @@ -57,7 +79,9 @@ * The value one is not valid, timeouts are rounded up to * this value. */ +#if !defined(CH_CFG_ST_TIMEDELTA) #define CH_CFG_ST_TIMEDELTA 0 +#endif /** @} */ @@ -80,7 +104,9 @@ * @note The round robin preemption is not supported in tickless mode and * must be set to zero in that case. */ -#define CH_CFG_TIME_QUANTUM 20 +#if !defined(CH_CFG_TIME_QUANTUM) +#define CH_CFG_TIME_QUANTUM 2 +#endif /** * @brief Managed RAM size. @@ -93,7 +119,9 @@ * provide the @p __heap_base__ and @p __heap_end__ symbols. * @note Requires @p CH_CFG_USE_MEMCORE. */ +#if !defined(CH_CFG_MEMCORE_SIZE) #define CH_CFG_MEMCORE_SIZE 0 +#endif /** * @brief Idle thread automatic spawn suppression. @@ -102,7 +130,9 @@ * function becomes the idle thread and must implement an * infinite loop. */ +#if !defined(CH_CFG_NO_IDLE_THREAD) #define CH_CFG_NO_IDLE_THREAD FALSE +#endif /** @} */ @@ -121,7 +151,9 @@ * @note This is not related to the compiler optimization options. * @note The default is @p TRUE. */ +#if !defined(CH_CFG_OPTIMIZE_SPEED) #define CH_CFG_OPTIMIZE_SPEED TRUE +#endif /** @} */ @@ -139,7 +171,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_TM) #define CH_CFG_USE_TM FALSE +#endif /** * @brief Threads registry APIs. @@ -147,7 +181,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_REGISTRY) #define CH_CFG_USE_REGISTRY TRUE +#endif /** * @brief Threads synchronization APIs. @@ -156,7 +192,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_WAITEXIT) #define CH_CFG_USE_WAITEXIT TRUE +#endif /** * @brief Semaphores APIs. @@ -164,7 +202,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_SEMAPHORES) #define CH_CFG_USE_SEMAPHORES TRUE +#endif /** * @brief Semaphores queuing mode. @@ -175,7 +215,9 @@ * requirements. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ +#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY) #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE +#endif /** * @brief Mutexes APIs. @@ -183,7 +225,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MUTEXES) #define CH_CFG_USE_MUTEXES TRUE +#endif /** * @brief Enables recursive behavior on mutexes. @@ -193,7 +237,9 @@ * @note The default is @p FALSE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE) #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE +#endif /** * @brief Conditional Variables APIs. @@ -203,7 +249,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_CONDVARS) #define CH_CFG_USE_CONDVARS TRUE +#endif /** * @brief Conditional Variables APIs with timeout. @@ -213,7 +261,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_CONDVARS. */ +#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT) #define CH_CFG_USE_CONDVARS_TIMEOUT TRUE +#endif /** * @brief Events Flags APIs. @@ -221,7 +271,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_EVENTS) #define CH_CFG_USE_EVENTS TRUE +#endif /** * @brief Events Flags APIs with timeout. @@ -231,7 +283,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_EVENTS. */ +#if !defined(CH_CFG_USE_EVENTS_TIMEOUT) #define CH_CFG_USE_EVENTS_TIMEOUT TRUE +#endif /** * @brief Synchronous Messages APIs. @@ -240,7 +294,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MESSAGES) #define CH_CFG_USE_MESSAGES TRUE +#endif /** * @brief Synchronous Messages queuing mode. @@ -251,7 +307,9 @@ * requirements. * @note Requires @p CH_CFG_USE_MESSAGES. */ +#if !defined(CH_CFG_USE_MESSAGES_PRIORITY) #define CH_CFG_USE_MESSAGES_PRIORITY FALSE +#endif /** * @brief Mailboxes APIs. @@ -261,7 +319,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ +#if !defined(CH_CFG_USE_MAILBOXES) #define CH_CFG_USE_MAILBOXES TRUE +#endif /** * @brief Core Memory Manager APIs. @@ -270,7 +330,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMCORE) #define CH_CFG_USE_MEMCORE TRUE +#endif /** * @brief Heap Allocator APIs. @@ -282,7 +344,9 @@ * @p CH_CFG_USE_SEMAPHORES. * @note Mutexes are recommended. */ +#if !defined(CH_CFG_USE_HEAP) #define CH_CFG_USE_HEAP TRUE +#endif /** * @brief Memory Pools Allocator APIs. @@ -291,7 +355,20 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMPOOLS) #define CH_CFG_USE_MEMPOOLS TRUE +#endif + +/** + * @brief Objects FIFOs APIs. + * @details If enabled then the objects FIFOs APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#if !defined(CH_CFG_USE_OBJ_FIFOS) +#define CH_CFG_USE_OBJ_FIFOS TRUE +#endif /** * @brief Dynamic Threads APIs. @@ -302,7 +379,73 @@ * @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. */ +#if !defined(CH_CFG_USE_DYNAMIC) #define CH_CFG_USE_DYNAMIC TRUE +#endif + +/** @} */ + +/*===========================================================================*/ +/** + * @name Objects factory options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Objects Factory APIs. + * @details If enabled then the objects factory APIs are included in the + * kernel. + * + * @note The default is @p FALSE. + */ +#if !defined(CH_CFG_USE_FACTORY) +#define CH_CFG_USE_FACTORY TRUE +#endif + +/** + * @brief Maximum length for object names. + * @details If the specified length is zero then the name is stored by + * pointer but this could have unintended side effects. + */ +#if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH) +#define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8 +#endif + +/** + * @brief Enables the registry of generic objects. + */ +#if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY) +#define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE +#endif + +/** + * @brief Enables factory for generic buffers. + */ +#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS) +#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE +#endif + +/** + * @brief Enables factory for semaphores. + */ +#if !defined(CH_CFG_FACTORY_SEMAPHORES) +#define CH_CFG_FACTORY_SEMAPHORES TRUE +#endif + +/** + * @brief Enables factory for mailboxes. + */ +#if !defined(CH_CFG_FACTORY_MAILBOXES) +#define CH_CFG_FACTORY_MAILBOXES TRUE +#endif + +/** + * @brief Enables factory for objects FIFOs. + */ +#if !defined(CH_CFG_FACTORY_OBJ_FIFOS) +#define CH_CFG_FACTORY_OBJ_FIFOS TRUE +#endif /** @} */ @@ -318,7 +461,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_STATISTICS) #define CH_DBG_STATISTICS FALSE +#endif /** * @brief Debug option, system state check. @@ -327,7 +472,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_SYSTEM_STATE_CHECK FALSE +#if !defined(CH_DBG_SYSTEM_STATE_CHECK) +#define CH_DBG_SYSTEM_STATE_CHECK TRUE +#endif /** * @brief Debug option, parameters checks. @@ -336,7 +483,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_ENABLE_CHECKS FALSE +#if !defined(CH_DBG_ENABLE_CHECKS) +#define CH_DBG_ENABLE_CHECKS TRUE +#endif /** * @brief Debug option, consistency checks. @@ -346,16 +495,28 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_ENABLE_ASSERTS FALSE +#if !defined(CH_DBG_ENABLE_ASSERTS) +#define CH_DBG_ENABLE_ASSERTS TRUE +#endif /** * @brief Debug option, trace buffer. - * @details If enabled then the context switch circular trace buffer is - * activated. + * @details If enabled then the trace buffer is activated. * - * @note The default is @p FALSE. + * @note The default is @p CH_DBG_TRACE_MASK_DISABLED. + */ +#if !defined(CH_DBG_TRACE_MASK) +#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL +#endif + +/** + * @brief Trace buffer entries. + * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is + * different from @p CH_DBG_TRACE_MASK_DISABLED. */ -#define CH_DBG_ENABLE_TRACE FALSE +#if !defined(CH_DBG_TRACE_BUFFER_SIZE) +#define CH_DBG_TRACE_BUFFER_SIZE 128 +#endif /** * @brief Debug option, stack checks. @@ -367,7 +528,9 @@ * @note The default failure mode is to halt the system with the global * @p panic_msg variable set to @p NULL. */ -#define CH_DBG_ENABLE_STACK_CHECK FALSE +#if !defined(CH_DBG_ENABLE_STACK_CHECK) +#define CH_DBG_ENABLE_STACK_CHECK TRUE +#endif /** * @brief Debug option, stacks initialization. @@ -377,7 +540,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_FILL_THREADS FALSE +#if !defined(CH_DBG_FILL_THREADS) +#define CH_DBG_FILL_THREADS TRUE +#endif /** * @brief Debug option, threads profiling. @@ -388,7 +553,9 @@ * @note This debug option is not currently compatible with the * tickless mode. */ +#if !defined(CH_DBG_THREADS_PROFILING) #define CH_DBG_THREADS_PROFILING FALSE +#endif /** @} */ @@ -399,6 +566,22 @@ */ /*===========================================================================*/ +/** + * @brief System structure extension. + * @details User fields added to the end of the @p ch_system_t structure. + */ +#define CH_CFG_SYSTEM_EXTRA_FIELDS \ + /* Add threads custom fields here.*/ + +/** + * @brief System initialization hook. + * @details User initialization code added to the @p chSysInit() function + * just before interrupts are enabled globally. + */ +#define CH_CFG_SYSTEM_INIT_HOOK() { \ + /* Add threads initialization code here.*/ \ +} + /** * @brief Threads descriptor structure extension. * @details User fields added to the end of the @p thread_t structure. @@ -408,9 +591,9 @@ /** * @brief Threads initialization hook. - * @details User initialization code added to the @p chThdInit() API. + * @details User initialization code added to the @p _thread_init() function. * - * @note It is invoked from within @p chThdInit() and implicitly from all + * @note It is invoked from within @p _thread_init() and implicitly from all * the threads creation APIs. */ #define CH_CFG_THREAD_INIT_HOOK(tp) { \ @@ -420,10 +603,6 @@ /** * @brief Threads finalization hook. * @details User finalization code added to the @p chThdExit() API. - * - * @note It is inserted into lock zone. - * @note It is also invoked when the threads simply return in order to - * terminate. */ #define CH_CFG_THREAD_EXIT_HOOK(tp) { \ /* Add threads finalization code here.*/ \ @@ -458,6 +637,7 @@ * @note This macro can be used to activate a power saving mode. */ #define CH_CFG_IDLE_ENTER_HOOK() { \ + /* Idle-enter code here.*/ \ } /** @@ -467,6 +647,7 @@ * @note This macro can be used to deactivate a power saving mode. */ #define CH_CFG_IDLE_LEAVE_HOOK() { \ + /* Idle-leave code here.*/ \ } /** @@ -510,6 +691,6 @@ /* Port-specific settings (override port settings defaulted in chcore.h). */ /*===========================================================================*/ -#endif /* _CHCONF_H_ */ +#endif /* CHCONF_H */ /** @} */ diff --git a/testhal/KINETIS/TEENSY3_x/GPT/halconf_community.h b/testhal/KINETIS/TEENSY3_x/GPT/halconf_community.h new file mode 100644 index 0000000..43fdbf8 --- /dev/null +++ b/testhal/KINETIS/TEENSY3_x/GPT/halconf_community.h @@ -0,0 +1,173 @@ +/* + ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#ifndef HALCONF_COMMUNITY_H +#define HALCONF_COMMUNITY_H + +/** + * @brief Enables the community overlay. + */ +#if !defined(HAL_USE_COMMUNITY) || defined(__DOXYGEN__) +#define HAL_USE_COMMUNITY TRUE +#endif + +/** + * @brief Enables the FSMC subsystem. + */ +#if !defined(HAL_USE_FSMC) || defined(__DOXYGEN__) +#define HAL_USE_FSMC FALSE +#endif + +/** + * @brief Enables the NAND subsystem. + */ +#if !defined(HAL_USE_NAND) || defined(__DOXYGEN__) +#define HAL_USE_NAND FALSE +#endif + +/** + * @brief Enables the 1-wire subsystem. + */ +#if !defined(HAL_USE_ONEWIRE) || defined(__DOXYGEN__) +#define HAL_USE_ONEWIRE FALSE +#endif + +/** + * @brief Enables the EICU subsystem. + */ +#if !defined(HAL_USE_EICU) || defined(__DOXYGEN__) +#define HAL_USE_EICU FALSE +#endif + +/** + * @brief Enables the CRC subsystem. + */ +#if !defined(HAL_USE_CRC) || defined(__DOXYGEN__) +#define HAL_USE_CRC FALSE +#endif + +/** + * @brief Enables the RNG subsystem. + */ +#if !defined(HAL_USE_RNG) || defined(__DOXYGEN__) +#define HAL_USE_RNG FALSE +#endif + +/** + * @brief Enables the EEPROM subsystem. + */ +#if !defined(HAL_USE_EEPROM) || defined(__DOXYGEN__) +#define HAL_USE_EEPROM FALSE +#endif + +/** + * @brief Enables the TIMCAP subsystem. + */ +#if !defined(HAL_USE_TIMCAP) || defined(__DOXYGEN__) +#define HAL_USE_TIMCAP FALSE +#endif + +/** + * @brief Enables the TIMCAP subsystem. + */ +#if !defined(HAL_USE_COMP) || defined(__DOXYGEN__) +#define HAL_USE_COMP FALSE +#endif + +/** + * @brief Enables the QEI subsystem. + */ +#if !defined(HAL_USE_QEI) || defined(__DOXYGEN__) +#define HAL_USE_QEI FALSE +#endif + +/** + * @brief Enables the USBH subsystem. + */ +#if !defined(HAL_USE_USBH) || defined(__DOXYGEN__) +#define HAL_USE_USBH FALSE +#endif + +/** + * @brief Enables the USB_MSD subsystem. + */ +#if !defined(HAL_USE_USB_MSD) || defined(__DOXYGEN__) +#define HAL_USE_USB_MSD FALSE +#endif + +/*===========================================================================*/ +/* FSMCNAND driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables the @p nandAcquireBus() and @p nanReleaseBus() APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(NAND_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define NAND_USE_MUTUAL_EXCLUSION TRUE +#endif + +/*===========================================================================*/ +/* 1-wire driver related settings. */ +/*===========================================================================*/ +/** + * @brief Enables strong pull up feature. + * @note Disabling this option saves both code and data space. + */ +#define ONEWIRE_USE_STRONG_PULLUP FALSE + +/** + * @brief Enables search ROM feature. + * @note Disabling this option saves both code and data space. + */ +#define ONEWIRE_USE_SEARCH_ROM TRUE + +/*===========================================================================*/ +/* QEI driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables discard of overlow + */ +#if !defined(QEI_USE_OVERFLOW_DISCARD) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_DISCARD FALSE +#endif + +/** + * @brief Enables min max of overlow + */ +#if !defined(QEI_USE_OVERFLOW_MINMAX) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_MINMAX FALSE +#endif + +/*===========================================================================*/ +/* EEProm driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables 24xx series I2C eeprom device driver. + * @note Disabling this option saves both code and data space. + */ +#define EEPROM_USE_EE24XX FALSE + /** + * @brief Enables 25xx series SPI eeprom device driver. + * @note Disabling this option saves both code and data space. + */ +#define EEPROM_USE_EE25XX FALSE + +#endif /* HALCONF_COMMUNITY_H */ + +/** @} */ diff --git a/testhal/KINETIS/TEENSY3_x/PWM/Makefile b/testhal/KINETIS/TEENSY3_x/PWM/Makefile index 6510052..d12b346 100644 --- a/testhal/KINETIS/TEENSY3_x/PWM/Makefile +++ b/testhal/KINETIS/TEENSY3_x/PWM/Makefile @@ -30,7 +30,7 @@ endif # Enable this if you want link time optimizations (LTO) ifeq ($(USE_LTO),) - USE_LTO = no + USE_LTO = yes endif # If enabled, this option allows to compile the application in THUMB mode. @@ -88,6 +88,8 @@ PROJECT = ch # Imported source files and paths CHIBIOS = ../../../../../ChibiOS-RT CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib +# Licensing files. +include $(CHIBIOS)/os/license/license.mk # Startup files. include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_k20x7.mk # HAL-OSAL files (optional). @@ -105,19 +107,13 @@ LDSCRIPT= $(STARTUPLD)/MK20DX256.ld # C sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CSRC = $(STARTUPSRC) \ - $(KERNSRC) \ - $(PORTSRC) \ - $(OSALSRC) \ - $(HALSRC) \ - $(PLATFORMSRC) \ - $(BOARDSRC) \ +CSRC = $(ALLCSRC) \ $(TESTSRC) \ main.c # C++ sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CPPSRC = +CPPSRC = $(ALLCPPSRC) # C sources to be compiled in ARM mode regardless of the global setting. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler @@ -140,13 +136,11 @@ TCSRC = TCPPSRC = # List ASM source files here -ASMSRC = -ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM) +ASMSRC = $(ALLASMSRC) +ASMXSRC = $(ALLXASMSRC) -INCDIR = $(CHIBIOS)/os/license \ - $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ - $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \ - $(CHIBIOS)/os/various +INCDIR = $(ALLINC) $(TESTINC) \ + $(TESTHAL) # # Project, sources and paths diff --git a/testhal/KINETIS/TEENSY3_x/PWM/chconf.h b/testhal/KINETIS/TEENSY3_x/PWM/chconf.h index a661f7e..1750f63 100644 --- a/testhal/KINETIS/TEENSY3_x/PWM/chconf.h +++ b/testhal/KINETIS/TEENSY3_x/PWM/chconf.h @@ -1,5 +1,5 @@ /* - ChibiOS - (C) 2015-2016 flabbergast + ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ */ /** - * @file TEENSY3_x/PWM/chconf.h + * @file templates/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. @@ -25,11 +25,11 @@ * @{ */ -#ifndef _CHCONF_H_ -#define _CHCONF_H_ +#ifndef CHCONF_H +#define CHCONF_H #define _CHIBIOS_RT_CONF_ -#define _CHIBIOS_RT_CONF_VER_5_0_ +#define _CHIBIOS_RT_CONF_VER_5_1_ /*===========================================================================*/ /** @@ -42,14 +42,34 @@ * @brief System time counter resolution. * @note Allowed values are 16 or 32 bits. */ +#if !defined(CH_CFG_ST_RESOLUTION) #define CH_CFG_ST_RESOLUTION 32 +#endif /** * @brief System tick frequency. * @details Frequency of the system timer that drives the system ticks. This * setting also defines the system tick time unit. */ +#if !defined(CH_CFG_ST_FREQUENCY) #define CH_CFG_ST_FREQUENCY 1000 +#endif + +/** + * @brief Time intervals data size. + * @note Allowed values are 16, 32 or 64 bits. + */ +#if !defined(CH_CFG_INTERVALS_SIZE) +#define CH_CFG_INTERVALS_SIZE 32 +#endif + +/** + * @brief Time types data size. + * @note Allowed values are 16 or 32 bits. + */ +#if !defined(CH_CFG_TIME_TYPES_SIZE) +#define CH_CFG_TIME_TYPES_SIZE 32 +#endif /** * @brief Time delta constant for the tick-less mode. @@ -59,7 +79,9 @@ * The value one is not valid, timeouts are rounded up to * this value. */ +#if !defined(CH_CFG_ST_TIMEDELTA) #define CH_CFG_ST_TIMEDELTA 0 +#endif /** @} */ @@ -82,7 +104,9 @@ * @note The round robin preemption is not supported in tickless mode and * must be set to zero in that case. */ -#define CH_CFG_TIME_QUANTUM 20 +#if !defined(CH_CFG_TIME_QUANTUM) +#define CH_CFG_TIME_QUANTUM 2 +#endif /** * @brief Managed RAM size. @@ -95,7 +119,9 @@ * provide the @p __heap_base__ and @p __heap_end__ symbols. * @note Requires @p CH_CFG_USE_MEMCORE. */ +#if !defined(CH_CFG_MEMCORE_SIZE) #define CH_CFG_MEMCORE_SIZE 0 +#endif /** * @brief Idle thread automatic spawn suppression. @@ -104,7 +130,9 @@ * function becomes the idle thread and must implement an * infinite loop. */ +#if !defined(CH_CFG_NO_IDLE_THREAD) #define CH_CFG_NO_IDLE_THREAD FALSE +#endif /** @} */ @@ -123,7 +151,9 @@ * @note This is not related to the compiler optimization options. * @note The default is @p TRUE. */ +#if !defined(CH_CFG_OPTIMIZE_SPEED) #define CH_CFG_OPTIMIZE_SPEED TRUE +#endif /** @} */ @@ -141,7 +171,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_TM) #define CH_CFG_USE_TM FALSE +#endif /** * @brief Threads registry APIs. @@ -149,7 +181,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_REGISTRY) #define CH_CFG_USE_REGISTRY TRUE +#endif /** * @brief Threads synchronization APIs. @@ -158,7 +192,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_WAITEXIT) #define CH_CFG_USE_WAITEXIT TRUE +#endif /** * @brief Semaphores APIs. @@ -166,7 +202,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_SEMAPHORES) #define CH_CFG_USE_SEMAPHORES TRUE +#endif /** * @brief Semaphores queuing mode. @@ -177,7 +215,9 @@ * requirements. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ +#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY) #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE +#endif /** * @brief Mutexes APIs. @@ -185,7 +225,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MUTEXES) #define CH_CFG_USE_MUTEXES TRUE +#endif /** * @brief Enables recursive behavior on mutexes. @@ -195,7 +237,9 @@ * @note The default is @p FALSE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE) #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE +#endif /** * @brief Conditional Variables APIs. @@ -205,7 +249,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_CONDVARS) #define CH_CFG_USE_CONDVARS TRUE +#endif /** * @brief Conditional Variables APIs with timeout. @@ -215,7 +261,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_CONDVARS. */ +#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT) #define CH_CFG_USE_CONDVARS_TIMEOUT TRUE +#endif /** * @brief Events Flags APIs. @@ -223,7 +271,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_EVENTS) #define CH_CFG_USE_EVENTS TRUE +#endif /** * @brief Events Flags APIs with timeout. @@ -233,7 +283,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_EVENTS. */ +#if !defined(CH_CFG_USE_EVENTS_TIMEOUT) #define CH_CFG_USE_EVENTS_TIMEOUT TRUE +#endif /** * @brief Synchronous Messages APIs. @@ -242,7 +294,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MESSAGES) #define CH_CFG_USE_MESSAGES TRUE +#endif /** * @brief Synchronous Messages queuing mode. @@ -253,7 +307,9 @@ * requirements. * @note Requires @p CH_CFG_USE_MESSAGES. */ +#if !defined(CH_CFG_USE_MESSAGES_PRIORITY) #define CH_CFG_USE_MESSAGES_PRIORITY FALSE +#endif /** * @brief Mailboxes APIs. @@ -263,7 +319,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ +#if !defined(CH_CFG_USE_MAILBOXES) #define CH_CFG_USE_MAILBOXES TRUE +#endif /** * @brief Core Memory Manager APIs. @@ -272,7 +330,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMCORE) #define CH_CFG_USE_MEMCORE TRUE +#endif /** * @brief Heap Allocator APIs. @@ -284,7 +344,9 @@ * @p CH_CFG_USE_SEMAPHORES. * @note Mutexes are recommended. */ +#if !defined(CH_CFG_USE_HEAP) #define CH_CFG_USE_HEAP TRUE +#endif /** * @brief Memory Pools Allocator APIs. @@ -293,7 +355,20 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMPOOLS) #define CH_CFG_USE_MEMPOOLS TRUE +#endif + +/** + * @brief Objects FIFOs APIs. + * @details If enabled then the objects FIFOs APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#if !defined(CH_CFG_USE_OBJ_FIFOS) +#define CH_CFG_USE_OBJ_FIFOS TRUE +#endif /** * @brief Dynamic Threads APIs. @@ -304,7 +379,73 @@ * @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. */ +#if !defined(CH_CFG_USE_DYNAMIC) #define CH_CFG_USE_DYNAMIC TRUE +#endif + +/** @} */ + +/*===========================================================================*/ +/** + * @name Objects factory options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Objects Factory APIs. + * @details If enabled then the objects factory APIs are included in the + * kernel. + * + * @note The default is @p FALSE. + */ +#if !defined(CH_CFG_USE_FACTORY) +#define CH_CFG_USE_FACTORY TRUE +#endif + +/** + * @brief Maximum length for object names. + * @details If the specified length is zero then the name is stored by + * pointer but this could have unintended side effects. + */ +#if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH) +#define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8 +#endif + +/** + * @brief Enables the registry of generic objects. + */ +#if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY) +#define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE +#endif + +/** + * @brief Enables factory for generic buffers. + */ +#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS) +#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE +#endif + +/** + * @brief Enables factory for semaphores. + */ +#if !defined(CH_CFG_FACTORY_SEMAPHORES) +#define CH_CFG_FACTORY_SEMAPHORES TRUE +#endif + +/** + * @brief Enables factory for mailboxes. + */ +#if !defined(CH_CFG_FACTORY_MAILBOXES) +#define CH_CFG_FACTORY_MAILBOXES TRUE +#endif + +/** + * @brief Enables factory for objects FIFOs. + */ +#if !defined(CH_CFG_FACTORY_OBJ_FIFOS) +#define CH_CFG_FACTORY_OBJ_FIFOS TRUE +#endif /** @} */ @@ -320,7 +461,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_STATISTICS) #define CH_DBG_STATISTICS FALSE +#endif /** * @brief Debug option, system state check. @@ -329,7 +472,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_SYSTEM_STATE_CHECK FALSE +#if !defined(CH_DBG_SYSTEM_STATE_CHECK) +#define CH_DBG_SYSTEM_STATE_CHECK TRUE +#endif /** * @brief Debug option, parameters checks. @@ -338,7 +483,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_ENABLE_CHECKS FALSE +#if !defined(CH_DBG_ENABLE_CHECKS) +#define CH_DBG_ENABLE_CHECKS TRUE +#endif /** * @brief Debug option, consistency checks. @@ -348,16 +495,28 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_ENABLE_ASSERTS FALSE +#if !defined(CH_DBG_ENABLE_ASSERTS) +#define CH_DBG_ENABLE_ASSERTS TRUE +#endif /** * @brief Debug option, trace buffer. - * @details If enabled then the context switch circular trace buffer is - * activated. + * @details If enabled then the trace buffer is activated. * - * @note The default is @p FALSE. + * @note The default is @p CH_DBG_TRACE_MASK_DISABLED. + */ +#if !defined(CH_DBG_TRACE_MASK) +#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL +#endif + +/** + * @brief Trace buffer entries. + * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is + * different from @p CH_DBG_TRACE_MASK_DISABLED. */ -#define CH_DBG_ENABLE_TRACE FALSE +#if !defined(CH_DBG_TRACE_BUFFER_SIZE) +#define CH_DBG_TRACE_BUFFER_SIZE 128 +#endif /** * @brief Debug option, stack checks. @@ -369,7 +528,9 @@ * @note The default failure mode is to halt the system with the global * @p panic_msg variable set to @p NULL. */ -#define CH_DBG_ENABLE_STACK_CHECK FALSE +#if !defined(CH_DBG_ENABLE_STACK_CHECK) +#define CH_DBG_ENABLE_STACK_CHECK TRUE +#endif /** * @brief Debug option, stacks initialization. @@ -379,7 +540,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_FILL_THREADS FALSE +#if !defined(CH_DBG_FILL_THREADS) +#define CH_DBG_FILL_THREADS TRUE +#endif /** * @brief Debug option, threads profiling. @@ -390,7 +553,9 @@ * @note This debug option is not currently compatible with the * tickless mode. */ +#if !defined(CH_DBG_THREADS_PROFILING) #define CH_DBG_THREADS_PROFILING FALSE +#endif /** @} */ @@ -401,6 +566,22 @@ */ /*===========================================================================*/ +/** + * @brief System structure extension. + * @details User fields added to the end of the @p ch_system_t structure. + */ +#define CH_CFG_SYSTEM_EXTRA_FIELDS \ + /* Add threads custom fields here.*/ + +/** + * @brief System initialization hook. + * @details User initialization code added to the @p chSysInit() function + * just before interrupts are enabled globally. + */ +#define CH_CFG_SYSTEM_INIT_HOOK() { \ + /* Add threads initialization code here.*/ \ +} + /** * @brief Threads descriptor structure extension. * @details User fields added to the end of the @p thread_t structure. @@ -410,9 +591,9 @@ /** * @brief Threads initialization hook. - * @details User initialization code added to the @p chThdInit() API. + * @details User initialization code added to the @p _thread_init() function. * - * @note It is invoked from within @p chThdInit() and implicitly from all + * @note It is invoked from within @p _thread_init() and implicitly from all * the threads creation APIs. */ #define CH_CFG_THREAD_INIT_HOOK(tp) { \ @@ -422,10 +603,6 @@ /** * @brief Threads finalization hook. * @details User finalization code added to the @p chThdExit() API. - * - * @note It is inserted into lock zone. - * @note It is also invoked when the threads simply return in order to - * terminate. */ #define CH_CFG_THREAD_EXIT_HOOK(tp) { \ /* Add threads finalization code here.*/ \ @@ -460,6 +637,7 @@ * @note This macro can be used to activate a power saving mode. */ #define CH_CFG_IDLE_ENTER_HOOK() { \ + /* Idle-enter code here.*/ \ } /** @@ -469,6 +647,7 @@ * @note This macro can be used to deactivate a power saving mode. */ #define CH_CFG_IDLE_LEAVE_HOOK() { \ + /* Idle-leave code here.*/ \ } /** @@ -512,6 +691,6 @@ /* Port-specific settings (override port settings defaulted in chcore.h). */ /*===========================================================================*/ -#endif /* _CHCONF_H_ */ +#endif /* CHCONF_H */ /** @} */ diff --git a/testhal/KINETIS/TEENSY3_x/PWM/halconf_community.h b/testhal/KINETIS/TEENSY3_x/PWM/halconf_community.h new file mode 100644 index 0000000..43fdbf8 --- /dev/null +++ b/testhal/KINETIS/TEENSY3_x/PWM/halconf_community.h @@ -0,0 +1,173 @@ +/* + ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#ifndef HALCONF_COMMUNITY_H +#define HALCONF_COMMUNITY_H + +/** + * @brief Enables the community overlay. + */ +#if !defined(HAL_USE_COMMUNITY) || defined(__DOXYGEN__) +#define HAL_USE_COMMUNITY TRUE +#endif + +/** + * @brief Enables the FSMC subsystem. + */ +#if !defined(HAL_USE_FSMC) || defined(__DOXYGEN__) +#define HAL_USE_FSMC FALSE +#endif + +/** + * @brief Enables the NAND subsystem. + */ +#if !defined(HAL_USE_NAND) || defined(__DOXYGEN__) +#define HAL_USE_NAND FALSE +#endif + +/** + * @brief Enables the 1-wire subsystem. + */ +#if !defined(HAL_USE_ONEWIRE) || defined(__DOXYGEN__) +#define HAL_USE_ONEWIRE FALSE +#endif + +/** + * @brief Enables the EICU subsystem. + */ +#if !defined(HAL_USE_EICU) || defined(__DOXYGEN__) +#define HAL_USE_EICU FALSE +#endif + +/** + * @brief Enables the CRC subsystem. + */ +#if !defined(HAL_USE_CRC) || defined(__DOXYGEN__) +#define HAL_USE_CRC FALSE +#endif + +/** + * @brief Enables the RNG subsystem. + */ +#if !defined(HAL_USE_RNG) || defined(__DOXYGEN__) +#define HAL_USE_RNG FALSE +#endif + +/** + * @brief Enables the EEPROM subsystem. + */ +#if !defined(HAL_USE_EEPROM) || defined(__DOXYGEN__) +#define HAL_USE_EEPROM FALSE +#endif + +/** + * @brief Enables the TIMCAP subsystem. + */ +#if !defined(HAL_USE_TIMCAP) || defined(__DOXYGEN__) +#define HAL_USE_TIMCAP FALSE +#endif + +/** + * @brief Enables the TIMCAP subsystem. + */ +#if !defined(HAL_USE_COMP) || defined(__DOXYGEN__) +#define HAL_USE_COMP FALSE +#endif + +/** + * @brief Enables the QEI subsystem. + */ +#if !defined(HAL_USE_QEI) || defined(__DOXYGEN__) +#define HAL_USE_QEI FALSE +#endif + +/** + * @brief Enables the USBH subsystem. + */ +#if !defined(HAL_USE_USBH) || defined(__DOXYGEN__) +#define HAL_USE_USBH FALSE +#endif + +/** + * @brief Enables the USB_MSD subsystem. + */ +#if !defined(HAL_USE_USB_MSD) || defined(__DOXYGEN__) +#define HAL_USE_USB_MSD FALSE +#endif + +/*===========================================================================*/ +/* FSMCNAND driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables the @p nandAcquireBus() and @p nanReleaseBus() APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(NAND_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define NAND_USE_MUTUAL_EXCLUSION TRUE +#endif + +/*===========================================================================*/ +/* 1-wire driver related settings. */ +/*===========================================================================*/ +/** + * @brief Enables strong pull up feature. + * @note Disabling this option saves both code and data space. + */ +#define ONEWIRE_USE_STRONG_PULLUP FALSE + +/** + * @brief Enables search ROM feature. + * @note Disabling this option saves both code and data space. + */ +#define ONEWIRE_USE_SEARCH_ROM TRUE + +/*===========================================================================*/ +/* QEI driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables discard of overlow + */ +#if !defined(QEI_USE_OVERFLOW_DISCARD) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_DISCARD FALSE +#endif + +/** + * @brief Enables min max of overlow + */ +#if !defined(QEI_USE_OVERFLOW_MINMAX) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_MINMAX FALSE +#endif + +/*===========================================================================*/ +/* EEProm driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables 24xx series I2C eeprom device driver. + * @note Disabling this option saves both code and data space. + */ +#define EEPROM_USE_EE24XX FALSE + /** + * @brief Enables 25xx series SPI eeprom device driver. + * @note Disabling this option saves both code and data space. + */ +#define EEPROM_USE_EE25XX FALSE + +#endif /* HALCONF_COMMUNITY_H */ + +/** @} */ diff --git a/testhal/KINETIS/TEENSY3_x/SERIAL/Makefile b/testhal/KINETIS/TEENSY3_x/SERIAL/Makefile index 6510052..d12b346 100644 --- a/testhal/KINETIS/TEENSY3_x/SERIAL/Makefile +++ b/testhal/KINETIS/TEENSY3_x/SERIAL/Makefile @@ -30,7 +30,7 @@ endif # Enable this if you want link time optimizations (LTO) ifeq ($(USE_LTO),) - USE_LTO = no + USE_LTO = yes endif # If enabled, this option allows to compile the application in THUMB mode. @@ -88,6 +88,8 @@ PROJECT = ch # Imported source files and paths CHIBIOS = ../../../../../ChibiOS-RT CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib +# Licensing files. +include $(CHIBIOS)/os/license/license.mk # Startup files. include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_k20x7.mk # HAL-OSAL files (optional). @@ -105,19 +107,13 @@ LDSCRIPT= $(STARTUPLD)/MK20DX256.ld # C sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CSRC = $(STARTUPSRC) \ - $(KERNSRC) \ - $(PORTSRC) \ - $(OSALSRC) \ - $(HALSRC) \ - $(PLATFORMSRC) \ - $(BOARDSRC) \ +CSRC = $(ALLCSRC) \ $(TESTSRC) \ main.c # C++ sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CPPSRC = +CPPSRC = $(ALLCPPSRC) # C sources to be compiled in ARM mode regardless of the global setting. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler @@ -140,13 +136,11 @@ TCSRC = TCPPSRC = # List ASM source files here -ASMSRC = -ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM) +ASMSRC = $(ALLASMSRC) +ASMXSRC = $(ALLXASMSRC) -INCDIR = $(CHIBIOS)/os/license \ - $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ - $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \ - $(CHIBIOS)/os/various +INCDIR = $(ALLINC) $(TESTINC) \ + $(TESTHAL) # # Project, sources and paths diff --git a/testhal/KINETIS/TEENSY3_x/SERIAL/chconf.h b/testhal/KINETIS/TEENSY3_x/SERIAL/chconf.h index 27ed81c..1750f63 100644 --- a/testhal/KINETIS/TEENSY3_x/SERIAL/chconf.h +++ b/testhal/KINETIS/TEENSY3_x/SERIAL/chconf.h @@ -1,5 +1,5 @@ /* - ChibiOS - (C) 2015 RedoX https://github.com/RedoXyde + ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -15,19 +15,21 @@ */ /** - * @file TEENSY3_x/SERIAL/chconf.h - * @brief Configuration file. + * @file templates/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 config * @details Kernel related settings and hooks. * @{ */ -#ifndef _CHCONF_H_ -#define _CHCONF_H_ +#ifndef CHCONF_H +#define CHCONF_H #define _CHIBIOS_RT_CONF_ -#define _CHIBIOS_RT_CONF_VER_5_0_ +#define _CHIBIOS_RT_CONF_VER_5_1_ /*===========================================================================*/ /** @@ -40,14 +42,34 @@ * @brief System time counter resolution. * @note Allowed values are 16 or 32 bits. */ +#if !defined(CH_CFG_ST_RESOLUTION) #define CH_CFG_ST_RESOLUTION 32 +#endif /** * @brief System tick frequency. * @details Frequency of the system timer that drives the system ticks. This * setting also defines the system tick time unit. */ +#if !defined(CH_CFG_ST_FREQUENCY) #define CH_CFG_ST_FREQUENCY 1000 +#endif + +/** + * @brief Time intervals data size. + * @note Allowed values are 16, 32 or 64 bits. + */ +#if !defined(CH_CFG_INTERVALS_SIZE) +#define CH_CFG_INTERVALS_SIZE 32 +#endif + +/** + * @brief Time types data size. + * @note Allowed values are 16 or 32 bits. + */ +#if !defined(CH_CFG_TIME_TYPES_SIZE) +#define CH_CFG_TIME_TYPES_SIZE 32 +#endif /** * @brief Time delta constant for the tick-less mode. @@ -57,7 +79,9 @@ * The value one is not valid, timeouts are rounded up to * this value. */ +#if !defined(CH_CFG_ST_TIMEDELTA) #define CH_CFG_ST_TIMEDELTA 0 +#endif /** @} */ @@ -80,7 +104,9 @@ * @note The round robin preemption is not supported in tickless mode and * must be set to zero in that case. */ -#define CH_CFG_TIME_QUANTUM 20 +#if !defined(CH_CFG_TIME_QUANTUM) +#define CH_CFG_TIME_QUANTUM 2 +#endif /** * @brief Managed RAM size. @@ -93,7 +119,9 @@ * provide the @p __heap_base__ and @p __heap_end__ symbols. * @note Requires @p CH_CFG_USE_MEMCORE. */ +#if !defined(CH_CFG_MEMCORE_SIZE) #define CH_CFG_MEMCORE_SIZE 0 +#endif /** * @brief Idle thread automatic spawn suppression. @@ -102,7 +130,9 @@ * function becomes the idle thread and must implement an * infinite loop. */ +#if !defined(CH_CFG_NO_IDLE_THREAD) #define CH_CFG_NO_IDLE_THREAD FALSE +#endif /** @} */ @@ -121,7 +151,9 @@ * @note This is not related to the compiler optimization options. * @note The default is @p TRUE. */ +#if !defined(CH_CFG_OPTIMIZE_SPEED) #define CH_CFG_OPTIMIZE_SPEED TRUE +#endif /** @} */ @@ -139,7 +171,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_TM) #define CH_CFG_USE_TM FALSE +#endif /** * @brief Threads registry APIs. @@ -147,7 +181,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_REGISTRY) #define CH_CFG_USE_REGISTRY TRUE +#endif /** * @brief Threads synchronization APIs. @@ -156,7 +192,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_WAITEXIT) #define CH_CFG_USE_WAITEXIT TRUE +#endif /** * @brief Semaphores APIs. @@ -164,7 +202,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_SEMAPHORES) #define CH_CFG_USE_SEMAPHORES TRUE +#endif /** * @brief Semaphores queuing mode. @@ -175,7 +215,9 @@ * requirements. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ +#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY) #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE +#endif /** * @brief Mutexes APIs. @@ -183,7 +225,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MUTEXES) #define CH_CFG_USE_MUTEXES TRUE +#endif /** * @brief Enables recursive behavior on mutexes. @@ -193,7 +237,9 @@ * @note The default is @p FALSE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE) #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE +#endif /** * @brief Conditional Variables APIs. @@ -203,7 +249,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_CONDVARS) #define CH_CFG_USE_CONDVARS TRUE +#endif /** * @brief Conditional Variables APIs with timeout. @@ -213,7 +261,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_CONDVARS. */ +#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT) #define CH_CFG_USE_CONDVARS_TIMEOUT TRUE +#endif /** * @brief Events Flags APIs. @@ -221,7 +271,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_EVENTS) #define CH_CFG_USE_EVENTS TRUE +#endif /** * @brief Events Flags APIs with timeout. @@ -231,7 +283,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_EVENTS. */ +#if !defined(CH_CFG_USE_EVENTS_TIMEOUT) #define CH_CFG_USE_EVENTS_TIMEOUT TRUE +#endif /** * @brief Synchronous Messages APIs. @@ -240,7 +294,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MESSAGES) #define CH_CFG_USE_MESSAGES TRUE +#endif /** * @brief Synchronous Messages queuing mode. @@ -251,7 +307,9 @@ * requirements. * @note Requires @p CH_CFG_USE_MESSAGES. */ +#if !defined(CH_CFG_USE_MESSAGES_PRIORITY) #define CH_CFG_USE_MESSAGES_PRIORITY FALSE +#endif /** * @brief Mailboxes APIs. @@ -261,7 +319,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ +#if !defined(CH_CFG_USE_MAILBOXES) #define CH_CFG_USE_MAILBOXES TRUE +#endif /** * @brief Core Memory Manager APIs. @@ -270,7 +330,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMCORE) #define CH_CFG_USE_MEMCORE TRUE +#endif /** * @brief Heap Allocator APIs. @@ -282,7 +344,9 @@ * @p CH_CFG_USE_SEMAPHORES. * @note Mutexes are recommended. */ +#if !defined(CH_CFG_USE_HEAP) #define CH_CFG_USE_HEAP TRUE +#endif /** * @brief Memory Pools Allocator APIs. @@ -291,7 +355,20 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMPOOLS) #define CH_CFG_USE_MEMPOOLS TRUE +#endif + +/** + * @brief Objects FIFOs APIs. + * @details If enabled then the objects FIFOs APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#if !defined(CH_CFG_USE_OBJ_FIFOS) +#define CH_CFG_USE_OBJ_FIFOS TRUE +#endif /** * @brief Dynamic Threads APIs. @@ -302,7 +379,73 @@ * @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. */ +#if !defined(CH_CFG_USE_DYNAMIC) #define CH_CFG_USE_DYNAMIC TRUE +#endif + +/** @} */ + +/*===========================================================================*/ +/** + * @name Objects factory options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Objects Factory APIs. + * @details If enabled then the objects factory APIs are included in the + * kernel. + * + * @note The default is @p FALSE. + */ +#if !defined(CH_CFG_USE_FACTORY) +#define CH_CFG_USE_FACTORY TRUE +#endif + +/** + * @brief Maximum length for object names. + * @details If the specified length is zero then the name is stored by + * pointer but this could have unintended side effects. + */ +#if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH) +#define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8 +#endif + +/** + * @brief Enables the registry of generic objects. + */ +#if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY) +#define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE +#endif + +/** + * @brief Enables factory for generic buffers. + */ +#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS) +#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE +#endif + +/** + * @brief Enables factory for semaphores. + */ +#if !defined(CH_CFG_FACTORY_SEMAPHORES) +#define CH_CFG_FACTORY_SEMAPHORES TRUE +#endif + +/** + * @brief Enables factory for mailboxes. + */ +#if !defined(CH_CFG_FACTORY_MAILBOXES) +#define CH_CFG_FACTORY_MAILBOXES TRUE +#endif + +/** + * @brief Enables factory for objects FIFOs. + */ +#if !defined(CH_CFG_FACTORY_OBJ_FIFOS) +#define CH_CFG_FACTORY_OBJ_FIFOS TRUE +#endif /** @} */ @@ -318,7 +461,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_STATISTICS) #define CH_DBG_STATISTICS FALSE +#endif /** * @brief Debug option, system state check. @@ -327,7 +472,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_SYSTEM_STATE_CHECK FALSE +#if !defined(CH_DBG_SYSTEM_STATE_CHECK) +#define CH_DBG_SYSTEM_STATE_CHECK TRUE +#endif /** * @brief Debug option, parameters checks. @@ -336,7 +483,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_ENABLE_CHECKS FALSE +#if !defined(CH_DBG_ENABLE_CHECKS) +#define CH_DBG_ENABLE_CHECKS TRUE +#endif /** * @brief Debug option, consistency checks. @@ -346,16 +495,28 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_ENABLE_ASSERTS FALSE +#if !defined(CH_DBG_ENABLE_ASSERTS) +#define CH_DBG_ENABLE_ASSERTS TRUE +#endif /** * @brief Debug option, trace buffer. - * @details If enabled then the context switch circular trace buffer is - * activated. + * @details If enabled then the trace buffer is activated. * - * @note The default is @p FALSE. + * @note The default is @p CH_DBG_TRACE_MASK_DISABLED. + */ +#if !defined(CH_DBG_TRACE_MASK) +#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL +#endif + +/** + * @brief Trace buffer entries. + * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is + * different from @p CH_DBG_TRACE_MASK_DISABLED. */ -#define CH_DBG_ENABLE_TRACE FALSE +#if !defined(CH_DBG_TRACE_BUFFER_SIZE) +#define CH_DBG_TRACE_BUFFER_SIZE 128 +#endif /** * @brief Debug option, stack checks. @@ -367,7 +528,9 @@ * @note The default failure mode is to halt the system with the global * @p panic_msg variable set to @p NULL. */ -#define CH_DBG_ENABLE_STACK_CHECK FALSE +#if !defined(CH_DBG_ENABLE_STACK_CHECK) +#define CH_DBG_ENABLE_STACK_CHECK TRUE +#endif /** * @brief Debug option, stacks initialization. @@ -377,7 +540,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_FILL_THREADS FALSE +#if !defined(CH_DBG_FILL_THREADS) +#define CH_DBG_FILL_THREADS TRUE +#endif /** * @brief Debug option, threads profiling. @@ -388,7 +553,9 @@ * @note This debug option is not currently compatible with the * tickless mode. */ +#if !defined(CH_DBG_THREADS_PROFILING) #define CH_DBG_THREADS_PROFILING FALSE +#endif /** @} */ @@ -399,6 +566,22 @@ */ /*===========================================================================*/ +/** + * @brief System structure extension. + * @details User fields added to the end of the @p ch_system_t structure. + */ +#define CH_CFG_SYSTEM_EXTRA_FIELDS \ + /* Add threads custom fields here.*/ + +/** + * @brief System initialization hook. + * @details User initialization code added to the @p chSysInit() function + * just before interrupts are enabled globally. + */ +#define CH_CFG_SYSTEM_INIT_HOOK() { \ + /* Add threads initialization code here.*/ \ +} + /** * @brief Threads descriptor structure extension. * @details User fields added to the end of the @p thread_t structure. @@ -408,9 +591,9 @@ /** * @brief Threads initialization hook. - * @details User initialization code added to the @p chThdInit() API. + * @details User initialization code added to the @p _thread_init() function. * - * @note It is invoked from within @p chThdInit() and implicitly from all + * @note It is invoked from within @p _thread_init() and implicitly from all * the threads creation APIs. */ #define CH_CFG_THREAD_INIT_HOOK(tp) { \ @@ -420,10 +603,6 @@ /** * @brief Threads finalization hook. * @details User finalization code added to the @p chThdExit() API. - * - * @note It is inserted into lock zone. - * @note It is also invoked when the threads simply return in order to - * terminate. */ #define CH_CFG_THREAD_EXIT_HOOK(tp) { \ /* Add threads finalization code here.*/ \ @@ -458,6 +637,7 @@ * @note This macro can be used to activate a power saving mode. */ #define CH_CFG_IDLE_ENTER_HOOK() { \ + /* Idle-enter code here.*/ \ } /** @@ -467,6 +647,7 @@ * @note This macro can be used to deactivate a power saving mode. */ #define CH_CFG_IDLE_LEAVE_HOOK() { \ + /* Idle-leave code here.*/ \ } /** @@ -510,6 +691,6 @@ /* Port-specific settings (override port settings defaulted in chcore.h). */ /*===========================================================================*/ -#endif /* _CHCONF_H_ */ +#endif /* CHCONF_H */ /** @} */ diff --git a/testhal/KINETIS/TEENSY3_x/SERIAL/halconf_community.h b/testhal/KINETIS/TEENSY3_x/SERIAL/halconf_community.h new file mode 100644 index 0000000..43fdbf8 --- /dev/null +++ b/testhal/KINETIS/TEENSY3_x/SERIAL/halconf_community.h @@ -0,0 +1,173 @@ +/* + ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#ifndef HALCONF_COMMUNITY_H +#define HALCONF_COMMUNITY_H + +/** + * @brief Enables the community overlay. + */ +#if !defined(HAL_USE_COMMUNITY) || defined(__DOXYGEN__) +#define HAL_USE_COMMUNITY TRUE +#endif + +/** + * @brief Enables the FSMC subsystem. + */ +#if !defined(HAL_USE_FSMC) || defined(__DOXYGEN__) +#define HAL_USE_FSMC FALSE +#endif + +/** + * @brief Enables the NAND subsystem. + */ +#if !defined(HAL_USE_NAND) || defined(__DOXYGEN__) +#define HAL_USE_NAND FALSE +#endif + +/** + * @brief Enables the 1-wire subsystem. + */ +#if !defined(HAL_USE_ONEWIRE) || defined(__DOXYGEN__) +#define HAL_USE_ONEWIRE FALSE +#endif + +/** + * @brief Enables the EICU subsystem. + */ +#if !defined(HAL_USE_EICU) || defined(__DOXYGEN__) +#define HAL_USE_EICU FALSE +#endif + +/** + * @brief Enables the CRC subsystem. + */ +#if !defined(HAL_USE_CRC) || defined(__DOXYGEN__) +#define HAL_USE_CRC FALSE +#endif + +/** + * @brief Enables the RNG subsystem. + */ +#if !defined(HAL_USE_RNG) || defined(__DOXYGEN__) +#define HAL_USE_RNG FALSE +#endif + +/** + * @brief Enables the EEPROM subsystem. + */ +#if !defined(HAL_USE_EEPROM) || defined(__DOXYGEN__) +#define HAL_USE_EEPROM FALSE +#endif + +/** + * @brief Enables the TIMCAP subsystem. + */ +#if !defined(HAL_USE_TIMCAP) || defined(__DOXYGEN__) +#define HAL_USE_TIMCAP FALSE +#endif + +/** + * @brief Enables the TIMCAP subsystem. + */ +#if !defined(HAL_USE_COMP) || defined(__DOXYGEN__) +#define HAL_USE_COMP FALSE +#endif + +/** + * @brief Enables the QEI subsystem. + */ +#if !defined(HAL_USE_QEI) || defined(__DOXYGEN__) +#define HAL_USE_QEI FALSE +#endif + +/** + * @brief Enables the USBH subsystem. + */ +#if !defined(HAL_USE_USBH) || defined(__DOXYGEN__) +#define HAL_USE_USBH FALSE +#endif + +/** + * @brief Enables the USB_MSD subsystem. + */ +#if !defined(HAL_USE_USB_MSD) || defined(__DOXYGEN__) +#define HAL_USE_USB_MSD FALSE +#endif + +/*===========================================================================*/ +/* FSMCNAND driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables the @p nandAcquireBus() and @p nanReleaseBus() APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(NAND_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define NAND_USE_MUTUAL_EXCLUSION TRUE +#endif + +/*===========================================================================*/ +/* 1-wire driver related settings. */ +/*===========================================================================*/ +/** + * @brief Enables strong pull up feature. + * @note Disabling this option saves both code and data space. + */ +#define ONEWIRE_USE_STRONG_PULLUP FALSE + +/** + * @brief Enables search ROM feature. + * @note Disabling this option saves both code and data space. + */ +#define ONEWIRE_USE_SEARCH_ROM TRUE + +/*===========================================================================*/ +/* QEI driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables discard of overlow + */ +#if !defined(QEI_USE_OVERFLOW_DISCARD) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_DISCARD FALSE +#endif + +/** + * @brief Enables min max of overlow + */ +#if !defined(QEI_USE_OVERFLOW_MINMAX) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_MINMAX FALSE +#endif + +/*===========================================================================*/ +/* EEProm driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables 24xx series I2C eeprom device driver. + * @note Disabling this option saves both code and data space. + */ +#define EEPROM_USE_EE24XX FALSE + /** + * @brief Enables 25xx series SPI eeprom device driver. + * @note Disabling this option saves both code and data space. + */ +#define EEPROM_USE_EE25XX FALSE + +#endif /* HALCONF_COMMUNITY_H */ + +/** @} */ diff --git a/testhal/KINETIS/TEENSY3_x/USB_SERIAL/Makefile b/testhal/KINETIS/TEENSY3_x/USB_SERIAL/Makefile index 055c3dc..0cd1dbc 100644 --- a/testhal/KINETIS/TEENSY3_x/USB_SERIAL/Makefile +++ b/testhal/KINETIS/TEENSY3_x/USB_SERIAL/Makefile @@ -1,225 +1,219 @@ -############################################################################## -# Build global options -# NOTE: Can be overridden externally. -# - -# Compiler options here. -ifeq ($(USE_OPT),) - USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16 -endif - -# C specific options here (added to USE_OPT). -ifeq ($(USE_COPT),) - USE_COPT = -endif - -# C++ specific options here (added to USE_OPT). -ifeq ($(USE_CPPOPT),) - USE_CPPOPT = -fno-rtti -endif - -# Enable this if you want the linker to remove unused code and data -ifeq ($(USE_LINK_GC),) - USE_LINK_GC = yes -endif - -# Linker extra options here. -ifeq ($(USE_LDOPT),) - USE_LDOPT = -endif - -# Enable this if you want link time optimizations (LTO) -ifeq ($(USE_LTO),) - USE_LTO = no -endif - -# If enabled, this option allows to compile the application in THUMB mode. -ifeq ($(USE_THUMB),) - USE_THUMB = yes -endif - -# Enable this if you want to see the full log while compiling. -ifeq ($(USE_VERBOSE_COMPILE),) - USE_VERBOSE_COMPILE = no -endif - -# If enabled, this option makes the build process faster by not compiling -# modules not used in the current configuration. -ifeq ($(USE_SMART_BUILD),) - USE_SMART_BUILD = yes -endif - -# -# Build global options -############################################################################## - -############################################################################## -# Architecture or project specific options -# - -# Stack size to be allocated to the Cortex-M process stack. This stack is -# the stack used by the main() thread. -ifeq ($(USE_PROCESS_STACKSIZE),) - USE_PROCESS_STACKSIZE = 0x200 -endif - -# Stack size to the allocated to the Cortex-M main/exceptions stack. This -# stack is used for processing interrupts and exceptions. -ifeq ($(USE_EXCEPTIONS_STACKSIZE),) - USE_EXCEPTIONS_STACKSIZE = 0x400 -endif - -# Enables the use of FPU on Cortex-M4 (no, softfp, hard). -ifeq ($(USE_FPU),) - USE_FPU = no -endif - -# -# Architecture or project specific options -############################################################################## - -############################################################################## -# Project, sources and paths -# - -# Define project name here -PROJECT = ch - -# Imported source files and paths -CHIBIOS = ../../../../../ChibiOS-RT -CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib -# Startup files. -include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_k20x7.mk -# HAL-OSAL files (optional). -include $(CHIBIOS)/os/hal/hal.mk -include $(CHIBIOS_CONTRIB)/os/hal/ports/KINETIS/K20x/platform.mk -include $(CHIBIOS_CONTRIB)/os/hal/boards/PJRC_TEENSY_3_1/board.mk -include $(CHIBIOS)/os/hal/osal/rt/osal.mk -# RTOS files (optional). -include $(CHIBIOS)/os/rt/rt.mk -include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk -# Other files (optional). -include $(CHIBIOS)/test/rt/test.mk -include $(CHIBIOS)/os/hal/lib/streams/streams.mk -include $(CHIBIOS)/os/various/shell/shell.mk - -# Define linker script file here -LDSCRIPT= $(STARTUPLD)/MK20DX256.ld - -# C sources that can be compiled in ARM or THUMB mode depending on the global -# setting. -CSRC = $(STARTUPSRC) \ - $(KERNSRC) \ - $(PORTSRC) \ - $(OSALSRC) \ - $(HALSRC) \ - $(PLATFORMSRC) \ - $(BOARDSRC) \ - $(TESTSRC) \ - $(STREAMSSRC) \ - $(SHELLSRC) \ - usbcfg.c \ - main.c \ - -# C++ sources that can be compiled in ARM or THUMB mode depending on the global -# setting. -CPPSRC = - -# C sources to be compiled in ARM mode regardless of the global setting. -# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler -# option that results in lower performance and larger code size. -ACSRC = - -# C++ sources to be compiled in ARM mode regardless of the global setting. -# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler -# option that results in lower performance and larger code size. -ACPPSRC = - -# C sources to be compiled in THUMB mode regardless of the global setting. -# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler -# option that results in lower performance and larger code size. -TCSRC = - -# C sources to be compiled in THUMB mode regardless of the global setting. -# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler -# option that results in lower performance and larger code size. -TCPPSRC = - -# List ASM source files here -ASMSRC = -ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM) - -INCDIR = $(CHIBIOS)/os/license \ - $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ - $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \ - $(STREAMSINC) $(SHELLINC) - -# -# Project, sources and paths -############################################################################## - -############################################################################## -# Compiler settings -# - -MCU = cortex-m4 - -#TRGT = arm-elf- -TRGT = arm-none-eabi- -CC = $(TRGT)gcc -CPPC = $(TRGT)g++ -# Enable loading with g++ only if you need C++ runtime support. -# NOTE: You can use C++ even without C++ support if you are careful. C++ -# runtime support makes code size explode. -LD = $(TRGT)gcc -#LD = $(TRGT)g++ -CP = $(TRGT)objcopy -AS = $(TRGT)gcc -x assembler-with-cpp -AR = $(TRGT)ar -OD = $(TRGT)objdump -SZ = $(TRGT)size -HEX = $(CP) -O ihex -BIN = $(CP) -O binary -SREC = $(CP) -O srec - -# ARM-specific options here -AOPT = - -# THUMB-specific options here -TOPT = -mthumb -DTHUMB - -# Define C warning options here -CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes - -# Define C++ warning options here -CPPWARN = -Wall -Wextra -Wundef - -# -# Compiler settings -############################################################################## - -############################################################################## -# Start of user section -# - -# List all user C define here, like -D_DEBUG=1 -UDEFS = - -# Define ASM defines here -UADEFS = - -# List all user directories here -UINCDIR = - -# List the user directory to look for the libraries here -ULIBDIR = - -# List all user libraries here -ULIBS = - -# -# End of user defines -############################################################################## - -RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC -include $(RULESPATH)/rules.mk +############################################################################## +# Build global options +# NOTE: Can be overridden externally. +# + +# Compiler options here. +ifeq ($(USE_OPT),) + USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16 +endif + +# C specific options here (added to USE_OPT). +ifeq ($(USE_COPT),) + USE_COPT = +endif + +# C++ specific options here (added to USE_OPT). +ifeq ($(USE_CPPOPT),) + USE_CPPOPT = -fno-rtti +endif + +# Enable this if you want the linker to remove unused code and data +ifeq ($(USE_LINK_GC),) + USE_LINK_GC = yes +endif + +# Linker extra options here. +ifeq ($(USE_LDOPT),) + USE_LDOPT = +endif + +# Enable this if you want link time optimizations (LTO) +ifeq ($(USE_LTO),) + USE_LTO = yes +endif + +# If enabled, this option allows to compile the application in THUMB mode. +ifeq ($(USE_THUMB),) + USE_THUMB = yes +endif + +# Enable this if you want to see the full log while compiling. +ifeq ($(USE_VERBOSE_COMPILE),) + USE_VERBOSE_COMPILE = no +endif + +# If enabled, this option makes the build process faster by not compiling +# modules not used in the current configuration. +ifeq ($(USE_SMART_BUILD),) + USE_SMART_BUILD = yes +endif + +# +# Build global options +############################################################################## + +############################################################################## +# Architecture or project specific options +# + +# Stack size to be allocated to the Cortex-M process stack. This stack is +# the stack used by the main() thread. +ifeq ($(USE_PROCESS_STACKSIZE),) + USE_PROCESS_STACKSIZE = 0x200 +endif + +# Stack size to the allocated to the Cortex-M main/exceptions stack. This +# stack is used for processing interrupts and exceptions. +ifeq ($(USE_EXCEPTIONS_STACKSIZE),) + USE_EXCEPTIONS_STACKSIZE = 0x400 +endif + +# Enables the use of FPU on Cortex-M4 (no, softfp, hard). +ifeq ($(USE_FPU),) + USE_FPU = no +endif + +# +# Architecture or project specific options +############################################################################## + +############################################################################## +# Project, sources and paths +# + +# Define project name here +PROJECT = ch + +# Imported source files and paths +CHIBIOS = ../../../../../ChibiOS-RT +CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib +# Licensing files. +include $(CHIBIOS)/os/license/license.mk +# Startup files. +include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_k20x7.mk +# HAL-OSAL files (optional). +include $(CHIBIOS)/os/hal/hal.mk +include $(CHIBIOS_CONTRIB)/os/hal/ports/KINETIS/K20x/platform.mk +include $(CHIBIOS_CONTRIB)/os/hal/boards/PJRC_TEENSY_3_1/board.mk +include $(CHIBIOS)/os/hal/osal/rt/osal.mk +# RTOS files (optional). +include $(CHIBIOS)/os/rt/rt.mk +include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk +# Other files (optional). +include $(CHIBIOS)/test/lib/test.mk +include $(CHIBIOS)/test/rt/rt_test.mk +include $(CHIBIOS)/test/oslib/oslib_test.mk +include $(CHIBIOS)/os/hal/lib/streams/streams.mk +include $(CHIBIOS)/os/various/shell/shell.mk + +# Define linker script file here +LDSCRIPT= $(STARTUPLD)/MK20DX256.ld + +# C sources that can be compiled in ARM or THUMB mode depending on the global +# setting. +CSRC = $(ALLCSRC) \ + $(TESTSRC) \ + usbcfg.c \ + main.c + +# C++ sources that can be compiled in ARM or THUMB mode depending on the global +# setting. +CPPSRC = $(ALLCPPSRC) + +# C sources to be compiled in ARM mode regardless of the global setting. +# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler +# option that results in lower performance and larger code size. +ACSRC = + +# C++ sources to be compiled in ARM mode regardless of the global setting. +# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler +# option that results in lower performance and larger code size. +ACPPSRC = + +# C sources to be compiled in THUMB mode regardless of the global setting. +# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler +# option that results in lower performance and larger code size. +TCSRC = + +# C sources to be compiled in THUMB mode regardless of the global setting. +# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler +# option that results in lower performance and larger code size. +TCPPSRC = + +# List ASM source files here +ASMSRC = $(ALLASMSRC) +ASMXSRC = $(ALLXASMSRC) + +INCDIR = $(ALLINC) $(TESTINC) \ + $(TESTHAL) + +# +# Project, sources and paths +############################################################################## + +############################################################################## +# Compiler settings +# + +MCU = cortex-m4 + +#TRGT = arm-elf- +TRGT = arm-none-eabi- +CC = $(TRGT)gcc +CPPC = $(TRGT)g++ +# Enable loading with g++ only if you need C++ runtime support. +# NOTE: You can use C++ even without C++ support if you are careful. C++ +# runtime support makes code size explode. +LD = $(TRGT)gcc +#LD = $(TRGT)g++ +CP = $(TRGT)objcopy +AS = $(TRGT)gcc -x assembler-with-cpp +AR = $(TRGT)ar +OD = $(TRGT)objdump +SZ = $(TRGT)size +HEX = $(CP) -O ihex +BIN = $(CP) -O binary +SREC = $(CP) -O srec + +# ARM-specific options here +AOPT = + +# THUMB-specific options here +TOPT = -mthumb -DTHUMB + +# Define C warning options here +CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes + +# Define C++ warning options here +CPPWARN = -Wall -Wextra -Wundef + +# +# Compiler settings +############################################################################## + +############################################################################## +# Start of user section +# + +# List all user C define here, like -D_DEBUG=1 +UDEFS = + +# Define ASM defines here +UADEFS = + +# List all user directories here +UINCDIR = + +# List the user directory to look for the libraries here +ULIBDIR = + +# List all user libraries here +ULIBS = + +# +# End of user defines +############################################################################## + +RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC +include $(RULESPATH)/rules.mk diff --git a/testhal/KINETIS/TEENSY3_x/USB_SERIAL/chconf.h b/testhal/KINETIS/TEENSY3_x/USB_SERIAL/chconf.h index 6dbecb5..1750f63 100644 --- a/testhal/KINETIS/TEENSY3_x/USB_SERIAL/chconf.h +++ b/testhal/KINETIS/TEENSY3_x/USB_SERIAL/chconf.h @@ -1,5 +1,5 @@ /* - ChibiOS - (C) 2015-2016 flabbergast + ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -15,19 +15,21 @@ */ /** - * @file TEENSY3_x/USB_SERIAL/chconf.h - * @brief Configuration file. + * @file templates/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 config * @details Kernel related settings and hooks. * @{ */ -#ifndef _CHCONF_H_ -#define _CHCONF_H_ +#ifndef CHCONF_H +#define CHCONF_H #define _CHIBIOS_RT_CONF_ -#define _CHIBIOS_RT_CONF_VER_5_0_ +#define _CHIBIOS_RT_CONF_VER_5_1_ /*===========================================================================*/ /** @@ -40,14 +42,34 @@ * @brief System time counter resolution. * @note Allowed values are 16 or 32 bits. */ +#if !defined(CH_CFG_ST_RESOLUTION) #define CH_CFG_ST_RESOLUTION 32 +#endif /** * @brief System tick frequency. * @details Frequency of the system timer that drives the system ticks. This * setting also defines the system tick time unit. */ +#if !defined(CH_CFG_ST_FREQUENCY) #define CH_CFG_ST_FREQUENCY 1000 +#endif + +/** + * @brief Time intervals data size. + * @note Allowed values are 16, 32 or 64 bits. + */ +#if !defined(CH_CFG_INTERVALS_SIZE) +#define CH_CFG_INTERVALS_SIZE 32 +#endif + +/** + * @brief Time types data size. + * @note Allowed values are 16 or 32 bits. + */ +#if !defined(CH_CFG_TIME_TYPES_SIZE) +#define CH_CFG_TIME_TYPES_SIZE 32 +#endif /** * @brief Time delta constant for the tick-less mode. @@ -57,7 +79,9 @@ * The value one is not valid, timeouts are rounded up to * this value. */ +#if !defined(CH_CFG_ST_TIMEDELTA) #define CH_CFG_ST_TIMEDELTA 0 +#endif /** @} */ @@ -80,7 +104,9 @@ * @note The round robin preemption is not supported in tickless mode and * must be set to zero in that case. */ -#define CH_CFG_TIME_QUANTUM 20 +#if !defined(CH_CFG_TIME_QUANTUM) +#define CH_CFG_TIME_QUANTUM 2 +#endif /** * @brief Managed RAM size. @@ -93,15 +119,20 @@ * provide the @p __heap_base__ and @p __heap_end__ symbols. * @note Requires @p CH_CFG_USE_MEMCORE. */ +#if !defined(CH_CFG_MEMCORE_SIZE) #define CH_CFG_MEMCORE_SIZE 0 +#endif /** * @brief Idle thread automatic spawn suppression. * @details When this option is activated the function @p chSysInit() * does not spawn the idle thread. The application @p main() * function becomes the idle thread and must implement an - * infinite loop. */ + * infinite loop. + */ +#if !defined(CH_CFG_NO_IDLE_THREAD) #define CH_CFG_NO_IDLE_THREAD FALSE +#endif /** @} */ @@ -120,7 +151,9 @@ * @note This is not related to the compiler optimization options. * @note The default is @p TRUE. */ +#if !defined(CH_CFG_OPTIMIZE_SPEED) #define CH_CFG_OPTIMIZE_SPEED TRUE +#endif /** @} */ @@ -138,7 +171,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_TM) #define CH_CFG_USE_TM FALSE +#endif /** * @brief Threads registry APIs. @@ -146,7 +181,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_REGISTRY) #define CH_CFG_USE_REGISTRY TRUE +#endif /** * @brief Threads synchronization APIs. @@ -155,7 +192,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_WAITEXIT) #define CH_CFG_USE_WAITEXIT TRUE +#endif /** * @brief Semaphores APIs. @@ -163,7 +202,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_SEMAPHORES) #define CH_CFG_USE_SEMAPHORES TRUE +#endif /** * @brief Semaphores queuing mode. @@ -174,7 +215,9 @@ * requirements. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ +#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY) #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE +#endif /** * @brief Mutexes APIs. @@ -182,7 +225,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MUTEXES) #define CH_CFG_USE_MUTEXES TRUE +#endif /** * @brief Enables recursive behavior on mutexes. @@ -192,7 +237,9 @@ * @note The default is @p FALSE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE) #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE +#endif /** * @brief Conditional Variables APIs. @@ -202,7 +249,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_CONDVARS) #define CH_CFG_USE_CONDVARS TRUE +#endif /** * @brief Conditional Variables APIs with timeout. @@ -212,7 +261,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_CONDVARS. */ +#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT) #define CH_CFG_USE_CONDVARS_TIMEOUT TRUE +#endif /** * @brief Events Flags APIs. @@ -220,7 +271,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_EVENTS) #define CH_CFG_USE_EVENTS TRUE +#endif /** * @brief Events Flags APIs with timeout. @@ -230,7 +283,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_EVENTS. */ +#if !defined(CH_CFG_USE_EVENTS_TIMEOUT) #define CH_CFG_USE_EVENTS_TIMEOUT TRUE +#endif /** * @brief Synchronous Messages APIs. @@ -239,7 +294,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MESSAGES) #define CH_CFG_USE_MESSAGES TRUE +#endif /** * @brief Synchronous Messages queuing mode. @@ -250,7 +307,9 @@ * requirements. * @note Requires @p CH_CFG_USE_MESSAGES. */ +#if !defined(CH_CFG_USE_MESSAGES_PRIORITY) #define CH_CFG_USE_MESSAGES_PRIORITY FALSE +#endif /** * @brief Mailboxes APIs. @@ -260,7 +319,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ +#if !defined(CH_CFG_USE_MAILBOXES) #define CH_CFG_USE_MAILBOXES TRUE +#endif /** * @brief Core Memory Manager APIs. @@ -269,7 +330,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMCORE) #define CH_CFG_USE_MEMCORE TRUE +#endif /** * @brief Heap Allocator APIs. @@ -281,7 +344,9 @@ * @p CH_CFG_USE_SEMAPHORES. * @note Mutexes are recommended. */ +#if !defined(CH_CFG_USE_HEAP) #define CH_CFG_USE_HEAP TRUE +#endif /** * @brief Memory Pools Allocator APIs. @@ -290,7 +355,20 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMPOOLS) #define CH_CFG_USE_MEMPOOLS TRUE +#endif + +/** + * @brief Objects FIFOs APIs. + * @details If enabled then the objects FIFOs APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#if !defined(CH_CFG_USE_OBJ_FIFOS) +#define CH_CFG_USE_OBJ_FIFOS TRUE +#endif /** * @brief Dynamic Threads APIs. @@ -301,7 +379,73 @@ * @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. */ +#if !defined(CH_CFG_USE_DYNAMIC) #define CH_CFG_USE_DYNAMIC TRUE +#endif + +/** @} */ + +/*===========================================================================*/ +/** + * @name Objects factory options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Objects Factory APIs. + * @details If enabled then the objects factory APIs are included in the + * kernel. + * + * @note The default is @p FALSE. + */ +#if !defined(CH_CFG_USE_FACTORY) +#define CH_CFG_USE_FACTORY TRUE +#endif + +/** + * @brief Maximum length for object names. + * @details If the specified length is zero then the name is stored by + * pointer but this could have unintended side effects. + */ +#if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH) +#define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8 +#endif + +/** + * @brief Enables the registry of generic objects. + */ +#if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY) +#define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE +#endif + +/** + * @brief Enables factory for generic buffers. + */ +#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS) +#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE +#endif + +/** + * @brief Enables factory for semaphores. + */ +#if !defined(CH_CFG_FACTORY_SEMAPHORES) +#define CH_CFG_FACTORY_SEMAPHORES TRUE +#endif + +/** + * @brief Enables factory for mailboxes. + */ +#if !defined(CH_CFG_FACTORY_MAILBOXES) +#define CH_CFG_FACTORY_MAILBOXES TRUE +#endif + +/** + * @brief Enables factory for objects FIFOs. + */ +#if !defined(CH_CFG_FACTORY_OBJ_FIFOS) +#define CH_CFG_FACTORY_OBJ_FIFOS TRUE +#endif /** @} */ @@ -317,7 +461,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_STATISTICS) #define CH_DBG_STATISTICS FALSE +#endif /** * @brief Debug option, system state check. @@ -326,7 +472,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_SYSTEM_STATE_CHECK FALSE +#if !defined(CH_DBG_SYSTEM_STATE_CHECK) +#define CH_DBG_SYSTEM_STATE_CHECK TRUE +#endif /** * @brief Debug option, parameters checks. @@ -335,7 +483,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_ENABLE_CHECKS FALSE +#if !defined(CH_DBG_ENABLE_CHECKS) +#define CH_DBG_ENABLE_CHECKS TRUE +#endif /** * @brief Debug option, consistency checks. @@ -345,16 +495,28 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_ENABLE_ASSERTS FALSE +#if !defined(CH_DBG_ENABLE_ASSERTS) +#define CH_DBG_ENABLE_ASSERTS TRUE +#endif /** * @brief Debug option, trace buffer. - * @details If enabled then the context switch circular trace buffer is - * activated. + * @details If enabled then the trace buffer is activated. * - * @note The default is @p FALSE. + * @note The default is @p CH_DBG_TRACE_MASK_DISABLED. + */ +#if !defined(CH_DBG_TRACE_MASK) +#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL +#endif + +/** + * @brief Trace buffer entries. + * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is + * different from @p CH_DBG_TRACE_MASK_DISABLED. */ -#define CH_DBG_ENABLE_TRACE FALSE +#if !defined(CH_DBG_TRACE_BUFFER_SIZE) +#define CH_DBG_TRACE_BUFFER_SIZE 128 +#endif /** * @brief Debug option, stack checks. @@ -366,7 +528,9 @@ * @note The default failure mode is to halt the system with the global * @p panic_msg variable set to @p NULL. */ -#define CH_DBG_ENABLE_STACK_CHECK FALSE +#if !defined(CH_DBG_ENABLE_STACK_CHECK) +#define CH_DBG_ENABLE_STACK_CHECK TRUE +#endif /** * @brief Debug option, stacks initialization. @@ -376,7 +540,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_FILL_THREADS FALSE +#if !defined(CH_DBG_FILL_THREADS) +#define CH_DBG_FILL_THREADS TRUE +#endif /** * @brief Debug option, threads profiling. @@ -387,7 +553,9 @@ * @note This debug option is not currently compatible with the * tickless mode. */ +#if !defined(CH_DBG_THREADS_PROFILING) #define CH_DBG_THREADS_PROFILING FALSE +#endif /** @} */ @@ -398,6 +566,22 @@ */ /*===========================================================================*/ +/** + * @brief System structure extension. + * @details User fields added to the end of the @p ch_system_t structure. + */ +#define CH_CFG_SYSTEM_EXTRA_FIELDS \ + /* Add threads custom fields here.*/ + +/** + * @brief System initialization hook. + * @details User initialization code added to the @p chSysInit() function + * just before interrupts are enabled globally. + */ +#define CH_CFG_SYSTEM_INIT_HOOK() { \ + /* Add threads initialization code here.*/ \ +} + /** * @brief Threads descriptor structure extension. * @details User fields added to the end of the @p thread_t structure. @@ -407,9 +591,9 @@ /** * @brief Threads initialization hook. - * @details User initialization code added to the @p chThdInit() API. + * @details User initialization code added to the @p _thread_init() function. * - * @note It is invoked from within @p chThdInit() and implicitly from all + * @note It is invoked from within @p _thread_init() and implicitly from all * the threads creation APIs. */ #define CH_CFG_THREAD_INIT_HOOK(tp) { \ @@ -419,10 +603,6 @@ /** * @brief Threads finalization hook. * @details User finalization code added to the @p chThdExit() API. - * - * @note It is inserted into lock zone. - * @note It is also invoked when the threads simply return in order to - * terminate. */ #define CH_CFG_THREAD_EXIT_HOOK(tp) { \ /* Add threads finalization code here.*/ \ @@ -433,7 +613,7 @@ * @details This hook is invoked just before switching between threads. */ #define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \ - /* System halt code here.*/ \ + /* Context switch code here.*/ \ } /** @@ -456,7 +636,8 @@ * should be invoked from here. * @note This macro can be used to activate a power saving mode. */ -#define CH_CFG_IDLE_ENTER_HOOK() { \ +#define CH_CFG_IDLE_ENTER_HOOK() { \ + /* Idle-enter code here.*/ \ } /** @@ -465,7 +646,8 @@ * should be invoked from here. * @note This macro can be used to deactivate a power saving mode. */ -#define CH_CFG_IDLE_LEAVE_HOOK() { \ +#define CH_CFG_IDLE_LEAVE_HOOK() { \ + /* Idle-leave code here.*/ \ } /** @@ -509,6 +691,6 @@ /* Port-specific settings (override port settings defaulted in chcore.h). */ /*===========================================================================*/ -#endif /* _CHCONF_H_ */ +#endif /* CHCONF_H */ /** @} */ diff --git a/testhal/KINETIS/TEENSY3_x/USB_SERIAL/halconf_community.h b/testhal/KINETIS/TEENSY3_x/USB_SERIAL/halconf_community.h new file mode 100644 index 0000000..43fdbf8 --- /dev/null +++ b/testhal/KINETIS/TEENSY3_x/USB_SERIAL/halconf_community.h @@ -0,0 +1,173 @@ +/* + ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#ifndef HALCONF_COMMUNITY_H +#define HALCONF_COMMUNITY_H + +/** + * @brief Enables the community overlay. + */ +#if !defined(HAL_USE_COMMUNITY) || defined(__DOXYGEN__) +#define HAL_USE_COMMUNITY TRUE +#endif + +/** + * @brief Enables the FSMC subsystem. + */ +#if !defined(HAL_USE_FSMC) || defined(__DOXYGEN__) +#define HAL_USE_FSMC FALSE +#endif + +/** + * @brief Enables the NAND subsystem. + */ +#if !defined(HAL_USE_NAND) || defined(__DOXYGEN__) +#define HAL_USE_NAND FALSE +#endif + +/** + * @brief Enables the 1-wire subsystem. + */ +#if !defined(HAL_USE_ONEWIRE) || defined(__DOXYGEN__) +#define HAL_USE_ONEWIRE FALSE +#endif + +/** + * @brief Enables the EICU subsystem. + */ +#if !defined(HAL_USE_EICU) || defined(__DOXYGEN__) +#define HAL_USE_EICU FALSE +#endif + +/** + * @brief Enables the CRC subsystem. + */ +#if !defined(HAL_USE_CRC) || defined(__DOXYGEN__) +#define HAL_USE_CRC FALSE +#endif + +/** + * @brief Enables the RNG subsystem. + */ +#if !defined(HAL_USE_RNG) || defined(__DOXYGEN__) +#define HAL_USE_RNG FALSE +#endif + +/** + * @brief Enables the EEPROM subsystem. + */ +#if !defined(HAL_USE_EEPROM) || defined(__DOXYGEN__) +#define HAL_USE_EEPROM FALSE +#endif + +/** + * @brief Enables the TIMCAP subsystem. + */ +#if !defined(HAL_USE_TIMCAP) || defined(__DOXYGEN__) +#define HAL_USE_TIMCAP FALSE +#endif + +/** + * @brief Enables the TIMCAP subsystem. + */ +#if !defined(HAL_USE_COMP) || defined(__DOXYGEN__) +#define HAL_USE_COMP FALSE +#endif + +/** + * @brief Enables the QEI subsystem. + */ +#if !defined(HAL_USE_QEI) || defined(__DOXYGEN__) +#define HAL_USE_QEI FALSE +#endif + +/** + * @brief Enables the USBH subsystem. + */ +#if !defined(HAL_USE_USBH) || defined(__DOXYGEN__) +#define HAL_USE_USBH FALSE +#endif + +/** + * @brief Enables the USB_MSD subsystem. + */ +#if !defined(HAL_USE_USB_MSD) || defined(__DOXYGEN__) +#define HAL_USE_USB_MSD FALSE +#endif + +/*===========================================================================*/ +/* FSMCNAND driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables the @p nandAcquireBus() and @p nanReleaseBus() APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(NAND_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define NAND_USE_MUTUAL_EXCLUSION TRUE +#endif + +/*===========================================================================*/ +/* 1-wire driver related settings. */ +/*===========================================================================*/ +/** + * @brief Enables strong pull up feature. + * @note Disabling this option saves both code and data space. + */ +#define ONEWIRE_USE_STRONG_PULLUP FALSE + +/** + * @brief Enables search ROM feature. + * @note Disabling this option saves both code and data space. + */ +#define ONEWIRE_USE_SEARCH_ROM TRUE + +/*===========================================================================*/ +/* QEI driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables discard of overlow + */ +#if !defined(QEI_USE_OVERFLOW_DISCARD) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_DISCARD FALSE +#endif + +/** + * @brief Enables min max of overlow + */ +#if !defined(QEI_USE_OVERFLOW_MINMAX) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_MINMAX FALSE +#endif + +/*===========================================================================*/ +/* EEProm driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables 24xx series I2C eeprom device driver. + * @note Disabling this option saves both code and data space. + */ +#define EEPROM_USE_EE24XX FALSE + /** + * @brief Enables 25xx series SPI eeprom device driver. + * @note Disabling this option saves both code and data space. + */ +#define EEPROM_USE_EE25XX FALSE + +#endif /* HALCONF_COMMUNITY_H */ + +/** @} */ diff --git a/testhal/KINETIS/TEENSY_LC/BOOTLOADER/Makefile b/testhal/KINETIS/TEENSY_LC/BOOTLOADER/Makefile index f868337..71438e9 100644 --- a/testhal/KINETIS/TEENSY_LC/BOOTLOADER/Makefile +++ b/testhal/KINETIS/TEENSY_LC/BOOTLOADER/Makefile @@ -5,7 +5,7 @@ # Compiler options here. ifeq ($(USE_OPT),) - USE_OPT = -O0 -ggdb -fomit-frame-pointer -falign-functions=16 + USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16 endif # C specific options here (added to USE_OPT). @@ -30,7 +30,7 @@ endif # Enable this if you want link time optimizations (LTO) ifeq ($(USE_LTO),) - USE_LTO = no + USE_LTO = yes endif # If enabled, this option allows to compile the application in THUMB mode. @@ -69,6 +69,11 @@ ifeq ($(USE_EXCEPTIONS_STACKSIZE),) USE_EXCEPTIONS_STACKSIZE = 0x400 endif +# Enables the use of FPU on Cortex-M4 (no, softfp, hard). +ifeq ($(USE_FPU),) + USE_FPU = no +endif + # # Architecture or project specific options ############################################################################## @@ -83,6 +88,8 @@ PROJECT = ch # Imported source files and paths CHIBIOS = ../../../../../ChibiOS-RT CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib +# Licensing files. +include $(CHIBIOS)/os/license/license.mk # Startup files. include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_kl2x.mk # HAL-OSAL files (optional). @@ -100,18 +107,13 @@ LDSCRIPT= $(STARTUPLD)/MKL26Z64.ld # C sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CSRC = $(STARTUPSRC) \ - $(KERNSRC) \ - $(PORTSRC) \ - $(OSALSRC) \ - $(HALSRC) \ - $(PLATFORMSRC) \ - $(BOARDSRC) \ +CSRC = $(ALLCSRC) \ + $(TESTSRC) \ main.c # C++ sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CPPSRC = +CPPSRC = $(ALLCPPSRC) # C sources to be compiled in ARM mode regardless of the global setting. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler @@ -134,13 +136,11 @@ TCSRC = TCPPSRC = # List ASM source files here -ASMSRC = -ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM) +ASMSRC = $(ALLASMSRC) +ASMXSRC = $(ALLXASMSRC) -INCDIR = $(CHIBIOS)/os/license \ - $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ - $(HALINC) $(PLATFORMINC) $(BOARDINC) \ - $(CHIBIOS)/os/various +INCDIR = $(ALLINC) $(TESTINC) \ + $(TESTHAL) # # Project, sources and paths diff --git a/testhal/KINETIS/TEENSY_LC/BOOTLOADER/chconf.h b/testhal/KINETIS/TEENSY_LC/BOOTLOADER/chconf.h index f0c238c..1750f63 100644 --- a/testhal/KINETIS/TEENSY_LC/BOOTLOADER/chconf.h +++ b/testhal/KINETIS/TEENSY_LC/BOOTLOADER/chconf.h @@ -1,5 +1,5 @@ /* - ChibiOS - (C) 2015-2016 flabbergast + ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -15,19 +15,21 @@ */ /** - * @file TEENSY_LC/BOOTLOADER/chconf.h - * @brief Configuration file. + * @file templates/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 config * @details Kernel related settings and hooks. * @{ */ -#ifndef _CHCONF_H_ -#define _CHCONF_H_ +#ifndef CHCONF_H +#define CHCONF_H #define _CHIBIOS_RT_CONF_ -#define _CHIBIOS_RT_CONF_VER_5_0_ +#define _CHIBIOS_RT_CONF_VER_5_1_ /*===========================================================================*/ /** @@ -40,14 +42,34 @@ * @brief System time counter resolution. * @note Allowed values are 16 or 32 bits. */ +#if !defined(CH_CFG_ST_RESOLUTION) #define CH_CFG_ST_RESOLUTION 32 +#endif /** * @brief System tick frequency. * @details Frequency of the system timer that drives the system ticks. This * setting also defines the system tick time unit. */ +#if !defined(CH_CFG_ST_FREQUENCY) #define CH_CFG_ST_FREQUENCY 1000 +#endif + +/** + * @brief Time intervals data size. + * @note Allowed values are 16, 32 or 64 bits. + */ +#if !defined(CH_CFG_INTERVALS_SIZE) +#define CH_CFG_INTERVALS_SIZE 32 +#endif + +/** + * @brief Time types data size. + * @note Allowed values are 16 or 32 bits. + */ +#if !defined(CH_CFG_TIME_TYPES_SIZE) +#define CH_CFG_TIME_TYPES_SIZE 32 +#endif /** * @brief Time delta constant for the tick-less mode. @@ -57,7 +79,9 @@ * The value one is not valid, timeouts are rounded up to * this value. */ +#if !defined(CH_CFG_ST_TIMEDELTA) #define CH_CFG_ST_TIMEDELTA 0 +#endif /** @} */ @@ -80,7 +104,9 @@ * @note The round robin preemption is not supported in tickless mode and * must be set to zero in that case. */ -#define CH_CFG_TIME_QUANTUM 20 +#if !defined(CH_CFG_TIME_QUANTUM) +#define CH_CFG_TIME_QUANTUM 2 +#endif /** * @brief Managed RAM size. @@ -93,7 +119,9 @@ * provide the @p __heap_base__ and @p __heap_end__ symbols. * @note Requires @p CH_CFG_USE_MEMCORE. */ +#if !defined(CH_CFG_MEMCORE_SIZE) #define CH_CFG_MEMCORE_SIZE 0 +#endif /** * @brief Idle thread automatic spawn suppression. @@ -102,7 +130,9 @@ * function becomes the idle thread and must implement an * infinite loop. */ +#if !defined(CH_CFG_NO_IDLE_THREAD) #define CH_CFG_NO_IDLE_THREAD FALSE +#endif /** @} */ @@ -121,7 +151,9 @@ * @note This is not related to the compiler optimization options. * @note The default is @p TRUE. */ +#if !defined(CH_CFG_OPTIMIZE_SPEED) #define CH_CFG_OPTIMIZE_SPEED TRUE +#endif /** @} */ @@ -139,7 +171,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_TM) #define CH_CFG_USE_TM FALSE +#endif /** * @brief Threads registry APIs. @@ -147,7 +181,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_REGISTRY) #define CH_CFG_USE_REGISTRY TRUE +#endif /** * @brief Threads synchronization APIs. @@ -156,7 +192,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_WAITEXIT) #define CH_CFG_USE_WAITEXIT TRUE +#endif /** * @brief Semaphores APIs. @@ -164,7 +202,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_SEMAPHORES) #define CH_CFG_USE_SEMAPHORES TRUE +#endif /** * @brief Semaphores queuing mode. @@ -175,7 +215,9 @@ * requirements. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ -#define CH_CFG_USE_SEMAPHORES_PRIORITY TRUE +#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY) +#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE +#endif /** * @brief Mutexes APIs. @@ -183,7 +225,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MUTEXES) #define CH_CFG_USE_MUTEXES TRUE +#endif /** * @brief Enables recursive behavior on mutexes. @@ -193,7 +237,9 @@ * @note The default is @p FALSE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE) #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE +#endif /** * @brief Conditional Variables APIs. @@ -203,7 +249,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_CONDVARS) #define CH_CFG_USE_CONDVARS TRUE +#endif /** * @brief Conditional Variables APIs with timeout. @@ -213,7 +261,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_CONDVARS. */ +#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT) #define CH_CFG_USE_CONDVARS_TIMEOUT TRUE +#endif /** * @brief Events Flags APIs. @@ -221,7 +271,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_EVENTS) #define CH_CFG_USE_EVENTS TRUE +#endif /** * @brief Events Flags APIs with timeout. @@ -231,7 +283,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_EVENTS. */ +#if !defined(CH_CFG_USE_EVENTS_TIMEOUT) #define CH_CFG_USE_EVENTS_TIMEOUT TRUE +#endif /** * @brief Synchronous Messages APIs. @@ -240,7 +294,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MESSAGES) #define CH_CFG_USE_MESSAGES TRUE +#endif /** * @brief Synchronous Messages queuing mode. @@ -251,7 +307,9 @@ * requirements. * @note Requires @p CH_CFG_USE_MESSAGES. */ +#if !defined(CH_CFG_USE_MESSAGES_PRIORITY) #define CH_CFG_USE_MESSAGES_PRIORITY FALSE +#endif /** * @brief Mailboxes APIs. @@ -261,7 +319,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ +#if !defined(CH_CFG_USE_MAILBOXES) #define CH_CFG_USE_MAILBOXES TRUE +#endif /** * @brief Core Memory Manager APIs. @@ -270,7 +330,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMCORE) #define CH_CFG_USE_MEMCORE TRUE +#endif /** * @brief Heap Allocator APIs. @@ -282,7 +344,9 @@ * @p CH_CFG_USE_SEMAPHORES. * @note Mutexes are recommended. */ +#if !defined(CH_CFG_USE_HEAP) #define CH_CFG_USE_HEAP TRUE +#endif /** * @brief Memory Pools Allocator APIs. @@ -291,7 +355,20 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMPOOLS) #define CH_CFG_USE_MEMPOOLS TRUE +#endif + +/** + * @brief Objects FIFOs APIs. + * @details If enabled then the objects FIFOs APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#if !defined(CH_CFG_USE_OBJ_FIFOS) +#define CH_CFG_USE_OBJ_FIFOS TRUE +#endif /** * @brief Dynamic Threads APIs. @@ -302,7 +379,73 @@ * @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. */ +#if !defined(CH_CFG_USE_DYNAMIC) #define CH_CFG_USE_DYNAMIC TRUE +#endif + +/** @} */ + +/*===========================================================================*/ +/** + * @name Objects factory options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Objects Factory APIs. + * @details If enabled then the objects factory APIs are included in the + * kernel. + * + * @note The default is @p FALSE. + */ +#if !defined(CH_CFG_USE_FACTORY) +#define CH_CFG_USE_FACTORY TRUE +#endif + +/** + * @brief Maximum length for object names. + * @details If the specified length is zero then the name is stored by + * pointer but this could have unintended side effects. + */ +#if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH) +#define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8 +#endif + +/** + * @brief Enables the registry of generic objects. + */ +#if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY) +#define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE +#endif + +/** + * @brief Enables factory for generic buffers. + */ +#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS) +#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE +#endif + +/** + * @brief Enables factory for semaphores. + */ +#if !defined(CH_CFG_FACTORY_SEMAPHORES) +#define CH_CFG_FACTORY_SEMAPHORES TRUE +#endif + +/** + * @brief Enables factory for mailboxes. + */ +#if !defined(CH_CFG_FACTORY_MAILBOXES) +#define CH_CFG_FACTORY_MAILBOXES TRUE +#endif + +/** + * @brief Enables factory for objects FIFOs. + */ +#if !defined(CH_CFG_FACTORY_OBJ_FIFOS) +#define CH_CFG_FACTORY_OBJ_FIFOS TRUE +#endif /** @} */ @@ -318,7 +461,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_STATISTICS) #define CH_DBG_STATISTICS FALSE +#endif /** * @brief Debug option, system state check. @@ -327,7 +472,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_SYSTEM_STATE_CHECK) #define CH_DBG_SYSTEM_STATE_CHECK TRUE +#endif /** * @brief Debug option, parameters checks. @@ -336,7 +483,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_ENABLE_CHECKS) #define CH_DBG_ENABLE_CHECKS TRUE +#endif /** * @brief Debug option, consistency checks. @@ -346,16 +495,28 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_ENABLE_ASSERTS) #define CH_DBG_ENABLE_ASSERTS TRUE +#endif /** * @brief Debug option, trace buffer. - * @details If enabled then the context switch circular trace buffer is - * activated. + * @details If enabled then the trace buffer is activated. * - * @note The default is @p FALSE. + * @note The default is @p CH_DBG_TRACE_MASK_DISABLED. + */ +#if !defined(CH_DBG_TRACE_MASK) +#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL +#endif + +/** + * @brief Trace buffer entries. + * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is + * different from @p CH_DBG_TRACE_MASK_DISABLED. */ -#define CH_DBG_ENABLE_TRACE TRUE +#if !defined(CH_DBG_TRACE_BUFFER_SIZE) +#define CH_DBG_TRACE_BUFFER_SIZE 128 +#endif /** * @brief Debug option, stack checks. @@ -367,7 +528,9 @@ * @note The default failure mode is to halt the system with the global * @p panic_msg variable set to @p NULL. */ +#if !defined(CH_DBG_ENABLE_STACK_CHECK) #define CH_DBG_ENABLE_STACK_CHECK TRUE +#endif /** * @brief Debug option, stacks initialization. @@ -377,7 +540,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_FILL_THREADS) #define CH_DBG_FILL_THREADS TRUE +#endif /** * @brief Debug option, threads profiling. @@ -388,7 +553,9 @@ * @note This debug option is not currently compatible with the * tickless mode. */ +#if !defined(CH_DBG_THREADS_PROFILING) #define CH_DBG_THREADS_PROFILING FALSE +#endif /** @} */ @@ -399,6 +566,22 @@ */ /*===========================================================================*/ +/** + * @brief System structure extension. + * @details User fields added to the end of the @p ch_system_t structure. + */ +#define CH_CFG_SYSTEM_EXTRA_FIELDS \ + /* Add threads custom fields here.*/ + +/** + * @brief System initialization hook. + * @details User initialization code added to the @p chSysInit() function + * just before interrupts are enabled globally. + */ +#define CH_CFG_SYSTEM_INIT_HOOK() { \ + /* Add threads initialization code here.*/ \ +} + /** * @brief Threads descriptor structure extension. * @details User fields added to the end of the @p thread_t structure. @@ -408,9 +591,9 @@ /** * @brief Threads initialization hook. - * @details User initialization code added to the @p chThdInit() API. + * @details User initialization code added to the @p _thread_init() function. * - * @note It is invoked from within @p chThdInit() and implicitly from all + * @note It is invoked from within @p _thread_init() and implicitly from all * the threads creation APIs. */ #define CH_CFG_THREAD_INIT_HOOK(tp) { \ @@ -420,10 +603,6 @@ /** * @brief Threads finalization hook. * @details User finalization code added to the @p chThdExit() API. - * - * @note It is inserted into lock zone. - * @note It is also invoked when the threads simply return in order to - * terminate. */ #define CH_CFG_THREAD_EXIT_HOOK(tp) { \ /* Add threads finalization code here.*/ \ @@ -458,6 +637,7 @@ * @note This macro can be used to activate a power saving mode. */ #define CH_CFG_IDLE_ENTER_HOOK() { \ + /* Idle-enter code here.*/ \ } /** @@ -467,6 +647,7 @@ * @note This macro can be used to deactivate a power saving mode. */ #define CH_CFG_IDLE_LEAVE_HOOK() { \ + /* Idle-leave code here.*/ \ } /** @@ -510,6 +691,6 @@ /* Port-specific settings (override port settings defaulted in chcore.h). */ /*===========================================================================*/ -#endif /* _CHCONF_H_ */ +#endif /* CHCONF_H */ /** @} */ diff --git a/testhal/KINETIS/TEENSY_LC/BOOTLOADER/halconf_community.h b/testhal/KINETIS/TEENSY_LC/BOOTLOADER/halconf_community.h new file mode 100644 index 0000000..43fdbf8 --- /dev/null +++ b/testhal/KINETIS/TEENSY_LC/BOOTLOADER/halconf_community.h @@ -0,0 +1,173 @@ +/* + ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#ifndef HALCONF_COMMUNITY_H +#define HALCONF_COMMUNITY_H + +/** + * @brief Enables the community overlay. + */ +#if !defined(HAL_USE_COMMUNITY) || defined(__DOXYGEN__) +#define HAL_USE_COMMUNITY TRUE +#endif + +/** + * @brief Enables the FSMC subsystem. + */ +#if !defined(HAL_USE_FSMC) || defined(__DOXYGEN__) +#define HAL_USE_FSMC FALSE +#endif + +/** + * @brief Enables the NAND subsystem. + */ +#if !defined(HAL_USE_NAND) || defined(__DOXYGEN__) +#define HAL_USE_NAND FALSE +#endif + +/** + * @brief Enables the 1-wire subsystem. + */ +#if !defined(HAL_USE_ONEWIRE) || defined(__DOXYGEN__) +#define HAL_USE_ONEWIRE FALSE +#endif + +/** + * @brief Enables the EICU subsystem. + */ +#if !defined(HAL_USE_EICU) || defined(__DOXYGEN__) +#define HAL_USE_EICU FALSE +#endif + +/** + * @brief Enables the CRC subsystem. + */ +#if !defined(HAL_USE_CRC) || defined(__DOXYGEN__) +#define HAL_USE_CRC FALSE +#endif + +/** + * @brief Enables the RNG subsystem. + */ +#if !defined(HAL_USE_RNG) || defined(__DOXYGEN__) +#define HAL_USE_RNG FALSE +#endif + +/** + * @brief Enables the EEPROM subsystem. + */ +#if !defined(HAL_USE_EEPROM) || defined(__DOXYGEN__) +#define HAL_USE_EEPROM FALSE +#endif + +/** + * @brief Enables the TIMCAP subsystem. + */ +#if !defined(HAL_USE_TIMCAP) || defined(__DOXYGEN__) +#define HAL_USE_TIMCAP FALSE +#endif + +/** + * @brief Enables the TIMCAP subsystem. + */ +#if !defined(HAL_USE_COMP) || defined(__DOXYGEN__) +#define HAL_USE_COMP FALSE +#endif + +/** + * @brief Enables the QEI subsystem. + */ +#if !defined(HAL_USE_QEI) || defined(__DOXYGEN__) +#define HAL_USE_QEI FALSE +#endif + +/** + * @brief Enables the USBH subsystem. + */ +#if !defined(HAL_USE_USBH) || defined(__DOXYGEN__) +#define HAL_USE_USBH FALSE +#endif + +/** + * @brief Enables the USB_MSD subsystem. + */ +#if !defined(HAL_USE_USB_MSD) || defined(__DOXYGEN__) +#define HAL_USE_USB_MSD FALSE +#endif + +/*===========================================================================*/ +/* FSMCNAND driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables the @p nandAcquireBus() and @p nanReleaseBus() APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(NAND_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define NAND_USE_MUTUAL_EXCLUSION TRUE +#endif + +/*===========================================================================*/ +/* 1-wire driver related settings. */ +/*===========================================================================*/ +/** + * @brief Enables strong pull up feature. + * @note Disabling this option saves both code and data space. + */ +#define ONEWIRE_USE_STRONG_PULLUP FALSE + +/** + * @brief Enables search ROM feature. + * @note Disabling this option saves both code and data space. + */ +#define ONEWIRE_USE_SEARCH_ROM TRUE + +/*===========================================================================*/ +/* QEI driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables discard of overlow + */ +#if !defined(QEI_USE_OVERFLOW_DISCARD) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_DISCARD FALSE +#endif + +/** + * @brief Enables min max of overlow + */ +#if !defined(QEI_USE_OVERFLOW_MINMAX) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_MINMAX FALSE +#endif + +/*===========================================================================*/ +/* EEProm driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables 24xx series I2C eeprom device driver. + * @note Disabling this option saves both code and data space. + */ +#define EEPROM_USE_EE24XX FALSE + /** + * @brief Enables 25xx series SPI eeprom device driver. + * @note Disabling this option saves both code and data space. + */ +#define EEPROM_USE_EE25XX FALSE + +#endif /* HALCONF_COMMUNITY_H */ + +/** @} */ diff --git a/testhal/KINETIS/TEENSY_LC/EEPROM_EMU/Makefile b/testhal/KINETIS/TEENSY_LC/EEPROM_EMU/Makefile index a9534fc..812efc4 100644 --- a/testhal/KINETIS/TEENSY_LC/EEPROM_EMU/Makefile +++ b/testhal/KINETIS/TEENSY_LC/EEPROM_EMU/Makefile @@ -5,7 +5,7 @@ # Compiler options here. ifeq ($(USE_OPT),) - USE_OPT = -O0 -ggdb -fomit-frame-pointer -falign-functions=16 + USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16 endif # C specific options here (added to USE_OPT). @@ -30,7 +30,7 @@ endif # Enable this if you want link time optimizations (LTO) ifeq ($(USE_LTO),) - USE_LTO = no + USE_LTO = yes endif # If enabled, this option allows to compile the application in THUMB mode. @@ -69,6 +69,11 @@ ifeq ($(USE_EXCEPTIONS_STACKSIZE),) USE_EXCEPTIONS_STACKSIZE = 0x400 endif +# Enables the use of FPU on Cortex-M4 (no, softfp, hard). +ifeq ($(USE_FPU),) + USE_FPU = no +endif + # # Architecture or project specific options ############################################################################## @@ -83,6 +88,8 @@ PROJECT = ch # Imported source files and paths CHIBIOS = ../../../../../ChibiOS-RT CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib +# Licensing files. +include $(CHIBIOS)/os/license/license.mk # Startup files. include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_kl2x.mk # HAL-OSAL files (optional). @@ -96,23 +103,18 @@ include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk # Other files (optional). # Define linker script file here -LDSCRIPT = MKL26Z64.ld +LDSCRIPT= MKL26Z64.ld # C sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CSRC = $(STARTUPSRC) \ - $(KERNSRC) \ - $(PORTSRC) \ - $(OSALSRC) \ - $(HALSRC) \ - $(PLATFORMSRC) \ - $(BOARDSRC) \ +CSRC = $(ALLCSRC) \ + $(TESTSRC) \ eeprom.c \ main.c # C++ sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CPPSRC = +CPPSRC = $(ALLCPPSRC) # C sources to be compiled in ARM mode regardless of the global setting. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler @@ -135,13 +137,11 @@ TCSRC = TCPPSRC = # List ASM source files here -ASMSRC = -ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM) +ASMSRC = $(ALLASMSRC) +ASMXSRC = $(ALLXASMSRC) -INCDIR = $(CHIBIOS)/os/license \ - $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ - $(HALINC) $(PLATFORMINC) $(BOARDINC) \ - $(CHIBIOS)/os/various +INCDIR = $(ALLINC) $(TESTINC) \ + $(TESTHAL) # # Project, sources and paths diff --git a/testhal/KINETIS/TEENSY_LC/EEPROM_EMU/chconf.h b/testhal/KINETIS/TEENSY_LC/EEPROM_EMU/chconf.h index 97c98b7..1750f63 100644 --- a/testhal/KINETIS/TEENSY_LC/EEPROM_EMU/chconf.h +++ b/testhal/KINETIS/TEENSY_LC/EEPROM_EMU/chconf.h @@ -1,5 +1,5 @@ /* - ChibiOS - (C) 2015-2016 flabbergast + ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -15,19 +15,21 @@ */ /** - * @file TEENSY_LC/EEPROM_EMU/chconf.h - * @brief Configuration file. + * @file templates/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 config * @details Kernel related settings and hooks. * @{ */ -#ifndef _CHCONF_H_ -#define _CHCONF_H_ +#ifndef CHCONF_H +#define CHCONF_H #define _CHIBIOS_RT_CONF_ -#define _CHIBIOS_RT_CONF_VER_5_0_ +#define _CHIBIOS_RT_CONF_VER_5_1_ /*===========================================================================*/ /** @@ -40,14 +42,34 @@ * @brief System time counter resolution. * @note Allowed values are 16 or 32 bits. */ +#if !defined(CH_CFG_ST_RESOLUTION) #define CH_CFG_ST_RESOLUTION 32 +#endif /** * @brief System tick frequency. * @details Frequency of the system timer that drives the system ticks. This * setting also defines the system tick time unit. */ +#if !defined(CH_CFG_ST_FREQUENCY) #define CH_CFG_ST_FREQUENCY 1000 +#endif + +/** + * @brief Time intervals data size. + * @note Allowed values are 16, 32 or 64 bits. + */ +#if !defined(CH_CFG_INTERVALS_SIZE) +#define CH_CFG_INTERVALS_SIZE 32 +#endif + +/** + * @brief Time types data size. + * @note Allowed values are 16 or 32 bits. + */ +#if !defined(CH_CFG_TIME_TYPES_SIZE) +#define CH_CFG_TIME_TYPES_SIZE 32 +#endif /** * @brief Time delta constant for the tick-less mode. @@ -57,7 +79,9 @@ * The value one is not valid, timeouts are rounded up to * this value. */ +#if !defined(CH_CFG_ST_TIMEDELTA) #define CH_CFG_ST_TIMEDELTA 0 +#endif /** @} */ @@ -80,7 +104,9 @@ * @note The round robin preemption is not supported in tickless mode and * must be set to zero in that case. */ -#define CH_CFG_TIME_QUANTUM 20 +#if !defined(CH_CFG_TIME_QUANTUM) +#define CH_CFG_TIME_QUANTUM 2 +#endif /** * @brief Managed RAM size. @@ -93,7 +119,9 @@ * provide the @p __heap_base__ and @p __heap_end__ symbols. * @note Requires @p CH_CFG_USE_MEMCORE. */ +#if !defined(CH_CFG_MEMCORE_SIZE) #define CH_CFG_MEMCORE_SIZE 0 +#endif /** * @brief Idle thread automatic spawn suppression. @@ -102,7 +130,9 @@ * function becomes the idle thread and must implement an * infinite loop. */ +#if !defined(CH_CFG_NO_IDLE_THREAD) #define CH_CFG_NO_IDLE_THREAD FALSE +#endif /** @} */ @@ -121,7 +151,9 @@ * @note This is not related to the compiler optimization options. * @note The default is @p TRUE. */ +#if !defined(CH_CFG_OPTIMIZE_SPEED) #define CH_CFG_OPTIMIZE_SPEED TRUE +#endif /** @} */ @@ -139,7 +171,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_TM) #define CH_CFG_USE_TM FALSE +#endif /** * @brief Threads registry APIs. @@ -147,7 +181,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_REGISTRY) #define CH_CFG_USE_REGISTRY TRUE +#endif /** * @brief Threads synchronization APIs. @@ -156,7 +192,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_WAITEXIT) #define CH_CFG_USE_WAITEXIT TRUE +#endif /** * @brief Semaphores APIs. @@ -164,7 +202,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_SEMAPHORES) #define CH_CFG_USE_SEMAPHORES TRUE +#endif /** * @brief Semaphores queuing mode. @@ -175,7 +215,9 @@ * requirements. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ -#define CH_CFG_USE_SEMAPHORES_PRIORITY TRUE +#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY) +#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE +#endif /** * @brief Mutexes APIs. @@ -183,7 +225,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MUTEXES) #define CH_CFG_USE_MUTEXES TRUE +#endif /** * @brief Enables recursive behavior on mutexes. @@ -193,7 +237,9 @@ * @note The default is @p FALSE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE) #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE +#endif /** * @brief Conditional Variables APIs. @@ -203,7 +249,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_CONDVARS) #define CH_CFG_USE_CONDVARS TRUE +#endif /** * @brief Conditional Variables APIs with timeout. @@ -213,7 +261,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_CONDVARS. */ +#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT) #define CH_CFG_USE_CONDVARS_TIMEOUT TRUE +#endif /** * @brief Events Flags APIs. @@ -221,7 +271,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_EVENTS) #define CH_CFG_USE_EVENTS TRUE +#endif /** * @brief Events Flags APIs with timeout. @@ -231,7 +283,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_EVENTS. */ +#if !defined(CH_CFG_USE_EVENTS_TIMEOUT) #define CH_CFG_USE_EVENTS_TIMEOUT TRUE +#endif /** * @brief Synchronous Messages APIs. @@ -240,7 +294,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MESSAGES) #define CH_CFG_USE_MESSAGES TRUE +#endif /** * @brief Synchronous Messages queuing mode. @@ -251,7 +307,9 @@ * requirements. * @note Requires @p CH_CFG_USE_MESSAGES. */ +#if !defined(CH_CFG_USE_MESSAGES_PRIORITY) #define CH_CFG_USE_MESSAGES_PRIORITY FALSE +#endif /** * @brief Mailboxes APIs. @@ -261,7 +319,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ +#if !defined(CH_CFG_USE_MAILBOXES) #define CH_CFG_USE_MAILBOXES TRUE +#endif /** * @brief Core Memory Manager APIs. @@ -270,7 +330,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMCORE) #define CH_CFG_USE_MEMCORE TRUE +#endif /** * @brief Heap Allocator APIs. @@ -282,7 +344,9 @@ * @p CH_CFG_USE_SEMAPHORES. * @note Mutexes are recommended. */ +#if !defined(CH_CFG_USE_HEAP) #define CH_CFG_USE_HEAP TRUE +#endif /** * @brief Memory Pools Allocator APIs. @@ -291,7 +355,20 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMPOOLS) #define CH_CFG_USE_MEMPOOLS TRUE +#endif + +/** + * @brief Objects FIFOs APIs. + * @details If enabled then the objects FIFOs APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#if !defined(CH_CFG_USE_OBJ_FIFOS) +#define CH_CFG_USE_OBJ_FIFOS TRUE +#endif /** * @brief Dynamic Threads APIs. @@ -302,7 +379,73 @@ * @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. */ +#if !defined(CH_CFG_USE_DYNAMIC) #define CH_CFG_USE_DYNAMIC TRUE +#endif + +/** @} */ + +/*===========================================================================*/ +/** + * @name Objects factory options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Objects Factory APIs. + * @details If enabled then the objects factory APIs are included in the + * kernel. + * + * @note The default is @p FALSE. + */ +#if !defined(CH_CFG_USE_FACTORY) +#define CH_CFG_USE_FACTORY TRUE +#endif + +/** + * @brief Maximum length for object names. + * @details If the specified length is zero then the name is stored by + * pointer but this could have unintended side effects. + */ +#if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH) +#define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8 +#endif + +/** + * @brief Enables the registry of generic objects. + */ +#if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY) +#define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE +#endif + +/** + * @brief Enables factory for generic buffers. + */ +#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS) +#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE +#endif + +/** + * @brief Enables factory for semaphores. + */ +#if !defined(CH_CFG_FACTORY_SEMAPHORES) +#define CH_CFG_FACTORY_SEMAPHORES TRUE +#endif + +/** + * @brief Enables factory for mailboxes. + */ +#if !defined(CH_CFG_FACTORY_MAILBOXES) +#define CH_CFG_FACTORY_MAILBOXES TRUE +#endif + +/** + * @brief Enables factory for objects FIFOs. + */ +#if !defined(CH_CFG_FACTORY_OBJ_FIFOS) +#define CH_CFG_FACTORY_OBJ_FIFOS TRUE +#endif /** @} */ @@ -318,7 +461,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_STATISTICS) #define CH_DBG_STATISTICS FALSE +#endif /** * @brief Debug option, system state check. @@ -327,7 +472,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_SYSTEM_STATE_CHECK) #define CH_DBG_SYSTEM_STATE_CHECK TRUE +#endif /** * @brief Debug option, parameters checks. @@ -336,7 +483,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_ENABLE_CHECKS) #define CH_DBG_ENABLE_CHECKS TRUE +#endif /** * @brief Debug option, consistency checks. @@ -346,16 +495,28 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_ENABLE_ASSERTS) #define CH_DBG_ENABLE_ASSERTS TRUE +#endif /** * @brief Debug option, trace buffer. - * @details If enabled then the context switch circular trace buffer is - * activated. + * @details If enabled then the trace buffer is activated. * - * @note The default is @p FALSE. + * @note The default is @p CH_DBG_TRACE_MASK_DISABLED. + */ +#if !defined(CH_DBG_TRACE_MASK) +#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL +#endif + +/** + * @brief Trace buffer entries. + * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is + * different from @p CH_DBG_TRACE_MASK_DISABLED. */ -#define CH_DBG_ENABLE_TRACE TRUE +#if !defined(CH_DBG_TRACE_BUFFER_SIZE) +#define CH_DBG_TRACE_BUFFER_SIZE 128 +#endif /** * @brief Debug option, stack checks. @@ -367,7 +528,9 @@ * @note The default failure mode is to halt the system with the global * @p panic_msg variable set to @p NULL. */ +#if !defined(CH_DBG_ENABLE_STACK_CHECK) #define CH_DBG_ENABLE_STACK_CHECK TRUE +#endif /** * @brief Debug option, stacks initialization. @@ -377,7 +540,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_FILL_THREADS) #define CH_DBG_FILL_THREADS TRUE +#endif /** * @brief Debug option, threads profiling. @@ -388,7 +553,9 @@ * @note This debug option is not currently compatible with the * tickless mode. */ +#if !defined(CH_DBG_THREADS_PROFILING) #define CH_DBG_THREADS_PROFILING FALSE +#endif /** @} */ @@ -399,6 +566,22 @@ */ /*===========================================================================*/ +/** + * @brief System structure extension. + * @details User fields added to the end of the @p ch_system_t structure. + */ +#define CH_CFG_SYSTEM_EXTRA_FIELDS \ + /* Add threads custom fields here.*/ + +/** + * @brief System initialization hook. + * @details User initialization code added to the @p chSysInit() function + * just before interrupts are enabled globally. + */ +#define CH_CFG_SYSTEM_INIT_HOOK() { \ + /* Add threads initialization code here.*/ \ +} + /** * @brief Threads descriptor structure extension. * @details User fields added to the end of the @p thread_t structure. @@ -408,9 +591,9 @@ /** * @brief Threads initialization hook. - * @details User initialization code added to the @p chThdInit() API. + * @details User initialization code added to the @p _thread_init() function. * - * @note It is invoked from within @p chThdInit() and implicitly from all + * @note It is invoked from within @p _thread_init() and implicitly from all * the threads creation APIs. */ #define CH_CFG_THREAD_INIT_HOOK(tp) { \ @@ -420,10 +603,6 @@ /** * @brief Threads finalization hook. * @details User finalization code added to the @p chThdExit() API. - * - * @note It is inserted into lock zone. - * @note It is also invoked when the threads simply return in order to - * terminate. */ #define CH_CFG_THREAD_EXIT_HOOK(tp) { \ /* Add threads finalization code here.*/ \ @@ -458,6 +637,7 @@ * @note This macro can be used to activate a power saving mode. */ #define CH_CFG_IDLE_ENTER_HOOK() { \ + /* Idle-enter code here.*/ \ } /** @@ -467,6 +647,7 @@ * @note This macro can be used to deactivate a power saving mode. */ #define CH_CFG_IDLE_LEAVE_HOOK() { \ + /* Idle-leave code here.*/ \ } /** @@ -510,6 +691,6 @@ /* Port-specific settings (override port settings defaulted in chcore.h). */ /*===========================================================================*/ -#endif /* _CHCONF_H_ */ +#endif /* CHCONF_H */ /** @} */ diff --git a/testhal/KINETIS/TEENSY_LC/EEPROM_EMU/halconf_community.h b/testhal/KINETIS/TEENSY_LC/EEPROM_EMU/halconf_community.h new file mode 100644 index 0000000..43fdbf8 --- /dev/null +++ b/testhal/KINETIS/TEENSY_LC/EEPROM_EMU/halconf_community.h @@ -0,0 +1,173 @@ +/* + ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#ifndef HALCONF_COMMUNITY_H +#define HALCONF_COMMUNITY_H + +/** + * @brief Enables the community overlay. + */ +#if !defined(HAL_USE_COMMUNITY) || defined(__DOXYGEN__) +#define HAL_USE_COMMUNITY TRUE +#endif + +/** + * @brief Enables the FSMC subsystem. + */ +#if !defined(HAL_USE_FSMC) || defined(__DOXYGEN__) +#define HAL_USE_FSMC FALSE +#endif + +/** + * @brief Enables the NAND subsystem. + */ +#if !defined(HAL_USE_NAND) || defined(__DOXYGEN__) +#define HAL_USE_NAND FALSE +#endif + +/** + * @brief Enables the 1-wire subsystem. + */ +#if !defined(HAL_USE_ONEWIRE) || defined(__DOXYGEN__) +#define HAL_USE_ONEWIRE FALSE +#endif + +/** + * @brief Enables the EICU subsystem. + */ +#if !defined(HAL_USE_EICU) || defined(__DOXYGEN__) +#define HAL_USE_EICU FALSE +#endif + +/** + * @brief Enables the CRC subsystem. + */ +#if !defined(HAL_USE_CRC) || defined(__DOXYGEN__) +#define HAL_USE_CRC FALSE +#endif + +/** + * @brief Enables the RNG subsystem. + */ +#if !defined(HAL_USE_RNG) || defined(__DOXYGEN__) +#define HAL_USE_RNG FALSE +#endif + +/** + * @brief Enables the EEPROM subsystem. + */ +#if !defined(HAL_USE_EEPROM) || defined(__DOXYGEN__) +#define HAL_USE_EEPROM FALSE +#endif + +/** + * @brief Enables the TIMCAP subsystem. + */ +#if !defined(HAL_USE_TIMCAP) || defined(__DOXYGEN__) +#define HAL_USE_TIMCAP FALSE +#endif + +/** + * @brief Enables the TIMCAP subsystem. + */ +#if !defined(HAL_USE_COMP) || defined(__DOXYGEN__) +#define HAL_USE_COMP FALSE +#endif + +/** + * @brief Enables the QEI subsystem. + */ +#if !defined(HAL_USE_QEI) || defined(__DOXYGEN__) +#define HAL_USE_QEI FALSE +#endif + +/** + * @brief Enables the USBH subsystem. + */ +#if !defined(HAL_USE_USBH) || defined(__DOXYGEN__) +#define HAL_USE_USBH FALSE +#endif + +/** + * @brief Enables the USB_MSD subsystem. + */ +#if !defined(HAL_USE_USB_MSD) || defined(__DOXYGEN__) +#define HAL_USE_USB_MSD FALSE +#endif + +/*===========================================================================*/ +/* FSMCNAND driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables the @p nandAcquireBus() and @p nanReleaseBus() APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(NAND_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define NAND_USE_MUTUAL_EXCLUSION TRUE +#endif + +/*===========================================================================*/ +/* 1-wire driver related settings. */ +/*===========================================================================*/ +/** + * @brief Enables strong pull up feature. + * @note Disabling this option saves both code and data space. + */ +#define ONEWIRE_USE_STRONG_PULLUP FALSE + +/** + * @brief Enables search ROM feature. + * @note Disabling this option saves both code and data space. + */ +#define ONEWIRE_USE_SEARCH_ROM TRUE + +/*===========================================================================*/ +/* QEI driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables discard of overlow + */ +#if !defined(QEI_USE_OVERFLOW_DISCARD) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_DISCARD FALSE +#endif + +/** + * @brief Enables min max of overlow + */ +#if !defined(QEI_USE_OVERFLOW_MINMAX) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_MINMAX FALSE +#endif + +/*===========================================================================*/ +/* EEProm driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables 24xx series I2C eeprom device driver. + * @note Disabling this option saves both code and data space. + */ +#define EEPROM_USE_EE24XX FALSE + /** + * @brief Enables 25xx series SPI eeprom device driver. + * @note Disabling this option saves both code and data space. + */ +#define EEPROM_USE_EE25XX FALSE + +#endif /* HALCONF_COMMUNITY_H */ + +/** @} */ diff --git a/testhal/KINETIS/TEENSY_LC/PWM/Makefile b/testhal/KINETIS/TEENSY_LC/PWM/Makefile index f868337..71438e9 100644 --- a/testhal/KINETIS/TEENSY_LC/PWM/Makefile +++ b/testhal/KINETIS/TEENSY_LC/PWM/Makefile @@ -5,7 +5,7 @@ # Compiler options here. ifeq ($(USE_OPT),) - USE_OPT = -O0 -ggdb -fomit-frame-pointer -falign-functions=16 + USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16 endif # C specific options here (added to USE_OPT). @@ -30,7 +30,7 @@ endif # Enable this if you want link time optimizations (LTO) ifeq ($(USE_LTO),) - USE_LTO = no + USE_LTO = yes endif # If enabled, this option allows to compile the application in THUMB mode. @@ -69,6 +69,11 @@ ifeq ($(USE_EXCEPTIONS_STACKSIZE),) USE_EXCEPTIONS_STACKSIZE = 0x400 endif +# Enables the use of FPU on Cortex-M4 (no, softfp, hard). +ifeq ($(USE_FPU),) + USE_FPU = no +endif + # # Architecture or project specific options ############################################################################## @@ -83,6 +88,8 @@ PROJECT = ch # Imported source files and paths CHIBIOS = ../../../../../ChibiOS-RT CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib +# Licensing files. +include $(CHIBIOS)/os/license/license.mk # Startup files. include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_kl2x.mk # HAL-OSAL files (optional). @@ -100,18 +107,13 @@ LDSCRIPT= $(STARTUPLD)/MKL26Z64.ld # C sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CSRC = $(STARTUPSRC) \ - $(KERNSRC) \ - $(PORTSRC) \ - $(OSALSRC) \ - $(HALSRC) \ - $(PLATFORMSRC) \ - $(BOARDSRC) \ +CSRC = $(ALLCSRC) \ + $(TESTSRC) \ main.c # C++ sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CPPSRC = +CPPSRC = $(ALLCPPSRC) # C sources to be compiled in ARM mode regardless of the global setting. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler @@ -134,13 +136,11 @@ TCSRC = TCPPSRC = # List ASM source files here -ASMSRC = -ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM) +ASMSRC = $(ALLASMSRC) +ASMXSRC = $(ALLXASMSRC) -INCDIR = $(CHIBIOS)/os/license \ - $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ - $(HALINC) $(PLATFORMINC) $(BOARDINC) \ - $(CHIBIOS)/os/various +INCDIR = $(ALLINC) $(TESTINC) \ + $(TESTHAL) # # Project, sources and paths diff --git a/testhal/KINETIS/TEENSY_LC/PWM/chconf.h b/testhal/KINETIS/TEENSY_LC/PWM/chconf.h index d910706..1750f63 100644 --- a/testhal/KINETIS/TEENSY_LC/PWM/chconf.h +++ b/testhal/KINETIS/TEENSY_LC/PWM/chconf.h @@ -1,5 +1,5 @@ /* - ChibiOS - (C) 2015-2016 flabbergast + ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -15,19 +15,21 @@ */ /** - * @file TEENSY_LC/PWM/chconf.h - * @brief Configuration file. + * @file templates/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 config * @details Kernel related settings and hooks. * @{ */ -#ifndef _CHCONF_H_ -#define _CHCONF_H_ +#ifndef CHCONF_H +#define CHCONF_H #define _CHIBIOS_RT_CONF_ -#define _CHIBIOS_RT_CONF_VER_5_0_ +#define _CHIBIOS_RT_CONF_VER_5_1_ /*===========================================================================*/ /** @@ -40,14 +42,34 @@ * @brief System time counter resolution. * @note Allowed values are 16 or 32 bits. */ +#if !defined(CH_CFG_ST_RESOLUTION) #define CH_CFG_ST_RESOLUTION 32 +#endif /** * @brief System tick frequency. * @details Frequency of the system timer that drives the system ticks. This * setting also defines the system tick time unit. */ +#if !defined(CH_CFG_ST_FREQUENCY) #define CH_CFG_ST_FREQUENCY 1000 +#endif + +/** + * @brief Time intervals data size. + * @note Allowed values are 16, 32 or 64 bits. + */ +#if !defined(CH_CFG_INTERVALS_SIZE) +#define CH_CFG_INTERVALS_SIZE 32 +#endif + +/** + * @brief Time types data size. + * @note Allowed values are 16 or 32 bits. + */ +#if !defined(CH_CFG_TIME_TYPES_SIZE) +#define CH_CFG_TIME_TYPES_SIZE 32 +#endif /** * @brief Time delta constant for the tick-less mode. @@ -57,7 +79,9 @@ * The value one is not valid, timeouts are rounded up to * this value. */ +#if !defined(CH_CFG_ST_TIMEDELTA) #define CH_CFG_ST_TIMEDELTA 0 +#endif /** @} */ @@ -80,7 +104,9 @@ * @note The round robin preemption is not supported in tickless mode and * must be set to zero in that case. */ -#define CH_CFG_TIME_QUANTUM 20 +#if !defined(CH_CFG_TIME_QUANTUM) +#define CH_CFG_TIME_QUANTUM 2 +#endif /** * @brief Managed RAM size. @@ -93,7 +119,9 @@ * provide the @p __heap_base__ and @p __heap_end__ symbols. * @note Requires @p CH_CFG_USE_MEMCORE. */ +#if !defined(CH_CFG_MEMCORE_SIZE) #define CH_CFG_MEMCORE_SIZE 0 +#endif /** * @brief Idle thread automatic spawn suppression. @@ -102,7 +130,9 @@ * function becomes the idle thread and must implement an * infinite loop. */ +#if !defined(CH_CFG_NO_IDLE_THREAD) #define CH_CFG_NO_IDLE_THREAD FALSE +#endif /** @} */ @@ -121,7 +151,9 @@ * @note This is not related to the compiler optimization options. * @note The default is @p TRUE. */ +#if !defined(CH_CFG_OPTIMIZE_SPEED) #define CH_CFG_OPTIMIZE_SPEED TRUE +#endif /** @} */ @@ -139,7 +171,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_TM) #define CH_CFG_USE_TM FALSE +#endif /** * @brief Threads registry APIs. @@ -147,7 +181,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_REGISTRY) #define CH_CFG_USE_REGISTRY TRUE +#endif /** * @brief Threads synchronization APIs. @@ -156,7 +192,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_WAITEXIT) #define CH_CFG_USE_WAITEXIT TRUE +#endif /** * @brief Semaphores APIs. @@ -164,7 +202,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_SEMAPHORES) #define CH_CFG_USE_SEMAPHORES TRUE +#endif /** * @brief Semaphores queuing mode. @@ -175,7 +215,9 @@ * requirements. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ +#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY) #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE +#endif /** * @brief Mutexes APIs. @@ -183,7 +225,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MUTEXES) #define CH_CFG_USE_MUTEXES TRUE +#endif /** * @brief Enables recursive behavior on mutexes. @@ -193,7 +237,9 @@ * @note The default is @p FALSE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE) #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE +#endif /** * @brief Conditional Variables APIs. @@ -203,7 +249,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_CONDVARS) #define CH_CFG_USE_CONDVARS TRUE +#endif /** * @brief Conditional Variables APIs with timeout. @@ -213,7 +261,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_CONDVARS. */ +#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT) #define CH_CFG_USE_CONDVARS_TIMEOUT TRUE +#endif /** * @brief Events Flags APIs. @@ -221,7 +271,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_EVENTS) #define CH_CFG_USE_EVENTS TRUE +#endif /** * @brief Events Flags APIs with timeout. @@ -231,7 +283,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_EVENTS. */ +#if !defined(CH_CFG_USE_EVENTS_TIMEOUT) #define CH_CFG_USE_EVENTS_TIMEOUT TRUE +#endif /** * @brief Synchronous Messages APIs. @@ -240,7 +294,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MESSAGES) #define CH_CFG_USE_MESSAGES TRUE +#endif /** * @brief Synchronous Messages queuing mode. @@ -251,7 +307,9 @@ * requirements. * @note Requires @p CH_CFG_USE_MESSAGES. */ +#if !defined(CH_CFG_USE_MESSAGES_PRIORITY) #define CH_CFG_USE_MESSAGES_PRIORITY FALSE +#endif /** * @brief Mailboxes APIs. @@ -261,7 +319,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ +#if !defined(CH_CFG_USE_MAILBOXES) #define CH_CFG_USE_MAILBOXES TRUE +#endif /** * @brief Core Memory Manager APIs. @@ -270,7 +330,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMCORE) #define CH_CFG_USE_MEMCORE TRUE +#endif /** * @brief Heap Allocator APIs. @@ -282,7 +344,9 @@ * @p CH_CFG_USE_SEMAPHORES. * @note Mutexes are recommended. */ +#if !defined(CH_CFG_USE_HEAP) #define CH_CFG_USE_HEAP TRUE +#endif /** * @brief Memory Pools Allocator APIs. @@ -291,7 +355,20 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMPOOLS) #define CH_CFG_USE_MEMPOOLS TRUE +#endif + +/** + * @brief Objects FIFOs APIs. + * @details If enabled then the objects FIFOs APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#if !defined(CH_CFG_USE_OBJ_FIFOS) +#define CH_CFG_USE_OBJ_FIFOS TRUE +#endif /** * @brief Dynamic Threads APIs. @@ -302,7 +379,73 @@ * @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. */ +#if !defined(CH_CFG_USE_DYNAMIC) #define CH_CFG_USE_DYNAMIC TRUE +#endif + +/** @} */ + +/*===========================================================================*/ +/** + * @name Objects factory options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Objects Factory APIs. + * @details If enabled then the objects factory APIs are included in the + * kernel. + * + * @note The default is @p FALSE. + */ +#if !defined(CH_CFG_USE_FACTORY) +#define CH_CFG_USE_FACTORY TRUE +#endif + +/** + * @brief Maximum length for object names. + * @details If the specified length is zero then the name is stored by + * pointer but this could have unintended side effects. + */ +#if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH) +#define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8 +#endif + +/** + * @brief Enables the registry of generic objects. + */ +#if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY) +#define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE +#endif + +/** + * @brief Enables factory for generic buffers. + */ +#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS) +#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE +#endif + +/** + * @brief Enables factory for semaphores. + */ +#if !defined(CH_CFG_FACTORY_SEMAPHORES) +#define CH_CFG_FACTORY_SEMAPHORES TRUE +#endif + +/** + * @brief Enables factory for mailboxes. + */ +#if !defined(CH_CFG_FACTORY_MAILBOXES) +#define CH_CFG_FACTORY_MAILBOXES TRUE +#endif + +/** + * @brief Enables factory for objects FIFOs. + */ +#if !defined(CH_CFG_FACTORY_OBJ_FIFOS) +#define CH_CFG_FACTORY_OBJ_FIFOS TRUE +#endif /** @} */ @@ -318,7 +461,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_STATISTICS) #define CH_DBG_STATISTICS FALSE +#endif /** * @brief Debug option, system state check. @@ -327,7 +472,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_SYSTEM_STATE_CHECK) #define CH_DBG_SYSTEM_STATE_CHECK TRUE +#endif /** * @brief Debug option, parameters checks. @@ -336,7 +483,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_ENABLE_CHECKS) #define CH_DBG_ENABLE_CHECKS TRUE +#endif /** * @brief Debug option, consistency checks. @@ -346,16 +495,28 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_ENABLE_ASSERTS) #define CH_DBG_ENABLE_ASSERTS TRUE +#endif /** * @brief Debug option, trace buffer. - * @details If enabled then the context switch circular trace buffer is - * activated. + * @details If enabled then the trace buffer is activated. * - * @note The default is @p FALSE. + * @note The default is @p CH_DBG_TRACE_MASK_DISABLED. + */ +#if !defined(CH_DBG_TRACE_MASK) +#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL +#endif + +/** + * @brief Trace buffer entries. + * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is + * different from @p CH_DBG_TRACE_MASK_DISABLED. */ -#define CH_DBG_ENABLE_TRACE TRUE +#if !defined(CH_DBG_TRACE_BUFFER_SIZE) +#define CH_DBG_TRACE_BUFFER_SIZE 128 +#endif /** * @brief Debug option, stack checks. @@ -367,7 +528,9 @@ * @note The default failure mode is to halt the system with the global * @p panic_msg variable set to @p NULL. */ +#if !defined(CH_DBG_ENABLE_STACK_CHECK) #define CH_DBG_ENABLE_STACK_CHECK TRUE +#endif /** * @brief Debug option, stacks initialization. @@ -377,7 +540,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_FILL_THREADS) #define CH_DBG_FILL_THREADS TRUE +#endif /** * @brief Debug option, threads profiling. @@ -388,7 +553,9 @@ * @note This debug option is not currently compatible with the * tickless mode. */ +#if !defined(CH_DBG_THREADS_PROFILING) #define CH_DBG_THREADS_PROFILING FALSE +#endif /** @} */ @@ -399,6 +566,22 @@ */ /*===========================================================================*/ +/** + * @brief System structure extension. + * @details User fields added to the end of the @p ch_system_t structure. + */ +#define CH_CFG_SYSTEM_EXTRA_FIELDS \ + /* Add threads custom fields here.*/ + +/** + * @brief System initialization hook. + * @details User initialization code added to the @p chSysInit() function + * just before interrupts are enabled globally. + */ +#define CH_CFG_SYSTEM_INIT_HOOK() { \ + /* Add threads initialization code here.*/ \ +} + /** * @brief Threads descriptor structure extension. * @details User fields added to the end of the @p thread_t structure. @@ -408,9 +591,9 @@ /** * @brief Threads initialization hook. - * @details User initialization code added to the @p chThdInit() API. + * @details User initialization code added to the @p _thread_init() function. * - * @note It is invoked from within @p chThdInit() and implicitly from all + * @note It is invoked from within @p _thread_init() and implicitly from all * the threads creation APIs. */ #define CH_CFG_THREAD_INIT_HOOK(tp) { \ @@ -420,10 +603,6 @@ /** * @brief Threads finalization hook. * @details User finalization code added to the @p chThdExit() API. - * - * @note It is inserted into lock zone. - * @note It is also invoked when the threads simply return in order to - * terminate. */ #define CH_CFG_THREAD_EXIT_HOOK(tp) { \ /* Add threads finalization code here.*/ \ @@ -458,6 +637,7 @@ * @note This macro can be used to activate a power saving mode. */ #define CH_CFG_IDLE_ENTER_HOOK() { \ + /* Idle-enter code here.*/ \ } /** @@ -467,6 +647,7 @@ * @note This macro can be used to deactivate a power saving mode. */ #define CH_CFG_IDLE_LEAVE_HOOK() { \ + /* Idle-leave code here.*/ \ } /** @@ -510,6 +691,6 @@ /* Port-specific settings (override port settings defaulted in chcore.h). */ /*===========================================================================*/ -#endif /* _CHCONF_H_ */ +#endif /* CHCONF_H */ /** @} */ diff --git a/testhal/KINETIS/TEENSY_LC/PWM/halconf_community.h b/testhal/KINETIS/TEENSY_LC/PWM/halconf_community.h new file mode 100644 index 0000000..43fdbf8 --- /dev/null +++ b/testhal/KINETIS/TEENSY_LC/PWM/halconf_community.h @@ -0,0 +1,173 @@ +/* + ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#ifndef HALCONF_COMMUNITY_H +#define HALCONF_COMMUNITY_H + +/** + * @brief Enables the community overlay. + */ +#if !defined(HAL_USE_COMMUNITY) || defined(__DOXYGEN__) +#define HAL_USE_COMMUNITY TRUE +#endif + +/** + * @brief Enables the FSMC subsystem. + */ +#if !defined(HAL_USE_FSMC) || defined(__DOXYGEN__) +#define HAL_USE_FSMC FALSE +#endif + +/** + * @brief Enables the NAND subsystem. + */ +#if !defined(HAL_USE_NAND) || defined(__DOXYGEN__) +#define HAL_USE_NAND FALSE +#endif + +/** + * @brief Enables the 1-wire subsystem. + */ +#if !defined(HAL_USE_ONEWIRE) || defined(__DOXYGEN__) +#define HAL_USE_ONEWIRE FALSE +#endif + +/** + * @brief Enables the EICU subsystem. + */ +#if !defined(HAL_USE_EICU) || defined(__DOXYGEN__) +#define HAL_USE_EICU FALSE +#endif + +/** + * @brief Enables the CRC subsystem. + */ +#if !defined(HAL_USE_CRC) || defined(__DOXYGEN__) +#define HAL_USE_CRC FALSE +#endif + +/** + * @brief Enables the RNG subsystem. + */ +#if !defined(HAL_USE_RNG) || defined(__DOXYGEN__) +#define HAL_USE_RNG FALSE +#endif + +/** + * @brief Enables the EEPROM subsystem. + */ +#if !defined(HAL_USE_EEPROM) || defined(__DOXYGEN__) +#define HAL_USE_EEPROM FALSE +#endif + +/** + * @brief Enables the TIMCAP subsystem. + */ +#if !defined(HAL_USE_TIMCAP) || defined(__DOXYGEN__) +#define HAL_USE_TIMCAP FALSE +#endif + +/** + * @brief Enables the TIMCAP subsystem. + */ +#if !defined(HAL_USE_COMP) || defined(__DOXYGEN__) +#define HAL_USE_COMP FALSE +#endif + +/** + * @brief Enables the QEI subsystem. + */ +#if !defined(HAL_USE_QEI) || defined(__DOXYGEN__) +#define HAL_USE_QEI FALSE +#endif + +/** + * @brief Enables the USBH subsystem. + */ +#if !defined(HAL_USE_USBH) || defined(__DOXYGEN__) +#define HAL_USE_USBH FALSE +#endif + +/** + * @brief Enables the USB_MSD subsystem. + */ +#if !defined(HAL_USE_USB_MSD) || defined(__DOXYGEN__) +#define HAL_USE_USB_MSD FALSE +#endif + +/*===========================================================================*/ +/* FSMCNAND driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables the @p nandAcquireBus() and @p nanReleaseBus() APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(NAND_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define NAND_USE_MUTUAL_EXCLUSION TRUE +#endif + +/*===========================================================================*/ +/* 1-wire driver related settings. */ +/*===========================================================================*/ +/** + * @brief Enables strong pull up feature. + * @note Disabling this option saves both code and data space. + */ +#define ONEWIRE_USE_STRONG_PULLUP FALSE + +/** + * @brief Enables search ROM feature. + * @note Disabling this option saves both code and data space. + */ +#define ONEWIRE_USE_SEARCH_ROM TRUE + +/*===========================================================================*/ +/* QEI driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables discard of overlow + */ +#if !defined(QEI_USE_OVERFLOW_DISCARD) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_DISCARD FALSE +#endif + +/** + * @brief Enables min max of overlow + */ +#if !defined(QEI_USE_OVERFLOW_MINMAX) || defined(__DOXYGEN__) +#define QEI_USE_OVERFLOW_MINMAX FALSE +#endif + +/*===========================================================================*/ +/* EEProm driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables 24xx series I2C eeprom device driver. + * @note Disabling this option saves both code and data space. + */ +#define EEPROM_USE_EE24XX FALSE + /** + * @brief Enables 25xx series SPI eeprom device driver. + * @note Disabling this option saves both code and data space. + */ +#define EEPROM_USE_EE25XX FALSE + +#endif /* HALCONF_COMMUNITY_H */ + +/** @} */ -- cgit v1.2.3