From 5e32393035673df27df43a04d3d04c3705c4fb04 Mon Sep 17 00:00:00 2001 From: Phillip Stevens Date: Sat, 11 Apr 2020 11:31:24 +1000 Subject: [PATCH] ATmegaxxxx - remove single line comments --- portable/GCC/ATmegaxxxx/port.c | 12 ++++++------ portable/GCC/ATmegaxxxx/portmacro.h | 28 ++++++++++++++++------------ portable/GCC/ATmegaxxxx/readme.md | 20 ++++++++++---------- 3 files changed, 32 insertions(+), 28 deletions(-) diff --git a/portable/GCC/ATmegaxxxx/port.c b/portable/GCC/ATmegaxxxx/port.c index 1373970fc..370a9b9aa 100644 --- a/portable/GCC/ATmegaxxxx/port.c +++ b/portable/GCC/ATmegaxxxx/port.c @@ -600,10 +600,10 @@ void vPortEndScheduler( void ) disable the tick interrupt here. */ #if defined (portUSE_WDTO) - wdt_disable(); // disable Watchdog Timer + wdt_disable(); /* disable Watchdog Timer */ #elif defined( portUSE_TIMER0 ) - portTIMSK &= ~( _BV(OCIE0B)|_BV(OCIE0A)|_BV(TOIE0) ); // disable all Timer0 interrupts + portTIMSK &= ~( _BV(OCIE0B)|_BV(OCIE0A)|_BV(TOIE0) ); /* disable all Timer0 interrupts */ #endif } @@ -650,7 +650,7 @@ void vPortYieldFromTick( void ) */ void prvSetupTimerInterrupt( void ) { - //reset watchdog + /* reset watchdog */ wdt_reset(); /* actual port tick rate in Hz, calculated */ @@ -658,7 +658,7 @@ void prvSetupTimerInterrupt( void ) /* initialise first second of ticks */ ticksRemainingInSec = portTickRateHz; - //set up WDT Interrupt (rather than the WDT Reset). + /* set up WDT Interrupt (rather than the WDT Reset). */ wdt_interrupt_enable( portUSE_WDTO ); } @@ -719,7 +719,7 @@ uint8_t ucLowByte; * */ ISR(portSCHEDULER_ISR, ISR_NAKED) __attribute__ ((hot, flatten)); -// ISR(portSCHEDULER_ISR, ISR_NAKED ISR_NOBLOCK) __attribute__ ((hot, flatten)); +/* ISR(portSCHEDULER_ISR, ISR_NAKED ISR_NOBLOCK) __attribute__ ((hot, flatten)); */ ISR(portSCHEDULER_ISR) { @@ -736,7 +736,7 @@ uint8_t ucLowByte; * use ISR_NOBLOCK where there is an important timer running, that should preempt the scheduler. */ ISR(portSCHEDULER_ISR) __attribute__ ((hot, flatten)); -// ISR(portSCHEDULER_ISR, ISR_NOBLOCK) __attribute__ ((hot, flatten)); +/* ISR(portSCHEDULER_ISR, ISR_NOBLOCK) __attribute__ ((hot, flatten)); */ ISR(portSCHEDULER_ISR) { diff --git a/portable/GCC/ATmegaxxxx/portmacro.h b/portable/GCC/ATmegaxxxx/portmacro.h index ae6ce20cd..492bf8562 100644 --- a/portable/GCC/ATmegaxxxx/portmacro.h +++ b/portable/GCC/ATmegaxxxx/portmacro.h @@ -49,15 +49,15 @@ extern "C" { #define portLONG long #define portSHORT int -typedef uint8_t StackType_t; -typedef int8_t BaseType_t; -typedef uint8_t UBaseType_t; +typedef uint8_t StackType_t; +typedef int8_t BaseType_t; +typedef uint8_t UBaseType_t; #if configUSE_16_BIT_TICKS == 1 - typedef uint16_t TickType_t; + typedef uint16_t TickType_t; #define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef uint32_t TickType_t; + typedef uint32_t TickType_t; #define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ @@ -86,12 +86,13 @@ typedef uint8_t UBaseType_t; /* Architecture specifics. */ -// System Tick - Scheduler timer -// Prefer to use the enhanced Watchdog Timer, but also Timer0 is ok. +/* System Tick - Scheduler timer + * Prefer to use the enhanced Watchdog Timer, but also Timer0 is ok. + */ -#if defined(WDIE) && defined(WDIF) // Enhanced WDT with interrupt capability +#if defined(WDIE) && defined(WDIF) /* If Enhanced WDT with interrupt capability is available */ -#define portUSE_WDTO WDTO_15MS // portUSE_WDTO to use the Watchdog Timer for xTaskIncrementTick +#define portUSE_WDTO WDTO_15MS /* use the Watchdog Timer for xTaskIncrementTick */ /* Watchdog period options: WDTO_15MS WDTO_30MS @@ -105,7 +106,7 @@ typedef uint8_t UBaseType_t; #else -#define portUSE_TIMER0 // portUSE_TIMER0 to use 8 bit Timer0 for xTaskIncrementTick +#define portUSE_TIMER0 /* use the 8-bit Timer0 for xTaskIncrementTick */ #endif @@ -117,7 +118,7 @@ typedef uint8_t UBaseType_t; * from data sheet. */ #if defined( portUSE_WDTO ) -#define portTICK_PERIOD_MS ( (TickType_t) _BV( portUSE_WDTO + 4 ) ) // Inaccurately assuming 128 kHz Watchdog Timer. +#define portTICK_PERIOD_MS ( (TickType_t) _BV( portUSE_WDTO + 4 ) ) #else #define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) #endif @@ -133,7 +134,10 @@ extern void vPortYield( void ) __attribute__ ( ( naked ) ); #if defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__) /* Task function macros as described on the FreeRTOS.org WEB site. */ -// Add .lowtext tag from the linker script avr6.x for ATmega2560 and ATmega2561. To make sure they are loaded in low memory. + +/* Add .lowtext tag from the avr linker script avr6.x for ATmega2560 and ATmega2561 + * to make sure functions are loaded in low memory. + */ #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters ) __attribute__ ((section (".lowtext"))) #else #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters ) diff --git a/portable/GCC/ATmegaxxxx/readme.md b/portable/GCC/ATmegaxxxx/readme.md index 4ce7090b4..1d502e890 100644 --- a/portable/GCC/ATmegaxxxx/readme.md +++ b/portable/GCC/ATmegaxxxx/readme.md @@ -8,7 +8,7 @@ This port provides a basis for supporting all modern ATmega devices using either This initial commit contains the information required to build with System Tick being generated by either the: - Watchdog Timer, or -- Timer 0 - an 8-bit Timer +- Timer0 - an 8-bit Timer Further commits can add support for 16-bit Timers available on many relevant devices. The availability of these 16-bit Timers is somewhat device specific, and these complex and highly configurable Timers are often used to generate phase correct PWM timing (for example) and they would be wasted as a simple System Tick. @@ -59,18 +59,11 @@ To avoid this issue causing `pvPort_Malloc()` to failing, the user needs to issu if( __malloc_heap_end == 0 ) __malloc_heap_end = (char *)(RAMEND - __malloc_margin); ``` -Unfortunately in the repository there is nowhere sensible to include this statement. +Unfortunately in the repository there is nowhere sensible to include this statement as it should be included early in the `main()` function.

Supported Devices

-ATmega devices without enhanced __WDT__ Interrupt capability - use Timer0. - - - ATmega8A/16A/32A/64A/128A -> 4kB RAM - - ATmega808/809/1608/1609/3208/3209/4808/4809 -> 6kB RAM - - ATmega165A/165PA/325A/325PA/3250A/3250PA/645A/645P/6450A/6450P -> 4kB RAM - - ATmega169A/169PA/329A/329PA/3290A/3290PA/649A/649P/6490A/6490P -> 4kB RAM - -ATmega devices with __ENHANCED WDT__ Interrupt capability - use WDT. +ATmega devices with __ENHANCED WDT__ Interrupt capability - will use WDT. - ATmega8U2/16U2/32U2 -> 2kB RAM - ATmega16U4/32U4 - Arduino Leonardo -> 2.5kB RAM @@ -78,3 +71,10 @@ ATmega devices with __ENHANCED WDT__ Interrupt capability - use WDT. - ATmega164PA/324PA/644PA/1284P - Goldilocks -> __16kB RAM__ - ATmega324PB -> 2kB RAM - ATmega640/1280/2560/1281/2561 - Arduino Mega -> __8kB RAM + XRAM__ + +ATmega devices without enhanced __WDT__ Interrupt capability - will use Timer0. + + - ATmega8A/16A/32A/64A/128A -> 4kB RAM + - ATmega808/809/1608/1609/3208/3209/4808/4809 -> 6kB RAM + - ATmega165A/165PA/325A/325PA/3250A/3250PA/645A/645P/6450A/6450P -> 4kB RAM + - ATmega169A/169PA/329A/329PA/3290A/3290PA/649A/649P/6490A/6490P -> 4kB RAM