Error: invalid swi expression Error: value of 0000000000070000 too large for field of 2 bytes at 000

Hi,

I am trying to compile the uart code comes with AM335X_StarterWare_02_00_01_01 for BeagleBoneBlack.
But I get below error :

/tmp/ccKSsL5N.s:43: Error: invalid swi expression
/tmp/ccKSsL5N.s:43: Error: value of 0000000000070000 too large for field of 2 bytes at 0000000000000004

this error comes for the below code:

****************************************************************************/
/

  • \brief This API can be used to switch from user mode to privileged mode
  • The priviledge mode will be system mode. System mode will share
  • the same resources as user mode, but with privileges.

Can anyone help me to fix this problem? Is it a gcc compiler issue or issue with the code.

Aside from 458752 being about 7 times to big to fit in a 16 bit field ?

So, what value I should use to enable privileged mode of BeagleBoneBlack?

void CPUSwitchToPrivilegedMode(void)
{
asm(" SWI ???");
}

Manish,

I have no idea how the underlying code uses this value so I could not give an 100% accurate answer.

Except that the value passed in as is will have to be between 0 and 65535( max range for a 16bit type ).

The SWI op code accepts a 24 bit immedtiate operand, which is assembled as its lower 24 bits. The interrupt routine called by SWI extracts it and interprets it. Perhaps you need to indicate its an immediate value using your assemblers syntax.

Thanks for the suggestion, Jerome.

As you suggested, I tried passing the value with $, like below
asm(" SWI $458752");

But it did not worked.

Then, In some link in internet , I found out that, my arm cross compiler(arm-linux-gnueabi-gcc) automatically generates thumb instructions, and somehow this instruction is not supported with that.

So, I just added “-marm” in the compiler option, to not to generate thumb instructions and it worked out.

Now, I am not getting this error, and it compiled perfectly.

Thanks for your help. Regards,