- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to implement a simple FreeRTOS V9.0 demo on my existing NiosII system. I am using FreeRTOS demo for Nios II pretty much as is. The only changes I had to do were:
- Change my BSP type to HAL
- Regenerate BSP
- Modify system.h to remove# define ALT_ENHANCED_INTERRUPT_API_PRESENT and add# define ALT_LEGACY_INTERRUPT_API_PRESENT
- Modify FreeRTOSConfig.h to match my platform settings
- Make a very simple demo (see below)
.section .exceptions.soft, "xa"soft_exceptions:
ldw et, 0(ea) # Load the instruction where the interrupt occured.
movhi at, %hi(0x003B683A) # Load the registers with the trap instruction code
ori at, at, %lo(0x003B683A)
cmpne et, et, at # Compare the trap instruction code to the last excuted instruction
beq et, r0, call_scheduler # its a trap so switchcontext
break # This is an un-implemented instruction or muldiv problem.
br restore_context # its something else
static void MyTask( void *p){
static volatile u32 cntr = 0;
while(1)
{
cntr++;
vTaskDelay(100);
cntr++;
}
}
static StackType_t MyTaskStack;
StaticTask_t MyTaskBuffer;
int main()
{
TaskHandle_t taskHandle;
taskHandle = xTaskCreateStatic(
MyTask,
"MyTaskName",
NumEntries(MyTaskStack),
NULL,
2 | portPRIVILEGE_BIT, // Low priority numbers denote low priority tasks.
MyTaskStack,
&MyTaskBuffer);
if (NULL == taskHandle)
asm( "break" );
vTaskStartScheduler();
// Will only reach here if there is insufficient heap available to start the scheduler.
for( ;; );
}
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
After some deep diving into FreeRTOS port_asm.S file and comparing it against the standard exception handling code in HAL, I figured out the problem. The issue is that the FreeRTOS port requires that HAL must have hal.enable_runtime_stack_checking set to false. Having changed just that one setting, I am now able to properly continue executing after hitting a breakpoint.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page