KSDK Linker Error - Command line too long

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

KSDK Linker Error - Command line too long

跳至解决方案
14,363 次查看
larrykoos
Contributor III

I'm using KDS 1.1.1 with MQX_KSDK 1.0.0. I've built a project with Processor Expert targeting a K64 part. After using the project successfully for several weeks, I have reached a point where I get a linker error such as:

 

arm-none-eabi-g++: error: C:/Freescale/KDS_1.1.1/eclipse//../toolchain/arm-none-eabi/lib/m4fp/v4-sp-d16/libm.a: No such file or directory

 

Through experimentation, I have determined this error is caused by a linker command line that exceeds a maximum threshold. Here is an example of the command line auto-generated by the tool:

 

arm-none-eabi-g++ -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections  -g3 -T "C:/Users/Larry/git/asr_v1/asr_v1/Project_Settings/Linker_Files/ProcessorExpert.ld" -Xlinker --gc-sections -L"C:/Users/Larry/git/asr_v1/asr_v1/Project_Settings/Linker_Files" -L"C:\Users\Larry\workspace.kds\xbee\Debug" -Wl,-Map,"asr_v1.map" -nostartfiles -nodefaultlibs -nostdlib -Xlinker -z -Xlinker muldefs -Xlinker -static -o "asr_v1.elf"  ./Static_Code/System/PE_low_level_init.o  ./Sources/xbee/xbee_platform_posix.o ./Sources/xbee/xbee_serial_mqx.o  ./Sources/Events.o ./Sources/asrMessaging.o ./Sources/main.o ./Sources/mqx_tasks.o ./Sources/telit.o ./Sources/uart_handler.o  ./SDK/rtos/mqx/mqx_stdlib/source/strings/strings.o  ./SDK/rtos/mqx/mqx_stdlib/source/stdio/buf_prv.o ./SDK/rtos/mqx/mqx_stdlib/source/stdio/err.o ./SDK/rtos/mqx/mqx_stdlib/source/stdio/fclose.o ./SDK/rtos/mqx/mqx_stdlib/source/stdio/fflush.o ./SDK/rtos/mqx/mqx_stdlib/source/stdio/fopen.o ./SDK/rtos/mqx/mqx_stdlib/source/stdio/fp_prv.o ./SDK/rtos/mqx/mqx_stdlib/source/stdio/fread.o ./SDK/rtos/mqx/mqx_stdlib/source/stdio/fwrite.o ./SDK/rtos/mqx/mqx_stdlib/source/stdio/get.o ./SDK/rtos/mqx/mqx_stdlib/source/stdio/pos.o ./SDK/rtos/mqx/mqx_stdlib/source/stdio/print.o ./SDK/rtos/mqx/mqx_stdlib/source/stdio/print_prv.o ./SDK/rtos/mqx/mqx_stdlib/source/stdio/put.o ./SDK/rtos/mqx/mqx_stdlib/source/stdio/scan.o ./SDK/rtos/mqx/mqx_stdlib/source/stdio/scan_prv.o ./SDK/rtos/mqx/mqx_stdlib/source/stdio/stdio.o  ./SDK/rtos/mqx/mqx/source/string/str_utos.o ./SDK/rtos/mqx/mqx/source/string/strnlen.o ./SDK/rtos/mqx/mqx/source/string/unicode.o  ./SDK/rtos/mqx/mqx/source/psp/cortex_m/core/M4/boot.o ./SDK/rtos/mqx/mqx/source/psp/cortex_m/core/M4/dispatch.o ./SDK/rtos/mqx/mqx/source/psp/cortex_m/core/M4/support.o  ./SDK/rtos/mqx/mqx/source/psp/cortex_m/compiler/gcc_arm/comp.o  ./SDK/rtos/mqx/mqx/source/psp/cortex_m/cortex.o ./SDK/rtos/mqx/mqx/source/psp/cortex_m/int_gkis.o ./SDK/rtos/mqx/mqx/source/psp/cortex_m/int_inst.o ./SDK/rtos/mqx/mqx/source/psp/cortex_m/int_kisr.o ./SDK/rtos/mqx/mqx/source/psp/cortex_m/int_pvta.o ./SDK/rtos/mqx/mqx/source/psp/cortex_m/int_unx.o ./SDK/rtos/mqx/mqx/source/psp/cortex_m/int_vtab.o ./SDK/rtos/mqx/mqx/source/psp/cortex_m/int_xcpt.o ./SDK/rtos/mqx/mqx/source/psp/cortex_m/ipsum.o ./SDK/rtos/mqx/mqx/source/psp/cortex_m/mem_copy.o ./SDK/rtos/mqx/mqx/source/psp/cortex_m/mem_zero.o ./SDK/rtos/mqx/mqx/source/psp/cortex_m/nvic.o ./SDK/rtos/mqx/mqx/source/psp/cortex_m/psp_dati.o ./SDK/rtos/mqx/mqx/source/psp/cortex_m/psp_gelms.o ./SDK/rtos/mqx/mqx/source/psp/cortex_m/psp_hoti.o ./SDK/rtos/mqx/mqx/source/psp/cortex_m/psp_iinit.o ./SDK/rtos/mqx/mqx/source/psp/cortex_m/psp_mat1.o ./SDK/rtos/mqx/mqx/source/psp/cortex_m/psp_mat2.o ./SDK/rtos/mqx/mqx/source/psp/cortex_m/psp_mat3.o ./SDK/rtos/mqx/mqx/source/psp/cortex_m/psp_miti.o ./SDK/rtos/mqx/mqx/source/psp/cortex_m/psp_msti.o ./SDK/rtos/mqx/mqx/source/psp/cortex_m/psp_mstiq.o ./SDK/rtos/mqx/mqx/source/psp/cortex_m/psp_nsti.o ./SDK/rtos/mqx/mqx/source/psp/cortex_m/psp_psti.o ./SDK/rtos/mqx/mqx/source/psp/cortex_m/psp_seti.o ./SDK/rtos/mqx/mqx/source/psp/cortex_m/psp_supp.o ./SDK/rtos/mqx/mqx/source/psp/cortex_m/psp_tiad.o ./SDK/rtos/mqx/mqx/source/psp/cortex_m/psp_tida.o ./SDK/rtos/mqx/mqx/source/psp/cortex_m/psp_tihr.o ./SDK/rtos/mqx/mqx/source/psp/cortex_m/psp_timn.o ./SDK/rtos/mqx/mqx/source/psp/cortex_m/psp_tims.o ./SDK/rtos/mqx/mqx/source/psp/cortex_m/psp_tinm.o ./SDK/rtos/mqx/mqx/source/psp/cortex_m/psp_tins.o ./SDK/rtos/mqx/mqx/source/psp/cortex_m/psp_tiol.o ./SDK/rtos/mqx/mqx/source/psp/cortex_m/psp_tipr.o ./SDK/rtos/mqx/mqx/source/psp/cortex_m/psp_tips.o ./SDK/rtos/mqx/mqx/source/psp/cortex_m/psp_tise.o ./SDK/rtos/mqx/mqx/source/psp/cortex_m/psp_tisu.o ./SDK/rtos/mqx/mqx/source/psp/cortex_m/psp_tius.o ./SDK/rtos/mqx/mqx/source/psp/cortex_m/psp_tkti.o ./SDK/rtos/mqx/mqx/source/psp/cortex_m/psp_usti.o ./SDK/rtos/mqx/mqx/source/psp/cortex_m/sc_irdyq.o ./SDK/rtos/mqx/mqx/source/psp/cortex_m/stack_bu.o ./SDK/rtos/mqx/mqx/source/psp/cortex_m/stack_de.o ./SDK/rtos/mqx/mqx/source/psp/cortex_m/stack_st.o  ./SDK/rtos/mqx/mqx/source/nio/src/errno.o ./SDK/rtos/mqx/mqx/source/nio/src/nio.o  ./SDK/rtos/mqx/mqx/source/nio/fs/fs_supp.o  ./SDK/rtos/mqx/mqx/source/nio/drivers/nio_tty/src/nio_tty.o  ./SDK/rtos/mqx/mqx/source/nio/drivers/nio_tfs/src/nio_tfs.o  ./SDK/rtos/mqx/mqx/source/nio/drivers/nio_serial/src/nio_serial.o  ./SDK/rtos/mqx/mqx/source/nio/drivers/nio_pipe/src/nio_pipe.o  ./SDK/rtos/mqx/mqx/source/nio/drivers/nio_null/src/nio_null.o  ./SDK/rtos/mqx/mqx/source/nio/drivers/nio_mem/src/nio_mem.o  ./SDK/rtos/mqx/mqx/source/nio/drivers/nio_dummy/src/nio_dummy.o  ./SDK/rtos/mqx/mqx/source/kernel/event.o ./SDK/rtos/mqx/mqx/source/kernel/idletask.o ./SDK/rtos/mqx/mqx/source/kernel/inittask.o ./SDK/rtos/mqx/mqx/source/kernel/int.o ./SDK/rtos/mqx/mqx/source/kernel/klog.o ./SDK/rtos/mqx/mqx/source/kernel/log.o ./SDK/rtos/mqx/mqx/source/kernel/lwevent.o ./SDK/rtos/mqx/mqx/source/kernel/lwlog.o ./SDK/rtos/mqx/mqx/source/kernel/lwmem.o ./SDK/rtos/mqx/mqx/source/kernel/lwmsgq.o ./SDK/rtos/mqx/mqx/source/kernel/lwsem.o ./SDK/rtos/mqx/mqx/source/kernel/lwtimer.o ./SDK/rtos/mqx/mqx/source/kernel/mem.o ./SDK/rtos/mqx/mqx/source/kernel/mqx.o ./SDK/rtos/mqx/mqx/source/kernel/msg.o ./SDK/rtos/mqx/mqx/source/kernel/msgpool.o ./SDK/rtos/mqx/mqx/source/kernel/msgq.o ./SDK/rtos/mqx/mqx/source/kernel/mutex.o ./SDK/rtos/mqx/mqx/source/kernel/name.o ./SDK/rtos/mqx/mqx/source/kernel/partition.o ./SDK/rtos/mqx/mqx/source/kernel/queue.o ./SDK/rtos/mqx/mqx/source/kernel/sched.o ./SDK/rtos/mqx/mqx/source/kernel/sem.o ./SDK/rtos/mqx/mqx/source/kernel/task.o ./SDK/rtos/mqx/mqx/source/kernel/taskq.o ./SDK/rtos/mqx/mqx/source/kernel/time.o ./SDK/rtos/mqx/mqx/source/kernel/timer.o ./SDK/rtos/mqx/mqx/source/kernel/watchdog.o  ./SDK/rtos/mqx/mqx/source/bsp/K64F12/vectors.o  ./SDK/rtos/mqx/mqx/source/bsp/init_bsp.o ./SDK/rtos/mqx/mqx/source/bsp/init_hardware.o ./SDK/rtos/mqx/mqx/source/bsp/init_nio_serial.o ./SDK/rtos/mqx/mqx/source/bsp/mqx_init.o  ./SDK/rtos/mqx/config/app_mqx.o  ./SDK/platform/utilities/src/fsl_misc_utilities.o  ./SDK/platform/system/interrupt/src/fsl_interrupt_manager.o  ./SDK/platform/system/hwtimer/src/fsl_hwtimer.o ./SDK/platform/system/hwtimer/src/fsl_hwtimer_systick.o  ./SDK/platform/system/clock/MK64F12/fsl_clock_K64F12.o  ./SDK/platform/system/clock/fsl_clock_manager.o  ./SDK/platform/startup/MK64F12/system_MK64F12.o  ./SDK/platform/osa/src/fsl_os_abstraction_mqx.o  ./SDK/platform/hal/uart/fsl_uart_hal.o  ./SDK/platform/hal/sim/MK64F12/fsl_sim_hal_K64F12.o  ./SDK/platform/hal/sim/fsl_sim_hal.o  ./SDK/platform/hal/sdhc/fsl_sdhc_hal.o  ./SDK/platform/hal/port/fsl_port_hal.o  ./SDK/platform/hal/osc/fsl_osc_hal.o  ./SDK/platform/hal/mpu/fsl_mpu_hal.o  ./SDK/platform/hal/mcg/fsl_mcg_hal.o ./SDK/platform/hal/mcg/fsl_mcg_hal_modes.o  ./SDK/platform/hal/lptmr/fsl_lptmr_hal.o  ./SDK/platform/hal/gpio/fsl_gpio_hal.o  ./SDK/platform/drivers/uart/src/fsl_uart_driver.o  ./SDK/platform/drivers/uart/common/fsl_uart_common.o  ./SDK/platform/drivers/uart/fsl_uart_irq.o  ./SDK/platform/drivers/sdhc/src/fsl_sdhc_driver.o  ./SDK/platform/drivers/sdhc/common/fsl_sdhc_common.o  ./SDK/platform/drivers/sdhc/fsl_sdhc_irq.o  ./SDK/platform/drivers/mpu/src/fsl_mpu_driver.o  ./SDK/platform/drivers/mpu/common/fsl_mpu_common.o  ./SDK/platform/drivers/gpio/src/fsl_gpio_driver.o  ./SDK/platform/drivers/gpio/common/fsl_gpio_common.o  ./SDK/platform/drivers/gpio/fsl_gpio_irq.o  ./Generated_Code/Cpu.o ./Generated_Code/fsl_hwtimer1.o ./Generated_Code/fsl_mpu1.o ./Generated_Code/fsl_uart1.o ./Generated_Code/gpio_pins.o ./Generated_Code/hardware_init.o ./Generated_Code/mqx_ksdk.o ./Generated_Code/pin_init.o ./Generated_Code/sdCard1.o ./Generated_Code/uartCom0.o ./Generated_Code/uartCom3.o  C:/Freescale/KDS_1.1.1/eclipse//../toolchain/lib/gcc/arm-none-eabi/4.8.0/m4/fp/v4-sp-d16/libgcc.a C:/Freescale/KDS_1.1.1/eclipse//../toolchain/arm-none-eabi/lib/m4/fp/v4-sp-d16/libc.a C:/Freescale/KDS_1.1.1/eclipse//../toolchain/arm-none-eabi/lib/m4/fp/v4-sp-d16/libsupc++.a C:/Freescale/KDS_1.1.1/eclipse//../toolchain/arm-none-eabi/lib/m4/fp/v4-sp-d16/libm.a -lxbee

 

 

Clearly, the right way to fix this is to make a library of MQX and link in the library to the application, but I can't figure out how to do this without breaking the Processor Expert environment. Can anyone tell me the correct process?

 

Thanks.

标签 (1)
标记 (3)
1 解答
11,524 次查看
larrykoos
Contributor III

Here is a good work-around to this problem.

First, create a textfile called makefile.defs in the project's root directory. This file is referenced in the autogenerated makefile in an include statement as shown and is provided for the developer to influence an auto-generated make.

.

.

.

ifneq ($(strip $(S_UPPER_DEPS)),)

-include $(S_UPPER_DEPS)

endif

endif

-include ../makefile.defs

# Add inputs and outputs from these tool invocations to the build variables

# All Target

.

.

.

Use this file, makefile.defs, to copy all the compiled object files and libraries into a file which we called ObjectList. The makefile script we used is:

$(shell rm ObjectList)

$(foreach obj, $(OBJS), $(shell echo $(obj) >> ObjectList))

$(shell echo $(USER_OBJS) >> ObjectList)

There is probably a more efficient script than this but I'm not a script wiz.

Finally, edit the project linker settings' Command Line Pattern to remove the reference to $(INPUTS) and replace it with @ObjectList

pastedImage_0.png

Hope this helps.

在原帖中查看解决方案

27 回复数
2,132 次查看
larrykoos
Contributor III

Erich,

As far as I know, its not possible to build MQX as a library and continue to use PE. Is this correct or is there a way to do it?

Also, is there a way to get the tool to auto-generate the file used to pass a list of files to the linker?

0 项奖励
回复
1,534 次查看
arwedspringer
Contributor II

I have the same problem since yesterday.

Is there any known solution yet?

Thanks for any help.

0 项奖励
回复
1,534 次查看
larrykoos
Contributor III

No. We determined yesterday that it is not as simple as the command line being too long. We have another project that produces a longer command line but it links correctly. This morning we will try to verify that the problem is machine independent by building the problem on another laptop. Please let me know if you learn anything as well. Thanks.

0 项奖励
回复
1,534 次查看
arwedspringer
Contributor II

I figured out that exactly ONE character is removed from the command line string, which is always at the same position!

I added three dummy characters to the path string which was not found anymore. In the result the position where the character is missing has moved by three!

So I added a long empty entry in     property setting > Cross ARM C++ Link > Miscellaneous   just before the library which isn't found and now the linking works fine again.

(see the picture)

I know, this is just a quick hack but it works for the moment until the bug is fixed.

kds.jpg

1,534 次查看
giacomopetrini
Contributor IV

:smileyshocked:

ok, good to know.

Bye Giacomo

0 项奖励
回复
1,534 次查看
arwedspringer
Contributor II

I just had a look at the command line.

The missing character is exactly at position 8192 of the parameter string (whithout the command "arm-none-eabi-g++") 

So it seams that there is a problem if the created parameter string is greater than 8k bytes...

Bye Springer

1,534 次查看
larrykoos
Contributor III

This hack works on my project as well. Hopefully someone with more knowledge with the tool can help out here and give us a real fix.

Really good catch. Thanks.

0 项奖励
回复