Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




Loading

Corrected portable for Cortex-M0 (LPC11C14)

Posted by Dave Nadler on July 12, 2011
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 ;-)

RE: Corrected portable for Cortex-M0 (LPC11C14)

Posted by MEdwards on July 12, 2011
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.

RE: Corrected portable for Cortex-M0 (LPC11C14)

Posted by Dave Nadler on July 12, 2011
I will definitely post this after I get it cleaned up, probably next week,
first I must finish the (delayed by this issue) project and send some
boards to the customer... M0 stack setup is a bit different...
Best Regards, Dave


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




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists