Skip to content

Commit

Permalink
Version of Arm used for competition
Browse files Browse the repository at this point in the history
  • Loading branch information
MasterBoyd committed Oct 6, 2021
1 parent 6c83559 commit d5ea471
Show file tree
Hide file tree
Showing 5,894 changed files with 1,365,543 additions and 2 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
9 changes: 9 additions & 0 deletions Core/Core-Source/FreeRTOS_ARM/library.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name=FreeRTOS_ARM
version=2015.11.12
author=
maintainer=
sentence=FreeRTOS for ARM.
paragraph=
category=Uncategorized
url=
architectures=sam
122 changes: 122 additions & 0 deletions Core/Core-Source/FreeRTOS_ARM/src/FreeRTOS_ARM.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
/**
* \file
* \brief FreeRTOS for Due and Teensy 3.0
*/
#include <FreeRTOS_ARM.h>
#include <Arduino.h>
//------------------------------------------------------------------------------
/** calibration factor for delayMS */
#define CAL_FACTOR (F_CPU/7000)
/** delay between led error flashes
* \param[in] millis milliseconds to delay
*/
static void delayMS(uint32_t millis) {
uint32_t iterations = millis * CAL_FACTOR;
uint32_t i;
for(i = 0; i < iterations; ++i) {
asm volatile("nop\n\t");
}
}
//------------------------------------------------------------------------------
/** Blink error pattern
*
* \param[in] n number of short pulses
*/
static void errorBlink(int n) {
noInterrupts();
pinMode(13, OUTPUT);
for (;;) {
int i;
for (i = 0; i < n; i++) {
digitalWrite(13, 1);
delayMS(300);
digitalWrite(13, 0);
delayMS(300);
}
delayMS(2000);
}
}
//------------------------------------------------------------------------------
/** assertBlink
* Blink one short pulse every two seconds if configASSERT fails.
*/
void assertBlink() {
errorBlink(1);
}
//------------------------------------------------------------------------------
/** vApplicationMallocFailedHook()
Blink two short pulses if malloc fails.
will only be called if
configUSE_MALLOC_FAILED_HOOK is set to 1 in FreeRTOSConfig.h. It is a hook
function that will get called if a call to pvPortMalloc() fails.
pvPortMalloc() is called internally by the kernel whenever a task, queue,
timer or semaphore is created. It is also called by various parts of the
demo application. If heap_1.c or heap_2.c are used, then the size of the
heap available to pvPortMalloc() is defined by configTOTAL_HEAP_SIZE in
FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used
to query the size of free heap space that remains (although it does not
provide information on how the remaining heap might be fragmented). */
void vApplicationMallocFailedHook() {
errorBlink(2);
}
//------------------------------------------------------------------------------

/** vApplicationIdleHook() will only be called if configUSE_IDLE_HOOK is set
to 1 in FreeRTOSConfig.h. It will be called on each iteration of the idle
task. It is essential that code added to this hook function never attempts
to block in any way (for example, call xQueueReceive() with a block time
specified, or call vTaskDelay()). If the application makes use of the
vTaskDelete() API function (as this demo application does) then it is also
important that vApplicationIdleHook() is permitted to return to its calling
function, because it is the responsibility of the idle task to clean up
memory allocated by the kernel to any task that has since been deleted. */
void __attribute__((weak)) vApplicationIdleHook( void ) {
//void loop();
//loop();
}
/*-----------------------------------------------------------*/
/** Blink three short pulses if stack overflow is detected.
Run time stack overflow checking is performed if
configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook
function is called if a stack overflow is detected.
\param[in] pxTask Task handle
\param[in] pcTaskName Task name
*/
void vApplicationStackOverflowHook(TaskHandle_t pxTask, char *pcTaskName) {
(void) pcTaskName;
(void) pxTask;
errorBlink(3);
}
//------------------------------------------------------------------------------
// catch Teensy 3 and Due exceptions
/** Hard fault - blink four short flash every two seconds */
void hard_fault_isr() {errorBlink(4);}
/** Hard fault - blink four short flash every two seconds */
void HardFault_Handler() {errorBlink(4);}

/** Bus fault - blink five short flashes every two seconds */
void bus_fault_isr() {errorBlink(5);}
/** Bus fault - blink five short flashes every two seconds */
void BusFault_Handler() {errorBlink(5);}

/** Usage fault - blink six short flashes every two seconds */
void usage_fault_isr() {errorBlink(6);}
/** Usage fault - blink six short flashes every two seconds */
void UsageFault_Handler() {errorBlink(6);}
/*-----------------------------------------------------------*/
/** This function will be called by each tick interrupt if
configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be
added here, but the tick hook is called from an interrupt context, so
code must not attempt to block, and only the interrupt safe FreeRTOS API
functions can be used (those that end in FromISR()). */
void __attribute__((weak)) vApplicationTickHook() {
}
/*-----------------------------------------------------------*/
/** Dummy time stats gathering functions need to be defined to keep the
linker happy. Could edit FreeRTOSConfig.h to remove these.*/
void vMainConfigureTimerForRunTimeStats( void ) {}
/** Dummy function
* \return zero
*/
unsigned long ulMainGetRunTimeCounterValue() {return 0UL;}
22 changes: 22 additions & 0 deletions Core/Core-Source/FreeRTOS_ARM/src/FreeRTOS_ARM.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* \file
* \brief FreeRTOS for Teensy 3.x and Due
*/
#ifndef FreeRTOS_ARM_h
#define FreeRTOS_ARM_h

#ifndef __arm__
#error ARM Due or Teensy 3.x required
#else // __arm__
//------------------------------------------------------------------------------
/** FreeRTOS_ARM version YYYYMMDD */
#define FREE_RTOS_ARM_VERSION 20151113
//------------------------------------------------------------------------------
#include "utility/FreeRTOS.h"
#include "utility/task.h"
#include "utility/queue.h"
#include "utility/semphr.h"
#include "utility/portmacro.h"
//#include "utility/cmsis_os.h"
#endif // __arm__
#endif // FreeRTOS_ARM_h
18 changes: 18 additions & 0 deletions Core/Core-Source/FreeRTOS_ARM/src/assertMsg.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include <Arduino.h>

extern "C" {
/**
* Print file and line when configASSERT is defied like this.
*
* #define configASSERT( x ) if( ( x ) == 0 ) {assertMsg(__FILE__,__LINE__);}
*/
void assertMsg(const char* file, int line) {
interrupts();
Serial.print(file);
Serial.write('.');
Serial.println(line);
Serial.flush();
noInterrupts();
for (;;) {}
}
} // extern "C"
99 changes: 99 additions & 0 deletions Core/Core-Source/FreeRTOS_ARM/src/basic_io_arm.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/*
FreeRTOS.org V5.0.4 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution.
FreeRTOS.org is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
FreeRTOS.org is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with FreeRTOS.org; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
A special exception to the GPL can be applied should you wish to distribute
a combined work that includes FreeRTOS.org, without being obliged to provide
the source code for any proprietary components. See the licensing section
of http://www.FreeRTOS.org for full details of how and when the exception
can be applied.
***************************************************************************
***************************************************************************
* *
* SAVE TIME AND MONEY! We can port FreeRTOS.org to your own hardware, *
* and even write all or part of your application on your behalf. *
* See http://www.OpenRTOS.com for details of the services we provide to *
* expedite your project. *
* *
***************************************************************************
***************************************************************************
Please ensure to read the configuration and relevant port sections of the
online documentation.
http://www.FreeRTOS.org - Documentation, latest information, license and
contact details.
http://www.SafeRTOS.com - A version that is certified for use in safety
critical systems.
http://www.OpenRTOS.com - Commercial support, development, porting,
licensing and training services.
*/
//#include <stdio.h>
//#include <conio.h>
#include <Arduino.h>
#include "FreeRTOS_ARM.h"
//#include "task.h"

void vPrintString( const char *pcString )
{
/* Print the string, suspending the scheduler as method of mutual
exclusion. */
vTaskSuspendAll();
{
Serial.print(pcString);
Serial.flush();
// printf( "%s", pcString );
// fflush( stdout );
}
xTaskResumeAll();

/* Allow any key to stop the application running. A real application that
actually used the key value should protect access to the keyboard too. */
if( Serial.available() )
{
vTaskEndScheduler();
}
}
/*-----------------------------------------------------------*/

void vPrintStringAndNumber( const char *pcString, unsigned portLONG ulValue )
{
/* Print the string, suspending the scheduler as method of mutual
exclusion. */
vTaskSuspendAll();
{
// printf( "%s %lu\r\n", pcString, ulValue );
// fflush( stdout );
Serial.print(pcString);
Serial.write(' ');
Serial.println(ulValue);
Serial.flush();
}
xTaskResumeAll();

/* Allow any key to stop the application running. */
if( Serial.available() )
{
vTaskEndScheduler();
}
}


55 changes: 55 additions & 0 deletions Core/Core-Source/FreeRTOS_ARM/src/basic_io_arm.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
FreeRTOS.org V5.0.4 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution.
FreeRTOS.org is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
FreeRTOS.org is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with FreeRTOS.org; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
A special exception to the GPL can be applied should you wish to distribute
a combined work that includes FreeRTOS.org, without being obliged to provide
the source code for any proprietary components. See the licensing section
of http://www.FreeRTOS.org for full details of how and when the exception
can be applied.
***************************************************************************
***************************************************************************
* *
* SAVE TIME AND MONEY! We can port FreeRTOS.org to your own hardware, *
* and even write all or part of your application on your behalf. *
* See http://www.OpenRTOS.com for details of the services we provide to *
* expedite your project. *
* *
***************************************************************************
***************************************************************************
Please ensure to read the configuration and relevant port sections of the
online documentation.
http://www.FreeRTOS.org - Documentation, latest information, license and
contact details.
http://www.SafeRTOS.com - A version that is certified for use in safety
critical systems.
http://www.OpenRTOS.com - Commercial support, development, porting,
licensing and training services.
*/

#ifndef BASIC_IO_H
#define BASIC_IO_H
void vPrintString( const char *pcString );
void vPrintStringAndNumber( const char *pcString, unsigned portLONG ulValue );
#endif

Loading

0 comments on commit d5ea471

Please sign in to comment.