Recent changes that could affect behavior of vPortStartFirstTask

westmorelandeng wrote on Tuesday, May 03, 2016:

Hello,

Have there been any recent changes that could affect behavior of vPortStartFirstTask?
Specifically any of the ARM R4F ports?

Thanks,
John W.

rtel wrote on Tuesday, May 03, 2016:

Not that I am aware of.

westmorelandeng wrote on Thursday, May 05, 2016:

Hello Richard,

I am having to do this in my portASM.s:

vPortStartFirstTask:
portRESTORE_CONTEXT_FIRST_TASK ; will run in debugger
;; portRESTORE_CONTEXT ; this won’t

And the difference is:

;;;                LDR LR, [LR, #+60]      ;; this will run standalone
                        LDR LR, [SP, #-0x04]          ;; this runs in the debugger

Thanks,
John W.

westmorelandeng wrote on Thursday, May 05, 2016:

Hello FreeRTOSer’s,

A slight mod in port.c fixed this; I want to test this for a while before publishing the fix.

Regards,
John W.

westmorelandeng wrote on Wednesday, May 11, 2016:

Hello,

For the port I am running under IAR for the TI Hercules processor - I have made the following change in ./portable/ARM_Cortex-R4/port.c:

in StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters )

In order to get the first task to start properly:

pxTopOfStack = ( StackType_t ) 0x00000000; / R14 */

has been changed to:

pxTopOfStack = ( StackType_t ) pxOriginalTOS - 64; / R14 */

Here is my comment I have in my code:
// *** this is a fix for the first task to start - otherwise it
// *** is taking the contents of 0 (zero), adding 60 and taking
// *** that as the address before subtracting 4 and loading
// *** that to the PC; which is wrong. It doesn’t hurt to do
// *** this fix-up since R14 is the LR for this architecture.
// *** — jcw

Appears to be an innocuous fix to get the first task started.

Regards,
John W.

heinbali01 wrote on Wednesday, May 11, 2016:

Hi John,

What release of FreeRTOS are you using?

What version of port.c are you writing about?

Is it this file ?

    FreeRTOS_V9.0.0rc2\FreeRTOS\Source\portable\IAR\ARM_CM4F\port.c

PS. The easiest way to include literal code is to surround it with two lines that only contains 4 tildas (```)

    /* Asterix may be used within a code block */
    pxTopOfStack = ( StackType_t ) 0x00000000; /* R14 */

A single word within a phrase can be put between /* backquotes */.

And I guess that the backslash * also works to show special characters.

regards.

westmorelandeng wrote on Wednesday, May 11, 2016:

Hello Hein,

I am using the tip of the FreeRTOS SVN tree.

The port I am using isn’t part of the official release. I took what was what you have pointed out (and is the same file I illustrated in my post) and have modified it. But that port.c is pretty much the same.

Regards,
John W.