Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Altera_Forum
Honored Contributor I
1,117 Views

NIOS II FreeRTOS not run

Hi everyone, 

I'm trying to run FreeRTOS on a Nios 2 processor without success. 

I'm using Quartus Prime v16.1, and my hardware layer is composed by: 

1 Nios 2 gen 2 CPU; 

1 JTAG 

1 UART 

1 timer interval (named sys_clk) 

1 onchip memory module 

1 parallel led interface 

I generate the .sopcinfo thorugh QSYS and Quartus, then I create e new bsp from eclipse by using the altera HAL type. After that, I change ENHANCED interrupt with LEGACY one. 

Finally a new blank project was created on the previous generated bsp. 

Now the FreeRTOS release is copied inside the Eclipse project, all files are linked and compiled. 

I try to run a simple task by driving two leds, but the FreeRTOS is not running. All leds are fixed and the system seems freezed. 

Have you tryied to run FreeRTOS on Nios processor? 

Thank you. 

 

 

include "uart.h" include "altera_avalon_pio_regs.h" / FreeRTOS / include "FreeRTOS.h" include "task.h" include "queue.h" bool UARTrxFLAG; char UARTrx; unsigned int delay; static unsigned int LEDctrl; / definizione funzioni / static void prvSetupHardware( void ); static void prvLEDtask( void *pvParameters ); static void prvSetupHardware( void ) { LEDctrl = 0x01; } int main() { prvSetupHardware(); IOWR_ALTERA_AVALON_PIO_DIRECTION(PIO_LED_BASE, 0x1F); IOWR_ALTERA_AVALON_PIO_DATA(PIO_LED_BASE, 0x00); xTaskCreate(prvLEDtask, "LEDtask", 100, (void*) NULL, tskIDLE_PRIORITY + 1, NULL); /* start scheduler */ vTaskStartScheduler(); /* infinite loop */ for( ;; ); } static void prvLEDtask( void *pvParameters ) { for( ;; ) { LEDctrl ^= 0x03; IOWR_ALTERA_AVALON_PIO_DATA(PIO_LED_BASE, LEDctrl); vTaskDelay(500 / portTICK_PERIOD_MS); } } /-----------------------------------------------------------/ void vApplicationStackOverflowHook( void ) { / Look at pxCurrentTCB to see which task overflowed its stack. / for( ;; ) { asm( "break" ); } } /-----------------------------------------------------------/ void _general_exception_handler( unsigned long ulCause, unsigned long ulStatus ) { / This overrides the definition provided by the kernel. Other exceptions should be handled here. / for( ;; ) { asm( "break" ); } } /-----------------------------------------------------------/
0 Kudos
1 Reply
Altera_Forum
Honored Contributor I
225 Views

 

--- Quote Start ---  

Hi everyone, 

I'm trying to run FreeRTOS on a Nios 2 processor without success. 

I'm using Quartus Prime v16.1, and my hardware layer is composed by: 

1 Nios 2 gen 2 CPU; 

1 JTAG 

1 UART 

1 timer interval (named sys_clk) 

1 onchip memory module 

1 parallel led interface 

I generate the .sopcinfo thorugh QSYS and Quartus, then I create e new bsp from eclipse by using the altera HAL type. After that, I change ENHANCED interrupt with LEGACY one. 

Finally a new blank project was created on the previous generated bsp. 

Now the FreeRTOS release is copied inside the Eclipse project, all files are linked and compiled. 

I try to run a simple task by driving two leds, but the FreeRTOS is not running. All leds are fixed and the system seems freezed. 

Have you tryied to run FreeRTOS on Nios processor? 

Thank you. 

 

 

include "uart.h" include "altera_avalon_pio_regs.h" / FreeRTOS / include "FreeRTOS.h" include "task.h" include "queue.h" bool UARTrxFLAG; char UARTrx; unsigned int delay; static unsigned int LEDctrl; / definizione funzioni / static void prvSetupHardware( void ); static void prvLEDtask( void *pvParameters ); static void prvSetupHardware( void ) { LEDctrl = 0x01; } int main() { prvSetupHardware(); IOWR_ALTERA_AVALON_PIO_DIRECTION(PIO_LED_BASE, 0x1F); IOWR_ALTERA_AVALON_PIO_DATA(PIO_LED_BASE, 0x00); xTaskCreate(prvLEDtask, "LEDtask", 100, (void*) NULL, tskIDLE_PRIORITY + 1, NULL); /* start scheduler */ vTaskStartScheduler(); /* infinite loop */ for( ;; ); } static void prvLEDtask( void *pvParameters ) { for( ;; ) { LEDctrl ^= 0x03; IOWR_ALTERA_AVALON_PIO_DATA(PIO_LED_BASE, LEDctrl); vTaskDelay(500 / portTICK_PERIOD_MS); } } /-----------------------------------------------------------/ void vApplicationStackOverflowHook( void ) { / Look at pxCurrentTCB to see which task overflowed its stack. / for( ;; ) { asm( "break" ); } } /-----------------------------------------------------------/ void _general_exception_handler( unsigned long ulCause, unsigned long ulStatus ) { / This overrides the definition provided by the kernel. Other exceptions should be handled here. / for( ;; ) { asm( "break" ); } } /-----------------------------------------------------------/  

--- Quote End ---  

 

 

Hi lomielectronics, 

 

Can you please share the details how the problem was fixed in your case? I'm facing the same issue. 

 

In my case, I'm using FreeRTOS on NIOSII platform with USB. The interesting thing is, when there isn't any FreeRTOS code integrated to my project, everything runs smoothly including USB(enumerates successfully) and able to see debug prints through Altera JTAG. But when I'm integrating FreeRTOS code in the same working project, NIOS stuck somewhere. I'm even not able to see debug prints on Altera JTAG. Still no luck after I disabled xTaskCreate() and vTaskStartScheduler() and run the project. 

 

Your inputs will really help us a lot. Thanks in advance! 

 

Regards, 

Harshil
Reply