Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Loading

Stack overflow hook on PIC32MZ/Harmony

Posted by pbjork on September 19, 2014

I'm adapting some Harmony 1.0 demo code by adding USART functionality to the Harmony RTOS/dual USB/CDC demo project through the Harmony Configurator. I think I've got the configuration correct. This is on the PIC32MZ starter kit board, with the XC32 1.33 compiler. FreeRTOS v8.? is as included in Harmony 1.0 distribution.

The problem is that when I try to run an extra task, the framework tasks seem to get starved out, and I get a stack overflow hook error. The task that throws the error seems to be the Framework (system) tasks, but sometimes it seems to be a NULL task, according to the current task stub object. If I suspend() the other task immediately after creating it, or before it gets into its for(;;) loop, then the whole original CDC project runs correctly. More specifically, if I try to block the task using the API routines Delay() or DelayUntil() (sp?), then the stack overflow hook is thrown.

I've tried increasing the framework stack size, doubling it to 2048 words, to no avail. Framework task priority is 1, other task priority is 4, max is set to 6.

Any ideas?


Stack overflow hook on PIC32MZ/Harmony

Posted by rtel on September 19, 2014

If you are increasing the stack size but it still overflows then it could be that something is being called recursively, or that simply something has overwritten the stack (corrupted the stack).

What happens if you have your task(s) running at the same priority as the framework task?

Regards.


Stack overflow hook on PIC32MZ/Harmony

Posted by pbjork on September 19, 2014

I'll try dropping the extra task priority to the same as that of the framework task. And check for anything recursive.

BTW, it seems that the overflow can occur before any framework code has been executed ( as verified by breakpoint on the first line). Harmony-generated code does not use assembly wrappers. Is it possible that a bunch of interrupts come in, nesting and increasing the stack usage?


Stack overflow hook on PIC32MZ/Harmony

Posted by pbjork on September 19, 2014

Drat!

I confused configMAXSYSCALLINTERRUPTPRIORITY with configMAXPRIORITY. I changed the former from 3 to 4, corresponding to that of my new task and the code works without a stack overflow. Sorry for wasting both of our times.

BTW, the question about assembly ISR wrappers is still confusing me. Even though Harmony does not auto-generate them, shall I write them out anyway to avoid the nested interrupt stack size problem? Do you suppose that Microchip will get around to providing this option?

Shall I put this into a new topic?


Stack overflow hook on PIC32MZ/Harmony

Posted by rtel on September 19, 2014

Not to worry. I will ping Microchip about the wrappers.

Regards.


Stack overflow hook on PIC32MZ/Harmony

Posted by tlafleur on September 19, 2014

Paul

Is it possible for you to send me or post a copy of your working project...

Thanks

On Fri, Sep 19, 2014 at 11:09 AM, Paul Bjork pbjork@users.sf.net wrote:

Drat!

I confused configMAXSYSCALLINTERRUPTPRIORITY with configMAXPRIORITY. I changed the former to 4, corresponding to that of my new task and the code works without a stack overflow. Sorry for wasting both of our times.

BTW, the question about assembly ISR wrappers is still confusing me. Even though Harmony does not auto-generate them, shall I write them out anyway to avoid the nested interrupt stack size problem? Do you suppose that Microchip will get around to providing this option?

Shall I put this into a new topic?

Stack overflow hook on PIC32MZ/Harmony

Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/freertos/discussion/382005/

To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

~~ _/) ~~~~ _/) ~~~~ _/) ~~~~ _/) ~~

Tom Lafleur

Attachments

alternate (1960 bytes)

Stack overflow hook on PIC32MZ/Harmony

Posted by pbjork on September 20, 2014

Tom,

I'm not quite sure how to wrap up the project to send to you, but I'll try to zip it. But where to send it? I suppose I could post it.

Psul


Stack overflow hook on PIC32MZ/Harmony

Posted by tlafleur on September 20, 2014

Tom @ lafleur dot us

~~ _/) ~~~~ _/) ~~~~ _/) ~~~~ _/) ~~

On Sep 19, 2014, at 6:27 PM, Paul Bjork pbjork@users.sf.net wrote:

Tom,

I'm not quite sure how to wrap up the project to send to you, but I'll try to zip it. But where to send it? I suppose I could post it.

Psul

Stack overflow hook on PIC32MZ/Harmony

Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/freertos/discussion/382005/

To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

Attachments

alternate (1160 bytes)


[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]


Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner