mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-10-17 18:27:47 -04:00
added correct interrupt handler initialization in RISC-V-Qemu-virt_GCC (#864)
* added correct trap_handler initialization in main.c Co-authored-by: Joseph Julicher <jjulicher@mac.com> Co-authored-by: Kody Stribrny <kstribrn@amazon.com> Co-authored-by: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com>
This commit is contained in:
parent
54d4eeaa26
commit
dc2c031c45
3 changed files with 78 additions and 2 deletions
|
@ -20,7 +20,7 @@
|
|||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://www.github.com/FreeRTOS
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -30,6 +30,10 @@
|
|||
|
||||
/* Run a simple demo just prints 'Blink' */
|
||||
#define DEMO_BLINKY 1
|
||||
#define mainVECTOR_MODE_DIRECT 1
|
||||
|
||||
extern void freertos_risc_v_trap_handler( void );
|
||||
extern void freertos_vector_table( void );
|
||||
|
||||
void vApplicationMallocFailedHook( void );
|
||||
void vApplicationIdleHook( void );
|
||||
|
@ -43,6 +47,16 @@ int main_blinky( void );
|
|||
int main( void )
|
||||
{
|
||||
int ret;
|
||||
// trap handler initialization
|
||||
#if( mainVECTOR_MODE_DIRECT == 1 )
|
||||
{
|
||||
__asm__ volatile( "csrw mtvec, %0" :: "r"( freertos_risc_v_trap_handler ) );
|
||||
}
|
||||
#else
|
||||
{
|
||||
__asm__ volatile( "csrw mtvec, %0" :: "r"( ( uintptr_t )freertos_vector_table | 0x1 ) );
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(DEMO_BLINKY)
|
||||
ret = main_blinky();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue