mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-20 05:21:59 -04:00
Work on the Full build configuration for the MicroBlaze. Still a work in progress - not all tasks are running yet.
This commit is contained in:
parent
78953066af
commit
57653ee0ea
|
@ -44,7 +44,7 @@
|
|||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/FreeRTOS_Source/include}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/FreeRTOS_Source/portable/GCC/MicroBlaze}""/>
|
||||
</option>
|
||||
<option id="xilinx.gnu.compiler.symbols.defined.522894226" name="Defined symbols (-D)" superClass="xilinx.gnu.compiler.symbols.defined" valueType="definedSymbols"/>
|
||||
<option id="xilinx.gnu.compiler.symbols.defined.522894226" name="Defined symbols (-D)" superClass="xilinx.gnu.compiler.symbols.defined"/>
|
||||
<inputType id="xilinx.gnu.compiler.input.264309084" name="C source files" superClass="xilinx.gnu.compiler.input"/>
|
||||
</tool>
|
||||
<tool id="xilinx.gnu.mb.cxx.toolchain.compiler.debug.1757864406" name="MicroBlaze g++ compiler" superClass="xilinx.gnu.mb.cxx.toolchain.compiler.debug">
|
||||
|
@ -990,6 +990,9 @@
|
|||
<builder buildPath="${workspace_loc:/RTOSDemoSource/Debug}" enableAutoBuild="true" id="xilinx.gnu.mb.toolchain.builder.debug.2034661333" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="GNU make" superClass="xilinx.gnu.mb.toolchain.builder.debug"/>
|
||||
<tool id="xilinx.gnu.mb.c.toolchain.assembler.debug.1663720311" name="MicroBlaze gcc assembler" superClass="xilinx.gnu.mb.c.toolchain.assembler.debug">
|
||||
<option id="xilinx.gnu.mb.assembler.usele.787661810" name="Produce little endian code (-mlittle-endian)" superClass="xilinx.gnu.mb.assembler.usele" value="true" valueType="boolean"/>
|
||||
<option id="xilinx.gnu.both.asm.option.include.paths.67817492" name="Include Paths (-I)" superClass="xilinx.gnu.both.asm.option.include.paths" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}}""/>
|
||||
</option>
|
||||
<inputType id="xilinx.gnu.assembler.input.828396103" superClass="xilinx.gnu.assembler.input"/>
|
||||
</tool>
|
||||
<tool id="xilinx.gnu.mb.c.toolchain.compiler.debug.1610218702" name="MicroBlaze gcc compiler" superClass="xilinx.gnu.mb.c.toolchain.compiler.debug">
|
||||
|
|
|
@ -83,7 +83,7 @@
|
|||
#define configCPU_CLOCK_HZ ( XPAR_MICROBLAZE_CORE_CLOCK_FREQ_HZ ) /* Not actually used in this demo as the timer is set up in main and uses the peripheral clock, not the CPU clock. */
|
||||
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
|
||||
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 6 )
|
||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 40 * 1024 ) )
|
||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 60 * 1024 ) )
|
||||
#define configMAX_TASK_NAME_LEN ( 10 )
|
||||
#define configUSE_TRACE_FACILITY 0
|
||||
#define configUSE_16_BIT_TICKS 1
|
||||
|
@ -119,8 +119,7 @@ to exclude the API function. */
|
|||
#define INCLUDE_vTaskDelayUntil 1
|
||||
#define INCLUDE_vTaskDelay 1
|
||||
|
||||
extern void vAssertCalled( char *pcFile, long lLine );
|
||||
#define configASSERT( x ) if( ( x ) == 0 ) vAssertCalled( __FILE__, __LINE__ );
|
||||
#define configASSERT( x ) if( ( x ) == 0 ) { portDISABLE_INTERRUPTS(); for( ;; ); }
|
||||
|
||||
#define configINTERRUPT_CONTROLLER_TO_USE XPAR_INTC_SINGLE_DEVICE_ID
|
||||
|
||||
|
|
|
@ -0,0 +1,263 @@
|
|||
/*
|
||||
FreeRTOS V7.0.1 - Copyright (C) 2011 Real Time Engineers Ltd.
|
||||
|
||||
|
||||
FreeRTOS supports many tools and architectures. V7.0.0 is sponsored by:
|
||||
Atollic AB - Atollic provides professional embedded systems development
|
||||
tools for C/C++ development, code analysis and test automation.
|
||||
See http://www.atollic.com
|
||||
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||
* Complete, revised, and edited pdf reference manuals are also *
|
||||
* available. *
|
||||
* *
|
||||
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||
* ensuring you get running as quickly as possible and with an *
|
||||
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||
* the FreeRTOS project to continue with its mission of providing *
|
||||
* professional grade, cross platform, de facto standard solutions *
|
||||
* for microcontrollers - completely free of charge! *
|
||||
* *
|
||||
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||
* *
|
||||
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
|
||||
>>>NOTE<<< The modification to the GPL is included to allow you to
|
||||
distribute a combined work that includes FreeRTOS without being obliged to
|
||||
provide the source code for proprietary components outside of the FreeRTOS
|
||||
kernel. FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
|
||||
can be viewed here: http://www.freertos.org/a00114.html and also obtained
|
||||
by writing to Richard Barry, contact details for whom are available on the
|
||||
FreeRTOS WEB site.
|
||||
|
||||
1 tab == 4 spaces!
|
||||
|
||||
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 "FreeRTOSConfig.h"
|
||||
|
||||
.extern pxCurrentTCB
|
||||
.extern XIntc_DeviceInterruptHandler
|
||||
.extern vTaskSwitchContext
|
||||
.extern uxCriticalNesting
|
||||
.extern pulISRStack
|
||||
|
||||
.global _interrupt_handler
|
||||
.global VPortYieldASM
|
||||
.global vPortStartFirstTask
|
||||
|
||||
|
||||
.macro portSAVE_CONTEXT
|
||||
|
||||
/* Make room for the context on the stack. */
|
||||
addik r1, r1, -132
|
||||
|
||||
/* Save r31 so it can then be used as a temporary. */
|
||||
swi r31, r1, 4
|
||||
|
||||
/* Copy the msr into r31 - this is stacked later. */
|
||||
mfs r31, rmsr
|
||||
|
||||
/* Stack general registers. */
|
||||
swi r30, r1, 12
|
||||
swi r29, r1, 16
|
||||
swi r28, r1, 20
|
||||
swi r27, r1, 24
|
||||
swi r26, r1, 28
|
||||
swi r25, r1, 32
|
||||
swi r24, r1, 36
|
||||
swi r23, r1, 40
|
||||
swi r22, r1, 44
|
||||
swi r21, r1, 48
|
||||
swi r20, r1, 52
|
||||
swi r19, r1, 56
|
||||
swi r18, r1, 60
|
||||
swi r17, r1, 64
|
||||
swi r16, r1, 68
|
||||
swi r15, r1, 72
|
||||
swi r13, r1, 80
|
||||
swi r12, r1, 84
|
||||
swi r11, r1, 88
|
||||
swi r10, r1, 92
|
||||
swi r9, r1, 96
|
||||
swi r8, r1, 100
|
||||
swi r7, r1, 104
|
||||
swi r6, r1, 108
|
||||
swi r5, r1, 112
|
||||
swi r4, r1, 116
|
||||
swi r3, r1, 120
|
||||
swi r2, r1, 124
|
||||
|
||||
/* Stack the critical section nesting value. */
|
||||
lwi r3, r0, uxCriticalNesting
|
||||
swi r3, r1, 128
|
||||
|
||||
/* Save the top of stack value to the TCB. */
|
||||
lwi r3, r0, pxCurrentTCB
|
||||
sw r1, r0, r3
|
||||
|
||||
.endm
|
||||
|
||||
.macro portRESTORE_CONTEXT
|
||||
|
||||
/* Load the top of stack value from the TCB. */
|
||||
lwi r3, r0, pxCurrentTCB
|
||||
lw r1, r0, r3
|
||||
|
||||
/* Restore the general registers. */
|
||||
lwi r31, r1, 4
|
||||
lwi r30, r1, 12
|
||||
lwi r29, r1, 16
|
||||
lwi r28, r1, 20
|
||||
lwi r27, r1, 24
|
||||
lwi r26, r1, 28
|
||||
lwi r25, r1, 32
|
||||
lwi r24, r1, 36
|
||||
lwi r23, r1, 40
|
||||
lwi r22, r1, 44
|
||||
lwi r21, r1, 48
|
||||
lwi r20, r1, 52
|
||||
lwi r19, r1, 56
|
||||
lwi r18, r1, 60
|
||||
lwi r17, r1, 64
|
||||
lwi r16, r1, 68
|
||||
lwi r15, r1, 72
|
||||
lwi r14, r1, 76
|
||||
lwi r13, r1, 80
|
||||
lwi r12, r1, 84
|
||||
lwi r11, r1, 88
|
||||
lwi r10, r1, 92
|
||||
lwi r9, r1, 96
|
||||
lwi r8, r1, 100
|
||||
lwi r7, r1, 104
|
||||
lwi r6, r1, 108
|
||||
lwi r5, r1, 112
|
||||
lwi r4, r1, 116
|
||||
lwi r2, r1, 124
|
||||
|
||||
/* Reload the rmsr from the stack. */
|
||||
lwi r3, r1, 8
|
||||
mts rmsr, r3
|
||||
|
||||
/* Load the critical nesting value. */
|
||||
lwi r3, r1, 128
|
||||
swi r3, r0, uxCriticalNesting
|
||||
|
||||
/* Test the critical nesting value. If it is non zero then the task last
|
||||
exited the running state using a yield. If it is zero, then the task
|
||||
last exited the running state through an interrupt. */
|
||||
xori r3, r3, 0
|
||||
bnei r3, exit_from_yield
|
||||
|
||||
/* r3 was being used as a temporary. Now restore its true value from the
|
||||
stack. */
|
||||
lwi r3, r1, 120
|
||||
|
||||
/* Remove the stack frame. */
|
||||
addik r1, r1, 132
|
||||
|
||||
/* Return using rtid so interrupts are re-enabled as this function is
|
||||
exited. */
|
||||
rtid r14, 0
|
||||
or r0, r0, r0
|
||||
|
||||
.endm
|
||||
|
||||
.text
|
||||
.align 2
|
||||
|
||||
/* This function is used to exit portRESTORE_CONTEXT() if the task being
|
||||
returned to last left the Running state by calling taskYIELD() (rather than
|
||||
being preempted by an interrupt. */
|
||||
exit_from_yield:
|
||||
|
||||
/* r3 was being used as a temporary. Now restore its true value from the
|
||||
stack. */
|
||||
lwi r3, r1, 120
|
||||
|
||||
/* Remove the stack frame. */
|
||||
addik r1, r1, 132
|
||||
|
||||
/* Return to the task. */
|
||||
rtsd r14, 0
|
||||
or r0, r0, r0
|
||||
|
||||
|
||||
_interrupt_handler:
|
||||
|
||||
portSAVE_CONTEXT
|
||||
|
||||
/* Stack msr. */
|
||||
swi r31, r1, 8
|
||||
|
||||
/* Stack the return address. */
|
||||
swi r14, r1, 76
|
||||
|
||||
/* Switch to the ISR stack. */
|
||||
lwi r1, r0, pulISRStack
|
||||
|
||||
/* The parameter to the interrupt handler. */
|
||||
ori r5, r0, configINTERRUPT_CONTROLLER_TO_USE
|
||||
|
||||
/* Execute any pending interrupts. */
|
||||
bralid r15, XIntc_DeviceInterruptHandler
|
||||
or r0, r0, r0
|
||||
|
||||
/* Restore the context of the next task scheduled to execute. */
|
||||
portRESTORE_CONTEXT
|
||||
|
||||
|
||||
VPortYieldASM:
|
||||
|
||||
portSAVE_CONTEXT
|
||||
|
||||
/* Stack msr. */
|
||||
swi r31, r1, 8
|
||||
|
||||
/* Modify the return address so a return is done to the instruction after
|
||||
the call to VPortYieldASM. */
|
||||
addi r14, r14, 8
|
||||
swi r14, r1, 76
|
||||
|
||||
/* Switch to use the ISR stack. */
|
||||
lwi r1, r0, pulISRStack
|
||||
|
||||
/* Select the next task to execute. */
|
||||
bralid r15, vTaskSwitchContext
|
||||
or r0, r0, r0
|
||||
|
||||
/* Restore the context of the next task scheduled to execute. */
|
||||
portRESTORE_CONTEXT
|
||||
|
||||
vPortStartFirstTask:
|
||||
|
||||
portRESTORE_CONTEXT
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -478,15 +478,3 @@ unsigned long ulCSR;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vAssertCalled( char *pcFile, long lLine )
|
||||
{
|
||||
volatile unsigned long ul = 1;
|
||||
|
||||
taskDISABLE_INTERRUPTS();
|
||||
while( ul == 1 )
|
||||
{
|
||||
/* Just for somewhere to put a breakpoint. */
|
||||
portNOP();
|
||||
}
|
||||
taskENABLE_INTERRUPTS();
|
||||
}
|
||||
|
|
|
@ -249,25 +249,24 @@ static XTmrCtr xTimer0Instance;
|
|||
static xTimerHandle xCheckTimer = NULL;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
volatile int xyz = 1;
|
||||
|
||||
int main( void )
|
||||
{
|
||||
/* Configure the interrupt controller, LED outputs and button inputs. */
|
||||
prvSetupHardware();
|
||||
|
||||
|
||||
/* Start the reg test tasks which test the context switching mechanism. */
|
||||
// xTaskCreate( vRegisterTest1, ( const signed char * const ) "RegTst1", configMINIMAL_STACK_SIZE, ( void * ) 0, tskIDLE_PRIORITY, NULL );
|
||||
// xTaskCreate( vRegisterTest2, ( const signed char * const ) "RegTst2", configMINIMAL_STACK_SIZE, ( void * ) 0, tskIDLE_PRIORITY, NULL );
|
||||
xTaskCreate( vRegisterTest1, ( const signed char * const ) "RegTst1", configMINIMAL_STACK_SIZE, ( void * ) 0, tskIDLE_PRIORITY, NULL );
|
||||
xTaskCreate( vRegisterTest2, ( const signed char * const ) "RegTst2", configMINIMAL_STACK_SIZE, ( void * ) 0, tskIDLE_PRIORITY, NULL );
|
||||
|
||||
/* The web server task. */
|
||||
//_RB_ xTaskCreate( vuIP_Task, "uIP", mainuIP_STACK_SIZE, NULL, mainuIP_TASK_PRIORITY, NULL );
|
||||
|
||||
/* Create the standard demo tasks. */
|
||||
// vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
|
||||
// vCreateBlockTimeTasks();
|
||||
// vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
|
||||
// vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
|
||||
vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
|
||||
vCreateBlockTimeTasks();
|
||||
vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
|
||||
vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
|
||||
vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY );
|
||||
vStartLEDFlashTasks( mainFLASH_TASK_PRIORITY );
|
||||
// vStartQueuePeekTasks();
|
||||
|
@ -284,13 +283,13 @@ int main( void )
|
|||
the reasons stated in the comments above the call to
|
||||
vStartTimerDemoTask(), that the check timer is not actually started
|
||||
until after the scheduler has been started. */
|
||||
xCheckTimer = xTimerCreate( ( const signed char * ) "Check timer", mainNO_ERROR_CHECK_TIMER_PERIOD, pdTRUE, ( void * ) 0, vCheckTimerCallback );
|
||||
// xCheckTimer = xTimerCreate( ( const signed char * ) "Check timer", mainNO_ERROR_CHECK_TIMER_PERIOD, pdTRUE, ( void * ) 0, vCheckTimerCallback );
|
||||
|
||||
/* Ensure the check timer will start running as soon as the scheduler
|
||||
starts. The block time is set to 0 (mainDONT_BLOCK), but would be
|
||||
ingnored at this point anyway as block times can only be specified when
|
||||
the scheduler is running. */
|
||||
xTimerStart( xCheckTimer, mainDONT_BLOCK );
|
||||
// xTimerStart( xCheckTimer, mainDONT_BLOCK );
|
||||
|
||||
/* Start the tasks running. */
|
||||
vTaskStartScheduler();
|
||||
|
@ -537,6 +536,7 @@ const unsigned char ucSetToOutput = 0U;
|
|||
|
||||
configASSERT( ( xStatus == pdPASS ) );
|
||||
#else
|
||||
taskDISABLE_INTERRUPTS();
|
||||
vParTestInitialise();
|
||||
#endif //_RB_
|
||||
|
||||
|
@ -546,16 +546,3 @@ const unsigned char ucSetToOutput = 0U;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vAssertCalled( char *pcFile, long lLine )
|
||||
{
|
||||
volatile unsigned long ul = 1;
|
||||
|
||||
taskDISABLE_INTERRUPTS();
|
||||
while( ul == 1 )
|
||||
{
|
||||
/* Just for somewhere to put a breakpoint. */
|
||||
portNOP();
|
||||
}
|
||||
taskENABLE_INTERRUPTS();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue