mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-19 21:11:57 -04:00
Continue work on MicroBlaze port - still very much a work in progress.
This commit is contained in:
parent
1e5830a157
commit
ea5ec656f4
|
@ -15,6 +15,7 @@ BEGIN PROCESSOR
|
||||||
PARAMETER DRIVER_NAME = cpu
|
PARAMETER DRIVER_NAME = cpu
|
||||||
PARAMETER DRIVER_VER = 1.13.a
|
PARAMETER DRIVER_VER = 1.13.a
|
||||||
PARAMETER HW_INSTANCE = microblaze_0
|
PARAMETER HW_INSTANCE = microblaze_0
|
||||||
|
PARAMETER EXTRA_COMPILER_FLAGS = -O0 -g
|
||||||
END
|
END
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -126,6 +126,7 @@ const unsigned long ulR2 = ( unsigned long ) &_SDA2_BASE_;
|
||||||
const unsigned long ulR13 = ( unsigned long ) &_SDA_BASE_;
|
const unsigned long ulR13 = ( unsigned long ) &_SDA_BASE_;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
//_RB_
|
||||||
#ifdef XPAR_MICROBLAZE_USE_ICACHE
|
#ifdef XPAR_MICROBLAZE_USE_ICACHE
|
||||||
microblaze_invalidate_icache();
|
microblaze_invalidate_icache();
|
||||||
microblaze_enable_icache();
|
microblaze_enable_icache();
|
||||||
|
@ -150,74 +151,76 @@ const unsigned long ulR13 = ( unsigned long ) &_SDA_BASE_;
|
||||||
|
|
||||||
/* First stack an initial value for the critical section nesting. This
|
/* First stack an initial value for the critical section nesting. This
|
||||||
is initialised to zero as tasks are started with interrupts enabled. */
|
is initialised to zero as tasks are started with interrupts enabled. */
|
||||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x00; /* R0. */
|
*pxTopOfStack = ( portSTACK_TYPE ) 0x00; /* R0 is always zero. */
|
||||||
|
|
||||||
|
/* R1 is the SP. */
|
||||||
|
|
||||||
/* Place an initial value for all the general purpose registers. */
|
/* Place an initial value for all the general purpose registers. */
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
*pxTopOfStack = ( portSTACK_TYPE ) ulR2; /* R2 - small data area. */
|
*pxTopOfStack = ( portSTACK_TYPE ) ulR2; /* R2 - read only small data area. */
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x03; /* R3. */
|
*pxTopOfStack = ( portSTACK_TYPE ) 0x03; /* R3 - return values and temporaries. */
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x04; /* R4. */
|
*pxTopOfStack = ( portSTACK_TYPE ) 0x04; /* R4 - return values and temporaries. */
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
*pxTopOfStack = ( portSTACK_TYPE ) pvParameters;/* R5 contains the function call parameters. */
|
*pxTopOfStack = ( portSTACK_TYPE ) pvParameters;/* R5 contains the function call parameters. */
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x06; /* R6. */
|
*pxTopOfStack = ( portSTACK_TYPE ) 0x06; /* R6 - other parameters and temporaries. */
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x07; /* R7. */
|
*pxTopOfStack = ( portSTACK_TYPE ) 0x07; /* R7 - other parameters and temporaries. */
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x08; /* R8. */
|
*pxTopOfStack = ( portSTACK_TYPE ) 0x08; /* R8 - other parameters and temporaries. */
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x09; /* R9. */
|
*pxTopOfStack = ( portSTACK_TYPE ) 0x09; /* R9 - other parameters and temporaries. */
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x0a; /* R10. */
|
*pxTopOfStack = ( portSTACK_TYPE ) 0x0a; /* R10 - other parameters and temporaries. */
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x0b; /* R11. */
|
*pxTopOfStack = ( portSTACK_TYPE ) 0x0b; /* R11 - temporaries. */
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x0c; /* R12. */
|
*pxTopOfStack = ( portSTACK_TYPE ) 0x0c; /* R12 - temporaries. */
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
*pxTopOfStack = ( portSTACK_TYPE ) ulR13; /* R13 - small data read write area. */
|
*pxTopOfStack = ( portSTACK_TYPE ) ulR13; /* R13 - read/write small data area. */
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
*pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* R14. */
|
*pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* R14 - return address for interrupt. */
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x0f; /* R15. */
|
*pxTopOfStack = ( portSTACK_TYPE ) 0x0f; /* R15 - return address for subroutine. */
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x10; /* R16. */
|
*pxTopOfStack = ( portSTACK_TYPE ) 0x10; /* R16 - return address for trap (debugger). */
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x11; /* R17. */
|
*pxTopOfStack = ( portSTACK_TYPE ) 0x11; /* R17 - return address for exceptions, if configured. */
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x12; /* R18. */
|
*pxTopOfStack = ( portSTACK_TYPE ) 0x12; /* R18 - reserved for assembler and compiler temporaries. */
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x13; /* R19. */
|
*pxTopOfStack = ( portSTACK_TYPE ) 0x13; /* R19 - must be saved across function calls. Callee-save. */
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x14; /* R20. */
|
*pxTopOfStack = ( portSTACK_TYPE ) 0x14; /* R20 - reserved for storing a pointer to the Global Offset Table (GOT) in Position Independent Code (PIC). Non-volatile in non-PIC code. Must be saved across function calls. Callee-save. Not used by FreeRTOS. */
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x15; /* R21. */
|
*pxTopOfStack = ( portSTACK_TYPE ) 0x15; /* R21 - must be saved across function calls. Callee-save. */
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x16; /* R22. */
|
*pxTopOfStack = ( portSTACK_TYPE ) 0x16; /* R22 - must be saved across function calls. Callee-save. */
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x17; /* R23. */
|
*pxTopOfStack = ( portSTACK_TYPE ) 0x17; /* R23 - must be saved across function calls. Callee-save. */
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x18; /* R24. */
|
*pxTopOfStack = ( portSTACK_TYPE ) 0x18; /* R24 - must be saved across function calls. Callee-save. */
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x19; /* R25. */
|
*pxTopOfStack = ( portSTACK_TYPE ) 0x19; /* R25 - must be saved across function calls. Callee-save. */
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x1a; /* R26. */
|
*pxTopOfStack = ( portSTACK_TYPE ) 0x1a; /* R26 - must be saved across function calls. Callee-save. */
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x1b; /* R27. */
|
*pxTopOfStack = ( portSTACK_TYPE ) 0x1b; /* R27 - must be saved across function calls. Callee-save. */
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x1c; /* R28. */
|
*pxTopOfStack = ( portSTACK_TYPE ) 0x1c; /* R28 - must be saved across function calls. Callee-save. */
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x1d; /* R29. */
|
*pxTopOfStack = ( portSTACK_TYPE ) 0x1d; /* R29 - must be saved across function calls. Callee-save. */
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x1e; /* R30. */
|
*pxTopOfStack = ( portSTACK_TYPE ) 0x1e; /* R30 - must be saved across function calls. Callee-save. */
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
|
|
||||||
/* The MSR is stacked between R30 and R31. */
|
/* The MSR is stacked between R30 and R31. */
|
||||||
*pxTopOfStack = portINITIAL_MSR_STATE;
|
*pxTopOfStack = portINITIAL_MSR_STATE;
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
|
|
||||||
*pxTopOfStack = ( portSTACK_TYPE ) 0x1f; /* R31. */
|
*pxTopOfStack = ( portSTACK_TYPE ) 0x1f; /* R31 - must be saved across function calls. Callee-save. */
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
|
|
||||||
/* Return a pointer to the top of the stack we have generated so this can
|
/* Return a pointer to the top of the stack we have generated so this can
|
||||||
|
@ -359,9 +362,13 @@ portBASE_TYPE xReturn = XST_SUCCESS;
|
||||||
*/
|
*/
|
||||||
void vTickISR( void *pvUnused )
|
void vTickISR( void *pvUnused )
|
||||||
{
|
{
|
||||||
|
extern void vApplicationClearTimerInterrupt();
|
||||||
|
|
||||||
/* Ensure the unused parameter does not generate a compiler warning. */
|
/* Ensure the unused parameter does not generate a compiler warning. */
|
||||||
( void ) pvUnused;
|
( void ) pvUnused;
|
||||||
|
|
||||||
|
vApplicationClearTimerInterrupt();
|
||||||
|
|
||||||
/* Increment the RTOS tick - this might cause a task to unblock. */
|
/* Increment the RTOS tick - this might cause a task to unblock. */
|
||||||
vTaskIncrementTick();
|
vTaskIncrementTick();
|
||||||
|
|
||||||
|
@ -387,7 +394,7 @@ extern Xil_ExceptionHandler vPortFreeRTOSInterruptHandler;
|
||||||
|
|
||||||
/* Register the interrupt controller handle that uses the exception
|
/* Register the interrupt controller handle that uses the exception
|
||||||
table. */
|
table. */
|
||||||
Xil_ExceptionRegisterHandler( XIL_EXCEPTION_ID_INT, vPortFreeRTOSInterruptHandler, NULL );
|
//_RB_ Xil_ExceptionRegisterHandler( XIL_EXCEPTION_ID_INT, vPortFreeRTOSInterruptHandler, NULL );
|
||||||
|
|
||||||
/* Service all pending interrupts each time the handler is entered. */
|
/* Service all pending interrupts each time the handler is entered. */
|
||||||
XIntc_SetIntrSvcOption( xInterruptControllerInstance.BaseAddress, XIN_SVC_ALL_ISRS_OPTION );
|
XIntc_SetIntrSvcOption( xInterruptControllerInstance.BaseAddress, XIN_SVC_ALL_ISRS_OPTION );
|
||||||
|
|
|
@ -63,7 +63,8 @@
|
||||||
.extern uxCriticalNesting
|
.extern uxCriticalNesting
|
||||||
.extern pulISRStack
|
.extern pulISRStack
|
||||||
|
|
||||||
.global vPortFreeRTOSInterruptHandler
|
/* .global vPortFreeRTOSInterruptHandler */
|
||||||
|
.global _interrupt_handler
|
||||||
.global VPortYieldASM
|
.global VPortYieldASM
|
||||||
.global vStartFirstTask
|
.global vStartFirstTask
|
||||||
|
|
||||||
|
@ -188,7 +189,8 @@
|
||||||
.align 2
|
.align 2
|
||||||
|
|
||||||
|
|
||||||
vPortFreeRTOSInterruptHandler:
|
/*vPortFreeRTOSInterruptHandler:*/
|
||||||
|
_interrupt_handler:
|
||||||
portSAVE_CONTEXT
|
portSAVE_CONTEXT
|
||||||
/* Entered via an interrupt so interrupts must be enabled in msr. */
|
/* Entered via an interrupt so interrupts must be enabled in msr. */
|
||||||
ori r31, r31, 2
|
ori r31, r31, 2
|
||||||
|
|
|
@ -172,6 +172,41 @@ static volatile unsigned long ulGPIOState = 0UL;
|
||||||
static XTmrCtr xTimer0Instance;
|
static XTmrCtr xTimer0Instance;
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
#define JUST_TESTING
|
||||||
|
#ifdef JUST_TESTING
|
||||||
|
volatile unsigned long ul1 = 0, ul2 = 0;
|
||||||
|
|
||||||
|
void vTemp1( void *pvParameters )
|
||||||
|
{
|
||||||
|
for( ;; )
|
||||||
|
{
|
||||||
|
ul1++;
|
||||||
|
//taskYIELD();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void vTemp2( void *pvParameters )
|
||||||
|
{
|
||||||
|
for( ;; )
|
||||||
|
{
|
||||||
|
ul2++;
|
||||||
|
//taskYIELD();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void main( void )
|
||||||
|
{
|
||||||
|
prvSetupHardware();
|
||||||
|
|
||||||
|
xTaskCreate( vTemp1, ( signed char * ) "Test1", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 1, NULL );
|
||||||
|
xTaskCreate( vTemp2, ( signed char * ) "Test2", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 1, NULL );
|
||||||
|
|
||||||
|
vTaskStartScheduler();
|
||||||
|
for( ;; );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#else /* JUST_TESTING */
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
|
@ -210,7 +245,7 @@ int main(void)
|
||||||
for( ;; );
|
for( ;; );
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
#endif /* JUST_TESTING */
|
||||||
static void vLEDTimerCallback( xTimerHandle xTimer )
|
static void vLEDTimerCallback( xTimerHandle xTimer )
|
||||||
{
|
{
|
||||||
/* The timer has expired - so no button pushes have occurred in the last
|
/* The timer has expired - so no button pushes have occurred in the last
|
||||||
|
@ -416,3 +451,15 @@ extern void vTickISR( void *pvUnused );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void vApplicationClearTimerInterrupt( void )
|
||||||
|
{
|
||||||
|
unsigned long ulCSR;
|
||||||
|
|
||||||
|
/* Increment the RTOS tick - this might cause a task to unblock. */
|
||||||
|
vTaskIncrementTick();
|
||||||
|
|
||||||
|
/* Clear the timer interrupt */
|
||||||
|
ulCSR = XTmrCtr_GetControlStatusReg( XPAR_AXI_TIMER_0_BASEADDR, 0 );
|
||||||
|
XTmrCtr_SetControlStatusReg( XPAR_AXI_TIMER_0_BASEADDR, 0, ulCSR );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue