collect2: error: ld returned 1 exit status when compiler freertos_hello.c

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

collect2: error: ld returned 1 exit status when compiler freertos_hello.c

2,896 Views
Jems-advantech
Contributor I

Hello Sir,

I am working on i.MX8MM M4 and A53 testing. Would like to wake up A53 from M4. I found there is information as following link, that provided the freertos_hello.c, freertos_hello.bin, and patch files for waking up A53 Linus host. I am following the steps to patch in my Linux system and test with freertos_hello.bin file, it can wake up A53 when it in sleep mode without any problem. 

https://community.nxp.com/t5/i-MX-Processors-Knowledge-Base/M4-Low-Power-Demo-on-i-MX8MM/ta-p/110110...

But when I compiler the freertos_hello.c (Copy and replace the freertos_hello.c in "SDK_2.8.0_EVK-MIMX8MM/boards/evkmimx8mm/rtos_examples/freertos_hello") I got the error. Please check the output below and help to check what is cause this failed, Thanks in advansed~  

Output log:

SDK_2.8.0_EVK-MIMX8MM/boards/evkmimx8mm/rtos_examples/freertos_hello/armgcc$ ./build_release.sh
CMake Error: The current CMakeCache.txt directory /mnt/d/SDK_2.8.0_EVK-MIMX8MM/boards/evkmimx8mm/rtos_examples/freertos_hello/armgcc/CMakeCache.txt is different than the directory /mnt/f/Customer/3RGIT/M4_SDK/SDK_2.8.0_EVK-MIMX8MM/boards/evkmimx8mm/rtos_examples/freertos_hello_test/armgcc where CMakeCache.txt was created. This may result in binaries being created in the wrong place. If you are not sure, reedit the CMakeCache.txt
[ 3%] Linking C executable release/freertos_hello.elf
/mnt/f/Customer/3RGIT/M4_SDK/Toolchain/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: CMakeFiles/freertos_hello.elf.dir/mnt/f/Customer/3RGIT/M4_SDK/SDK_2.8.0_EVK-MIMX8MM/boards/evkmimx8mm/rtos_examples/freertos_hello_test/freertos_hello.c.obj: in function `LPM_MCORE_SetPowerStatus':
freertos_hello.c:(.text.LPM_MCORE_SetPowerStatus+0x30): undefined reference to `GPC_EnterWaitMode'
/mnt/f/Customer/3RGIT/M4_SDK/Toolchain/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: freertos_hello.c:(.text.LPM_MCORE_SetPowerStatus+0x3a): undefined reference to `GPC_EnterStopMode'
/mnt/f/Customer/3RGIT/M4_SDK/Toolchain/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: CMakeFiles/freertos_hello.elf.dir/mnt/f/Customer/3RGIT/M4_SDK/SDK_2.8.0_EVK-MIMX8MM/boards/evkmimx8mm/rtos_examples/freertos_hello_test/freertos_hello.c.obj: in function `hello_task':
freertos_hello.c:(.text.hello_task+0xcc): undefined reference to `MU_TriggerInterrupts'
/mnt/f/Customer/3RGIT/M4_SDK/Toolchain/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: freertos_hello.c:(.text.hello_task+0xde): undefined reference to `MU_SendMsg'
/mnt/f/Customer/3RGIT/M4_SDK/Toolchain/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: CMakeFiles/freertos_hello.elf.dir/mnt/f/Customer/3RGIT/M4_SDK/SDK_2.8.0_EVK-MIMX8MM/boards/evkmimx8mm/rtos_examples/freertos_hello_test/freertos_hello.c.obj: in function `main':
freertos_hello.c:(.text.startup.main+0x1e): undefined reference to `MU_Init'
/mnt/f/Customer/3RGIT/M4_SDK/Toolchain/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: freertos_hello.c:(.text.startup.main+0x40): undefined reference to `GPC_Init'
/mnt/f/Customer/3RGIT/M4_SDK/Toolchain/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: freertos_hello.c:(.text.startup.main+0x48): undefined reference to `GPC_EnableIRQ'
/mnt/f/Customer/3RGIT/M4_SDK/Toolchain/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: freertos_hello.c:(.text.startup.main+0x60): undefined reference to `GPT_GetDefaultConfig'
/mnt/f/Customer/3RGIT/M4_SDK/Toolchain/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: freertos_hello.c:(.text.startup.main+0x74): undefined reference to `GPT_Init'
/mnt/f/Customer/3RGIT/M4_SDK/Toolchain/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: freertos_hello.c:(.text.startup.main+0x88): undefined reference to `GPC_EnableIRQ'
collect2: error: ld returned 1 exit status
CMakeFiles/freertos_hello.elf.dir/build.make:788: recipe for target 'release/freertos_hello.elf' failed
make[2]: *** [release/freertos_hello.elf] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/freertos_hello.elf.dir/all' failed
make[1]: *** [CMakeFiles/freertos_hello.elf.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

 

0 Kudos
Reply
4 Replies

2,859 Views
Jems-advantech
Contributor I

Hi Sir,

The freertos_hello.c file I download from the link below, is it possible to have the armgcc project file for this freertos.c?

https://community.nxp.com/t5/i-MX-Processors-Knowledge-Base/M4-Low-Power-Demo-on-i-MX8MM/ta-p/110110...

 

Thanks in advance~

0 Kudos
Reply

2,892 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hello Jems-advantech,

 

If you installed the patch, please erase everything you previously build and then build again, sometimes the processor try the latest build and don´t find it.

Regards

 

0 Kudos
Reply

2,878 Views
Jems-advantech
Contributor I

Hi Sir,

I still occur link error when complier the freertos_hello.c file. I extract the SDK_2.8.0_EVK-MIMX8MM file. Replace freertos_hello.c file located at "SDK_2.8.0_EVK-MIMX8MM\boards\evkmimx8mm\rtos_examples\freertos_hello". And I export the toolcahin path and goto "armgcc" folder and run ./build_release.sh. I still got the same error when linking C executable.

 

0 Kudos
Reply

2,876 Views
Jems-advantech
Contributor I

Please reference the fail log. It fail when Linking C executable.

[ 93%] Building C object CMakeFiles/freertos_hello.elf.dir/mnt/d/SDK_2.8.0_EVK-MIMX8MM/rtos/freertos/freertos_kernel/tasks.c.obj
[ 96%] Building C object CMakeFiles/freertos_hello.elf.dir/mnt/d/SDK_2.8.0_EVK-MIMX8MM/devices/MIMX8MM6/utilities/fsl_sbrk.c.obj
[100%] Linking C executable release/freertos_hello.elf
/mnt/d/Toolchain/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: CMakeFiles/freertos_hello.elf.dir/mnt/d/SDK_2.8.0_EVK-MIMX8MM/boards/evkmimx8mm/rtos_examples/freertos_hello/freertos_hello.c.obj: in function `LPM_MCORE_SetPowerStatus':
freertos_hello.c:(.text.LPM_MCORE_SetPowerStatus+0x30): undefined reference to `GPC_EnterWaitMode'
/mnt/d/Toolchain/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: freertos_hello.c:(.text.LPM_MCORE_SetPowerStatus+0x3a): undefined reference to `GPC_EnterStopMode'
/mnt/d/Toolchain/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: CMakeFiles/freertos_hello.elf.dir/mnt/d/SDK_2.8.0_EVK-MIMX8MM/boards/evkmimx8mm/rtos_examples/freertos_hello/freertos_hello.c.obj: in function `hello_task':
freertos_hello.c:(.text.hello_task+0xcc): undefined reference to `MU_TriggerInterrupts'
/mnt/d/Toolchain/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: freertos_hello.c:(.text.hello_task+0xde): undefined reference to `MU_SendMsg'
/mnt/d/Toolchain/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: CMakeFiles/freertos_hello.elf.dir/mnt/d/SDK_2.8.0_EVK-MIMX8MM/boards/evkmimx8mm/rtos_examples/freertos_hello/freertos_hello.c.obj: in function `main':
freertos_hello.c:(.text.startup.main+0x1e): undefined reference to `MU_Init'
/mnt/d/Toolchain/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: freertos_hello.c:(.text.startup.main+0x40): undefined reference to `GPC_Init'
/mnt/d/Toolchain/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: freertos_hello.c:(.text.startup.main+0x48): undefined reference to `GPC_EnableIRQ'
/mnt/d/Toolchain/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: freertos_hello.c:(.text.startup.main+0x60): undefined reference to `GPT_GetDefaultConfig'
/mnt/d/Toolchain/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: freertos_hello.c:(.text.startup.main+0x74): undefined reference to `GPT_Init'
/mnt/d/Toolchain/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: freertos_hello.c:(.text.startup.main+0x88): undefined reference to `GPC_EnableIRQ'
collect2: error: ld returned 1 exit status
CMakeFiles/freertos_hello.elf.dir/build.make:788: recipe for target 'release/freertos_hello.elf' failed
make[2]: *** [release/freertos_hello.elf] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/freertos_hello.elf.dir/all' failed
make[1]: *** [CMakeFiles/freertos_hello.elf.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

0 Kudos
Reply