OpenNuvoton / MA35D1_RTP_BSP

MA35D1 Real Time Processor (RTP) BSP
1 stars 1 forks source link

Compile error with Yocto and NuEclipse #4

Open HiFiPhile opened 6 months ago

HiFiPhile commented 6 months ago

The issue was spotted in building m4proj_0.90.bb recipe of MA35D1_Yocto-v3.1.3, then reproduced by manually compile.

1st type of error is linker script not set (-T ""), apply to nearly all examples:

/home/me/tool/NuEclipse/eclipse/eclipse -nosplash --launcher.suppressErrors -application org.eclipse.cdt.managedbuilder.core.headlessbuild -data Temp -cleanBuild all -import SampleCode/CortexM4/MPU/GCC

.....

Building target: MPU.elf
Invoking: Cross ARM GNU C Linker
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections  -g -T "" -Xlinker --gc-sections -Wl,-Map,"MPU.map" -o "MPU.elf" ./User/main.o  ./CMSIS/CMSIS/system_ma35d1_rtp.o
/home/me/tool/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/13.2.1/../../../../arm-none-eabi/bin/ld: read in flex scanner failed
collect2: error: ld returned 1 exit status
make: *** [makefile:45: MPU.elf] Error 1

2nd type error is missing source file, apply to OpenAMP examples:

/home/me/tool/NuEclipse_V1.01.017_Linux_Setup/eclipse/eclipse -nosplash --launcher.suppressErrors -application org.eclipse.cdt.managedbuilder.core.headlessbuild -data Temp -cleanBuild all -import SampleCode/OpenAMP/Share_memory_demo/GCC/

......
Building target: Share_memory_sdram.elf
Invoking: Cross ARM GNU C Linker
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections  -g -T "/P4510/code/ma35d1/MA35D1_RTP_BSP/Library/Device/Nuvoton/ma35d1_rtp/Source/GCC/gcc_arm.ld" -Xlinker --gc-sections -Wl,-Map,"Share_memory_sdram.map" --specs=nano.specs -o "Share_memory_sdram.elf" ./User/porting/mbox_whc.o ./User/porting/openamp.o ./User/porting/rsc_table.o  ./User/main.o  ./CMSIS/CMSIS/GCC/_syscalls.o ./CMSIS/CMSIS/GCC/startup_ma35d1_rtp.o  ./CMSIS/CMSIS/system_ma35d1_rtp.o
/home/me/tool/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/13.2.1/../../../../arm-none-eabi/bin/ld: ./User/porting/mbox_whc.o: in function `Mbox_Poll':
/P4510/code/ma35d1/MA35D1_RTP_BSP/SampleCode/OpenAMP/Share_Memory_SDRAM/porting/mbox_whc.c:57:(.text.Mbox_Poll+0x34): undefined reference to `WHC_Send'
/home/me/tool/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/13.2.1/../../../../arm-none-eabi/bin/ld: /P4510/code/ma35d1/MA35D1_RTP_BSP/SampleCode/OpenAMP/Share_Memory_SDRAM/porting/mbox_whc.c:68:(.text.Mbox_Poll+0x6e): undefined reference to `WHC_Send'
/home/me/tool/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/13.2.1/../../../../arm-none-eabi/bin/ld: ./User/porting/mbox_whc.o: in function `WHC0_IRQHandler':
/P4510/code/ma35d1/MA35D1_RTP_BSP/SampleCode/OpenAMP/Share_Memory_SDRAM/porting/mbox_whc.c:89:(.text.WHC0_IRQHandler+0x12): undefined reference to `WHC_Recv'
/home/me/tool/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/13.2.1/../../../../arm-none-eabi/bin/ld: ./User/porting/openamp.o: in function `OPENAMP_shmem_init':
/P4510/code/ma35d1/MA35D1_RTP_BSP/SampleCode/OpenAMP/Share_Memory_SDRAM/porting/openamp.c:50:(.text.MA35D1_OpenAMP_Init+0x1a): undefined reference to `metal_init'
/home/me/tool/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/13.2.1/../../../../arm-none-eabi/bin/ld: /P4510/code/ma35d1/MA35D1_RTP_BSP/SampleCode/OpenAMP/Share_Memory_SDRAM/porting/openamp.c:52:(.text.MA35D1_OpenAMP_Init+0x20): undefined reference to `metal_register_generic_device'
/home/me/tool/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/13.2.1/../../../../arm-none-eabi/bin/ld: /P4510/code/ma35d1/MA35D1_RTP_BSP/SampleCode/OpenAMP/Share_Memory_SDRAM/porting/openamp.c:58:(.text.MA35D1_OpenAMP_Init+0x30): undefined reference to `metal_device_open'
/home/me/tool/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/13.2.1/../../../../arm-none-eabi/bin/ld: /P4510/code/ma35d1/MA35D1_RTP_BSP/SampleCode/OpenAMP/Share_Memory_SDRAM/porting/openamp.c:65:(.text.MA35D1_OpenAMP_Init+0x58): undefined reference to `metal_io_init'
/home/me/tool/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/13.2.1/../../../../arm-none-eabi/bin/ld: /P4510/code/ma35d1/MA35D1_RTP_BSP/SampleCode/OpenAMP/Share_Memory_SDRAM/porting/openamp.c:81:(.text.MA35D1_OpenAMP_Init+0x92): undefined reference to `metal_io_init'
/home/me/tool/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/13.2.1/../../../../arm-none-eabi/bin/ld: ./User/porting/openamp.o: in function `MA35D1_OpenAMP_Init':
/P4510/code/ma35d1/MA35D1_RTP_BSP/SampleCode/OpenAMP/Share_Memory_SDRAM/porting/openamp.c:107:(.text.MA35D1_OpenAMP_Init+0xb4): undefined reference to `rproc_virtio_create_vdev'
/home/me/tool/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/13.2.1/../../../../arm-none-eabi/bin/ld: /P4510/code/ma35d1/MA35D1_RTP_BSP/SampleCode/OpenAMP/Share_Memory_SDRAM/porting/openamp.c:113:(.text.MA35D1_OpenAMP_Init+0xbe): undefined reference to `rproc_virtio_wait_remote_ready'
/home/me/tool/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/13.2.1/../../../../arm-none-eabi/bin/ld: /P4510/code/ma35d1/MA35D1_RTP_BSP/SampleCode/OpenAMP/Share_Memory_SDRAM/porting/openamp.c:115:(.text.MA35D1_OpenAMP_Init+0xd8): undefined reference to `rproc_virtio_init_vring'
/home/me/tool/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/13.2.1/../../../../arm-none-eabi/bin/ld: /P4510/code/ma35d1/MA35D1_RTP_BSP/SampleCode/OpenAMP/Share_Memory_SDRAM/porting/openamp.c:122:(.text.MA35D1_OpenAMP_Init+0xf6): undefined reference to `rproc_virtio_init_vring'
/home/me/tool/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/13.2.1/../../../../arm-none-eabi/bin/ld: /P4510/code/ma35d1/MA35D1_RTP_BSP/SampleCode/OpenAMP/Share_Memory_SDRAM/porting/openamp.c:130:(.text.MA35D1_OpenAMP_Init+0x106): undefined reference to `rpmsg_virtio_init_shm_pool'
/home/me/tool/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/13.2.1/../../../../arm-none-eabi/bin/ld: ./User/porting/openamp.o: in function `OPENAMP_create_endpoint':
/P4510/code/ma35d1/MA35D1_RTP_BSP/SampleCode/OpenAMP/Share_Memory_SDRAM/porting/openamp.c:151:(.text.OPENAMP_create_endpoint+0x12): undefined reference to `rpmsg_create_ept'
/home/me/tool/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/13.2.1/../../../../arm-none-eabi/bin/ld: ./User/porting/openamp.o: in function `OPENAMP_send_data':
/P4510/code/ma35d1/MA35D1_RTP_BSP/SampleCode/OpenAMP/Share_Memory_SDRAM/porting/openamp.c:176:(.text.OPENAMP_send_data+0x30): undefined reference to `WHC_Send'
/home/me/tool/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/13.2.1/../../../../arm-none-eabi/bin/ld: ./User/porting/openamp.o:(.rodata+0x0): undefined reference to `metal_default_log_handler'
/home/me/tool/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/13.2.1/../../../../arm-none-eabi/bin/ld: ./User/main.o: in function `SYS_Init':
/P4510/code/ma35d1/MA35D1_RTP_BSP/SampleCode/OpenAMP/Share_Memory_SDRAM/main.c:39:(.text.SYS_Init+0x24): undefined reference to `CLK_SetModuleClock'
/home/me/tool/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/13.2.1/../../../../arm-none-eabi/bin/ld: /P4510/code/ma35d1/MA35D1_RTP_BSP/SampleCode/OpenAMP/Share_Memory_SDRAM/main.c:40:(.text.SYS_Init+0x2a): undefined reference to `CLK_EnableModuleClock'
/home/me/tool/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/13.2.1/../../../../arm-none-eabi/bin/ld: /P4510/code/ma35d1/MA35D1_RTP_BSP/SampleCode/OpenAMP/Share_Memory_SDRAM/main.c:41:(.text.SYS_Init+0x30): undefined reference to `CLK_EnableModuleClock'
/home/me/tool/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/13.2.1/../../../../arm-none-eabi/bin/ld: ./User/main.o: in function `main':
/P4510/code/ma35d1/MA35D1_RTP_BSP/SampleCode/OpenAMP/Share_Memory_SDRAM/main.c:70:(.text.startup.main+0xe): undefined reference to `UART_Open'
collect2: error: ld returned 1 exit status
make: *** [makefile:47: Share_memory_sdram.elf] Error 1
ychuang3 commented 6 months ago

We do not intend to support compilation on any Linux OS distribution, due to potential compilation issues arising from different versions of compilation tools. We recommend compiling in Docker. Please refer to the following documents:

HiFiPhile commented 6 months ago

In the manual it's stated Linux distribution is supported:

Nuvoton provides two environments of building images, Docker and Linux. Docker is a virtual machine
based on host Linux OS, so the setting in the Docker won’t affect the host OS and the Docker can create
an environment only for building images. Linux distribution will be updated and may result in building
image error, so Docker provided by Nuvoton is a better way than Linux.

Also there are instructions for Debian and other distributions:

Ubuntu and Debian:
$ sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \
 build-essential chrpath socat cpio python python3 python3-pip python3-pexpect \
 xz-utils debianutils iputils-ping libsdl1.2-dev xterm curl

Also as I've said above, the issue has been isolated from Yocto but a purely NuEclipse configuration issue,

In the .cproject file linker script is configured as <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/CMSIS/CMSIS/GCC/gcc_arm.ld}&quot;"/>

But there is no such file ${ProjName}/CMSIS/CMSIS/GCC/gcc_arm.ld.

In comparison IAR's linker script is well present: <state>$PROJ_DIR$\MPU.icf</state>

ychuang3 commented 6 months ago

Yes, there were some issues with the GCC project path settings for Share_Memory_SDRAM. Thank you for pointing that out. We have fixed this issue and updated it on GitHub. We have confirmed that NuEclipse compiles successfully on its own. Please update the RTP BSP and then test it again.

HiFiPhile commented 6 months ago

Thanks for the fix, I think it's more a NuEclipse issue as all files missing from build are linkedResources in .project.

It's fixed using latest V1.02.026 version.