cancel
Showing results for 
Search instead for 
Did you mean: 

Illegal instructions when using -fpic

Gustav Andersson
Associate II
Posted on December 22, 2017 at 09:55

Hello,

I'm trying to make my application position independent so that I canplace the software anywhere in the flash of the SPC564B I'm using.

Is this possible using the free FreeGCC v4.9.3 with VLE support?

If so, is there a guide available on how to solve this?

When I'm trying to just add -fpic, -fPIC or -fpie I get illegal instructions:

make all 
ppc-freevle-eabi-gcc -c -mcpu=e200z4 -meabi -msdata=none -mregnames -mvle -O2 -gdwarf-2 -fomit-frame-pointer -falign-functions=16 -fno-gcse -Wno-missing-field-initializers -fpie -ffunction-sections -fdata-sections -fno-common -Wall -Wextra -Wstrict-prototypes -Wa,-alms=build/lst/queue.lst -DPPC_USE_VLE=1 -D__FREERTOS__ -DconfigUSE_APPLICATION_TASK_TAG=1 -DconfigUSE_TRACE_FACILITY=1 -D__SPC5__ -DNPI_USE_BLEIO -DNPI_USE_UART -DNPI_MASTER -DDEBUG -DEVTLOGPINS -D__POLESTAR_PAK -DPAKM_LOW_POWER -DNATIVE_BIG_ENDIAN=1 -DSODIUM_STATIC -DNPI_POLESTAR -DPAKM_PROTO_V1 -DPAKM_PROTO_V2 -MD -MP -MF .dep/queue.o.d -I. -I./components/spc56ecxx_platform_component_rla/lib/include -I./components/spc5_freertos_component_rla/lib/include -I./components/spc5_freertos_component_rla/lib/portable -I./components/spc56ecxx_low_level_drivers_component_rla/lib/include -I./components/flash_driver/lib/include -I./components/spc5_crypto_spc56ecxx_cse_driver/lib/include -I./components/spc5_crypto_spc56ecxx_cse_driver/lib/include/common -I./components/spc5_crypto_spc56ecxx_cse_driver/cfg -I./components/spc5_crypto_spc56ecxx_cse_driver/lib/test -I./components/spc5_crypto_spc56ecxx_cse_support/lib/include -I./components/spc5_crypto_spc56ecxx_cse_support/cfg -I./components/spc5_crypto_spc56ecxx_cse_support/lib/test -I./components/spc5_crypto_spc56ecxx_cse_support/../cse_crypto_driver/cfg -I./components/spc5_crypto_spc56ecxx_cse_support/../cse_crypto_driver/lib/include -I./components/spc56ecxx_board_initialization_component_rla/lib/include -I./components/spc56ecxx_clock_component_rla/lib/include -I./components/spc56ecxx_irq_component_rla/lib/include -I./components/spc56ecxx_osal_component_rla/lib/include -I./components/spc56ecxx_platform_component_rla/cfg -I./components/spc5_freertos_component_rla/cfg -I./components/spc56ecxx_low_level_drivers_component_rla/cfg -I./components/flash_driver/cfg -I./components/spc5_crypto_spc56ecxx_cse_driver/cfg -I./components/spc5_crypto_spc56ecxx_cse_support/cfg -I./components/spc56ecxx_board_initialization_component_rla/cfg -I./components/spc56ecxx_clock_component_rla/cfg -I./components/spc56ecxx_irq_component_rla/cfg -I./components/spc56ecxx_osal_component_rla/cfg -I./source/ -I./components -I../../platform/drivers/st_spc5/spc5_only -I../.. -Icomponents/spc56ecxx_low_level_drivers_component_rla/cfg ./components/spc5_freertos_component_rla/lib/src/queue.c -o build/obj/queue.o
C:\Users\username\AppData\Local\Temp\cc4I5qUf.s: Assembler messages:
C:\Users\username\AppData\Local\Temp\cc4I5qUf.s:2569: Error: Illegal instruction for VLE mode: `bl'
C:\Users\username\AppData\Local\Temp\cc4I5qUf.s:2590: Error: Illegal instruction for VLE mode: `lwz'
C:\Users\username\AppData\Local\Temp\cc4I5qUf.s:2642: Error: Illegal instruction for VLE mode: `lwz'
C:\Users\username\AppData\Local\Temp\cc4I5qUf.s:2766: Error: Illegal instruction for VLE mode: `bl'
C:\Users\username\AppData\Local\Temp\cc4I5qUf.s:2780: Error: Illegal instruction for VLE mode: `lwz'
C:\Users\username\AppData\Local\Temp\cc4I5qUf.s:2835: Error: Illegal instruction for VLE mode: `bl'
C:\Users\username\AppData\Local\Temp\cc4I5qUf.s:2848: Error: Illegal instruction for VLE mode: `lwz'
C:\Users\username\AppData\Local\Temp\cc4I5qUf.s:2880: Error: Illegal instruction for VLE mode: `lwz'
C:\Users\username\AppData\Local\Temp\cc4I5qUf.s:2913: Error: Illegal instruction for VLE mode: `bl'
C:\Users\username\AppData\Local\Temp\cc4I5qUf.s:2926: Error: Illegal instruction for VLE mode: `lwz'
C:\Users\username\AppData\Local\Temp\cc4I5qUf.s:2953: Error: Illegal instruction for VLE mode: `lwz'
make: *** [build/obj/queue.o] Error 1�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?

#spc5 #fpic
1 ACCEPTED SOLUTION

Accepted Solutions
Erwan YVIN
ST Employee
Posted on December 22, 2017 at 11:07

Hello Gustav,

for your information,

FreeGCC v4.9.3 (

-fpic and -mvle are incompatible)

Maybe due to the long branch and so on ..

even in hightec compiler (based on gcc) (4.6.3) , it is not compatible 

            Best regards

                       Erwan

View solution in original post

4 REPLIES 4
Erwan YVIN
ST Employee
Posted on December 22, 2017 at 11:07

Hello Gustav,

for your information,

FreeGCC v4.9.3 (

-fpic and -mvle are incompatible)

Maybe due to the long branch and so on ..

even in hightec compiler (based on gcc) (4.6.3) , it is not compatible 

            Best regards

                       Erwan

Posted on December 22, 2017 at 12:07

Hello,

thanks for your answer. Is there a way to compile without using VLE?

Best regards,

Gustav

Posted on January 08, 2018 at 09:47

Hello Gustav ,

yes , it is possible on

SPC564B family but the .s is not compliant.

you have to update some VLE assembler routines to render in non-VLE mode.

            Best Regards

                  Erwan

Posted on January 25, 2018 at 19:07

Hi Erwan,

I have a similar issue where I need to use -fPIC, but am getting the illegal instruction for VLE mode errors.

Could you elaborate on how to update those VLE assembler routines so that it creates the .s file so it is compliant?

EDIT:  Unfortunately I realized that the SPC560C I am using has a e200z0 core, which apparently can only use VLE mode.  While I'm still curious about the question above, I have a new question as well:

Does this mean that the e200z0 core can't use any form of position independent code?  We have a workaround for the PIC, but would be more convenient to continue to use the PIC that we were using on a previous version of the project.

Thanks,

Davin