Control reaches end of non-void function

Building FreeRTOS for an RP2040, in kernel module portable/ThirdParty/GCC/RP2040/port.c there is a function defined:

 uint32_t ulSetInterruptMaskFromISR( void )
{
    __asm volatile (
        " mrs r0, PRIMASK    \n"
        " cpsid i            \n"
        " bx lr                "
        ::: "memory"
        );
}

The compiler complains that there is no obvious return value because obviously it has no idea what the asm code is doing. How to avoid this?

The function is marked as naked here which should address this. Just to double check that this declaration is seen by the compiler, can you please add the following line just before the function definition:

uint32_t ulSetInterruptMaskFromISR( void ) __attribute__( ( naked ) );

I did not write this code - it is part of the ARM_CM0 port. I don’t think I should have to modify the SDK to get it to compile. Instead I turned off some of the more detailed compiler checking options and now that works.

But now I am stuck at link time where it can not find vPortValid, vPortEnterCritical, vPortExitCritical, and pxPortInitializeStack, all referenced inside port.c. I can’t even find where these are defined. I just find ‘extern’ references.

This is one of those warnings which is hard to suppress because different compilers (this builds with GCC and LLVM), and versions of those compilers, will generate different warnings. You can just put a “return 0” at the end of the function, outside the __asm{} block if you don’t mind some compiler versions warning the code is unreachable.

From your first post, I see that you are using ThirdParty/GCC/RP2040 port. Here are the missing functions that you are pointing:

I guess you mean vPortYield and not vPortValid which is here - FreeRTOS-Kernel/portable/ThirdParty/GCC/RP2040/port.c at main · FreeRTOS/FreeRTOS-Kernel · GitHub.

Yes, I meant vPortYield. It is confusing that there seem to be two sets of CM0 ports. I will add that ‘thirdparty’ one to my cmake file.

You should use ThirdParty/GCC/RP2040 port for RP2040 and not the GCC/ARM_CM0.