npatel wrote on Saturday, December 17, 2016:
I am getting quite confused with this problem and not too sure why I am running into it. I am getting an error from FreeRTOS that states:
HALT: Task overflowed its stack.
Note that there is no task name being printed out here. If I dont fire the uart interrupts everything in the task works fine. When I begin entering in characters on the uart, eventually after a random time of entering in commands I get this message coming up.
I have increased the stack and heap sizes to be more than 16K and still encounter this problem in pretty much random times. (Its not taking longer to show the problem)
I am using fast_interrupts for the uart for the microblaze port. But I dont believe that the interrupts are the issue as I am able to fire them and print to hyperterminal just fine, without the task being executed. When I disable the main_task which is simply toggling a LED with characters being entered I get a stack overflow.
I have attached what the task is doing below:
void
main_task()
{
int counter = 0;
while( 1 )
{
if ( (counter++%2) == 0 )
{
*(volatile unsigned int*)0x40000000 &= ~0x1;
}
else
{
*(volatile unsigned int*)0x40000000 |= 0x1;
}
vTaskDelay(200);
}
}
int main()
{
xTaskCreate( (void(*)(void*)) main_task, "main_task", 4096, NULL, 3, &xCreatedTask );
vTaskStartScheduler();
}
The linker script is below:
STARTUP(crt0.o)
ENTRY(_start)
_STACK_SIZE = 0x4000;
_HEAP_SIZE = 0x4000;
MEMORY
{
mig_7series_0 : ORIGIN = 0x80000000, LENGTH = 0x10000000
}
SECTIONS
{
.vectors.reset 0x0 : {
KEEP (*(.vectors.reset))
}
.vectors.sw_exception 0x8 : {
KEEP (*(.vectors.sw_exception))
}
.vectors.interrupt 0x10 : {
KEEP (*(.vectors.interrupt))
}
.vectors.hw_exception 0x20 : {
KEEP (*(.vectors.hw_exception))
}
.text : {
*(.text)
*(.text.*)
*(.gnu.linkonce.t.*)
} > mig_7series_0
.rodata : {
__rodata_start = .;
*(.rodata)
*(.rodata.*)
*(.gnu.linkonce.r.*)
__rodata_end = .;
} > mig_7series_0
.sdata2 : {
. = ALIGN(8);
__sdata2_start = .;
*(.sdata2)
*(.sdata2.*)
*(.gnu.linkonce.s2.*)
. = ALIGN(8);
__sdata2_end = .;
} > mig_7series_0
.sbss2 : {
__sbss2_start = .;
*(.sbss2)
*(.sbss2.*)
*(.gnu.linkonce.sb2.*)
__sbss2_end = .;
} > mig_7series_0
.data : {
. = ALIGN(4);
__data_start = .;
*(.data)
*(.data.*)
*(.gnu.linkonce.d.*)
__data_end = .;
} > mig_7series_0
.sdata : {
. = ALIGN(8);
__sdata_start = .;
*(.sdata)
*(.sdata.*)
*(.gnu.linkonce.s.*)
__sdata_end = .;
} > mig_7series_0
.sbss (NOLOAD) : {
. = ALIGN(4);
__sbss_start = .;
*(.sbss)
*(.sbss.*)
*(.gnu.linkonce.sb.*)
. = ALIGN(8);
__sbss_end = .;
} > mig_7series_0
.tdata : {
__tdata_start = .;
*(.tdata)
*(.tdata.*)
*(.gnu.linkonce.td.*)
__tdata_end = .;
} > mig_7series_0
.tbss : {
__tbss_start = .;
*(.tbss)
*(.tbss.*)
*(.gnu.linkonce.tb.*)
__tbss_end = .;
} > mig_7series_0
.bss (NOLOAD) : {
. = ALIGN(4);
__bss_start = .;
*(.bss)
*(.bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
. = ALIGN(4);
__bss_end = .;
} > mig_7series_0
_SDA_BASE_ = __sdata_start + ((__sbss_end - __sdata_start) / 2 );
_SDA2_BASE_ = __sdata2_start + ((__sbss2_end - __sdata2_start) / 2 );
/* Generate Stack and Heap definitions */
.heap (NOLOAD) : {
. = ALIGN(8);
_heap = .;
_heap_start = .;
. += _HEAP_SIZE;
_heap_end = .;
} > mig_7series_0
.stack (NOLOAD) : {
_stack_end = .;
. += _STACK_SIZE;
. = ALIGN(8);
_stack = .;
__stack = _stack;
} > mig_7series_0
_end = .;
}