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] [February 2010 Threads] PIC32 CP0 operationsPosted by Eric Lofstad on February 15, 2010 The code for the PIC32 in portmacro.h does a read-modify-write on CP0 to control stuff like interrupts, which does not seem safe. For example this code enables interrupts. ulStatus = _CP0_GET_STATUS() ulStatus &= ~portALL_IPL_BITS; _CP0_SET_STATUS( ulStatus ); why do that rather than this _CP0_BIC_STATUS(portALL)IPL_BITS);
RE: PIC32 CP0 operationsPosted by Richard on February 16, 2010 The code generated by your suggestion is:
9D000020 40026000 mfc0 v0,Status << read 9D000024 00401821 addu v1,v0,zero 9D000028 3C02FFFF lui v0,0xffff 9D00002C 344203FF ori v0,v0,0x3ff 9D000030 00621024 and v0,v1,v0 9D000034 40826000 mtc0 v0,Status << write
so it is still performing a read/modify/write sequence so I'm not sure what is to be gained.
That said, the original code is probably less than ideal, however I don't think it is problematic because each task has its own Status value, and its own stack onto which ulStatus is stored.
Regards.
RE: PIC32 CP0 operationsPosted by Eric Lofstad on February 16, 2010 Thanks for the reply, I should have looked at the assembly first. I'm still left wondering how atomic the operation is, but the is independent of FreeRTOS.
Eric
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|