mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-20 05:21:59 -04:00
RISC-V work in progress:
+ Initialise task stack. + Successfully jump to start of first task.
This commit is contained in:
parent
0c0f0d0f8f
commit
b11eb3a59c
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* FreeRTOS Kernel V10.1.0
|
* FreeRTOS Kernel V10.1.1
|
||||||
* Copyright (C) 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
* Copyright (C) 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
@ -90,8 +90,65 @@ StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t px
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
*pxTopOfStack = ( StackType_t ) pxCode; /* X1 */
|
*pxTopOfStack = ( StackType_t ) pxCode; /* X1 */
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
*pxTopOfStack =
|
// *pxTopOfStack = ( StackType_t ) 2; /* Stack pointer is handled separately. */
|
||||||
|
// pxTopOfStack--;
|
||||||
|
// *pxTopOfStack = ( StackType_t ) 3; /* Global pointer is not manipulated. */
|
||||||
|
// pxTopOfStack--;
|
||||||
|
// *pxTopOfStack = ( StackType_t ) 4; /* Thread pointer is not manipulated. */
|
||||||
|
// pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) 5;
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) 6;
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) 7;
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) 8;
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) 9;
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) pvParameters;
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) 11;
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) 12;
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) 13;
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) 14;
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) 15;
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) 16;
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) 17;
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) 18;
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) 19;
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) 20;
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) 21;
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) 22;
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) 23;
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) 24;
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) 25;
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) 26;
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) 27;
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) 28;
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) 29;
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) 30;
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) 31;
|
||||||
|
|
||||||
return pxTopOfStack;
|
return pxTopOfStack;
|
||||||
}
|
}
|
||||||
|
@ -99,9 +156,50 @@ StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t px
|
||||||
|
|
||||||
BaseType_t xPortStartScheduler( void )
|
BaseType_t xPortStartScheduler( void )
|
||||||
{
|
{
|
||||||
|
__asm volatile
|
||||||
|
(
|
||||||
|
".extern pxCurrentTCB \r\n"
|
||||||
|
"lw sp, pxCurrentTCB \r\n" /* Load pxCurrentTCB. */
|
||||||
|
"lw sp, 0x00( sp ) \r\n" /* Read sp from first TCB member. */
|
||||||
|
"lw x31, 0( sp ) \r\n" /* X31 */
|
||||||
|
"lw x30, 4( sp ) \r\n" /* X30 */
|
||||||
|
"lw x29, 8( sp ) \r\n" /* X29 */
|
||||||
|
"lw x28, 12( sp ) \r\n" /* X28 */
|
||||||
|
"lw x27, 16( sp ) \r\n" /* X27 */
|
||||||
|
"lw x26, 20( sp ) \r\n" /* X26 */
|
||||||
|
"lw x25, 24( sp ) \r\n" /* X25 */
|
||||||
|
"lw x24, 28( sp ) \r\n" /* X24 */
|
||||||
|
"lw x23, 32( sp ) \r\n" /* X23 */
|
||||||
|
"lw x22, 36( sp ) \r\n" /* X22 */
|
||||||
|
"lw x21, 40( sp ) \r\n" /* X21 */
|
||||||
|
"lw x20, 44( sp ) \r\n" /* X20 */
|
||||||
|
"lw x19, 48( sp ) \r\n" /* X19 */
|
||||||
|
"lw x18, 52( sp ) \r\n" /* X18 */
|
||||||
|
"lw x17, 56( sp ) \r\n" /* X17 */
|
||||||
|
"lw x16, 60( sp ) \r\n" /* X16 */
|
||||||
|
"lw x15, 64( sp ) \r\n" /* X15 */
|
||||||
|
"lw x14, 68( sp ) \r\n" /* X14 */
|
||||||
|
"lw x13, 72( sp ) \r\n" /* X13 */
|
||||||
|
"lw x12, 76( sp ) \r\n" /* X12 */
|
||||||
|
"lw x11, 80( sp ) \r\n" /* X11 */
|
||||||
|
"lw x10, 84( sp ) \r\n" /* X10 */
|
||||||
|
"lw x9, 88( sp ) \r\n" /* X9 */
|
||||||
|
"lw x8, 92( sp ) \r\n" /* X8 */
|
||||||
|
"lw x7, 96( sp ) \r\n" /* X7 */
|
||||||
|
"lw x6, 100( sp ) \r\n" /* X6 */
|
||||||
|
"lw x5, 104( sp ) \r\n" /* X5 */
|
||||||
|
"lw x1, 108( sp ) \r\n" /* X1 */
|
||||||
|
"csrs mstatus, 8 \r\n" /* Enable interrupts. */
|
||||||
|
"ret "
|
||||||
|
);
|
||||||
|
|
||||||
/*Should not get here*/
|
/*Should not get here*/
|
||||||
return pdFALSE;
|
return pdFALSE;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
void vPortYield( void )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* FreeRTOS Kernel V10.1.0
|
* FreeRTOS Kernel V10.1.1
|
||||||
* Copyright (C) 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
* Copyright (C) 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
@ -70,7 +70,8 @@ not need to be guarded with a critical section. */
|
||||||
|
|
||||||
|
|
||||||
/* Scheduler utilities. */
|
/* Scheduler utilities. */
|
||||||
#define portYIELD()
|
extern void vPortYield( void );
|
||||||
|
#define portYIELD() vPortYield()
|
||||||
#define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired ) vPortYield()
|
#define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired ) vPortYield()
|
||||||
#define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
|
#define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
Loading…
Reference in a new issue