FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [July 2011 Threads]
First thanks again Richard for the support !
It appears that crashing I encountered was caused by some
problems in the "portable" components published by NXP.
I've corrected sources, merging the M0-specific changes
from NXP into FreeRTOS V7 ARM_M3 distributed files:
Not included, and I'm not sure where this should go:
MSP should be set up to point to a reserved small stack,
just after switching the stack in use to PSP.
Here's the code I'm using (for now in my main):
int answer = 46;
debug_printf("CONTROL register=%08x, stack in use is %s\n",__get_CONTROL(), (__get_CONTROL()&0x2)?"PSP":"MSP");
debug_printf("Handler mode ALWAYS uses MSP ('Main' stack pointer')\n");
debug_printf("Thread 'normal' mode is *recommended* to use PSP ('Process' stack pointer),\n");
debug_printf("...but defaults (on startup) to MSP\n");
// Set up "process" stack pointer and switch to it
__set_PSP(__get_MSP()); // copy current stack pointer value into PSP
__set_CONTROL(0x00000002); // switch to "process" stack pointer PSP
debug_printf("After stack pointer switch: CONTROL register=%08x, stack in use is %s\n",__get_CONTROL(), (__get_CONTROL()&0x2)?"PSP":"MSP");
debug_printf("The answer is %d (should be 46)\n",answer);
// Set MSP to a "safe reserved area", so an exception can run safely...
static MSP_stack[100];
__set_MSP((int)&MSP_stack[99]);
Any comments on my "portable" merge appreciated !
Thanks again,
Best Regards, Dave
PS: My app has now processed >1 million CAN msgs
very happily ;-)
I don't know how the m0 compares to the m3, but on the m3 the interrupt stack uses the stack that was used by main before the kernel was started. The location of the start of the stack is read from the first position of the vector table, if I remember.
If you have a modified port it would be good if you could post it to the http://interactive.freertos.org site. I'm sure people would appreciated that.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.