I create a new project use port.c file which in the Demo project, and run sucessful with STM32 microcontroller. Now I want to write port.c file, how can I get technical support about writting port.c file, or which tutorial can help me. I find nothing in FreeRTOS website, only simply descriptioins. http://www.freertos.org/FreeRTOS-porting-guide.html. Hope you help! Thanks.
Which target do you want to create the port for? Regards.
ARM Cortex-M3 architecture. I know there preparation of a good port.c in Demo Project. If there is a language to express the meaning is not clear, ask me. My mother tongue is not English.
The Cortex-M3 port will run on all Cortex-M3 device, from all manufacturers – you do not need to write a port.c if you want to run on a Cortex-M3. To use a Cortex-M3 or a Cortex-M4 without FPU use the files in: FreeRTOS/Source/portable/[compiler]/ARM_CM3 To use a Cortex-M4 with an FPU use the files in: FreeRTOS/Source/portable/[compiler]/ARM_CM4F Regards.
But I really would like to write port.c file. And if I use a new architecture microcontroller which FreeRTOS does not support, how can I do?
Look in portable.h, the functions that are defined in there need to be implemented in port. There are lots of port.c files you can use as examples. The first thing you will need to do is work out what makes up the architecture context. List out the registers, and decide how they will be placed on the stack. The architecture will dictate some of that if some registers are pushed on to the stack manually. Once you have a function that creates the starting stack for a task, create a function that starts the first task. Again there are lots of examples, and how it can be done is dictated by the architecture. Sometimes a simple function call is all that is needed, but sometimes a software trap is needed. The function moves the stack pointer to the start of the stack created for the task, then pops the registers off the stack into the architecture registers until finally it pops the program counter. The program counter will hold the address of the task function, so popping that address into the program counter will result in a jump to the start of the task. Then you need to work out how you are going to switch between tasks. But one thing at a time. There are some old pages here http://www.freertos.org/implementation/main.html
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.