diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3f0cdf68c..00d233114 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -76,14 +76,6 @@ jobs: run: | bundle exec rake ci - # Run Blinky - # Disabled because it's set up for avr-gcc - #- name: Run Tests On Blinky Project - # run: | - # cd examples/blinky - # ceedling module:create[someNewModule] module:destroy[someNewModule] test:all - # cd ../.. - # Build & Install Gem - name: build and install Gem run: | diff --git a/.gitignore b/.gitignore index 76689a939..256cceb26 100644 --- a/.gitignore +++ b/.gitignore @@ -7,8 +7,6 @@ out.fail tags *.taghl -examples/blinky/build/ -examples/blinky/vendor/ examples/temp_sensor/vendor/ examples/temp_sensor/build/ plugins/fff/examples/fff_example/build/ diff --git a/assets/project_as_gem.yml b/assets/project_as_gem.yml index 3824dbe40..d7327a025 100644 --- a/assets/project_as_gem.yml +++ b/assets/project_as_gem.yml @@ -31,6 +31,11 @@ # enable release build (more details in release_build section below) :release_build: FALSE +# Specify where to find mixins and any that should be enabled automatically +:mixins: + :enabled: [] + :load_paths: [] + # further details to configure the way Ceedling handles test code :test_build: :use_assembly: FALSE diff --git a/assets/project_with_guts.yml b/assets/project_with_guts.yml index a95970593..2dc73cb6e 100644 --- a/assets/project_with_guts.yml +++ b/assets/project_with_guts.yml @@ -31,6 +31,11 @@ # enable release build (more details in release_build section below) :release_build: FALSE +# Specify where to find mixins and any that should be enabled automatically +:mixins: + :enabled: [] + :load_paths: [] + # further details to configure the way Ceedling handles test code :test_build: :use_assembly: FALSE diff --git a/assets/project_with_guts_gcov.yml b/assets/project_with_guts_gcov.yml index 898cd72cd..7d0eadd25 100644 --- a/assets/project_with_guts_gcov.yml +++ b/assets/project_with_guts_gcov.yml @@ -31,6 +31,11 @@ # enable release build (more details in release_build section below) :release_build: FALSE +# Specify where to find mixins and any that should be enabled automatically +:mixins: + :enabled: [] + :load_paths: [] + # further details to configure the way Ceedling handles test code :test_build: :use_assembly: FALSE diff --git a/bin/cli_handler.rb b/bin/cli_handler.rb index cda3d6b23..e0aaa9d05 100644 --- a/bin/cli_handler.rb +++ b/bin/cli_handler.rb @@ -323,14 +323,18 @@ def create_example(env, app_cfg, options, name, dest) dest_src = File.join( dest, 'src' ) dest_test = File.join( dest, 'test' ) + dest_mixin = File.join( dest, 'mixin' ) dest_project = File.join( dest, DEFAULT_PROJECT_FILENAME ) + dest_readme = File.join( dest, 'README.md' ) # Thor Actions for project tasks use paths in relation to this path ActionsWrapper.source_root( app_cfg[:ceedling_root_path] ) @actions._directory( "examples/#{name}/src", dest_src, :force => true ) @actions._directory( "examples/#{name}/test", dest_test, :force => true ) + @actions._directory( "examples/#{name}/mixin", dest_mixin, :force => true ) @actions._copy_file( "examples/#{name}/#{DEFAULT_PROJECT_FILENAME}", dest_project, :force => true ) + @actions._copy_file( "examples/#{name}/README.md", dest_readme, :force => true ) # Vendor the tools and install command line helper scripts @helper.vendor_tools( app_cfg[:ceedling_root_path], dest ) if options[:local] diff --git a/examples/blinky/project.yml b/examples/blinky/project.yml deleted file mode 100644 index 1cba7b741..000000000 --- a/examples/blinky/project.yml +++ /dev/null @@ -1,108 +0,0 @@ -# ========================================================================= -# Ceedling - Test-Centered Build System for C -# ThrowTheSwitch.org -# Copyright (c) 2010-24 Mike Karlesky, Mark VanderVoord, & Greg Williams -# SPDX-License-Identifier: MIT -# ========================================================================= - ---- - -# Notes: -# This is a fully tested project that demonstrates the use -# of a timer ISR to blink the on board LED of an Arduino UNO -:project: - :use_test_preprocessor: TRUE - :build_root: build - :release_build: TRUE - :test_file_prefix: test_ - :which_ceedling: gem - :ceedling_version: '?' - -#You'll have to specify these -:environment: - - :mcu: atmega328p - - :f_cpu: 16000000UL - - :serial_port: COM8 #change this to the serial port you are using!!! - - :objcopy: avr-objcopy - # Uncomment these lines if you are using windows and don't have these tools in your path - # - :path: - # - C:\mingw\bin - # - C:\WinAVR-20100110\bin - # - C:\WinAVR-20100110\utils\bin - # - #{ENV['PATH']} - -:extension: - :executable: .bin - -:release_build: - :output: blinky - -:paths: - :test: - - +:test/** - - -:test/support - :source: - - src/** - :include: - - src/** - :support: - - test/support - -# Compilation symbols to be injected into builds -# See documentation for advanced options: -# - Test name matchers for different symbols per test executable build -# - Referencing symbols in multiple lists using advanced YAML -# - Specifiying symbols used during test preprocessing -:defines: - :test: - - TEST # Simple list option to add symbol 'TEST' to compilation of all files in all test executables - :release: [] - - # Enable to inject name of a test as a unique compilation symbol into its respective executable build. - :use_test_definition: FALSE - -:tools: - :release_compiler: - :executable: avr-gcc - :arguments: - - ${1} - - -DTARGET - - -DF_CPU=#{ENV['F_CPU']} - - -mmcu=#{ENV['MCU']} - - -Iinclude/ - - -Wall - - -Os - - -c - - -o ${2} - :release_linker: - :executable: avr-gcc - :arguments: - - -mmcu=#{ENV['MCU']} - - ${1} - - -o ${2}.bin - -:cmock: - :mock_prefix: mock_ - :when_no_prototypes: :warn - :enforce_strict_ordering: TRUE - :plugins: - - :ignore - :treat_as: - uint8: HEX8 - uint16: HEX16 - uint32: UINT32 - int8: INT8 - bool: UINT8 - -#:tools: -# Ceedling defaults to using gcc for compiling, linking, etc. -# As [:tools] is blank, gcc will be used (so long as it's in your system path) -# See documentation to configure a given toolchain for use - -:plugins: - :load_paths: - - "#{Ceedling.load_path}" - :enabled: - - report_tests_pretty_stdout - - module_generator -... diff --git a/examples/blinky/rakefile.rb b/examples/blinky/rakefile.rb deleted file mode 100644 index 52648ba3f..000000000 --- a/examples/blinky/rakefile.rb +++ /dev/null @@ -1,37 +0,0 @@ -# ========================================================================= -# Ceedling - Test-Centered Build System for C -# ThrowTheSwitch.org -# Copyright (c) 2010-24 Mike Karlesky, Mark VanderVoord, & Greg Williams -# SPDX-License-Identifier: MIT -# ========================================================================= - -require "ceedling" -Ceedling.load_project - -task :default => %w[ test:all release ] - -# Dummy task to ensure that the SERIAL_PORT environment variable is set. -# It can be set on the command line as follows: -# $ rake SERIAL_PORT=[serial port name] -task :serial_port do - unless ENV['SERIAL_PORT'] - raise "SERIAL_PORT is not defined in the environment!" - end -end - -desc "Convert the output binary to a hex file for programming to the Arduino" -task :convert => :release do - bin_file = "build/release/#{RELEASE_BUILD_OUTPUT}.bin" - hex_file = "build/release/#{RELEASE_BUILD_OUTPUT}.hex" - cmd = "#{ENV['OBJCOPY']} -O ihex -R .eeprom #{bin_file} #{hex_file}" - puts cmd - sh cmd -end - -desc "Program the Arduino over the serial port." -task :program => [:convert, :serial_port] do - hex_file = "build/release/#{RELEASE_BUILD_OUTPUT}.hex" - cmd = "avrdude -F -V -c arduino -p #{ENV['MCU']} -P #{ENV['SERIAL_PORT']} -b 115200 -U flash:w:#{hex_file}" - puts cmd - sh cmd -end diff --git a/examples/blinky/src/BlinkTask.c b/examples/blinky/src/BlinkTask.c deleted file mode 100644 index 139d777ad..000000000 --- a/examples/blinky/src/BlinkTask.c +++ /dev/null @@ -1,28 +0,0 @@ -/* ========================================================================= - Ceedling - Test-Centered Build System for C - ThrowTheSwitch.org - Copyright (c) 2010-24 Mike Karlesky, Mark VanderVoord, & Greg Williams - SPDX-License-Identifier: MIT -========================================================================= */ - -// #include - -#include "BlinkTask.h" - -#ifdef TEST - #define LOOP - #include "stub_io.h" -#else - #include - #include - #define LOOP while(1) -#endif // TEST - - - -void BlinkTask(void) -{ - /* toggle the LED */ - PORTB ^= _BV(PORTB5); - -} diff --git a/examples/blinky/src/BlinkTask.h b/examples/blinky/src/BlinkTask.h deleted file mode 100644 index c76ee51c4..000000000 --- a/examples/blinky/src/BlinkTask.h +++ /dev/null @@ -1,13 +0,0 @@ -/* ========================================================================= - Ceedling - Test-Centered Build System for C - ThrowTheSwitch.org - Copyright (c) 2010-24 Mike Karlesky, Mark VanderVoord, & Greg Williams - SPDX-License-Identifier: MIT -========================================================================= */ - -#ifndef BlinkTask_H -#define BlinkTask_H - -void BlinkTask(void); - -#endif diff --git a/examples/blinky/src/Configure.c b/examples/blinky/src/Configure.c deleted file mode 100644 index c81133af1..000000000 --- a/examples/blinky/src/Configure.c +++ /dev/null @@ -1,43 +0,0 @@ -/* ========================================================================= - Ceedling - Test-Centered Build System for C - ThrowTheSwitch.org - Copyright (c) 2010-24 Mike Karlesky, Mark VanderVoord, & Greg Williams - SPDX-License-Identifier: MIT -========================================================================= */ - -#include "Configure.h" -#include "main.h" -#ifdef TEST - #include "stub_io.h" - #include "stub_interrupt.h" -#else - #include - #include -#endif // TEST - -/* setup timer 0 to divide bus clock by 64. - This results in a 1.024ms overflow interrupt -16000000/64 - 250000 - -0.000 004s *256 -0.001024 -*/ -void Configure(void) -{ - /* disable interrupts */ - cli(); - - /* Configure TIMER0 to use the CLK/64 prescaler. */ - TCCR0B = _BV(CS00) | _BV(CS01); - - /* enable the TIMER0 overflow interrupt */ - TIMSK0 = _BV(TOIE0); - - /* confiure PB5 as an output. */ - DDRB |= _BV(DDB5); - - /* enable interrupts. */ - sei(); -} - diff --git a/examples/blinky/src/Configure.h b/examples/blinky/src/Configure.h deleted file mode 100644 index 133a58892..000000000 --- a/examples/blinky/src/Configure.h +++ /dev/null @@ -1,13 +0,0 @@ -/* ========================================================================= - Ceedling - Test-Centered Build System for C - ThrowTheSwitch.org - Copyright (c) 2010-24 Mike Karlesky, Mark VanderVoord, & Greg Williams - SPDX-License-Identifier: MIT -========================================================================= */ - -#ifndef Configure_H -#define Configure_H - -void Configure(void); - -#endif // Configure_H diff --git a/examples/blinky/src/main.c b/examples/blinky/src/main.c deleted file mode 100644 index 1d4e76a0d..000000000 --- a/examples/blinky/src/main.c +++ /dev/null @@ -1,58 +0,0 @@ -/* ========================================================================= - Ceedling - Test-Centered Build System for C - ThrowTheSwitch.org - Copyright (c) 2010-24 Mike Karlesky, Mark VanderVoord, & Greg Williams - SPDX-License-Identifier: MIT -========================================================================= */ - -// #include - -#include "main.h" -#include "BlinkTask.h" -#include "Configure.h" - -//Most OS's frown upon direct memory access. -//So we'll have to use fake registers during testing. -#ifdef TEST - #define LOOP - #include "stub_io.h" - #include "stub_interrupt.h" -#else - #include - #include - #define LOOP while(1) - //The target will need a main. - //Our test runner will provide it's own and call AppMain() - int main(void) - { - return AppMain(); - } -#endif // TEST - -int AppMain(void) -{ - Configure(); - - LOOP - { - if(BlinkTaskReady==0x01) - { - BlinkTaskReady = 0x00; - BlinkTask(); - } - } - return 0; -} - -ISR(TIMER0_OVF_vect) -{ - /* toggle every thousand ticks */ - if (tick >= 1000) - { - /* signal our periodic task. */ - BlinkTaskReady = 0x01; - /* reset the tick */ - tick = 0; - } - tick++; -} diff --git a/examples/blinky/src/main.h b/examples/blinky/src/main.h deleted file mode 100644 index d7e14f4af..000000000 --- a/examples/blinky/src/main.h +++ /dev/null @@ -1,16 +0,0 @@ -/* ========================================================================= - Ceedling - Test-Centered Build System for C - ThrowTheSwitch.org - Copyright (c) 2010-24 Mike Karlesky, Mark VanderVoord, & Greg Williams - SPDX-License-Identifier: MIT -========================================================================= */ - -#ifndef __MAIN_H__ -#define __MAIN_H__ - -int main(void); -int AppMain(void); -volatile int BlinkTaskReady; -int tick; - -#endif /* __MAIN_H__ */ diff --git a/examples/blinky/test/support/stub_interrupt.h b/examples/blinky/test/support/stub_interrupt.h deleted file mode 100644 index 7410f2149..000000000 --- a/examples/blinky/test/support/stub_interrupt.h +++ /dev/null @@ -1,347 +0,0 @@ -/* Copyright (c) 2002,2005,2007 Marek Michalkiewicz - Copyright (c) 2007, Dean Camera - - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - - * Neither the name of the copyright holders nor the names of - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. */ - -/* $Id: interrupt.h,v 1.25.2.1 2008/01/05 06:33:11 dmix Exp $ */ - -#ifndef _AVR_INTERRUPT_H_ -#define _AVR_INTERRUPT_H_ - -// #include -#include "stub_io.h" -#if !defined(__DOXYGEN__) && !defined(__STRINGIFY) -/* Auxiliary macro for ISR_ALIAS(). */ -#define __STRINGIFY(x) #x -#endif /* !defined(__DOXYGEN__) */ - -/** -\file -\@{ -*/ - - -/** \name Global manipulation of the interrupt flag - - The global interrupt flag is maintained in the I bit of the status - register (SREG). -*/ - -// #if defined(__DOXYGEN__) -/** \def sei() - \ingroup avr_interrupts - - \code #include \endcode - - Enables interrupts by setting the global interrupt mask. This function - actually compiles into a single line of assembly, so there is no function - call overhead. */ -// #define sei() -void sei(void); // Redefine the macro as a function so that it can be mocked by CMock -// #else /* !DOXYGEN */ -// # define sei() __asm__ __volatile__ ("sei" ::) -// #endif /* DOXYGEN */ - -// #if defined(__DOXYGEN__) -/** \def cli() - \ingroup avr_interrupts - - \code #include \endcode - - Disables all interrupts by clearing the global interrupt mask. This function - actually compiles into a single line of assembly, so there is no function - call overhead. */ -// #define cli() -void cli(void); // Redefine the macro as a function so that it can be mocked by CMock -// #else /* !DOXYGEN */ -// # define cli() __asm__ __volatile__ ("cli" ::) -// #endif /* DOXYGEN */ - - -/** \name Macros for writing interrupt handler functions */ - - -// #if defined(__DOXYGEN__) -/** \def ISR(vector [, attributes]) - \ingroup avr_interrupts - - \code #include \endcode - - Introduces an interrupt handler function (interrupt service - routine) that runs with global interrupts initially disabled - by default with no attributes specified. - - The attributes are optional and alter the behaviour and resultant - generated code of the interrupt routine. Multiple attributes may - be used for a single function, with a space seperating each - attribute. - - Valid attributes are ISR_BLOCK, ISR_NOBLOCK, ISR_NAKED and - ISR_ALIASOF(vect). - - \c vector must be one of the interrupt vector names that are - valid for the particular MCU type. -*/ -// # define ISR(vector, [attributes]) -#define ISR void ISR -// #else /* real code */ - -// #if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) -// # define __INTR_ATTRS used, externally_visible -// #else /* GCC < 4.1 */ -// # define __INTR_ATTRS used -// #endif - -// #ifdef __cplusplus -// # define ISR(vector, ...) \ -// extern "C" void vector (void) __attribute__ ((signal,__INTR_ATTRS)) __VA_ARGS__; \ -// void vector (void) -// #else -// # define ISR(vector, ...) \ -// void vector (void) __attribute__ ((signal,__INTR_ATTRS)) __VA_ARGS__; \ -// void vector (void) -// #endif - -// #endif /* DOXYGEN */ - -#if defined(__DOXYGEN__) -/** \def SIGNAL(vector) - \ingroup avr_interrupts - - \code #include \endcode - - Introduces an interrupt handler function that runs with global interrupts - initially disabled. - - This is the same as the ISR macro without optional attributes. - \deprecated Do not use SIGNAL() in new code. Use ISR() instead. -*/ -# define SIGNAL(vector) -#else /* real code */ - -#ifdef __cplusplus -# define SIGNAL(vector) \ - extern "C" void vector(void) __attribute__ ((signal, __INTR_ATTRS)); \ - void vector (void) -#else -# define SIGNAL(vector) \ - void vector (void) __attribute__ ((signal, __INTR_ATTRS)); \ - void vector (void) -#endif - -#endif /* DOXYGEN */ - -#if defined(__DOXYGEN__) -/** \def EMPTY_INTERRUPT(vector) - \ingroup avr_interrupts - - \code #include \endcode - - Defines an empty interrupt handler function. This will not generate - any prolog or epilog code and will only return from the ISR. Do not - define a function body as this will define it for you. - Example: - \code EMPTY_INTERRUPT(ADC_vect);\endcode */ -# define EMPTY_INTERRUPT(vector) -#else /* real code */ - -#ifdef __cplusplus -# define EMPTY_INTERRUPT(vector) \ - extern "C" void vector(void) __attribute__ ((signal,naked,__INTR_ATTRS)); \ - void vector (void) { __asm__ __volatile__ ("reti" ::); } -#else -# define EMPTY_INTERRUPT(vector) \ - void vector (void) __attribute__ ((signal,naked,__INTR_ATTRS)); \ - void vector (void) { __asm__ __volatile__ ("reti" ::); } -#endif - -#endif /* DOXYGEN */ - -#if defined(__DOXYGEN__) -/** \def ISR_ALIAS(vector, target_vector) - \ingroup avr_interrupts - - \code #include \endcode - - Aliases a given vector to another one in the same manner as the - ISR_ALIASOF attribute for the ISR() macro. Unlike the ISR_ALIASOF - attribute macro however, this is compatible for all versions of - GCC rather than just GCC version 4.2 onwards. - - \note This macro creates a trampoline function for the aliased - macro. This will result in a two cycle penalty for the aliased - vector compared to the ISR the vector is aliased to, due to the - JMP/RJMP opcode used. - - \deprecated - For new code, the use of ISR(..., ISR_ALIASOF(...)) is - recommended. - - Example: - \code - ISR(INT0_vect) - { - PORTB = 42; - } - - ISR_ALIAS(INT1_vect, INT0_vect); - \endcode -*/ -# define ISR_ALIAS(vector, target_vector) -#else /* real code */ - -#ifdef __cplusplus -# if defined(__AVR_MEGA__) && __AVR_MEGA__ -# define ISR_ALIAS(vector, tgt) extern "C" void vector (void) \ - __attribute__((signal, naked, __INTR_ATTRS)); \ - void vector (void) { asm volatile ("jmp " __STRINGIFY(tgt) ::); } -# else /* !__AVR_MEGA */ -# define ISR_ALIAS(vector, tgt) extern "C" void vector (void) \ - __attribute__((signal, naked, __INTR_ATTRS)); \ - void vector (void) { asm volatile ("rjmp " __STRINGIFY(tgt) ::); } -# endif /* __AVR_MEGA__ */ -#else /* !__cplusplus */ -# if defined(__AVR_MEGA__) && __AVR_MEGA__ -# define ISR_ALIAS(vector, tgt) void vector (void) \ - __attribute__((signal, naked, __INTR_ATTRS)); \ - void vector (void) { asm volatile ("jmp " __STRINGIFY(tgt) ::); } -# else /* !__AVR_MEGA */ -# define ISR_ALIAS(vector, tgt) void vector (void) \ - __attribute__((signal, naked, __INTR_ATTRS)); \ - void vector (void) { asm volatile ("rjmp " __STRINGIFY(tgt) ::); } -# endif /* __AVR_MEGA__ */ -#endif /* __cplusplus */ - -#endif /* DOXYGEN */ - -#if defined(__DOXYGEN__) -/** \def reti() - \ingroup avr_interrupts - - \code #include \endcode - - Returns from an interrupt routine, enabling global interrupts. This should - be the last command executed before leaving an ISR defined with the ISR_NAKED - attribute. - - This macro actually compiles into a single line of assembly, so there is - no function call overhead. -*/ -# define reti() -#else /* !DOXYGEN */ -# define reti() __asm__ __volatile__ ("reti" ::) -#endif /* DOXYGEN */ - -#if defined(__DOXYGEN__) -/** \def BADISR_vect - \ingroup avr_interrupts - - \code #include \endcode - - This is a vector which is aliased to __vector_default, the vector - executed when an ISR fires with no accompanying ISR handler. This - may be used along with the ISR() macro to create a catch-all for - undefined but used ISRs for debugging purposes. -*/ -# define BADISR_vect -#else /* !DOXYGEN */ -# define BADISR_vect __vector_default -#endif /* DOXYGEN */ - -/** \name ISR attributes */ - -#if defined(__DOXYGEN__) -/** \def ISR_BLOCK - \ingroup avr_interrupts - - \code# include \endcode - - Identical to an ISR with no attributes specified. Global - interrupts are initially disabled by the AVR hardware when - entering the ISR, without the compiler modifying this state. - - Use this attribute in the attributes parameter of the ISR macro. -*/ -# define ISR_BLOCK - -/** \def ISR_NOBLOCK - \ingroup avr_interrupts - - \code# include \endcode - - ISR runs with global interrupts initially enabled. The interrupt - enable flag is activated by the compiler as early as possible - within the ISR to ensure minimal processing delay for nested - interrupts. - - This may be used to create nested ISRs, however care should be - taken to avoid stack overflows, or to avoid infinitely entering - the ISR for those cases where the AVR hardware does not clear the - respective interrupt flag before entering the ISR. - - Use this attribute in the attributes parameter of the ISR macro. -*/ -# define ISR_NOBLOCK - -/** \def ISR_NAKED - \ingroup avr_interrupts - - \code# include \endcode - - ISR is created with no prologue or epilogue code. The user code is - responsible for preservation of the machine state including the - SREG register, as well as placing a reti() at the end of the - interrupt routine. - - Use this attribute in the attributes parameter of the ISR macro. -*/ -# define ISR_NAKED - -/** \def ISR_ALIASOF(target_vector) - \ingroup avr_interrupts - - \code#include \endcode - - The ISR is linked to another ISR, specified by the vect parameter. - This is compatible with GCC 4.2 and greater only. - - Use this attribute in the attributes parameter of the ISR macro. -*/ -# define ISR_ALIASOF(target_vector) -#else /* !DOXYGEN */ -# define ISR_BLOCK -# define ISR_NOBLOCK __attribute__((interrupt)) -# define ISR_NAKED __attribute__((naked)) -# define ISR_ALIASOF(v) __attribute__((alias(__STRINGIFY(v)))) -#endif /* DOXYGEN */ - -/* \@} */ - -#endif diff --git a/examples/blinky/test/support/stub_io.h b/examples/blinky/test/support/stub_io.h deleted file mode 100644 index e9646daf6..000000000 --- a/examples/blinky/test/support/stub_io.h +++ /dev/null @@ -1,421 +0,0 @@ -/* Copyright (c) 2002,2003,2005,2006,2007 Marek Michalkiewicz, Joerg Wunsch - Copyright (c) 2007 Eric B. Weddington - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - - * Neither the name of the copyright holders nor the names of - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. */ - -/* $Id: io.h,v 1.52.2.28 2009/12/20 17:02:53 arcanum Exp $ */ - -/** \file */ -/** \defgroup avr_io : AVR device-specific IO definitions - \code #include \endcode - - This header file includes the apropriate IO definitions for the - device that has been specified by the -mmcu= compiler - command-line switch. This is done by diverting to the appropriate - file <avr/ioXXXX.h> which should - never be included directly. Some register names common to all - AVR devices are defined directly within <avr/common.h>, - which is included in <avr/io.h>, - but most of the details come from the respective include file. - - Note that this file always includes the following files: - \code - #include - #include - #include - #include - \endcode - See \ref avr_sfr for more details about that header file. - - Included are definitions of the IO register set and their - respective bit values as specified in the Atmel documentation. - Note that inconsistencies in naming conventions, - so even identical functions sometimes get different names on - different devices. - - Also included are the specific names useable for interrupt - function definitions as documented - \ref avr_signames "here". - - Finally, the following macros are defined: - - - \b RAMEND -
- The last on-chip RAM address. -
- - \b XRAMEND -
- The last possible RAM location that is addressable. This is equal to - RAMEND for devices that do not allow for external RAM. For devices - that allow external RAM, this will be larger than RAMEND. -
- - \b E2END -
- The last EEPROM address. -
- - \b FLASHEND -
- The last byte address in the Flash program space. -
- - \b SPM_PAGESIZE -
- For devices with bootloader support, the flash pagesize - (in bytes) to be used for the \c SPM instruction. - - \b E2PAGESIZE -
- The size of the EEPROM page. - -*/ - -#ifndef _AVR_IO_H_ -#define _AVR_IO_H_ - -// #include -#include "stub_sfr_defs.h" -// #if defined (__AVR_AT94K__) -// # include -// #elif defined (__AVR_AT43USB320__) -// # include -// #elif defined (__AVR_AT43USB355__) -// # include -// #elif defined (__AVR_AT76C711__) -// # include -// #elif defined (__AVR_AT86RF401__) -// # include -// #elif defined (__AVR_AT90PWM1__) -// # include -// #elif defined (__AVR_AT90PWM2__) -// # include -// #elif defined (__AVR_AT90PWM2B__) -// # include -// #elif defined (__AVR_AT90PWM3__) -// # include -// #elif defined (__AVR_AT90PWM3B__) -// # include -// #elif defined (__AVR_AT90PWM216__) -// # include -// #elif defined (__AVR_AT90PWM316__) -// # include -// #elif defined (__AVR_AT90PWM81__) -// # include -// #elif defined (__AVR_ATmega8U2__) -// # include -// #elif defined (__AVR_ATmega16M1__) -// # include -// #elif defined (__AVR_ATmega16U2__) -// # include -// #elif defined (__AVR_ATmega16U4__) -// # include -// #elif defined (__AVR_ATmega32C1__) -// # include -// #elif defined (__AVR_ATmega32M1__) -// # include -// #elif defined (__AVR_ATmega32U2__) -// # include -// #elif defined (__AVR_ATmega32U4__) -// # include -// #elif defined (__AVR_ATmega32U6__) -// # include -// #elif defined (__AVR_ATmega64C1__) -// # include -// #elif defined (__AVR_ATmega64M1__) -// # include -// #elif defined (__AVR_ATmega128__) -// # include -// #elif defined (__AVR_ATmega1280__) -// # include -// #elif defined (__AVR_ATmega1281__) -// # include -// #elif defined (__AVR_ATmega1284P__) -// # include -// #elif defined (__AVR_ATmega128RFA1__) -// # include -// #elif defined (__AVR_ATmega2560__) -// # include -// #elif defined (__AVR_ATmega2561__) -// # include -// #elif defined (__AVR_AT90CAN32__) -// # include -// #elif defined (__AVR_AT90CAN64__) -// # include -// #elif defined (__AVR_AT90CAN128__) -// # include -// #elif defined (__AVR_AT90USB82__) -// # include -// #elif defined (__AVR_AT90USB162__) -// # include -// #elif defined (__AVR_AT90USB646__) -// # include -// #elif defined (__AVR_AT90USB647__) -// # include -// #elif defined (__AVR_AT90USB1286__) -// # include -// #elif defined (__AVR_AT90USB1287__) -// # include -// #elif defined (__AVR_ATmega64__) -// # include -// #elif defined (__AVR_ATmega640__) -// # include -// #elif defined (__AVR_ATmega644__) || defined (__AVR_ATmega644A__) -// # include -// #elif defined (__AVR_ATmega644P__) -// # include -// #elif defined (__AVR_ATmega644PA__) -// # include -// #elif defined (__AVR_ATmega645__) || defined (__AVR_ATmega645A__) || defined (__AVR_ATmega645P__) -// # include -// #elif defined (__AVR_ATmega6450__) || defined (__AVR_ATmega6450A__) || defined (__AVR_ATmega6450P__) -// # include -// #elif defined (__AVR_ATmega649__) || defined (__AVR_ATmega649A__) -// # include -// #elif defined (__AVR_ATmega6490__) || defined (__AVR_ATmega6490A__) || defined (__AVR_ATmega6490P__) -// # include -// #elif defined (__AVR_ATmega649P__) -// # include -// #elif defined (__AVR_ATmega64HVE__) -// # include -// #elif defined (__AVR_ATmega103__) -// # include -// #elif defined (__AVR_ATmega32__) -// # include -// #elif defined (__AVR_ATmega323__) -// # include -// #elif defined (__AVR_ATmega324P__) || defined (__AVR_ATmega324A__) -// # include -// #elif defined (__AVR_ATmega324PA__) -// # include -// #elif defined (__AVR_ATmega325__) -// # include -// #elif defined (__AVR_ATmega325P__) -// # include -// #elif defined (__AVR_ATmega3250__) -// # include -// #elif defined (__AVR_ATmega3250P__) -// # include -// #elif defined (__AVR_ATmega328P__) || defined (__AVR_ATmega328__) -// # include -# include -// #elif defined (__AVR_ATmega329__) -// # include -// #elif defined (__AVR_ATmega329P__) || defined (__AVR_ATmega329PA__) -// # include -// #elif defined (__AVR_ATmega3290__) -// # include -// #elif defined (__AVR_ATmega3290P__) -// # include -// #elif defined (__AVR_ATmega32HVB__) -// # include -// #elif defined (__AVR_ATmega406__) -// # include -// #elif defined (__AVR_ATmega16__) -// # include -// #elif defined (__AVR_ATmega16A__) -// # include -// #elif defined (__AVR_ATmega161__) -// # include -// #elif defined (__AVR_ATmega162__) -// # include -// #elif defined (__AVR_ATmega163__) -// # include -// #elif defined (__AVR_ATmega164P__) || defined (__AVR_ATmega164A__) -// # include -// #elif defined (__AVR_ATmega165__) || defined (__AVR_ATmega165A__) -// # include -// #elif defined (__AVR_ATmega165P__) -// # include -// #elif defined (__AVR_ATmega168__) || defined (__AVR_ATmega168A__) -// # include -// #elif defined (__AVR_ATmega168P__) -// # include -// #elif defined (__AVR_ATmega169__) || defined (__AVR_ATmega169A__) -// # include -// #elif defined (__AVR_ATmega169P__) -// # include -// #elif defined (__AVR_ATmega169PA__) -// # include -// #elif defined (__AVR_ATmega8HVA__) -// # include -// #elif defined (__AVR_ATmega16HVA__) -// # include -// #elif defined (__AVR_ATmega16HVA2__) -// # include -// #elif defined (__AVR_ATmega16HVB__) -// # include -// #elif defined (__AVR_ATmega8__) -// # include -// #elif defined (__AVR_ATmega48__) || defined (__AVR_ATmega48A__) -// # include -// #elif defined (__AVR_ATmega48P__) -// # include -// #elif defined (__AVR_ATmega88__) || defined (__AVR_ATmega88A__) -// # include -// #elif defined (__AVR_ATmega88P__) -// # include -// #elif defined (__AVR_ATmega88PA__) -// # include -// #elif defined (__AVR_ATmega8515__) -// # include -// #elif defined (__AVR_ATmega8535__) -// # include -// #elif defined (__AVR_AT90S8535__) -// # include -// #elif defined (__AVR_AT90C8534__) -// # include -// #elif defined (__AVR_AT90S8515__) -// # include -// #elif defined (__AVR_AT90S4434__) -// # include -// #elif defined (__AVR_AT90S4433__) -// # include -// #elif defined (__AVR_AT90S4414__) -// # include -// #elif defined (__AVR_ATtiny22__) -// # include -// #elif defined (__AVR_ATtiny26__) -// # include -// #elif defined (__AVR_AT90S2343__) -// # include -// #elif defined (__AVR_AT90S2333__) -// # include -// #elif defined (__AVR_AT90S2323__) -// # include -// #elif defined (__AVR_AT90S2313__) -// # include -// #elif defined (__AVR_ATtiny2313__) -// # include -// #elif defined (__AVR_ATtiny2313A__) -// # include -// #elif defined (__AVR_ATtiny13__) -// # include -// #elif defined (__AVR_ATtiny13A__) -// # include -// #elif defined (__AVR_ATtiny25__) -// # include -// #elif defined (__AVR_ATtiny4313__) -// # include -// #elif defined (__AVR_ATtiny45__) -// # include -// #elif defined (__AVR_ATtiny85__) -// # include -// #elif defined (__AVR_ATtiny24__) -// # include -// #elif defined (__AVR_ATtiny24A__) -// # include -// #elif defined (__AVR_ATtiny44__) -// # include -// #elif defined (__AVR_ATtiny44A__) -// # include -// #elif defined (__AVR_ATtiny84__) -// # include -// #elif defined (__AVR_ATtiny261__) -// # include -// #elif defined (__AVR_ATtiny261A__) -// # include -// #elif defined (__AVR_ATtiny461__) -// # include -// #elif defined (__AVR_ATtiny461A__) -// # include -// #elif defined (__AVR_ATtiny861__) -// # include -// #elif defined (__AVR_ATtiny861A__) -// # include -// #elif defined (__AVR_ATtiny43U__) -// # include -// #elif defined (__AVR_ATtiny48__) -// # include -// #elif defined (__AVR_ATtiny88__) -// # include -// #elif defined (__AVR_ATtiny87__) -// # include -// #elif defined (__AVR_ATtiny167__) -// # include -// #elif defined (__AVR_AT90SCR100__) -// # include -// #elif defined (__AVR_ATxmega16A4__) -// # include -// #elif defined (__AVR_ATxmega16D4__) -// # include -// #elif defined (__AVR_ATxmega32A4__) -// # include -// #elif defined (__AVR_ATxmega32D4__) -// # include -// #elif defined (__AVR_ATxmega64A1__) -// # include -// #elif defined (__AVR_ATxmega64A3__) -// # include -// #elif defined (__AVR_ATxmega64D3__) -// # include -// #elif defined (__AVR_ATxmega128A1__) -// # include -// #elif defined (__AVR_ATxmega128A3__) -// # include -// #elif defined (__AVR_ATxmega128D3__) -// # include -// #elif defined (__AVR_ATxmega192A3__) -// # include -// #elif defined (__AVR_ATxmega192D3__) -// # include -// #elif defined (__AVR_ATxmega256A3__) -// # include -// #elif defined (__AVR_ATxmega256A3B__) -// # include -// #elif defined (__AVR_ATxmega256D3__) -// # include -// #elif defined (__AVR_ATA6289__) -// # include -// /* avr1: the following only supported for assembler programs */ -// #elif defined (__AVR_ATtiny28__) -// # include -// #elif defined (__AVR_AT90S1200__) -// # include -// #elif defined (__AVR_ATtiny15__) -// # include -// #elif defined (__AVR_ATtiny12__) -// # include -// #elif defined (__AVR_ATtiny11__) -// # include -// #else -// # if !defined(__COMPILING_AVR_LIBC__) -// # warning "device type not defined" -// # endif -// #endif - -// #include - -// #include - -// #include - -// /* Include fuse.h after individual IO header files. */ -// #include - -// /* Include lock.h after individual IO header files. */ -// #include - -#endif /* _AVR_IO_H_ */ diff --git a/examples/blinky/test/support/stub_iom328p.h b/examples/blinky/test/support/stub_iom328p.h deleted file mode 100644 index 76f8974c3..000000000 --- a/examples/blinky/test/support/stub_iom328p.h +++ /dev/null @@ -1,883 +0,0 @@ -/* Copyright (c) 2007 Atmel Corporation - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - - * Neither the name of the copyright holders nor the names of - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. -*/ - -/* $Id: iom328p.h,v 1.3.2.14 2009/02/11 18:05:28 arcanum Exp $ */ - -/* avr/iom328p.h - definitions for ATmega328P. */ - -/* This file should only be included from , never directly. */ - -// #ifndef _AVR_IO_H_ -// # error "Include instead of this file." -// #endif - -// #ifndef _AVR_IOXXX_H_ -// # define _AVR_IOXXX_H_ "iom328p.h" -// #else -// # error "Attempt to include more than one file." -// #endif - - -#ifndef _AVR_IOM328P_H_ -#define _AVR_IOM328P_H_ 1 - -/* Registers and associated bit numbers */ - -// #define PINB _SFR_IO8(0x03) -// #define PINB0 0 -// #define PINB1 1 -// #define PINB2 2 -// #define PINB3 3 -// #define PINB4 4 -// #define PINB5 5 -// #define PINB6 6 -// #define PINB7 7 - -// #define DDRB _SFR_IO8(0x04) -char DDRB; -#define DDB0 0 -#define DDB1 1 -#define DDB2 2 -#define DDB3 3 -#define DDB4 4 -#define DDB5 5 -#define DDB6 6 -#define DDB7 7 - -// #define PORTB _SFR_IO8(0x05) -char PORTB; -#define PORTB0 0 -#define PORTB1 1 -#define PORTB2 2 -#define PORTB3 3 -#define PORTB4 4 -#define PORTB5 5 -#define PORTB6 6 -#define PORTB7 7 - -// #define PINC _SFR_IO8(0x06) -// #define PINC0 0 -// #define PINC1 1 -// #define PINC2 2 -// #define PINC3 3 -// #define PINC4 4 -// #define PINC5 5 -// #define PINC6 6 - -// #define DDRC _SFR_IO8(0x07) -// #define DDC0 0 -// #define DDC1 1 -// #define DDC2 2 -// #define DDC3 3 -// #define DDC4 4 -// #define DDC5 5 -// #define DDC6 6 - -// #define PORTC _SFR_IO8(0x08) -// #define PORTC0 0 -// #define PORTC1 1 -// #define PORTC2 2 -// #define PORTC3 3 -// #define PORTC4 4 -// #define PORTC5 5 -// #define PORTC6 6 - -// #define PIND _SFR_IO8(0x09) -char PIND; -#define PIND0 0 -#define PIND1 1 -#define PIND2 2 -#define PIND3 3 -#define PIND4 4 -#define PIND5 5 -#define PIND6 6 -#define PIND7 7 - -// #define DDRD _SFR_IO8(0x0A) -char DDRD; -#define DDD0 0 -#define DDD1 1 -#define DDD2 2 -#define DDD3 3 -#define DDD4 4 -#define DDD5 5 -#define DDD6 6 -#define DDD7 7 - -// #define PORTD _SFR_IO8(0x0B) -char PORTD; -#define PORTD0 0 -#define PORTD1 1 -#define PORTD2 2 -#define PORTD3 3 -#define PORTD4 4 -#define PORTD5 5 -#define PORTD6 6 -#define PORTD7 7 - -// #define TIFR0 _SFR_IO8(0x15) -// #define TOV0 0 -// #define OCF0A 1 -// #define OCF0B 2 - -// #define TIFR1 _SFR_IO8(0x16) -// #define TOV1 0 -// #define OCF1A 1 -// #define OCF1B 2 -// #define ICF1 5 - -// #define TIFR2 _SFR_IO8(0x17) -// #define TOV2 0 -// #define OCF2A 1 -// #define OCF2B 2 - -// #define PCIFR _SFR_IO8(0x1B) -// #define PCIF0 0 -// #define PCIF1 1 -// #define PCIF2 2 - -// #define EIFR _SFR_IO8(0x1C) -// #define INTF0 0 -// #define INTF1 1 - -// #define EIMSK _SFR_IO8(0x1D) -// #define INT0 0 -// #define INT1 1 - -// #define GPIOR0 _SFR_IO8(0x1E) -// #define GPIOR00 0 -// #define GPIOR01 1 -// #define GPIOR02 2 -// #define GPIOR03 3 -// #define GPIOR04 4 -// #define GPIOR05 5 -// #define GPIOR06 6 -// #define GPIOR07 7 - -// #define EECR _SFR_IO8(0x1F) -// #define EERE 0 -// #define EEPE 1 -// #define EEMPE 2 -// #define EERIE 3 -// #define EEPM0 4 -// #define EEPM1 5 - -// #define EEDR _SFR_IO8(0x20) -// #define EEDR0 0 -// #define EEDR1 1 -// #define EEDR2 2 -// #define EEDR3 3 -// #define EEDR4 4 -// #define EEDR5 5 -// #define EEDR6 6 -// #define EEDR7 7 - -// #define EEAR _SFR_IO16(0x21) - -// #define EEARL _SFR_IO8(0x21) -// #define EEAR0 0 -// #define EEAR1 1 -// #define EEAR2 2 -// #define EEAR3 3 -// #define EEAR4 4 -// #define EEAR5 5 -// #define EEAR6 6 -// #define EEAR7 7 - -// #define EEARH _SFR_IO8(0x22) -// #define EEAR8 0 -// #define EEAR9 1 - -// #define _EEPROM_REG_LOCATIONS_ 1F2021 - -// #define GTCCR _SFR_IO8(0x23) -// #define PSRSYNC 0 -// #define PSRASY 1 -// #define TSM 7 - -// #define TCCR0A _SFR_IO8(0x24) -// #define WGM00 0 -// #define WGM01 1 -// #define COM0B0 4 -// #define COM0B1 5 -// #define COM0A0 6 -// #define COM0A1 7 - -// #define TCCR0B _SFR_IO8(0x25) -char TCCR0B; -#define CS00 0 -#define CS01 1 -#define CS02 2 -#define WGM02 3 -#define FOC0B 6 -#define FOC0A 7 - -// #define TCNT0 _SFR_IO8(0x26) -char TCNT0; -#define TCNT0_0 0 -#define TCNT0_1 1 -#define TCNT0_2 2 -#define TCNT0_3 3 -#define TCNT0_4 4 -#define TCNT0_5 5 -#define TCNT0_6 6 -#define TCNT0_7 7 - -// #define OCR0A _SFR_IO8(0x27) -// #define OCR0A_0 0 -// #define OCR0A_1 1 -// #define OCR0A_2 2 -// #define OCR0A_3 3 -// #define OCR0A_4 4 -// #define OCR0A_5 5 -// #define OCR0A_6 6 -// #define OCR0A_7 7 - -// #define OCR0B _SFR_IO8(0x28) -// #define OCR0B_0 0 -// #define OCR0B_1 1 -// #define OCR0B_2 2 -// #define OCR0B_3 3 -// #define OCR0B_4 4 -// #define OCR0B_5 5 -// #define OCR0B_6 6 -// #define OCR0B_7 7 - -// #define GPIOR1 _SFR_IO8(0x2A) -// #define GPIOR10 0 -// #define GPIOR11 1 -// #define GPIOR12 2 -// #define GPIOR13 3 -// #define GPIOR14 4 -// #define GPIOR15 5 -// #define GPIOR16 6 -// #define GPIOR17 7 - -// #define GPIOR2 _SFR_IO8(0x2B) -// #define GPIOR20 0 -// #define GPIOR21 1 -// #define GPIOR22 2 -// #define GPIOR23 3 -// #define GPIOR24 4 -// #define GPIOR25 5 -// #define GPIOR26 6 -// #define GPIOR27 7 - -// #define SPCR _SFR_IO8(0x2C) -// #define SPR0 0 -// #define SPR1 1 -// #define CPHA 2 -// #define CPOL 3 -// #define MSTR 4 -// #define DORD 5 -// #define SPE 6 -// #define SPIE 7 - -// #define SPSR _SFR_IO8(0x2D) -// #define SPI2X 0 -// #define WCOL 6 -// #define SPIF 7 - -// #define SPDR _SFR_IO8(0x2E) -// #define SPDR0 0 -// #define SPDR1 1 -// #define SPDR2 2 -// #define SPDR3 3 -// #define SPDR4 4 -// #define SPDR5 5 -// #define SPDR6 6 -// #define SPDR7 7 - -// #define ACSR _SFR_IO8(0x30) -// #define ACIS0 0 -// #define ACIS1 1 -// #define ACIC 2 -// #define ACIE 3 -// #define ACI 4 -// #define ACO 5 -// #define ACBG 6 -// #define ACD 7 - -// #define SMCR _SFR_IO8(0x33) -// #define SE 0 -// #define SM0 1 -// #define SM1 2 -// #define SM2 3 - -// #define MCUSR _SFR_IO8(0x34) -// #define PORF 0 -// #define EXTRF 1 -// #define BORF 2 -// #define WDRF 3 - -// #define MCUCR _SFR_IO8(0x35) -// #define IVCE 0 -// #define IVSEL 1 -// #define PUD 4 -// #define BODSE 5 -// #define BODS 6 - -// #define SPMCSR _SFR_IO8(0x37) -// #define SELFPRGEN 0 -// #define PGERS 1 -// #define PGWRT 2 -// #define BLBSET 3 -// #define RWWSRE 4 -// #define RWWSB 6 -// #define SPMIE 7 - -// #define WDTCSR _SFR_MEM8(0x60) -// #define WDP0 0 -// #define WDP1 1 -// #define WDP2 2 -// #define WDE 3 -// #define WDCE 4 -// #define WDP3 5 -// #define WDIE 6 -// #define WDIF 7 - -// #define CLKPR _SFR_MEM8(0x61) -// #define CLKPS0 0 -// #define CLKPS1 1 -// #define CLKPS2 2 -// #define CLKPS3 3 -// #define CLKPCE 7 - -// #define PRR _SFR_MEM8(0x64) -// #define PRADC 0 -// #define PRUSART0 1 -// #define PRSPI 2 -// #define PRTIM1 3 -// #define PRTIM0 5 -// #define PRTIM2 6 -// #define PRTWI 7 - -// #define OSCCAL _SFR_MEM8(0x66) -// #define CAL0 0 -// #define CAL1 1 -// #define CAL2 2 -// #define CAL3 3 -// #define CAL4 4 -// #define CAL5 5 -// #define CAL6 6 -// #define CAL7 7 - -// #define PCICR _SFR_MEM8(0x68) -// #define PCIE0 0 -// #define PCIE1 1 -// #define PCIE2 2 - -// #define EICRA _SFR_MEM8(0x69) -// #define ISC00 0 -// #define ISC01 1 -// #define ISC10 2 -// #define ISC11 3 - -// #define PCMSK0 _SFR_MEM8(0x6B) -// #define PCINT0 0 -// #define PCINT1 1 -// #define PCINT2 2 -// #define PCINT3 3 -// #define PCINT4 4 -// #define PCINT5 5 -// #define PCINT6 6 -// #define PCINT7 7 - -// #define PCMSK1 _SFR_MEM8(0x6C) -// #define PCINT8 0 -// #define PCINT9 1 -// #define PCINT10 2 -// #define PCINT11 3 -// #define PCINT12 4 -// #define PCINT13 5 -// #define PCINT14 6 - -// #define PCMSK2 _SFR_MEM8(0x6D) -// #define PCINT16 0 -// #define PCINT17 1 -// #define PCINT18 2 -// #define PCINT19 3 -// #define PCINT20 4 -// #define PCINT21 5 -// #define PCINT22 6 -// #define PCINT23 7 - -// #define TIMSK0 _SFR_MEM8(0x6E) -char TIMSK0; -#define TOIE0 0 -#define OCIE0A 1 -#define OCIE0B 2 - -// #define TIMSK1 _SFR_MEM8(0x6F) -// #define TOIE1 0 -// #define OCIE1A 1 -// #define OCIE1B 2 -// #define ICIE1 5 - -// #define TIMSK2 _SFR_MEM8(0x70) -// #define TOIE2 0 -// #define OCIE2A 1 -// #define OCIE2B 2 - -// #ifndef __ASSEMBLER__ -// #define ADC _SFR_MEM16(0x78) -// #endif -// #define ADCW _SFR_MEM16(0x78) - -// #define ADCL _SFR_MEM8(0x78) -// #define ADCL0 0 -// #define ADCL1 1 -// #define ADCL2 2 -// #define ADCL3 3 -// #define ADCL4 4 -// #define ADCL5 5 -// #define ADCL6 6 -// #define ADCL7 7 - -// #define ADCH _SFR_MEM8(0x79) -// #define ADCH0 0 -// #define ADCH1 1 -// #define ADCH2 2 -// #define ADCH3 3 -// #define ADCH4 4 -// #define ADCH5 5 -// #define ADCH6 6 -// #define ADCH7 7 - -// #define ADCSRA _SFR_MEM8(0x7A) -// #define ADPS0 0 -// #define ADPS1 1 -// #define ADPS2 2 -// #define ADIE 3 -// #define ADIF 4 -// #define ADATE 5 -// #define ADSC 6 -// #define ADEN 7 - -// #define ADCSRB _SFR_MEM8(0x7B) -// #define ADTS0 0 -// #define ADTS1 1 -// #define ADTS2 2 -// #define ACME 6 - -// #define ADMUX _SFR_MEM8(0x7C) -// #define MUX0 0 -// #define MUX1 1 -// #define MUX2 2 -// #define MUX3 3 -// #define ADLAR 5 -// #define REFS0 6 -// #define REFS1 7 - -// #define DIDR0 _SFR_MEM8(0x7E) -// #define ADC0D 0 -// #define ADC1D 1 -// #define ADC2D 2 -// #define ADC3D 3 -// #define ADC4D 4 -// #define ADC5D 5 - -// #define DIDR1 _SFR_MEM8(0x7F) -// #define AIN0D 0 -// #define AIN1D 1 - -// #define TCCR1A _SFR_MEM8(0x80) -// #define WGM10 0 -// #define WGM11 1 -// #define COM1B0 4 -// #define COM1B1 5 -// #define COM1A0 6 -// #define COM1A1 7 - -// #define TCCR1B _SFR_MEM8(0x81) -// #define CS10 0 -// #define CS11 1 -// #define CS12 2 -// #define WGM12 3 -// #define WGM13 4 -// #define ICES1 6 -// #define ICNC1 7 - -// #define TCCR1C _SFR_MEM8(0x82) -// #define FOC1B 6 -// #define FOC1A 7 - -// #define TCNT1 _SFR_MEM16(0x84) - -// #define TCNT1L _SFR_MEM8(0x84) -// #define TCNT1L0 0 -// #define TCNT1L1 1 -// #define TCNT1L2 2 -// #define TCNT1L3 3 -// #define TCNT1L4 4 -// #define TCNT1L5 5 -// #define TCNT1L6 6 -// #define TCNT1L7 7 - -// #define TCNT1H _SFR_MEM8(0x85) -// #define TCNT1H0 0 -// #define TCNT1H1 1 -// #define TCNT1H2 2 -// #define TCNT1H3 3 -// #define TCNT1H4 4 -// #define TCNT1H5 5 -// #define TCNT1H6 6 -// #define TCNT1H7 7 - -// #define ICR1 _SFR_MEM16(0x86) - -// #define ICR1L _SFR_MEM8(0x86) -// #define ICR1L0 0 -// #define ICR1L1 1 -// #define ICR1L2 2 -// #define ICR1L3 3 -// #define ICR1L4 4 -// #define ICR1L5 5 -// #define ICR1L6 6 -// #define ICR1L7 7 - -// #define ICR1H _SFR_MEM8(0x87) -// #define ICR1H0 0 -// #define ICR1H1 1 -// #define ICR1H2 2 -// #define ICR1H3 3 -// #define ICR1H4 4 -// #define ICR1H5 5 -// #define ICR1H6 6 -// #define ICR1H7 7 - -// #define OCR1A _SFR_MEM16(0x88) - -// #define OCR1AL _SFR_MEM8(0x88) -// #define OCR1AL0 0 -// #define OCR1AL1 1 -// #define OCR1AL2 2 -// #define OCR1AL3 3 -// #define OCR1AL4 4 -// #define OCR1AL5 5 -// #define OCR1AL6 6 -// #define OCR1AL7 7 - -// #define OCR1AH _SFR_MEM8(0x89) -// #define OCR1AH0 0 -// #define OCR1AH1 1 -// #define OCR1AH2 2 -// #define OCR1AH3 3 -// #define OCR1AH4 4 -// #define OCR1AH5 5 -// #define OCR1AH6 6 -// #define OCR1AH7 7 - -// #define OCR1B _SFR_MEM16(0x8A) - -// #define OCR1BL _SFR_MEM8(0x8A) -// #define OCR1BL0 0 -// #define OCR1BL1 1 -// #define OCR1BL2 2 -// #define OCR1BL3 3 -// #define OCR1BL4 4 -// #define OCR1BL5 5 -// #define OCR1BL6 6 -// #define OCR1BL7 7 - -// #define OCR1BH _SFR_MEM8(0x8B) -// #define OCR1BH0 0 -// #define OCR1BH1 1 -// #define OCR1BH2 2 -// #define OCR1BH3 3 -// #define OCR1BH4 4 -// #define OCR1BH5 5 -// #define OCR1BH6 6 -// #define OCR1BH7 7 - -// #define TCCR2A _SFR_MEM8(0xB0) -// #define WGM20 0 -// #define WGM21 1 -// #define COM2B0 4 -// #define COM2B1 5 -// #define COM2A0 6 -// #define COM2A1 7 - -// #define TCCR2B _SFR_MEM8(0xB1) -// #define CS20 0 -// #define CS21 1 -// #define CS22 2 -// #define WGM22 3 -// #define FOC2B 6 -// #define FOC2A 7 - -// #define TCNT2 _SFR_MEM8(0xB2) -// #define TCNT2_0 0 -// #define TCNT2_1 1 -// #define TCNT2_2 2 -// #define TCNT2_3 3 -// #define TCNT2_4 4 -// #define TCNT2_5 5 -// #define TCNT2_6 6 -// #define TCNT2_7 7 - -// #define OCR2A _SFR_MEM8(0xB3) -// #define OCR2_0 0 -// #define OCR2_1 1 -// #define OCR2_2 2 -// #define OCR2_3 3 -// #define OCR2_4 4 -// #define OCR2_5 5 -// #define OCR2_6 6 -// #define OCR2_7 7 - -// #define OCR2B _SFR_MEM8(0xB4) -// #define OCR2_0 0 -// #define OCR2_1 1 -// #define OCR2_2 2 -// #define OCR2_3 3 -// #define OCR2_4 4 -// #define OCR2_5 5 -// #define OCR2_6 6 -// #define OCR2_7 7 - -// #define ASSR _SFR_MEM8(0xB6) -// #define TCR2BUB 0 -// #define TCR2AUB 1 -// #define OCR2BUB 2 -// #define OCR2AUB 3 -// #define TCN2UB 4 -// #define AS2 5 -// #define EXCLK 6 - -// #define TWBR _SFR_MEM8(0xB8) -// #define TWBR0 0 -// #define TWBR1 1 -// #define TWBR2 2 -// #define TWBR3 3 -// #define TWBR4 4 -// #define TWBR5 5 -// #define TWBR6 6 -// #define TWBR7 7 - -// #define TWSR _SFR_MEM8(0xB9) -// #define TWPS0 0 -// #define TWPS1 1 -// #define TWS3 3 -// #define TWS4 4 -// #define TWS5 5 -// #define TWS6 6 -// #define TWS7 7 - -// #define TWAR _SFR_MEM8(0xBA) -// #define TWGCE 0 -// #define TWA0 1 -// #define TWA1 2 -// #define TWA2 3 -// #define TWA3 4 -// #define TWA4 5 -// #define TWA5 6 -// #define TWA6 7 - -// #define TWDR _SFR_MEM8(0xBB) -// #define TWD0 0 -// #define TWD1 1 -// #define TWD2 2 -// #define TWD3 3 -// #define TWD4 4 -// #define TWD5 5 -// #define TWD6 6 -// #define TWD7 7 - -// #define TWCR _SFR_MEM8(0xBC) -// #define TWIE 0 -// #define TWEN 2 -// #define TWWC 3 -// #define TWSTO 4 -// #define TWSTA 5 -// #define TWEA 6 -// #define TWINT 7 - -// #define TWAMR _SFR_MEM8(0xBD) -// #define TWAM0 0 -// #define TWAM1 1 -// #define TWAM2 2 -// #define TWAM3 3 -// #define TWAM4 4 -// #define TWAM5 5 -// #define TWAM6 6 - -// #define UCSR0A _SFR_MEM8(0xC0) -// #define MPCM0 0 -// #define U2X0 1 -// #define UPE0 2 -// #define DOR0 3 -// #define FE0 4 -// #define UDRE0 5 -// #define TXC0 6 -// #define RXC0 7 - -// #define UCSR0B _SFR_MEM8(0xC1) -// #define TXB80 0 -// #define RXB80 1 -// #define UCSZ02 2 -// #define TXEN0 3 -// #define RXEN0 4 -// #define UDRIE0 5 -// #define TXCIE0 6 -// #define RXCIE0 7 - -// #define UCSR0C _SFR_MEM8(0xC2) -// #define UCPOL0 0 -// #define UCSZ00 1 -// #define UCPHA0 1 -// #define UCSZ01 2 -// #define UDORD0 2 -// #define USBS0 3 -// #define UPM00 4 -// #define UPM01 5 -// #define UMSEL00 6 -// #define UMSEL01 7 - -// #define UBRR0 _SFR_MEM16(0xC4) - -// #define UBRR0L _SFR_MEM8(0xC4) -// #define UBRR0_0 0 -// #define UBRR0_1 1 -// #define UBRR0_2 2 -// #define UBRR0_3 3 -// #define UBRR0_4 4 -// #define UBRR0_5 5 -// #define UBRR0_6 6 -// #define UBRR0_7 7 - -// #define UBRR0H _SFR_MEM8(0xC5) -// #define UBRR0_8 0 -// #define UBRR0_9 1 -// #define UBRR0_10 2 -// #define UBRR0_11 3 - -// #define UDR0 _SFR_MEM8(0xC6) -// #define UDR0_0 0 -// #define UDR0_1 1 -// #define UDR0_2 2 -// #define UDR0_3 3 -// #define UDR0_4 4 -// #define UDR0_5 5 -// #define UDR0_6 6 -// #define UDR0_7 7 - - - -// /* Interrupt Vectors */ -// /* Interrupt Vector 0 is the reset vector. */ -// #define INT0_vect _VECTOR(1) /* External Interrupt Request 0 */ -// #define INT1_vect _VECTOR(2) /* External Interrupt Request 1 */ -// #define PCINT0_vect _VECTOR(3) /* Pin Change Interrupt Request 0 */ -// #define PCINT1_vect _VECTOR(4) /* Pin Change Interrupt Request 0 */ -// #define PCINT2_vect _VECTOR(5) /* Pin Change Interrupt Request 1 */ -// #define WDT_vect _VECTOR(6) /* Watchdog Time-out Interrupt */ -// #define TIMER2_COMPA_vect _VECTOR(7) /* Timer/Counter2 Compare Match A */ -// #define TIMER2_COMPB_vect _VECTOR(8) /* Timer/Counter2 Compare Match A */ -// #define TIMER2_OVF_vect _VECTOR(9) /* Timer/Counter2 Overflow */ -// #define TIMER1_CAPT_vect _VECTOR(10) /* Timer/Counter1 Capture Event */ -// #define TIMER1_COMPA_vect _VECTOR(11) /* Timer/Counter1 Compare Match A */ -// #define TIMER1_COMPB_vect _VECTOR(12) /* Timer/Counter1 Compare Match B */ -// #define TIMER1_OVF_vect _VECTOR(13) /* Timer/Counter1 Overflow */ -// #define TIMER0_COMPA_vect _VECTOR(14) /* TimerCounter0 Compare Match A */ -// #define TIMER0_COMPB_vect _VECTOR(15) /* TimerCounter0 Compare Match B */ -// #define TIMER0_OVF_vect _VECTOR(16) /* Timer/Couner0 Overflow */ -// #define SPI_STC_vect _VECTOR(17) /* SPI Serial Transfer Complete */ -// #define USART_RX_vect _VECTOR(18) /* USART Rx Complete */ -// #define USART_UDRE_vect _VECTOR(19) /* USART, Data Register Empty */ -// #define USART_TX_vect _VECTOR(20) /* USART Tx Complete */ -// #define ADC_vect _VECTOR(21) /* ADC Conversion Complete */ -// #define EE_READY_vect _VECTOR(22) /* EEPROM Ready */ -// #define ANALOG_COMP_vect _VECTOR(23) /* Analog Comparator */ -// #define TWI_vect _VECTOR(24) /* Two-wire Serial Interface */ -// #define SPM_READY_vect _VECTOR(25) /* Store Program Memory Read */ - -// #define _VECTORS_SIZE (26 * 4) - - - -// /* Constants */ -// #define SPM_PAGESIZE 128 -// #define RAMEND 0x8FF /* Last On-Chip SRAM Location */ -// #define XRAMSIZE 0 -// #define XRAMEND RAMEND -// #define E2END 0x3FF -// #define E2PAGESIZE 4 -// #define FLASHEND 0x7FFF - - - -// /* Fuses */ -// #define FUSE_MEMORY_SIZE 3 - -// /* Low Fuse Byte */ -// #define FUSE_CKSEL0 (unsigned char)~_BV(0) /* Select Clock Source */ -// #define FUSE_CKSEL1 (unsigned char)~_BV(1) /* Select Clock Source */ -// #define FUSE_CKSEL2 (unsigned char)~_BV(2) /* Select Clock Source */ -// #define FUSE_CKSEL3 (unsigned char)~_BV(3) /* Select Clock Source */ -// #define FUSE_SUT0 (unsigned char)~_BV(4) /* Select start-up time */ -// #define FUSE_SUT1 (unsigned char)~_BV(5) /* Select start-up time */ -// #define FUSE_CKOUT (unsigned char)~_BV(6) /* Clock output */ -// #define FUSE_CKDIV8 (unsigned char)~_BV(7) /* Divide clock by 8 */ -// #define LFUSE_DEFAULT (FUSE_CKSEL0 & FUSE_CKSEL2 & FUSE_CKSEL3 & FUSE_SUT0 & FUSE_CKDIV8) - -// /* High Fuse Byte */ -// #define FUSE_BODLEVEL0 (unsigned char)~_BV(0) /* Brown-out Detector trigger level */ -// #define FUSE_BODLEVEL1 (unsigned char)~_BV(1) /* Brown-out Detector trigger level */ -// #define FUSE_BODLEVEL2 (unsigned char)~_BV(2) /* Brown-out Detector trigger level */ -// #define FUSE_EESAVE (unsigned char)~_BV(3) /* EEPROM memory is preserved through chip erase */ -// #define FUSE_WDTON (unsigned char)~_BV(4) /* Watchdog Timer Always On */ -// #define FUSE_SPIEN (unsigned char)~_BV(5) /* Enable Serial programming and Data Downloading */ -// #define FUSE_DWEN (unsigned char)~_BV(6) /* debugWIRE Enable */ -// #define FUSE_RSTDISBL (unsigned char)~_BV(7) /* External reset disable */ -// #define HFUSE_DEFAULT (FUSE_SPIEN) - -// /* Extended Fuse Byte */ -// #define FUSE_BOOTRST (unsigned char)~_BV(0) -// #define FUSE_BOOTSZ0 (unsigned char)~_BV(1) -// #define FUSE_BOOTSZ1 (unsigned char)~_BV(2) -// #define EFUSE_DEFAULT (FUSE_BOOTSZ0 & FUSE_BOOTSZ1) - - - -// /* Lock Bits */ -// #define __LOCK_BITS_EXIST -// #define __BOOT_LOCK_BITS_0_EXIST -// #define __BOOT_LOCK_BITS_1_EXIST - - -// /* Signature */ -// #define SIGNATURE_0 0x1E -// #define SIGNATURE_1 0x95 -// #define SIGNATURE_2 0x0F - - -#endif /* _AVR_IOM328P_H_ */ diff --git a/examples/blinky/test/support/stub_sfr_defs.h b/examples/blinky/test/support/stub_sfr_defs.h deleted file mode 100644 index 2107c24cf..000000000 --- a/examples/blinky/test/support/stub_sfr_defs.h +++ /dev/null @@ -1,270 +0,0 @@ - -/* Copyright (c) 2002, Marek Michalkiewicz - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - - * Neither the name of the copyright holders nor the names of - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. */ - -/* avr/sfr_defs.h - macros for accessing AVR special function registers */ - -/* $Id: sfr_defs.h,v 1.18.2.1 2008/04/28 22:05:42 arcanum Exp $ */ - -#ifndef _AVR_SFR_DEFS_H_ -#define _AVR_SFR_DEFS_H_ 1 - -/** \defgroup avr_sfr_notes Additional notes from - \ingroup avr_sfr - - The \c file is included by all of the \c - files, which use macros defined here to make the special function register - definitions look like C variables or simple constants, depending on the - _SFR_ASM_COMPAT define. Some examples from \c to - show how to define such macros: - -\code -#define PORTA _SFR_IO8(0x02) -#define EEAR _SFR_IO16(0x21) -#define UDR0 _SFR_MEM8(0xC6) -#define TCNT3 _SFR_MEM16(0x94) -#define CANIDT _SFR_MEM32(0xF0) -\endcode - - If \c _SFR_ASM_COMPAT is not defined, C programs can use names like - PORTA directly in C expressions (also on the left side of - assignment operators) and GCC will do the right thing (use short I/O - instructions if possible). The \c __SFR_OFFSET definition is not used in - any way in this case. - - Define \c _SFR_ASM_COMPAT as 1 to make these names work as simple constants - (addresses of the I/O registers). This is necessary when included in - preprocessed assembler (*.S) source files, so it is done automatically if - \c __ASSEMBLER__ is defined. By default, all addresses are defined as if - they were memory addresses (used in \c lds/sts instructions). To use these - addresses in \c in/out instructions, you must subtract 0x20 from them. - - For more backwards compatibility, insert the following at the start of your - old assembler source file: - -\code -#define __SFR_OFFSET 0 -\endcode - - This automatically subtracts 0x20 from I/O space addresses, but it's a - hack, so it is recommended to change your source: wrap such addresses in - macros defined here, as shown below. After this is done, the - __SFR_OFFSET definition is no longer necessary and can be removed. - - Real example - this code could be used in a boot loader that is portable - between devices with \c SPMCR at different addresses. - -\verbatim -: #define SPMCR _SFR_IO8(0x37) -: #define SPMCR _SFR_MEM8(0x68) -\endverbatim - -\code -#if _SFR_IO_REG_P(SPMCR) - out _SFR_IO_ADDR(SPMCR), r24 -#else - sts _SFR_MEM_ADDR(SPMCR), r24 -#endif -\endcode - - You can use the \c in/out/cbi/sbi/sbic/sbis instructions, without the - _SFR_IO_REG_P test, if you know that the register is in the I/O - space (as with \c SREG, for example). If it isn't, the assembler will - complain (I/O address out of range 0...0x3f), so this should be fairly - safe. - - If you do not define \c __SFR_OFFSET (so it will be 0x20 by default), all - special register addresses are defined as memory addresses (so \c SREG is - 0x5f), and (if code size and speed are not important, and you don't like - the ugly \#if above) you can always use lds/sts to access them. But, this - will not work if __SFR_OFFSET != 0x20, so use a different macro - (defined only if __SFR_OFFSET == 0x20) for safety: - -\code - sts _SFR_ADDR(SPMCR), r24 -\endcode - - In C programs, all 3 combinations of \c _SFR_ASM_COMPAT and - __SFR_OFFSET are supported - the \c _SFR_ADDR(SPMCR) macro can be - used to get the address of the \c SPMCR register (0x57 or 0x68 depending on - device). */ - -#ifdef __ASSEMBLER__ -#define _SFR_ASM_COMPAT 1 -#elif !defined(_SFR_ASM_COMPAT) -#define _SFR_ASM_COMPAT 0 -#endif - -#ifndef __ASSEMBLER__ -/* These only work in C programs. */ -#include - -#define _MMIO_BYTE(mem_addr) (*(volatile uint8_t *)(mem_addr)) -#define _MMIO_WORD(mem_addr) (*(volatile uint16_t *)(mem_addr)) -#define _MMIO_DWORD(mem_addr) (*(volatile uint32_t *)(mem_addr)) -#endif - -#if _SFR_ASM_COMPAT - -#ifndef __SFR_OFFSET -/* Define as 0 before including this file for compatibility with old asm - sources that don't subtract __SFR_OFFSET from symbolic I/O addresses. */ -# if __AVR_ARCH__ >= 100 -# define __SFR_OFFSET 0x00 -# else -# define __SFR_OFFSET 0x20 -# endif -#endif - -#if (__SFR_OFFSET != 0) && (__SFR_OFFSET != 0x20) -#error "__SFR_OFFSET must be 0 or 0x20" -#endif - -#define _SFR_MEM8(mem_addr) (mem_addr) -#define _SFR_MEM16(mem_addr) (mem_addr) -#define _SFR_MEM32(mem_addr) (mem_addr) -#define _SFR_IO8(io_addr) ((io_addr) + __SFR_OFFSET) -#define _SFR_IO16(io_addr) ((io_addr) + __SFR_OFFSET) - -#define _SFR_IO_ADDR(sfr) ((sfr) - __SFR_OFFSET) -#define _SFR_MEM_ADDR(sfr) (sfr) -#define _SFR_IO_REG_P(sfr) ((sfr) < 0x40 + __SFR_OFFSET) - -#if (__SFR_OFFSET == 0x20) -/* No need to use ?: operator, so works in assembler too. */ -#define _SFR_ADDR(sfr) _SFR_MEM_ADDR(sfr) -#elif !defined(__ASSEMBLER__) -#define _SFR_ADDR(sfr) (_SFR_IO_REG_P(sfr) ? (_SFR_IO_ADDR(sfr) + 0x20) : _SFR_MEM_ADDR(sfr)) -#endif - -#else /* !_SFR_ASM_COMPAT */ - -#ifndef __SFR_OFFSET -# if __AVR_ARCH__ >= 100 -# define __SFR_OFFSET 0x00 -# else -# define __SFR_OFFSET 0x20 -# endif -#endif - -#define _SFR_MEM8(mem_addr) _MMIO_BYTE(mem_addr) -#define _SFR_MEM16(mem_addr) _MMIO_WORD(mem_addr) -#define _SFR_MEM32(mem_addr) _MMIO_DWORD(mem_addr) -#define _SFR_IO8(io_addr) _MMIO_BYTE((io_addr) + __SFR_OFFSET) -#define _SFR_IO16(io_addr) _MMIO_WORD((io_addr) + __SFR_OFFSET) - -#define _SFR_MEM_ADDR(sfr) ((uint16_t) &(sfr)) -#define _SFR_IO_ADDR(sfr) (_SFR_MEM_ADDR(sfr) - __SFR_OFFSET) -#define _SFR_IO_REG_P(sfr) (_SFR_MEM_ADDR(sfr) < 0x40 + __SFR_OFFSET) - -#define _SFR_ADDR(sfr) _SFR_MEM_ADDR(sfr) - -#endif /* !_SFR_ASM_COMPAT */ - -#define _SFR_BYTE(sfr) _MMIO_BYTE(_SFR_ADDR(sfr)) -#define _SFR_WORD(sfr) _MMIO_WORD(_SFR_ADDR(sfr)) -#define _SFR_DWORD(sfr) _MMIO_DWORD(_SFR_ADDR(sfr)) - -/** \name Bit manipulation */ - -/*@{*/ -/** \def _BV - \ingroup avr_sfr - - \code #include \endcode - - Converts a bit number into a byte value. - - \note The bit shift is performed by the compiler which then inserts the - result into the code. Thus, there is no run-time overhead when using - _BV(). */ - -#define _BV(bit) (1 << (bit)) - -/*@}*/ - -#ifndef _VECTOR -#define _VECTOR(N) __vector_ ## N -#endif - -#ifndef __ASSEMBLER__ - - -/** \name IO register bit manipulation */ - -/*@{*/ - - - -/** \def bit_is_set - \ingroup avr_sfr - - \code #include \endcode - - Test whether bit \c bit in IO register \c sfr is set. - This will return a 0 if the bit is clear, and non-zero - if the bit is set. */ - -#define bit_is_set(sfr, bit) (_SFR_BYTE(sfr) & _BV(bit)) - -/** \def bit_is_clear - \ingroup avr_sfr - - \code #include \endcode - - Test whether bit \c bit in IO register \c sfr is clear. - This will return non-zero if the bit is clear, and a 0 - if the bit is set. */ - -#define bit_is_clear(sfr, bit) (!(_SFR_BYTE(sfr) & _BV(bit))) - -/** \def loop_until_bit_is_set - \ingroup avr_sfr - - \code #include \endcode - - Wait until bit \c bit in IO register \c sfr is set. */ - -#define loop_until_bit_is_set(sfr, bit) do { } while (bit_is_clear(sfr, bit)) - -/** \def loop_until_bit_is_clear - \ingroup avr_sfr - - \code #include \endcode - - Wait until bit \c bit in IO register \c sfr is clear. */ - -#define loop_until_bit_is_clear(sfr, bit) do { } while (bit_is_set(sfr, bit)) - -/*@}*/ - -#endif /* !__ASSEMBLER__ */ - -#endif /* _SFR_DEFS_H_ */ diff --git a/examples/blinky/test/test_BlinkTask.c b/examples/blinky/test/test_BlinkTask.c deleted file mode 100644 index 73f2958d1..000000000 --- a/examples/blinky/test/test_BlinkTask.c +++ /dev/null @@ -1,49 +0,0 @@ -/* ========================================================================= - Ceedling - Test-Centered Build System for C - ThrowTheSwitch.org - Copyright (c) 2010-24 Mike Karlesky, Mark VanderVoord, & Greg Williams - SPDX-License-Identifier: MIT -========================================================================= */ - -#include "unity.h" -#include "BlinkTask.h" -#include "stub_io.h" - -// every test file requires this function -// setUp() is called by the generated runner before each test case function -void setUp(void) -{ - PORTB = 0; -} - -// every test file requires this function -// tearDown() is called by the generated runner before each test case function -void tearDown(void) -{ -} - -void test_BlinkTask_should_toggle_led(void) -{ - /* Ensure known test state */ - - /* Setup expected call chain */ - - /* Call function under test */ - BlinkTask(); - - /* Verify test results */ - TEST_ASSERT_EQUAL_HEX8(0x20, PORTB); -} -void test_BlinkTask_should_toggle_led_LOW(void) -{ - /* Ensure known test state */ - PORTB = 0x20; - - /* Setup expected call chain */ - - /* Call function under test */ - BlinkTask(); - - /* Verify test results */ - TEST_ASSERT_EQUAL_HEX8(0, PORTB); -} diff --git a/examples/blinky/test/test_Configure.c b/examples/blinky/test/test_Configure.c deleted file mode 100644 index e6b7d6016..000000000 --- a/examples/blinky/test/test_Configure.c +++ /dev/null @@ -1,36 +0,0 @@ -/* ========================================================================= - Ceedling - Test-Centered Build System for C - ThrowTheSwitch.org - Copyright (c) 2010-24 Mike Karlesky, Mark VanderVoord, & Greg Williams - SPDX-License-Identifier: MIT -========================================================================= */ - -#include "unity.h" -#include "Configure.h" -#include "stub_io.h" -#include "mock_stub_interrupt.h" - -void setUp(void) -{ -} - -void tearDown(void) -{ -} - -void test_Configure_should_setup_timer_and_port(void) - { - /* Ensure known test state */ - - /* Setup expected call chain */ - //these are defined into assembly instructions. - cli_Expect(); - sei_Expect(); - /* Call function under test */ - Configure(); - - /* Verify test results */ - TEST_ASSERT_EQUAL_INT(3, TCCR0B); - TEST_ASSERT_EQUAL_INT(1, TIMSK0); - TEST_ASSERT_EQUAL_INT(0x20, DDRB); -} diff --git a/examples/blinky/test/test_main.c b/examples/blinky/test/test_main.c deleted file mode 100644 index ba11e4b96..000000000 --- a/examples/blinky/test/test_main.c +++ /dev/null @@ -1,67 +0,0 @@ -/* ========================================================================= - Ceedling - Test-Centered Build System for C - ThrowTheSwitch.org - Copyright (c) 2010-24 Mike Karlesky, Mark VanderVoord, & Greg Williams - SPDX-License-Identifier: MIT -========================================================================= */ - -#include "unity.h" -#include "main.h" -#include "stub_io.h" -#include "mock_Configure.h" -#include "mock_BlinkTask.h" -void setUp(void) {} // every test file requires this function; - // setUp() is called by the generated runner before each test case function -void tearDown(void) {} // every test file requires this function; - // tearDown() is called by the generated runner before each test case function - -void test_AppMain_should_call_configure(void) -{ - /* Ensure known test state */ - BlinkTaskReady=0; - /* Setup expected call chain */ - Configure_Expect(); - /* Call function under test */ - AppMain(); - - /* Verify test results */ - TEST_ASSERT_EQUAL_INT(0, BlinkTaskReady); -} -void test_AppMain_should_call_configure_and_BlinkTask(void) -{ - /* Ensure known test state */ - BlinkTaskReady=1; - /* Setup expected call chain */ - Configure_Expect(); - BlinkTask_Expect(); - /* Call function under test */ - AppMain(); - - /* Verify test results */ - TEST_ASSERT_EQUAL_INT(0, BlinkTaskReady); -} -void test_ISR_should_increment_tick(void) -{ - /* Ensure known test state */ - tick = 0; - /* Setup expected call chain */ - - /* Call function under test */ - ISR(); - - /* Verify test results */ - TEST_ASSERT_EQUAL_INT(1, tick); -} -void test_ISR_should_set_blinkReady_increment_tick(void) -{ - /* Ensure known test state */ - tick = 1000; - /* Setup expected call chain */ - - /* Call function under test */ - ISR(); - - /* Verify test results */ - TEST_ASSERT_EQUAL_INT(1, tick); - TEST_ASSERT_EQUAL_INT(1, BlinkTaskReady); -} diff --git a/examples/temp_sensor/README.md b/examples/temp_sensor/README.md new file mode 100644 index 000000000..b4557413a --- /dev/null +++ b/examples/temp_sensor/README.md @@ -0,0 +1,18 @@ +# Ceedling Temp-Sensor Example + +*Welcome to the Temp-Sensor Example!* This is a medium-sized example of how Ceedling +might work in your system. You can use it to verify you have all the tools installed. +You can use it as a starting point for your own code. You can build upon it for your +own creations, though honestly it's a bit of a mess. While it has some good ideas in +it, really it serves as a testing ground for some of Ceedling's features, and a place +for you to explore how Ceedling works. + +You'll find all the source files in the `src` folder. You'll find all the tests in +(you guessed it) the `test` folder (and its sub-folders). There are also some files +in the `test/support` folder, which demonstrate how you can create your own assertions. + +This project assumes you have `gcov` and `gcovr` installed for collecting coverage +information. If that's not true, you can just remove the `gcov` plugin from the +`plugins` list. Everything else will work fine. + +Have fun poking around! diff --git a/examples/temp_sensor/mixin/add_unity_helper.yml b/examples/temp_sensor/mixin/add_unity_helper.yml new file mode 100644 index 000000000..c24772311 --- /dev/null +++ b/examples/temp_sensor/mixin/add_unity_helper.yml @@ -0,0 +1,20 @@ +# ========================================================================= +# Ceedling - Test-Centered Build System for C +# ThrowTheSwitch.org +# Copyright (c) 2010-24 Mike Karlesky, Mark VanderVoord, & Greg Williams +# SPDX-License-Identifier: MIT +# ========================================================================= + +--- + +# Enable the unity helper's define to enable our custom assertion +:defines: + :test: + - TEST_CUSTOM_EXAMPLE_STRUCT_T + :release: [] + +# Add the unity helper configuration to cmock +:cmock: + :unity_helper_path: + - test/support/UnityHelper.h +... diff --git a/examples/temp_sensor/project.yml b/examples/temp_sensor/project.yml index 601227f46..2ff20b2b8 100644 --- a/examples/temp_sensor/project.yml +++ b/examples/temp_sensor/project.yml @@ -40,6 +40,12 @@ :use_assembly: FALSE :artifacts: [] +# Specify where to find mixins and any that should be enabled automatically +:mixins: + :enabled: [] + :load_paths: + - mixin + # Plugins are optional Ceedling features which can be enabled. Ceedling supports # a variety of plugins which may effect the way things are compiled, reported, # or may provide new command options. Refer to the readme in each plugin for diff --git a/examples/temp_sensor/test/support/UnityHelper.c b/examples/temp_sensor/test/support/UnityHelper.c index 4cbeab255..3513ae070 100644 --- a/examples/temp_sensor/test/support/UnityHelper.c +++ b/examples/temp_sensor/test/support/UnityHelper.c @@ -9,11 +9,11 @@ #include "unity_internals.h" #include "UnityHelper.h" -#if 0 -void AssertEqualMyDataType(const MyDataType_T expected, const MyDataType_T actual, const unsigned short line) +#if TEST_CUSTOM_EXAMPLE_STRUCT_T +void AssertEqualEXAMPLE_STRUCT_T(const EXAMPLE_STRUCT_T expected, const EXAMPLE_STRUCT_T actual, const unsigned short line) { - UNITY_TEST_ASSERT_EQUAL_INT(expected.length, actual.length, line, "MyDataType_T.length check failed"); - UNITY_TEST_ASSERT_EQUAL_MEMORY(expected.buffer, actual.buffer, expected.length, line, "MyDataType_T.buffer check failed"); + UNITY_TEST_ASSERT_EQUAL_INT(expected.x, actual.x, line, "EXAMPLE_STRUCT_T.x check failed"); + UNITY_TEST_ASSERT_EQUAL_INT(expected.y, actual.y, line, "EXAMPLE_STRUCT_T.y check failed"); } #endif diff --git a/examples/temp_sensor/test/support/UnityHelper.h b/examples/temp_sensor/test/support/UnityHelper.h index 08ef36d3a..bc536b0ed 100755 --- a/examples/temp_sensor/test/support/UnityHelper.h +++ b/examples/temp_sensor/test/support/UnityHelper.h @@ -8,12 +8,10 @@ #ifndef _TESTHELPER_H #define _TESTHELPER_H -// #include "MyTypes.h" - -#if 0 -void AssertEqualMyDataType(const MyDataType_T expected, const MyDataType_T actual, const unsigned short line); - -#define UNITY_TEST_ASSERT_EQUAL_MyDataType_T(expected, actual, line, message) {AssertEqualMyDataType(expected, actual, line);} +#if TEST_CUSTOM_EXAMPLE_STRUCT_T +#include "Types.h" +void AssertEqualEXAMPLE_STRUCT_T(const EXAMPLE_STRUCT_T expected, const EXAMPLE_STRUCT_T actual, const unsigned short line); +#define UNITY_TEST_ASSERT_EQUAL_EXAMPLE_STRUCT_T(expected, actual, line, message) {AssertEqualEXAMPLE_STRUCT_T(expected, actual, line);} #endif #endif // _TESTHELPER_H diff --git a/lib/ceedling/streaminator.rb b/lib/ceedling/streaminator.rb index 5c96330c2..d48ca70f7 100644 --- a/lib/ceedling/streaminator.rb +++ b/lib/ceedling/streaminator.rb @@ -32,6 +32,9 @@ def stream_puts(string, verbosity=Verbosity::NORMAL, stream=nil) # write to log as though Verbosity::OBNOXIOUS @loginator.log( string, @streaminator_helper.extract_name(stream) ) + # Flatten if needed + string = string.flatten.join('\n') if (string.class == Array) + # Only stream when message reaches current verbosity level if (@verbosinator.should_output?(verbosity)) diff --git a/spec/system/example_temp_sensor_spec.rb b/spec/system/example_temp_sensor_spec.rb index 16fdad9a7..269bc9824 100644 --- a/spec/system/example_temp_sensor_spec.rb +++ b/spec/system/example_temp_sensor_spec.rb @@ -30,7 +30,6 @@ end it "should list out all the examples" do - expect(@output).to match(/blinky/) expect(@output).to match(/temp_sensor/) end end @@ -107,6 +106,40 @@ end end + it "should be able to test when using a custom Unity Helper file added by relative-path mixin" do + @c.with_context do + Dir.chdir "temp_sensor" do + @output = `bundle exec ruby -S ceedling test:all --verbosity=obnoxious --mixin=mixin/add_unity_helper.yml 2>&1` + expect(@output).to match(/Merging command line mixin using mixin\/add_unity_helper\.yml/) + expect(@output).to match(/TESTED:\s+47/) + expect(@output).to match(/PASSED:\s+47/) + end + end + end + + it "should be able to test when using a custom Unity Helper file added by simple-named mixin" do + @c.with_context do + Dir.chdir "temp_sensor" do + @output = `bundle exec ruby -S ceedling test:all --verbosity=obnoxious --mixin=add_unity_helper 2>&1` + expect(@output).to match(/Merging built-in mixin 'add_unity_helper'/) + expect(@output).to match(/TESTED:\s+47/) + expect(@output).to match(/PASSED:\s+47/) + end + end + end + + it "should be able to test when using a custom Unity Helper file added by env-named mixin" do + @c.with_context do + ENV['CEEDLING_MIXIN_1'] = 'mixin/add_unity_helper.yml' + Dir.chdir "temp_sensor" do + @output = `bundle exec ruby -S ceedling test:all --verbosity=obnoxious 2>&1` + expect(@output).to match(/Merging CEEDLING_MIXIN_1 mixin using mixin\/add_unity_helper\.yml/) + expect(@output).to match(/TESTED:\s+47/) + expect(@output).to match(/PASSED:\s+47/) + end + end + end + it "should be able to report the assembly files found in paths" do @c.with_context do Dir.chdir "temp_sensor" do