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] [June 2012 Threads] Saving CRC Register on context switchPosted by Hari on June 20, 2012 I am using MSP430F5418 with FreeRTOS 7 in medium data model.
I want to save the MSP CRC registers on FreeRTOS context switch. I edited the portext.s43 like this.
In save context macro, after pushing 15 registers to stack, I push the CRC registers. (CRCDI is the MSP register to save)
mov.w CRCD1, r15 pushx.a r15 In restore context macro, I poped the CRC just before poping the 15 registers.
popx.a r15 mov.w r15, CRCDI It is supposed to be working , but it is not. The program control is going to unknow location.
Anybody have any Idea?
RE: Saving CRC Register on context switchPosted by Richard on June 20, 2012 You will also have to set up the initial stack given to the task when it is created to include the additional register - otherwise, when the task first starts, the restore context macro will try and pop a register that does not exist resulting in junk in the register and a stack underflow.
Look at the function pxPortInitialiseStack() in whichever port.c file you are using.
Regards.
RE: Saving CRC Register on context switchPosted by Hari on June 20, 2012 Thank you Richard for your reply. In that function what should I change?
RE: Saving CRC Register on context switchPosted by Richard on June 20, 2012 I don't know which port you are looking at, but if you look at FreeRTOS/Source/Portable/IAR/MSP430X/port.c, then assume PRELOAD_REGISTER_VALUES is set, you will see that the function writes a value for each register that is to be popped from the stack when the context is loaded. If your new register is the last thing popped from the stack, add it to the start of the list, if it is the first thing popped from the stack, add it to the end of the list.
Regards.
RE: Saving CRC Register on context switchPosted by Hari on June 21, 2012 But PRELOAD_REGISTER_VALUES is not set in my port.c, what should I do?
RE: Saving CRC Register on context switchPosted by Hari on June 21, 2012 I added the following at the top. before #ifdef PRELOAD_REGISTER_VALUES *pxTopOfStack = (portSTACK_TYPE) 0xffff; pxTopOfStack--;
#ifdef PRELOAD_REGISTER_VALUES follows
Now it is working but while restoring context, incorrect value is loaded
RE: Saving CRC Register on context switchPosted by Hari on June 21, 2012 Ya Now it is working. I want to save CRCRESR register also to do that. So I need one more *pxTopOfStack = (portSTACK_TYPE) 0xffff; pxTopOfStack--;
for that, right?
RE: Saving CRC Register on context switchPosted by Richard on June 21, 2012 “But PRELOAD_REGISTER_VALUES is not set in my port.c, what should I do?” Which port are you using then? Regards.
RE: Saving CRC Register on context switchPosted by Hari on June 21, 2012 I'm Sorry, I found it
RE: Saving CRC Register on context switchPosted by Hari on June 21, 2012 I am sorry, I couldn't found the PRELOAD_REGISTER_VALUES, anywhere in the free RTOS 7.0 files.
Could you please tell me how can I delete a post from this forum?
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|