Comment 5 for bug 1763050

Revision history for this message
aoandr (t-launchpad-nbs-eng-ru) wrote :

Thank you for your efforts!

This code comes from the FreeRTOS project.
The actual functions look like:

static void prvPortStartFirstTask( void )
{
__asm volatile(
  " ldr r0, =0xE000ED08 \n" /* Use the NVIC offset register to locate the stack. */
  " ldr r0, [r0] \n"
  " ldr r0, [r0] \n"
  " msr msp, r0 \n" /* Set the msp back to the start of the stack. */
  " cpsie i \n" /* Globally enable interrupts. */
  " cpsie f \n"
  " dsb \n"
  " isb \n"
  " svc 0 \n" /* System call to start first task. */
  " nop \n");
}

and

static void vPortEnableVFP( void )
{
__asm volatile (
  " ldr.w r0, =0xE000ED88 \n" /* The FPU enable bits are in the CPACR. */
  " ldr r1, [r0] \n"
  " \n"
  " orr r1, r1, #( 0xf << 20 ) \n" /* Enable CP10 and CP11 coprocessors, then save back. */
  " str r1, [r0] \n"
  " bx r14 ");
}

So, it looks like __asm() is essential here.
Will the proposed solution "ldr r1, [%0]" :: "r" (0xE000ED88) : "r1", "memory" work in this context? (Sorry, I have very little understanding of ARM assembly language.)

Thanks in advance!