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

PIC port explanation

Posted by Richard on February 1, 2005
I have moved this message from the bug tracker list. Please do not submit bug trackers until it has been shown that a bug exists. Original message follows:

I'm not very much into pic-assembler (yet), but I believe
there is an error in the pic-port.

From port.c:

<snippet from PortSAVECONTEXT macro>
/* Save the new top of the software stack in
the TCB. */
_asm
MOVFF pxCurrentTCB, FSR0L
MOVFF pxCurrentTCB + 1, FSR0H
MOVFF FSR1L, POSTINC0
MOVFF FSR1H, POSTINC0
_endasm
}
</snippet from PortSAVECONTEXT macro>

<snippet from PortRESTORECONTEXT macro>
/* Set FSR0 to point to pxCurrentTCB-
>pxTopOfStack. */
MOVFF pxCurrentTCB, FSR0L
MOVFF pxCurrentTCB + 1, FSR0H
</snippet from PortRESTORECONTEXT macro>

I cannot believe that the code in the PortSAVECONTEXT-
macro saves something in the TCB...


RE: PIC port explanation

Posted by Richard on February 1, 2005
Here is the save context snippet with an explanation:

; Obtain the low byte of the pointer to the current
; TCB and place it in the low byte of the FSR0
; register.
MOVFF pxCurrentTCB, FSR0L

; Obtain the high byte of the pointer to the current
; TCB and place it in the high byte of the FSR0
; register.
MOVFF pxCurrentTCB + 1, FSR0H

; The FSR1 register is being used as the stack
; pointer. FSR0 now points to the current TCB
; structure - the first member of which is the top
; of stack. Store the top of stack being used into
; the TCB top of stack member.

; Move the low byte of the stack pointer into the
; TCB, then increment the pointer to the high
; byte.
MOVFF FSR1L, POSTINC0

; Move the high byte of the stack pointer into the
; TCB. The FSR0 register is pointing to the high
; byte already due to the post increment in
; the statement above.
MOVFF FSR1H, POSTINC0


RE: PIC port explanation

Posted by Marcel van Lieshout on February 3, 2005
Thanks, it starts making sense now I'm getting more and more into pic asm...


[ 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