Skip to content

Cant set custom ldscript for compilation #28

@arsenier

Description

@arsenier

I'm trying to build application using letter-shell, which requires custom .ld script. I managed to add custom script for stm32 platform using following instructions in .ini file

[env:disco_f429zi]
platform = ststm32
board = disco_f429zi
framework = stm32cube
...
board_build.ldscript = STM32F429ZITX_FLASH.ld

I have modified .ld script for native machine also (from letter-shell examples) and tried to do the same under native platform:

[env:native]
platform = native
...
board_build.ldscript = x86.lds

But it does not compile.

Also I tried to add build flag as follows:

[env:native]
platform = native
build_flags =
    -T "x86.lds"

and it for some reason changes to -l/<path>/x86.lds

g++ -o .pio/build/native/program .pio/build/native/lib117/letter-shell/extensions/log/log.o .pio/build/native/lib117/letter-shell/extensions/shell_enhance/shell_cmd_group.o .pio/build/native/lib117/letter-shell/shell.o .pio/build/native/lib117/letter-shell/shell_cmd_list.o .pio/build/native/lib117/letter-shell/shell_companion.o .pio/build/native/lib117/letter-shell/shell_ext.o .pio/build/native/src/devices/bldc/bldc.o .pio/build/native/src/devices/chassis/chassis.o .pio/build/native/src/devices/chassis/chassis.shell.o .pio/build/native/src/devices/device_manager.o .pio/build/native/src/devices/logger/logger.o .pio/build/native/src/devices/oled/oled.o .pio/build/native/src/devices/oled/oled.shell.o .pio/build/native/src/devices/shell/shell.o .pio/build/native/src/drivers/can/can.o .pio/build/native/src/drivers/driver_manager.o .pio/build/native/src/drivers/i2c/i2c.o .pio/build/native/src/drivers/led/led.o .pio/build/native/src/drivers/system_clock/system_clock.o .pio/build/native/src/kernel/kernel.o .pio/build/native/src/main.o -L.pio/build/native -Wl,--start-group -l/<path>/x86.lds -Wl,--end-group
/usr/bin/ld: cannot find -l/<path>/x86.lds: No such file or directory

and linker throws an error.

If I try to run last compile command and change -l/<path>/x86.lds to required -T /<path>/x86.lds it compiles without errors.

So, how can I build my native application with custom ldscript?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions