Skip to main content
Gustav Andersson
Associate II
December 22, 2017
Solved

Illegal instructions when using -fpic

  • December 22, 2017
  • 4 replies
  • 1725 views
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
    This topic has been closed for replies.
    Best answer by Erwan YVIN
    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

    4 replies

    Erwan YVIN
    Erwan YVINBest answer
    ST Technical Moderator
    December 22, 2017
    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

    In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question.
    Gustav Andersson
    Associate II
    December 22, 2017
    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

    Erwan YVIN
    ST Technical Moderator
    January 8, 2018
    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

    In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question.