FreeRTOS on Pico 2350

Hello,
I’ve modified the RP2040 port to make FreeRTOS usable with the RP2350 until official support is available. You can find the repository at github’com\gabor-budai\FreeRTOS_PICO2350. (‘=’.‘;’'=‘/’; that’s my first topic, I had to find a workaround :slight_smile:)

For simplicity, I’ve included the changes that were made to portmacro.h below:

static inline void vPortRecursiveLock( uint32_t ulLockNum, spin_lock_t * pxSpinLock, BaseType_t uxAcquire )
{
    // recursion logic...

    if( uxAcquire )
    {
        //if( __builtin_expect( !*pxSpinLock, 0 ) )
        if ( __builtin_expect(!spin_try_lock_unsafe(pxSpinLock), 0 ) )
        {
            // recursion logic (if aquired, returns)
            // return;

            spin_lock_unsafe_blocking(pxSpinLock);
            //while( __builtin_expect( !*pxSpinLock, 0 ) ) {}
        }

        //__mem_fence_acquire(); // lock does this.
        // recursion logic
    }
    else
    {
        // recursion logic (release if recursion count is 0)
        spin_unlock_unsafe(pxSpinLock);
        //__mem_fence_release(); // unlock does this.
        //*pxSpinLock = 1;
        
    }
}

Welcome to the FreeRTOS community forums, @gabor-budai! Thanks for contributing. Our team will review your repo and provide feedback or comments soon.

It seems that the pico SDK supports FreeRTOS. Were you not able to use that?

Initially, I noticed that the official FreeRTOS-Kernel repo didn’t have a port for the RP2350, so I tried to figure out what I needed to do to make it runnable.

Then, I found the Raspberry Pi team’s fork, where the RP2350 port is already implemented. I updated the repo accordingly. This information might be useful for others who are also not very familiar with the Pico.

1 Like

Thank you for sharing the information!